Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 42 additions & 9 deletions src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -303,21 +303,54 @@ BITCOIN_QT_CPP += $(BITCOIN_QT_WALLET_CPP)
endif

RES_IMAGES = \
qt/res/images/arrow_down.png \
qt/res/images/arrow_down_small.png \
qt/res/images/arrow_left_small.png \
qt/res/images/arrow_right_small.png \
qt/res/images/arrow_up_small.png \
qt/res/images/checked.png \
qt/res/images/arrow_down_normal.png \
qt/res/images/arrow_down_hover.png \
qt/res/images/arrow_down_pressed.png \
qt/res/images/arrow_left_normal.png \
qt/res/images/arrow_left_hover.png \
qt/res/images/arrow_left_pressed.png \
qt/res/images/arrow_right_normal.png \
qt/res/images/arrow_right_hover.png \
qt/res/images/arrow_right_pressed.png \
qt/res/images/arrow_up_normal.png \
qt/res/images/arrow_up_hover.png \
qt/res/images/arrow_up_pressed.png \
qt/res/images/arrow_light_down_normal.png \
qt/res/images/arrow_light_down_hover.png \
qt/res/images/arrow_light_left_normal.png \
qt/res/images/arrow_light_left_hover.png \
qt/res/images/arrow_light_right_normal.png \
qt/res/images/arrow_light_right_hover.png \
qt/res/images/arrow_light_up_normal.png \
qt/res/images/arrow_light_up_hover.png \
qt/res/images/checkbox_normal.png \
qt/res/images/checkbox_normal_hover.png \
qt/res/images/checkbox_normal_pressed.png \
qt/res/images/checkbox_normal_disabled.png \
qt/res/images/checkbox_checked.png \
qt/res/images/checkbox_checked_hover.png \
qt/res/images/checkbox_checked_pressed.png \
qt/res/images/checkbox_checked_disabled.png \
qt/res/images/checkbox_partly_checked.png \
qt/res/images/checkbox_partly_checked_hover.png \
qt/res/images/checkbox_partly_checked_pressed.png \
qt/res/images/checkbox_partly_checked_disabled.png \
qt/res/images/dash_logo_horizontal.png \
qt/res/images/dash_logo_toolbar.png \
qt/res/images/dash_logo_toolbar_blue.png \
qt/res/images/qtreeview_selected.png \
qt/res/images/splash.png \
qt/res/images/unchecked.png
qt/res/images/radio_normal.png \
qt/res/images/radio_normal_hover.png \
qt/res/images/radio_normal_pressed.png \
qt/res/images/radio_checked.png \
qt/res/images/radio_checked_hover.png \
qt/res/images/radio_checked_pressed.png \
qt/res/images/radio_normal_disabled.png \
qt/res/images/radio_checked_disabled.png \
qt/res/images/splash.png

RES_CSS = \
qt/res/css/dark.css \
qt/res/css/general.css \
qt/res/css/light.css \
qt/res/css/scrollbars.css \
qt/res/css/trad.css
Expand Down
16 changes: 1 addition & 15 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,19 +241,6 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle *
progressBar->setStyleSheet("QProgressBar { background-color: #F8F8F8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #00CCFF, stop: 1 #33CCFF); border-radius: 7px; margin: 0px; }");
}

#ifndef Q_OS_MAC
// Apply some styling to scrollbars
QString theme = settings.value("theme", "").toString();
if (theme != "Traditional") { // No scrollbar styling for the traditional theme
QFile qFile(QString(":/css/scrollbars"));
QString styleSheet;
if (qFile.open(QFile::ReadOnly)) {
styleSheet = QLatin1String(qFile.readAll());
}
this->setStyleSheet(this->styleSheet().append(styleSheet));
}
#endif

statusBar()->addWidget(progressBarLabel);
statusBar()->addWidget(progressBar);
statusBar()->addPermanentWidget(frameBlocks);
Expand Down Expand Up @@ -620,9 +607,8 @@ void BitcoinGUI::createToolBars()
toolbar->addWidget(spacer);

