mirror of
https://github.com/YACReader/yacreader
synced 2026-04-12 15:49:53 -04:00
Improve theme editor usability so themes can be set from it
This commit is contained in:
@ -150,14 +150,19 @@ ThemeEditorDialog::ThemeEditorDialog(const QJsonObject ¶ms, QWidget *parent)
|
||||
});
|
||||
|
||||
// --- bottom buttons ---
|
||||
auto *saveBtn = new QPushButton(tr("Save to file..."), this);
|
||||
auto *saveLibBtn = new QPushButton(tr("Save and apply"), this);
|
||||
auto *exportBtn = new QPushButton(tr("Export to file..."), this);
|
||||
auto *loadBtn = new QPushButton(tr("Load from file..."), this);
|
||||
auto *closeBtn = new QPushButton(tr("Close"), this);
|
||||
connect(saveBtn, &QPushButton::clicked, this, &ThemeEditorDialog::saveToFile);
|
||||
connect(saveLibBtn, &QPushButton::clicked, this, [this]() {
|
||||
emit saveToLibraryRequested(this->params);
|
||||
});
|
||||
connect(exportBtn, &QPushButton::clicked, this, &ThemeEditorDialog::saveToFile);
|
||||
connect(loadBtn, &QPushButton::clicked, this, &ThemeEditorDialog::loadFromFile);
|
||||
connect(closeBtn, &QPushButton::clicked, this, &QDialog::close);
|
||||
auto *buttons = new QHBoxLayout();
|
||||
buttons->addWidget(saveBtn);
|
||||
buttons->addWidget(saveLibBtn);
|
||||
buttons->addWidget(exportBtn);
|
||||
buttons->addWidget(loadBtn);
|
||||
buttons->addStretch();
|
||||
buttons->addWidget(closeBtn);
|
||||
@ -373,6 +378,14 @@ void ThemeEditorDialog::syncMetaFromParams()
|
||||
variantCombo->setCurrentIndex(variant == "light" ? 0 : 1);
|
||||
}
|
||||
|
||||
void ThemeEditorDialog::updateSavedId(const QString &id)
|
||||
{
|
||||
auto meta = params["meta"].toObject();
|
||||
meta["id"] = id;
|
||||
params["meta"] = meta;
|
||||
idLabel->setText(id);
|
||||
}
|
||||
|
||||
void ThemeEditorDialog::saveToFile()
|
||||
{
|
||||
// Assign a user-scoped UUID if the current id is builtin or empty
|
||||
|
||||
Reference in New Issue
Block a user