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)
{
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);
}

View File

@ -1,21 +1,27 @@
#ifndef __GOTODIALOG_H
#define __GOTODIALOG_H
#include "themable.h"
#include <QDialog>
#include <QIntValidator>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
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;

View File

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

View File

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

View File

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

View File

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

View File

@ -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;

View File

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