Replace goto.png with a themeable svg image
Some checks failed
Build / Initialization (push) Has been cancelled
Build / Code Format Validation (push) Has been cancelled
Build / Linux (Qt6) (push) Has been cancelled
Build / Linux (Qt6 + 7zip) (push) Has been cancelled
Build / macOS (Qt6 Universal) (push) Has been cancelled
Build / Windows x64 (Qt6) (push) Has been cancelled
Build / Windows ARM64 (Qt6) (push) Has been cancelled
Build / Docker amd64 Image (push) Has been cancelled
Build / Docker arm64 Image (push) Has been cancelled
Build / Publish Dev Builds (push) Has been cancelled
Build / Publish Release (push) Has been cancelled
Build / Publish YACReader10 Pre-release Builds (push) Has been cancelled

This commit is contained in:
luisangelsm
2026-03-17 19:35:30 +01:00
parent b49446c246
commit 83e1b88c2c
10 changed files with 46 additions and 5 deletions

View File

@ -8,6 +8,7 @@ GoToDialog::GoToDialog(QWidget *parent)
: QDialog(parent) : QDialog(parent)
{ {
setupUI(); setupUI();
initTheme(this);
} }
void GoToDialog::setupUI() void GoToDialog::setupUI()
@ -42,9 +43,7 @@ void GoToDialog::setupUI()
mainLayout->addLayout(bottomLayout); mainLayout->addLayout(bottomLayout);
auto imgMainLayout = new QHBoxLayout; auto imgMainLayout = new QHBoxLayout;
auto imgLabel = new QLabel(); imgLabel = new QLabel();
QPixmap p(":/images/goto.png");
imgLabel->setPixmap(p);
imgMainLayout->addWidget(imgLabel); imgMainLayout->addWidget(imgLabel);
imgMainLayout->addLayout(mainLayout); imgMainLayout->addLayout(mainLayout);
@ -78,3 +77,8 @@ void GoToDialog::open()
pageNumber->setFocus(); pageNumber->setFocus();
QDialog::open(); QDialog::open();
} }
void GoToDialog::applyTheme(const Theme &theme)
{
imgLabel->setPixmap(theme.dialogIcons.goToDialogIcon);
}

View File

@ -1,21 +1,27 @@
#ifndef __GOTODIALOG_H #ifndef __GOTODIALOG_H
#define __GOTODIALOG_H #define __GOTODIALOG_H
#include "themable.h"
#include <QDialog> #include <QDialog>
#include <QIntValidator> #include <QIntValidator>
#include <QLabel> #include <QLabel>
#include <QLineEdit> #include <QLineEdit>
#include <QPushButton> #include <QPushButton>
class GoToDialog : public QDialog class GoToDialog : public QDialog, protected Themable
{ {
Q_OBJECT Q_OBJECT
public: public:
GoToDialog(QWidget *parent = nullptr); GoToDialog(QWidget *parent = nullptr);
protected:
void applyTheme(const Theme &theme) override;
private: private:
QLabel *numPagesLabel; QLabel *numPagesLabel;
QLabel *textLabel; QLabel *textLabel;
QLabel *imgLabel;
QLineEdit *pageNumber; QLineEdit *pageNumber;
QIntValidator *v; QIntValidator *v;
QPushButton *accept; QPushButton *accept;

View File

@ -1,4 +1,7 @@
{ {
"dialogIcons": {
"iconColor": "#404040"
},
"goToFlowWidget": { "goToFlowWidget": {
"editBackgroundColor": "#55000000", "editBackgroundColor": "#55000000",
"editBorderColor": "#77000000", "editBorderColor": "#77000000",

View File

@ -1,4 +1,7 @@
{ {
"dialogIcons": {
"iconColor": "#cccccc"
},
"goToFlowWidget": { "goToFlowWidget": {
"editBackgroundColor": "#55000000", "editBackgroundColor": "#55000000",
"editBorderColor": "#77000000", "editBorderColor": "#77000000",

View File

@ -1,4 +1,7 @@
{ {
"dialogIcons": {
"iconColor": "#404040"
},
"goToFlowWidget": { "goToFlowWidget": {
"editBackgroundColor": "#22000000", "editBackgroundColor": "#22000000",
"editBorderColor": "#33000000", "editBorderColor": "#33000000",

View File

@ -182,6 +182,7 @@ struct ShortcutsIconsTheme {
struct DialogIconsTheme { struct DialogIconsTheme {
QIcon findFolderIcon; QIcon findFolderIcon;
QPixmap goToDialogIcon;
}; };
struct Theme { struct Theme {

View File

@ -56,6 +56,10 @@ struct ShortcutsIconsParams {
QColor iconColor; // Main icon color (replaces #f0f) QColor iconColor; // Main icon color (replaces #f0f)
}; };
struct DialogIconsParams {
QColor iconColor; // Main icon color (replaces #f0f)
};
struct TranslatorParams { struct TranslatorParams {
TranslatorThemeTemplates t; TranslatorThemeTemplates t;
@ -79,6 +83,7 @@ struct ThemeParams {
HelpAboutDialogTheme helpAboutDialogParams; HelpAboutDialogTheme helpAboutDialogParams;
WhatsNewDialogParams whatsNewDialogParams; WhatsNewDialogParams whatsNewDialogParams;
ShortcutsIconsParams shortcutsIconsParams; ShortcutsIconsParams shortcutsIconsParams;
DialogIconsParams dialogIconsParams;
TranslatorParams translatorParams; TranslatorParams translatorParams;
}; };
@ -340,6 +345,11 @@ Theme makeTheme(const QJsonObject &json)
p.shortcutsIconsParams.iconColor = colorFromJson(s, "iconColor", p.shortcutsIconsParams.iconColor); 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")) { if (json.contains("translator")) {
const auto t = json["translator"].toObject(); const auto t = json["translator"].toObject();
auto &tp = p.translatorParams; auto &tp = p.translatorParams;

View File

@ -1,7 +1,7 @@
<RCC> <RCC>
<qresource> <qresource>
<file>../images/icon-new.svg</file> <file>../images/icon-new.svg</file>
<file>../images/goto.png</file> <file>../images/goto.svg</file>
<file>../images/find_folder.svg</file> <file>../images/find_folder.svg</file>
<file>../images/flow1.png</file> <file>../images/flow1.png</file>
<file>../images/flow2.png</file> <file>../images/flow2.png</file>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 908 B

11
images/goto.svg Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128">
<defs>
<style>
.cls-1 {
fill: #f0f;
}
</style>
</defs>
<path class="cls-1" d="M108,64l-45-30v20.12c-30,0-41-15.12-41-15.12,0,29,41,35.12,41,35.12v19.88l45-30Z"/>
</svg>

After

Width:  |  Height:  |  Size: 337 B