summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2021-11-25 01:52:48 -0800
committerGravatar GitHub2021-11-25 01:52:48 -0800
commit06ad463ec868878f3fb0fc0b23bfb0dbbb725d57 (patch)
treef65f6aa3134ee6e976047acd7704b19ee0b3343e /src
parentRefactor menu states and shortcuts in GMainWindow. (#7419) (diff)
parentReplace "Light" theme by "Default" (diff)
downloadyuzu-06ad463ec868878f3fb0fc0b23bfb0dbbb725d57.tar.gz
yuzu-06ad463ec868878f3fb0fc0b23bfb0dbbb725d57.tar.xz
yuzu-06ad463ec868878f3fb0fc0b23bfb0dbbb725d57.zip
Merge pull request #7330 from MightyCreak/simplify-theme-selection
Replace "Light" theme by "Default"
Diffstat (limited to 'src')
-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) {
3472} 3472}
3473 3473
3474void GMainWindow::UpdateUITheme() { 3474void GMainWindow::UpdateUITheme() {
3475 const QString default_icons = QStringLiteral("default"); 3475 const QString default_theme = QStringLiteral("default");
3476 const QString& current_theme = UISettings::values.theme; 3476 QString current_theme = UISettings::values.theme;
3477 const bool is_default_theme = current_theme == QString::fromUtf8(UISettings::themes[0].second);
3478 QStringList theme_paths(default_theme_paths); 3477 QStringList theme_paths(default_theme_paths);
3479 3478
3480 if (is_default_theme || current_theme.isEmpty()) { 3479 if (current_theme.isEmpty()) {
3481 const QString theme_uri(QStringLiteral(":default/style.qss")); 3480 current_theme = default_theme;
3481 }
3482
3483 if (current_theme != default_theme) {
3484 QString theme_uri{QStringLiteral(":%1/style.qss").arg(current_theme)};
3482 QFile f(theme_uri); 3485 QFile f(theme_uri);
3483 if (f.open(QFile::ReadOnly | QFile::Text)) { 3486 if (!f.open(QFile::ReadOnly | QFile::Text)) {
3484 QTextStream ts(&f); 3487 LOG_ERROR(Frontend, "Unable to open style \"{}\", fallback to the default theme",
3485 qApp->setStyleSheet(ts.readAll()); 3488 UISettings::values.theme.toStdString());
3486 setStyleSheet(ts.readAll()); 3489 current_theme = default_theme;
3487 } else {
3488 qApp->setStyleSheet({});
3489 setStyleSheet({});
3490 } 3490 }
3491 QIcon::setThemeName(default_icons); 3491 }
3492
3493 QString theme_uri{QStringLiteral(":%1/style.qss").arg(current_theme)};
3494 QFile f(theme_uri);
3495 if (f.open(QFile::ReadOnly | QFile::Text)) {
3496 QTextStream ts(&f);
3497 qApp->setStyleSheet(ts.readAll());
3498 setStyleSheet(ts.readAll());
3492 } else { 3499 } else {
3493 const QString theme_uri(QLatin1Char{':'} + current_theme + QStringLiteral("/style.qss")); 3500 LOG_ERROR(Frontend, "Unable to set style \"{}\", stylesheet file not found",
3494 QFile f(theme_uri); 3501 UISettings::values.theme.toStdString());
3495 if (f.open(QFile::ReadOnly | QFile::Text)) { 3502 qApp->setStyleSheet({});
3496 QTextStream ts(&f); 3503 setStyleSheet({});
3497 qApp->setStyleSheet(ts.readAll());
3498 setStyleSheet(ts.readAll());
3499 } else {
3500 LOG_ERROR(Frontend, "Unable to set style, stylesheet file not found");
3501 }
3502 QIcon::setThemeName(current_theme);
3503 } 3504 }
3504 3505
3506 QIcon::setThemeName(current_theme);
3505 QIcon::setThemeSearchPaths(theme_paths); 3507 QIcon::setThemeSearchPaths(theme_paths);
3506} 3508}
3507 3509
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 @@
7namespace UISettings { 7namespace UISettings {
8 8
9const Themes themes{{ 9const Themes themes{{
10 {"Light", "default"}, 10 {"Default", "default"},
11 {"Light Colorful", "colorful"}, 11 {"Default Colorful", "colorful"},
12 {"Dark", "qdarkstyle"}, 12 {"Dark", "qdarkstyle"},
13 {"Dark Colorful", "colorful_dark"}, 13 {"Dark Colorful", "colorful_dark"},
14 {"Midnight Blue", "qdarkstyle_midnight_blue"}, 14 {"Midnight Blue", "qdarkstyle_midnight_blue"},