QLabel *logoLabel = new QLabel();
QString theme = settings.value("theme", "").toString();
QString logoImage = ":/images/dash_logo_toolbar";
if (theme == "Traditional") {
if (!GUIUtil::dashThemeActive()) {
logoImage = ":/images/dash_logo_toolbar_blue";
}

Expand Down
49 changes: 41 additions & 8 deletions src/qt/dash.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<file alias="network_disabled">res/icons/network_disabled.png</file>
</qresource>
<qresource prefix="/css">
<file alias="general">res/css/general.css</file>
<file alias="scrollbars">res/css/scrollbars.css</file>
</qresource>
<qresource prefix="/themes">
Expand All @@ -63,18 +64,50 @@
<file alias="Traditional">res/css/trad.css</file>
</qresource>
<qresource prefix="/images">
<file alias="arrow_down">res/images/arrow_down.png</file>
<file alias="arrow_down_small">res/images/arrow_down_small.png</file>
<file alias="arrow_left_small">res/images/arrow_left_small.png</file>
<file alias="arrow_right_small">res/images/arrow_right_small.png</file>
<file alias="arrow_up_small">res/images/arrow_up_small.png</file>
<file alias="checked">res/images/checked.png</file>
<file alias="arrow_down_normal">res/images/arrow_down_normal.png</file>
<file alias="arrow_down_hover">res/images/arrow_down_hover.png</file>
<file alias="arrow_down_pressed">res/images/arrow_down_pressed.png</file>
<file alias="arrow_left_normal">res/images/arrow_left_normal.png</file>
<file alias="arrow_left_hover">res/images/arrow_left_hover.png</file>
<file alias="arrow_left_pressed">res/images/arrow_left_pressed.png</file>
<file alias="arrow_right_normal">res/images/arrow_right_normal.png</file>
<file alias="arrow_right_hover">res/images/arrow_right_hover.png</file>
<file alias="arrow_right_pressed">res/images/arrow_right_pressed.png</file>
<file alias="arrow_up_normal">res/images/arrow_up_normal.png</file>
<file alias="arrow_up_hover">res/images/arrow_up_hover.png</file>
<file alias="arrow_up_pressed">res/images/arrow_up_pressed.png</file>
<file alias="arrow_light_down_normal">res/images/arrow_light_down_normal.png</file>
<file alias="arrow_light_down_hover">res/images/arrow_light_down_hover.png</file>
<file alias="arrow_light_left_normal">res/images/arrow_light_left_normal.png</file>
<file alias="arrow_light_left_hover">res/images/arrow_light_left_hover.png</file>
<file alias="arrow_light_right_normal">res/images/arrow_light_right_normal.png</file>
<file alias="arrow_light_right_hover">res/images/arrow_light_right_hover.png</file>
<file alias="arrow_light_up_normal">res/images/arrow_light_up_normal.png</file>
<file alias="arrow_light_up_hover">res/images/arrow_light_up_hover.png</file>
<file alias="checkbox_normal">res/images/checkbox_normal.png</file>
<file alias="checkbox_normal_hover">res/images/checkbox_normal_hover.png</file>
<file alias="checkbox_normal_pressed">res/images/checkbox_normal_pressed.png</file>
<file alias="checkbox_normal_disabled">res/images/checkbox_normal_disabled.png</file>
<file alias="checkbox_checked">res/images/checkbox_checked.png</file>
<file alias="checkbox_checked_hover">res/images/checkbox_checked_hover.png</file>
<file alias="checkbox_checked_pressed">res/images/checkbox_checked_pressed.png</file>
<file alias="checkbox_checked_disabled">res/images/checkbox_checked_disabled.png</file>
<file alias="checkbox_partly_checked">res/images/checkbox_partly_checked.png</file>
<file alias="checkbox_partly_checked_hover">res/images/checkbox_partly_checked_hover.png</file>
<file alias="checkbox_partly_checked_pressed">res/images/checkbox_partly_checked_pressed.png</file>
<file alias="checkbox_partly_checked_disabled">res/images/checkbox_partly_checked_disabled.png</file>
<file alias="dash_logo_horizontal">res/images/dash_logo_horizontal.png</file>
<file alias="dash_logo_toolbar">res/images/dash_logo_toolbar.png</file>
<file alias="dash_logo_toolbar_blue">res/images/dash_logo_toolbar_blue.png</file>
<file alias="qtreeview_selected">res/images/qtreeview_selected.png</file>
<file alias="radio_normal">res/images/radio_normal.png</file>
<file alias="radio_normal_hover">res/images/radio_normal_hover.png</file>
<file alias="radio_normal_pressed">res/images/radio_normal_pressed.png</file>
<file alias="radio_checked">res/images/radio_checked.png</file>
<file alias="radio_checked_hover">res/images/radio_checked_hover.png</file>
<file alias="radio_checked_pressed">res/images/radio_checked_pressed.png</file>
<file alias="radio_normal_disabled">res/images/radio_normal_disabled.png</file>
<file alias="radio_checked_disabled">res/images/radio_checked_disabled.png</file>
<file alias="splash">res/images/splash.png</file>
<file alias="unchecked">res/images/unchecked.png</file>
</qresource>
<qresource prefix="/movies">
<file alias="spinner-000">res/movies/spinner-000.png</file>
Expand Down
56 changes: 44 additions & 12 deletions src/qt/guiutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ void ForceActivation();

namespace GUIUtil {

// The name of the traditional theme
static const QString traditionalTheme = "Traditional";
// The theme to set by default if settings are missing or incorrect
static const QString defaultTheme = "Light";
// The prefix a theme name should have if we want to apply dark colors and styles to it
Expand Down Expand Up @@ -974,22 +976,52 @@ void migrateQtSettings()
// Open CSS when configured
QString loadStyleSheet()
{
QSettings settings;
QString theme = settings.value("theme", "").toString();
static std::unique_ptr<QString> stylesheet;

QDir themes(":themes");
// Make sure settings are pointing to an existent theme
if (theme.isEmpty() || !themes.exists(theme)) {
theme = defaultTheme;
settings.setValue("theme", theme);
}
if (stylesheet.get() == nullptr) {

stylesheet = std::make_unique<QString>();

QSettings settings;
QDir themes(":themes");
QString theme = settings.value("theme", "").toString();

QFile qFile(":themes/" + theme);
if (qFile.open(QFile::ReadOnly)) {
return QLatin1String(qFile.readAll());
// Make sure settings are pointing to an existent theme
if (theme.isEmpty() || !themes.exists(theme)) {
theme = defaultTheme;
settings.setValue("theme", theme);
}

// If light/dark theme is used load general styles first
if (dashThemeActive()) {
Comment thread
xdustinface marked this conversation as resolved.
QFile qFileGeneral(":css/general");
if (qFileGeneral.open(QFile::ReadOnly)) {
stylesheet.get()->append(QLatin1String(qFileGeneral.readAll()));
}

#ifndef Q_OS_MAC
// Apply some styling to scrollbars
QFile qFileScrollbars(QString(":/css/scrollbars"));
if (qFileScrollbars.open(QFile::ReadOnly)) {
stylesheet.get()->append(QLatin1String(qFileScrollbars.readAll()));
}
#endif
}

QFile qFileTheme(":themes/" + theme);
if (qFileTheme.open(QFile::ReadOnly)) {
stylesheet.get()->append(QLatin1String(qFileTheme.readAll()));
}
}

return QString();
return *stylesheet.get();
}

bool dashThemeActive()
{
QSettings settings;
QString theme = settings.value("theme", "").toString();
return theme != traditionalTheme;
}

void setClipboard(const QString& str)
Expand Down
3 changes: 3 additions & 0 deletions src/qt/guiutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ namespace GUIUtil
/** Load global CSS theme */
QString loadStyleSheet();

/** Check if a dash specific theme is activated (light/dark) */
bool dashThemeActive();

/* Convert QString to OS specific boost path through UTF-8 */
fs::path qstringToBoostPath(const QString &path);

Expand Down
Loading