diff options
| author | 2017-06-24 02:41:11 +0200 | |
|---|---|---|
| committer | 2017-06-24 05:48:42 +0200 | |
| commit | 9c2335b984c3c5bb69b3b203d058816eba01246d (patch) | |
| tree | a025a95ad52e7167c3554cf395a13ad82b058997 | |
| parent | citra-qt: Add Dark theme from https://github.com/ColinDuquesnoy/QDarkStyleSheet (diff) | |
| download | yuzu-9c2335b984c3c5bb69b3b203d058816eba01246d.tar.gz yuzu-9c2335b984c3c5bb69b3b203d058816eba01246d.tar.xz yuzu-9c2335b984c3c5bb69b3b203d058816eba01246d.zip | |
citra-qt: load ui theme at startup and config change.
| -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) { | |||
| 71 | 71 | ||
| 72 | game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan); | 72 | game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan); |
| 73 | 73 | ||
| 74 | UpdateUITheme(); | ||
| 75 | |||
| 74 | QStringList args = QApplication::arguments(); | 76 | QStringList args = QApplication::arguments(); |
| 75 | if (args.length() >= 2) { | 77 | if (args.length() >= 2) { |
| 76 | BootGame(args[1]); | 78 | BootGame(args[1]); |
| @@ -606,6 +608,7 @@ void GMainWindow::OnConfigure() { | |||
| 606 | auto result = configureDialog.exec(); | 608 | auto result = configureDialog.exec(); |
| 607 | if (result == QDialog::Accepted) { | 609 | if (result == QDialog::Accepted) { |
| 608 | configureDialog.applyConfiguration(); | 610 | configureDialog.applyConfiguration(); |
| 611 | UpdateUITheme(); | ||
| 609 | config->Save(); | 612 | config->Save(); |
| 610 | } | 613 | } |
| 611 | } | 614 | } |
| @@ -791,6 +794,24 @@ void GMainWindow::filterBarSetChecked(bool state) { | |||
| 791 | emit(OnToggleFilterBar()); | 794 | emit(OnToggleFilterBar()); |
| 792 | } | 795 | } |
| 793 | 796 | ||
| 797 | void GMainWindow::UpdateUITheme() { | ||
| 798 | if (UISettings::values.theme != UISettings::themes[0].second) { | ||
| 799 | QString theme_uri(":" + UISettings::values.theme + "/style.qss"); | ||
| 800 | QFile f(theme_uri); | ||
| 801 | if (!f.exists()) { | ||
| 802 | LOG_ERROR(Frontend, "Unable to set style, stylesheet file not found"); | ||
| 803 | } else { | ||
| 804 | f.open(QFile::ReadOnly | QFile::Text); | ||
| 805 | QTextStream ts(&f); | ||
| 806 | qApp->setStyleSheet(ts.readAll()); | ||
| 807 | GMainWindow::setStyleSheet(ts.readAll()); | ||
| 808 | } | ||
| 809 | } else { | ||
| 810 | qApp->setStyleSheet(""); | ||
| 811 | GMainWindow::setStyleSheet(""); | ||
| 812 | } | ||
| 813 | } | ||
| 814 | |||
| 794 | #ifdef main | 815 | #ifdef main |
| 795 | #undef main | 816 | #undef main |
| 796 | #endif | 817 | #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 { | |||
| 42 | 42 | ||
| 43 | public: | 43 | public: |
| 44 | void filterBarSetChecked(bool state); | 44 | void filterBarSetChecked(bool state); |
| 45 | void UpdateUITheme(); | ||
| 45 | GMainWindow(); | 46 | GMainWindow(); |
| 46 | ~GMainWindow(); | 47 | ~GMainWindow(); |
| 47 | 48 | ||