diff --git a/YACReader/goto_dialog.cpp b/YACReader/goto_dialog.cpp index f442b93b..d0c5b12e 100644 --- a/YACReader/goto_dialog.cpp +++ b/YACReader/goto_dialog.cpp @@ -8,6 +8,7 @@ GoToDialog::GoToDialog(QWidget *parent) : QDialog(parent) { setupUI(); + initTheme(this); } void GoToDialog::setupUI() @@ -42,9 +43,7 @@ void GoToDialog::setupUI() mainLayout->addLayout(bottomLayout); auto imgMainLayout = new QHBoxLayout; - auto imgLabel = new QLabel(); - QPixmap p(":/images/goto.png"); - imgLabel->setPixmap(p); + imgLabel = new QLabel(); imgMainLayout->addWidget(imgLabel); imgMainLayout->addLayout(mainLayout); @@ -78,3 +77,8 @@ void GoToDialog::open() pageNumber->setFocus(); QDialog::open(); } + +void GoToDialog::applyTheme(const Theme &theme) +{ + imgLabel->setPixmap(theme.dialogIcons.goToDialogIcon); +} diff --git a/YACReader/goto_dialog.h b/YACReader/goto_dialog.h index e62f8d2d..339104d1 100644 --- a/YACReader/goto_dialog.h +++ b/YACReader/goto_dialog.h @@ -1,21 +1,27 @@ #ifndef __GOTODIALOG_H #define __GOTODIALOG_H +#include "themable.h" + #include #include #include #include #include -class GoToDialog : public QDialog +class GoToDialog : public QDialog, protected Themable { Q_OBJECT public: GoToDialog(QWidget *parent = nullptr); +protected: + void applyTheme(const Theme &theme) override; + private: QLabel *numPagesLabel; QLabel *textLabel; + QLabel *imgLabel; QLineEdit *pageNumber; QIntValidator *v; QPushButton *accept; diff --git a/YACReader/themes/builtin_classic.json b/YACReader/themes/builtin_classic.json index fcac45c7..3b0b217e 100644 --- a/YACReader/themes/builtin_classic.json +++ b/YACReader/themes/builtin_classic.json @@ -1,4 +1,7 @@ { + "dialogIcons": { + "iconColor": "#404040" + }, "goToFlowWidget": { "editBackgroundColor": "#55000000", "editBorderColor": "#77000000", diff --git a/YACReader/themes/builtin_dark.json b/YACReader/themes/builtin_dark.json index 7efd26ae..3dc7b9d3 100644 --- a/YACReader/themes/builtin_dark.json +++ b/YACReader/themes/builtin_dark.json @@ -1,4 +1,7 @@ { + "dialogIcons": { + "iconColor": "#cccccc" + }, "goToFlowWidget": { "editBackgroundColor": "#55000000", "editBorderColor": "#77000000", diff --git a/YACReader/themes/builtin_light.json b/YACReader/themes/builtin_light.json index dc9209f7..274788b8 100644 --- a/YACReader/themes/builtin_light.json +++ b/YACReader/themes/builtin_light.json @@ -1,4 +1,7 @@ { + "dialogIcons": { + "iconColor": "#404040" + }, "goToFlowWidget": { "editBackgroundColor": "#22000000", "editBorderColor": "#33000000", diff --git a/YACReader/themes/theme.h b/YACReader/themes/theme.h index f5c07351..1355dfbe 100644 --- a/YACReader/themes/theme.h +++ b/YACReader/themes/theme.h @@ -182,6 +182,7 @@ struct ShortcutsIconsTheme { struct DialogIconsTheme { QIcon findFolderIcon; + QPixmap goToDialogIcon; }; struct Theme { diff --git a/YACReader/themes/theme_factory.cpp b/YACReader/themes/theme_factory.cpp index deb85517..42f07fe8 100644 --- a/YACReader/themes/theme_factory.cpp +++ b/YACReader/themes/theme_factory.cpp @@ -56,6 +56,10 @@ struct ShortcutsIconsParams { QColor iconColor; // Main icon color (replaces #f0f) }; +struct DialogIconsParams { + QColor iconColor; // Main icon color (replaces #f0f) +}; + struct TranslatorParams { TranslatorThemeTemplates t; @@ -79,6 +83,7 @@ struct ThemeParams { HelpAboutDialogTheme helpAboutDialogParams; WhatsNewDialogParams whatsNewDialogParams; ShortcutsIconsParams shortcutsIconsParams; + DialogIconsParams dialogIconsParams; TranslatorParams translatorParams; }; @@ -340,6 +345,11 @@ Theme makeTheme(const QJsonObject &json) p.shortcutsIconsParams.iconColor = colorFromJson(s, "iconColor", p.shortcutsIconsParams.iconColor); } + if (json.contains("dialogIcons")) { + const auto o = json["dialogIcons"].toObject(); + p.dialogIconsParams.iconColor = colorFromJson(o, "iconColor", p.dialogIconsParams.iconColor); + } + if (json.contains("translator")) { const auto t = json["translator"].toObject(); auto &tp = p.translatorParams; diff --git a/YACReader/yacreader_images.qrc b/YACReader/yacreader_images.qrc index a5b011ed..a573b9fb 100644 --- a/YACReader/yacreader_images.qrc +++ b/YACReader/yacreader_images.qrc @@ -1,7 +1,7 @@ ../images/icon-new.svg - ../images/goto.png + ../images/goto.svg ../images/find_folder.svg ../images/flow1.png ../images/flow2.png diff --git a/images/goto.png b/images/goto.png deleted file mode 100644 index d99a3d01..00000000 Binary files a/images/goto.png and /dev/null differ diff --git a/images/goto.svg b/images/goto.svg new file mode 100644 index 00000000..89ccb810 --- /dev/null +++ b/images/goto.svg @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file