diff options
| author | 2022-08-12 06:10:18 -0700 | |
|---|---|---|
| committer | 2022-08-12 06:13:12 -0700 | |
| commit | d4b1095173cf32dbd9a890b066d991ca795abd80 (patch) | |
| tree | 06b005be2ddeabe853ec098dabcd188b16eb78ed /src | |
| parent | assign colors to default_dark theme (diff) | |
| download | yuzu-d4b1095173cf32dbd9a890b066d991ca795abd80.tar.gz yuzu-d4b1095173cf32dbd9a890b066d991ca795abd80.tar.xz yuzu-d4b1095173cf32dbd9a890b066d991ca795abd80.zip | |
review pass on CheckDarkMode function
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/main.cpp | 6 | ||||
| -rw-r--r-- | src/yuzu/main.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index e473ac6da..5111b0eba 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -257,7 +257,7 @@ static QString PrettyProductName() { | |||
| 257 | return QSysInfo::prettyProductName(); | 257 | return QSysInfo::prettyProductName(); |
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | bool GMainWindow::check_dark_mode() { | 260 | bool GMainWindow::CheckDarkMode() { |
| 261 | #ifdef __linux__ | 261 | #ifdef __linux__ |
| 262 | const QPalette test_palette(qApp->palette()); | 262 | const QPalette test_palette(qApp->palette()); |
| 263 | const QColor text_color = test_palette.color(QPalette::Active, QPalette::Text); | 263 | const QColor text_color = test_palette.color(QPalette::Active, QPalette::Text); |
| @@ -287,7 +287,7 @@ GMainWindow::GMainWindow(bool has_broken_vulkan) | |||
| 287 | statusBar()->hide(); | 287 | statusBar()->hide(); |
| 288 | 288 | ||
| 289 | // Check dark mode before a theme is loaded | 289 | // Check dark mode before a theme is loaded |
| 290 | os_dark_mode = check_dark_mode(); | 290 | os_dark_mode = CheckDarkMode(); |
| 291 | startup_icon_theme = QIcon::themeName(); | 291 | startup_icon_theme = QIcon::themeName(); |
| 292 | // fallback can only be set once, colorful theme icons are okay on both light/dark | 292 | // fallback can only be set once, colorful theme icons are okay on both light/dark |
| 293 | QIcon::setFallbackThemeName(QStringLiteral("colorful")); | 293 | QIcon::setFallbackThemeName(QStringLiteral("colorful")); |
| @@ -3979,7 +3979,7 @@ void GMainWindow::UpdateUITheme() { | |||
| 3979 | QIcon::setThemeName(current_theme == QStringLiteral("colorful") ? current_theme | 3979 | QIcon::setThemeName(current_theme == QStringLiteral("colorful") ? current_theme |
| 3980 | : startup_icon_theme); | 3980 | : startup_icon_theme); |
| 3981 | QIcon::setThemeSearchPaths(theme_paths); | 3981 | QIcon::setThemeSearchPaths(theme_paths); |
| 3982 | if (check_dark_mode()) { | 3982 | if (CheckDarkMode()) { |
| 3983 | current_theme = QStringLiteral("default_dark"); | 3983 | current_theme = QStringLiteral("default_dark"); |
| 3984 | } | 3984 | } |
| 3985 | } else { | 3985 | } else { |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 2d1c8857b..0b25ebe6c 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -348,6 +348,7 @@ private: | |||
| 348 | void OpenURL(const QUrl& url); | 348 | void OpenURL(const QUrl& url); |
| 349 | void LoadTranslation(); | 349 | void LoadTranslation(); |
| 350 | void OpenPerGameConfiguration(u64 title_id, const std::string& file_name); | 350 | void OpenPerGameConfiguration(u64 title_id, const std::string& file_name); |
| 351 | bool CheckDarkMode(); | ||
| 351 | 352 | ||
| 352 | QString GetTasStateDescription() const; | 353 | QString GetTasStateDescription() const; |
| 353 | 354 | ||
| @@ -395,7 +396,6 @@ private: | |||
| 395 | 396 | ||
| 396 | QString startup_icon_theme; | 397 | QString startup_icon_theme; |
| 397 | bool os_dark_mode = false; | 398 | bool os_dark_mode = false; |
| 398 | bool check_dark_mode(); | ||
| 399 | 399 | ||
| 400 | // FS | 400 | // FS |
| 401 | std::shared_ptr<FileSys::VfsFilesystem> vfs; | 401 | std::shared_ptr<FileSys::VfsFilesystem> vfs; |