summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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 4e5552d2a..cfda60997 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -3381,36 +3381,38 @@ void GMainWindow::filterBarSetChecked(bool state) {
3381} 3381}
3382 3382
3383void GMainWindow::UpdateUITheme() { 3383void GMainWindow::UpdateUITheme() {
3384 const QString default_icons = QStringLiteral("default"); 3384 const QString default_theme = QStringLiteral("default");
3385 const QString& current_theme = UISettings::values.theme; 3385 QString current_theme = UISettings::values.theme;
3386 const bool is_default_theme = current_theme == QString::fromUtf8(UISettings::themes[0].second);
3387 QStringList theme_paths(default_theme_paths); 3386 QStringList theme_paths(default_theme_paths);
3388 3387
3389 if (is_default_theme || current_theme.isEmpty()) { 3388 if (current_theme.isEmpty()) {
3390 const QString theme_uri(QStringLiteral(":default/style.qss")); 3389 current_theme = default_theme;
3390 }
3391
3392 if (current_theme != default_theme) {
3393 QString theme_uri{QStringLiteral(":%1/style.qss").arg(current_theme)};
3391 QFile f(theme_uri); 3394 QFile f(theme_uri);
3392 if (f.open(QFile::ReadOnly | QFile::Text)) { 3395 if (!f.open(QFile::ReadOnly | QFile::Text)) {
3393 QTextStream ts(&f); 3396 LOG_ERROR(Frontend, "Unable to open style \"{}\", fallback to the default theme",
3394 qApp->setStyleSheet(ts.readAll()); 3397 UISettings::values.theme.toStdString());
3395 setStyleSheet(ts.readAll()); 3398 current_theme = default_theme;
3396 } else {
3397 qApp->setStyleSheet({});
3398 setStyleSheet({});
3399 } 3399 }
3400 QIcon::setThemeName(default_icons); 3400 }
3401
3402 QString theme_uri{QStringLiteral(":%1/style.qss").arg(current_theme)};
3403 QFile f(theme_uri);
3404 if (f.open(QFile::ReadOnly | QFile::Text)) {
3405 QTextStream ts(&f);
3406 qApp->setStyleSheet(ts.readAll());
3407 setStyleSheet(ts.readAll());
3401 } else { 3408 } else {
3402 const QString theme_uri(QLatin1Char{':'} + current_theme + QStringLiteral("/style.qss")); 3409 LOG_ERROR(Frontend, "Unable to set style \"{}\", stylesheet file not found",
3403 QFile f(theme_uri); 3410 UISettings::values.theme.toStdString());
3404 if (f.open(QFile::ReadOnly | QFile::Text)) { 3411 qApp->setStyleSheet({});
3405 QTextStream ts(&f); 3412 setStyleSheet({});
3406 qApp->setStyleSheet(ts.readAll());
3407 setStyleSheet(ts.readAll());
3408 } else {
3409 LOG_ERROR(Frontend, "Unable to set style, stylesheet file not found");
3410 }
3411 QIcon::setThemeName(current_theme);
3412 } 3413 }
3413 3414
3415 QIcon::setThemeName(current_theme);
3414 QIcon::setThemeSearchPaths(theme_paths); 3416 QIcon::setThemeSearchPaths(theme_paths);
3415} 3417}
3416 3418
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"},