summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-11-25 10:52:48 +0100
committerGitHub <noreply@github.com>2021-11-25 10:52:48 +0100
commit06ad463ec868878f3fb0fc0b23bfb0dbbb725d57 (patch)
treef65f6aa3134ee6e976047acd7704b19ee0b3343e /src
parentRefactor menu states and shortcuts in GMainWindow. (#7419) (diff)
parentReplace "Light" theme by "Default" (diff)
downloadyuzu-06ad463ec868878f3fb0fc0b23bfb0dbbb725d57.tar
yuzu-06ad463ec868878f3fb0fc0b23bfb0dbbb725d57.tar.gz
yuzu-06ad463ec868878f3fb0fc0b23bfb0dbbb725d57.tar.bz2
yuzu-06ad463ec868878f3fb0fc0b23bfb0dbbb725d57.tar.lz
yuzu-06ad463ec868878f3fb0fc0b23bfb0dbbb725d57.tar.xz
yuzu-06ad463ec868878f3fb0fc0b23bfb0dbbb725d57.tar.zst
yuzu-06ad463ec868878f3fb0fc0b23bfb0dbbb725d57.zip
Diffstat (limited to '')
-rw-r--r--src/yuzu/main.cpp48
-rw-r--r--src/yuzu/uisettings.cpp4
2 files changed, 27 insertions, 25 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 88e84e8f7..6a070934d 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -3472,36 +3472,38 @@ void GMainWindow::filterBarSetChecked(bool state) {
}
void GMainWindow::UpdateUITheme() {
- const QString default_icons = QStringLiteral("default");
- const QString& current_theme = UISettings::values.theme;
- const bool is_default_theme = current_theme == QString::fromUtf8(UISettings::themes[0].second);
+ const QString default_theme = QStringLiteral("default");
+ QString current_theme = UISettings::values.theme;
QStringList theme_paths(default_theme_paths);
- if (is_default_theme || current_theme.isEmpty()) {
- const QString theme_uri(QStringLiteral(":default/style.qss"));
+ if (current_theme.isEmpty()) {
+ current_theme = default_theme;
+ }
+
+ if (current_theme != default_theme) {
+ QString theme_uri{QStringLiteral(":%1/style.qss").arg(current_theme)};
QFile f(theme_uri);
- if (f.open(QFile::ReadOnly | QFile::Text)) {
- QTextStream ts(&f);
- qApp->setStyleSheet(ts.readAll());
- setStyleSheet(ts.readAll());
- } else {
- qApp->setStyleSheet({});
- setStyleSheet({});
+ if (!f.open(QFile::ReadOnly | QFile::Text)) {
+ LOG_ERROR(Frontend, "Unable to open style \"{}\", fallback to the default theme",
+ UISettings::values.theme.toStdString());
+ current_theme = default_theme;
}
- QIcon::setThemeName(default_icons);
+ }
+
+ QString theme_uri{QStringLiteral(":%1/style.qss").arg(current_theme)};
+ QFile f(theme_uri);
+ if (f.open(QFile::ReadOnly | QFile::Text)) {
+ QTextStream ts(&f);
+ qApp->setStyleSheet(ts.readAll());
+ setStyleSheet(ts.readAll());
} else {
- const QString theme_uri(QLatin1Char{':'} + current_theme + QStringLiteral("/style.qss"));
- QFile f(theme_uri);
- if (f.open(QFile::ReadOnly | QFile::Text)) {
- QTextStream ts(&f);
- qApp->setStyleSheet(ts.readAll());
- setStyleSheet(ts.readAll());
- } else {
- LOG_ERROR(Frontend, "Unable to set style, stylesheet file not found");
- }
- QIcon::setThemeName(current_theme);
+ LOG_ERROR(Frontend, "Unable to set style \"{}\", stylesheet file not found",
+ UISettings::values.theme.toStdString());
+ qApp->setStyleSheet({});
+ setStyleSheet({});
}
+ QIcon::setThemeName(current_theme);
QIcon::setThemeSearchPaths(theme_paths);
}
diff --git a/src/yuzu/uisettings.cpp b/src/yuzu/uisettings.cpp
index 37499fc85..21683576c 100644
--- a/src/yuzu/uisettings.cpp
+++ b/src/yuzu/uisettings.cpp
@@ -7,8 +7,8 @@
namespace UISettings {
const Themes themes{{
- {"Light", "default"},
- {"Light Colorful", "colorful"},
+ {"Default", "default"},
+ {"Default Colorful", "colorful"},
{"Dark", "qdarkstyle"},
{"Dark Colorful", "colorful_dark"},
{"Midnight Blue", "qdarkstyle_midnight_blue"},