diff options
author | bunnei <bunneidev@gmail.com> | 2017-07-18 03:30:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-18 03:30:01 +0200 |
commit | 822e8d21ea9fd080a76fa939494c14c9bd2f3e27 (patch) | |
tree | 4d318f30937d9e1091dbd2a3c90920594dbd2081 /src/citra_qt/main.cpp | |
parent | Merge pull request #2818 from B3n30/network (diff) | |
parent | citra-qt: Add option to configure the UI theme (diff) | |
download | yuzu-822e8d21ea9fd080a76fa939494c14c9bd2f3e27.tar yuzu-822e8d21ea9fd080a76fa939494c14c9bd2f3e27.tar.gz yuzu-822e8d21ea9fd080a76fa939494c14c9bd2f3e27.tar.bz2 yuzu-822e8d21ea9fd080a76fa939494c14c9bd2f3e27.tar.lz yuzu-822e8d21ea9fd080a76fa939494c14c9bd2f3e27.tar.xz yuzu-822e8d21ea9fd080a76fa939494c14c9bd2f3e27.tar.zst yuzu-822e8d21ea9fd080a76fa939494c14c9bd2f3e27.zip |
Diffstat (limited to 'src/citra_qt/main.cpp')
-rw-r--r-- | src/citra_qt/main.cpp | 21 |
1 files changed, 21 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 |