diff options
author | Kloen <kloen@outlawkiwi.com> | 2017-06-24 02:41:11 +0200 |
---|---|---|
committer | Kloen <kloen@outlawkiwi.com> | 2017-06-24 05:48:42 +0200 |
commit | 9c2335b984c3c5bb69b3b203d058816eba01246d (patch) | |
tree | a025a95ad52e7167c3554cf395a13ad82b058997 /src | |
parent | citra-qt: Add Dark theme from https://github.com/ColinDuquesnoy/QDarkStyleSheet (diff) | |
download | yuzu-9c2335b984c3c5bb69b3b203d058816eba01246d.tar yuzu-9c2335b984c3c5bb69b3b203d058816eba01246d.tar.gz yuzu-9c2335b984c3c5bb69b3b203d058816eba01246d.tar.bz2 yuzu-9c2335b984c3c5bb69b3b203d058816eba01246d.tar.lz yuzu-9c2335b984c3c5bb69b3b203d058816eba01246d.tar.xz yuzu-9c2335b984c3c5bb69b3b203d058816eba01246d.tar.zst yuzu-9c2335b984c3c5bb69b3b203d058816eba01246d.zip |
Diffstat (limited to '')
-rw-r--r-- | src/citra_qt/main.cpp | 21 | ||||
-rw-r--r-- | src/citra_qt/main.h | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 4f5b2ddab..02bfdca3d 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -71,6 +71,8 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) { game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan); + UpdateUITheme(); + QStringList args = QApplication::arguments(); if (args.length() >= 2) { BootGame(args[1]); @@ -606,6 +608,7 @@ void GMainWindow::OnConfigure() { auto result = configureDialog.exec(); if (result == QDialog::Accepted) { configureDialog.applyConfiguration(); + UpdateUITheme(); config->Save(); } } @@ -791,6 +794,24 @@ void GMainWindow::filterBarSetChecked(bool state) { emit(OnToggleFilterBar()); } +void GMainWindow::UpdateUITheme() { + if (UISettings::values.theme != UISettings::themes[0].second) { + QString theme_uri(":" + UISettings::values.theme + "/style.qss"); + QFile f(theme_uri); + if (!f.exists()) { + LOG_ERROR(Frontend, "Unable to set style, stylesheet file not found"); + } else { + f.open(QFile::ReadOnly | QFile::Text); + QTextStream ts(&f); + qApp->setStyleSheet(ts.readAll()); + GMainWindow::setStyleSheet(ts.readAll()); + } + } else { + qApp->setStyleSheet(""); + GMainWindow::setStyleSheet(""); + } +} + #ifdef main #undef main #endif diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index 952a50974..360de2ced 100644 --- a/src/citra_qt/main.h +++ b/src/citra_qt/main.h @@ -42,6 +42,7 @@ class GMainWindow : public QMainWindow { public: void filterBarSetChecked(bool state); + void UpdateUITheme(); GMainWindow(); ~GMainWindow(); |