mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-11 11:54:57 +00:00
citra-qt: load ui theme at startup and config change.
This commit is contained in:
parent
1355f0f39e
commit
9c2335b984
2 changed files with 22 additions and 0 deletions
|
@ -71,6 +71,8 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) {
|
||||||
|
|
||||||
game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan);
|
game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan);
|
||||||
|
|
||||||
|
UpdateUITheme();
|
||||||
|
|
||||||
QStringList args = QApplication::arguments();
|
QStringList args = QApplication::arguments();
|
||||||
if (args.length() >= 2) {
|
if (args.length() >= 2) {
|
||||||
BootGame(args[1]);
|
BootGame(args[1]);
|
||||||
|
@ -606,6 +608,7 @@ void GMainWindow::OnConfigure() {
|
||||||
auto result = configureDialog.exec();
|
auto result = configureDialog.exec();
|
||||||
if (result == QDialog::Accepted) {
|
if (result == QDialog::Accepted) {
|
||||||
configureDialog.applyConfiguration();
|
configureDialog.applyConfiguration();
|
||||||
|
UpdateUITheme();
|
||||||
config->Save();
|
config->Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -791,6 +794,24 @@ void GMainWindow::filterBarSetChecked(bool state) {
|
||||||
emit(OnToggleFilterBar());
|
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
|
#ifdef main
|
||||||
#undef main
|
#undef main
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -42,6 +42,7 @@ class GMainWindow : public QMainWindow {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void filterBarSetChecked(bool state);
|
void filterBarSetChecked(bool state);
|
||||||
|
void UpdateUITheme();
|
||||||
GMainWindow();
|
GMainWindow();
|
||||||
~GMainWindow();
|
~GMainWindow();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue