diff --git a/src/qt/dash.qrc b/src/qt/dash.qrc index 0f293af43..d105dbc1b 100644 --- a/src/qt/dash.qrc +++ b/src/qt/dash.qrc @@ -54,10 +54,12 @@ res/icons/network_disabled.png - res/css/dark.css - res/css/light.css res/css/scrollbars.css - res/css/trad.css + + + res/css/dark.css + res/css/light.css + res/css/trad.css res/images/arrow_down.png diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 18a9f109e..cbeb24997 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -922,25 +922,23 @@ void migrateQtSettings() // Open CSS when configured QString loadStyleSheet() { - QString styleSheet; QSettings settings; - QString cssName; QString theme = settings.value("theme", "").toString(); - if(!theme.isEmpty()){ - cssName = QString(":/css/") + theme; - } - else { - cssName = QString(":/css/light"); - settings.setValue("theme", "light"); + QDir themes(":themes"); + // Make sure settings are pointing to an existent theme + // Set "Light" theme by default if settings are missing or incorrect + if (theme.isEmpty() || !themes.exists(theme)) { + theme = "Light"; + settings.setValue("theme", theme); } - QFile qFile(cssName); + QFile qFile(":themes/" + theme); if (qFile.open(QFile::ReadOnly)) { - styleSheet = QLatin1String(qFile.readAll()); + return QLatin1String(qFile.readAll()); } - return styleSheet; + return QString(); } void setClipboard(const QString& str) diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index e3d9a79af..da1c8aa06 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -91,9 +91,10 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) : } /* Theme selector */ - ui->theme->addItem(QString("Dark"), QVariant("dark")); - ui->theme->addItem(QString("Light"), QVariant("light")); - ui->theme->addItem(QString("Traditional"), QVariant("trad")); + QDir themes(":themes"); + for (const QString &entry : themes.entryList()) { + ui->theme->addItem(entry, QVariant(entry)); + } /* Language selector */ QDir translations(":translations");