Skip to content

Commit 83e1b88

Browse files
committed
Replace goto.png with a themeable svg image
1 parent b49446c commit 83e1b88

10 files changed

Lines changed: 46 additions & 5 deletions

File tree

YACReader/goto_dialog.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ GoToDialog::GoToDialog(QWidget *parent)
88
: QDialog(parent)
99
{
1010
setupUI();
11+
initTheme(this);
1112
}
1213

1314
void GoToDialog::setupUI()
@@ -42,9 +43,7 @@ void GoToDialog::setupUI()
4243
mainLayout->addLayout(bottomLayout);
4344

4445
auto imgMainLayout = new QHBoxLayout;
45-
auto imgLabel = new QLabel();
46-
QPixmap p(":/images/goto.png");
47-
imgLabel->setPixmap(p);
46+
imgLabel = new QLabel();
4847
imgMainLayout->addWidget(imgLabel);
4948
imgMainLayout->addLayout(mainLayout);
5049

@@ -78,3 +77,8 @@ void GoToDialog::open()
7877
pageNumber->setFocus();
7978
QDialog::open();
8079
}
80+
81+
void GoToDialog::applyTheme(const Theme &theme)
82+
{
83+
imgLabel->setPixmap(theme.dialogIcons.goToDialogIcon);
84+
}

YACReader/goto_dialog.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
#ifndef __GOTODIALOG_H
22
#define __GOTODIALOG_H
33

4+
#include "themable.h"
5+
46
#include <QDialog>
57
#include <QIntValidator>
68
#include <QLabel>
79
#include <QLineEdit>
810
#include <QPushButton>
911

10-
class GoToDialog : public QDialog
12+
class GoToDialog : public QDialog, protected Themable
1113
{
1214
Q_OBJECT
1315
public:
1416
GoToDialog(QWidget *parent = nullptr);
1517

18+
protected:
19+
void applyTheme(const Theme &theme) override;
20+
1621
private:
1722
QLabel *numPagesLabel;
1823
QLabel *textLabel;
24+
QLabel *imgLabel;
1925
QLineEdit *pageNumber;
2026
QIntValidator *v;
2127
QPushButton *accept;

YACReader/themes/builtin_classic.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"dialogIcons": {
3+
"iconColor": "#404040"
4+
},
25
"goToFlowWidget": {
36
"editBackgroundColor": "#55000000",
47
"editBorderColor": "#77000000",

YACReader/themes/builtin_dark.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"dialogIcons": {
3+
"iconColor": "#cccccc"
4+
},
25
"goToFlowWidget": {
36
"editBackgroundColor": "#55000000",
47
"editBorderColor": "#77000000",

YACReader/themes/builtin_light.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"dialogIcons": {
3+
"iconColor": "#404040"
4+
},
25
"goToFlowWidget": {
36
"editBackgroundColor": "#22000000",
47
"editBorderColor": "#33000000",

YACReader/themes/theme.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ struct ShortcutsIconsTheme {
182182

183183
struct DialogIconsTheme {
184184
QIcon findFolderIcon;
185+
QPixmap goToDialogIcon;
185186
};
186187

187188
struct Theme {

YACReader/themes/theme_factory.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ struct ShortcutsIconsParams {
5656
QColor iconColor; // Main icon color (replaces #f0f)
5757
};
5858

59+
struct DialogIconsParams {
60+
QColor iconColor; // Main icon color (replaces #f0f)
61+
};
62+
5963
struct TranslatorParams {
6064
TranslatorThemeTemplates t;
6165

@@ -79,6 +83,7 @@ struct ThemeParams {
7983
HelpAboutDialogTheme helpAboutDialogParams;
8084
WhatsNewDialogParams whatsNewDialogParams;
8185
ShortcutsIconsParams shortcutsIconsParams;
86+
DialogIconsParams dialogIconsParams;
8287
TranslatorParams translatorParams;
8388
};
8489

@@ -340,6 +345,11 @@ Theme makeTheme(const QJsonObject &json)
340345
p.shortcutsIconsParams.iconColor = colorFromJson(s, "iconColor", p.shortcutsIconsParams.iconColor);
341346
}
342347

348+
if (json.contains("dialogIcons")) {
349+
const auto o = json["dialogIcons"].toObject();
350+
p.dialogIconsParams.iconColor = colorFromJson(o, "iconColor", p.dialogIconsParams.iconColor);
351+
}
352+
343353
if (json.contains("translator")) {
344354
const auto t = json["translator"].toObject();
345355
auto &tp = p.translatorParams;

YACReader/yacreader_images.qrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<RCC>
22
<qresource>
33
<file>../images/icon-new.svg</file>
4-
<file>../images/goto.png</file>
4+
<file>../images/goto.svg</file>
55
<file>../images/find_folder.svg</file>
66
<file>../images/flow1.png</file>
77
<file>../images/flow2.png</file>

images/goto.png

-908 Bytes
Binary file not shown.

images/goto.svg

Lines changed: 11 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)