mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-10 22:28:03 -05:00
Add Dark theme, Icon theming
configure_general.ui: Add UI Option for Themes config.cpp: Save Theme Settings
This commit is contained in:
@ -95,6 +95,9 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) {
|
||||
|
||||
game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan);
|
||||
|
||||
default_theme_paths = QIcon::themeSearchPaths();
|
||||
UpdateUITheme();
|
||||
|
||||
// Show one-time "callout" messages to the user
|
||||
ShowCallouts();
|
||||
|
||||
@ -653,6 +656,7 @@ void GMainWindow::OnConfigure() {
|
||||
auto result = configureDialog.exec();
|
||||
if (result == QDialog::Accepted) {
|
||||
configureDialog.applyConfiguration();
|
||||
UpdateUITheme();
|
||||
config->Save();
|
||||
}
|
||||
}
|
||||
@ -833,6 +837,31 @@ void GMainWindow::filterBarSetChecked(bool state) {
|
||||
emit(OnToggleFilterBar());
|
||||
}
|
||||
|
||||
void GMainWindow::UpdateUITheme() {
|
||||
QStringList theme_paths(default_theme_paths);
|
||||
if (UISettings::values.theme != UISettings::themes[0].second &&
|
||||
!UISettings::values.theme.isEmpty()) {
|
||||
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());
|
||||
}
|
||||
theme_paths.append(QStringList{":/icons/default", ":/icons/" + UISettings::values.theme});
|
||||
QIcon::setThemeName(":/icons/" + UISettings::values.theme);
|
||||
} else {
|
||||
qApp->setStyleSheet("");
|
||||
GMainWindow::setStyleSheet("");
|
||||
theme_paths.append(QStringList{":/icons/default"});
|
||||
QIcon::setThemeName(":/icons/default");
|
||||
}
|
||||
QIcon::setThemeSearchPaths(theme_paths);
|
||||
}
|
||||
|
||||
#ifdef main
|
||||
#undef main
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user