From 5a4ee87d6a271a24200d7b599fbdb019cd45ac04 Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Wed, 31 May 2017 16:15:48 -0700 Subject: [PATCH] DolphinQt2: Settings: emit ThemeChanged signal --- Source/Core/DolphinQt2/Settings.cpp | 6 ++++++ Source/Core/DolphinQt2/Settings.h | 2 ++ Source/Core/DolphinQt2/Settings/InterfacePane.cpp | 5 +++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinQt2/Settings.cpp b/Source/Core/DolphinQt2/Settings.cpp index a1ec7d7b94..cc19bcdd7b 100644 --- a/Source/Core/DolphinQt2/Settings.cpp +++ b/Source/Core/DolphinQt2/Settings.cpp @@ -27,6 +27,12 @@ Settings& Settings::Instance() return settings; } +void Settings::SetThemeName(const QString& theme_name) +{ + SConfig::GetInstance().theme_name = theme_name.toStdString(); + emit ThemeChanged(); +} + QString Settings::GetThemeDir() const { return QString::fromStdString(File::GetThemeDir(SConfig::GetInstance().theme_name)); diff --git a/Source/Core/DolphinQt2/Settings.h b/Source/Core/DolphinQt2/Settings.h index d7f3dae319..47b9a9656f 100644 --- a/Source/Core/DolphinQt2/Settings.h +++ b/Source/Core/DolphinQt2/Settings.h @@ -26,6 +26,7 @@ public: static Settings& Instance(); // UI + void SetThemeName(const QString& theme_name); QString GetThemeDir() const; QString GetResourcesDir() const; QString GetProfilesDir() const; @@ -109,6 +110,7 @@ public: void Save(); signals: + void ThemeChanged(); void PathAdded(const QString&); void PathRemoved(const QString&); diff --git a/Source/Core/DolphinQt2/Settings/InterfacePane.cpp b/Source/Core/DolphinQt2/Settings/InterfacePane.cpp index fd404fb83c..b6d4bd11f1 100644 --- a/Source/Core/DolphinQt2/Settings/InterfacePane.cpp +++ b/Source/Core/DolphinQt2/Settings/InterfacePane.cpp @@ -17,6 +17,8 @@ #include "Common/StringUtil.h" #include "Core/ConfigManager.h" +#include "DolphinQt2/Settings.h" + InterfacePane::InterfacePane(QWidget* parent) : QWidget(parent) { CreateLayout(); @@ -106,7 +108,7 @@ void InterfacePane::ConnectLayout() connect(m_checkbox_top_window, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig); connect(m_checkbox_render_to_window, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig); connect(m_combobox_theme, static_cast(&QComboBox::activated), - [this](const QString& text) { OnSaveConfig(); }); + &Settings::Instance(), &Settings::SetThemeName); connect(m_combobox_language, static_cast(&QComboBox::activated), [this](int index) { OnSaveConfig(); }); connect(m_checkbox_confirm_on_stop, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig); @@ -140,7 +142,6 @@ void InterfacePane::OnSaveConfig() settings.bRenderWindowAutoSize = m_checkbox_auto_window->isChecked(); settings.bKeepWindowOnTop = m_checkbox_top_window->isChecked(); settings.bRenderToMain = m_checkbox_render_to_window->isChecked(); - settings.theme_name = m_combobox_theme->currentText().toStdString(); // In Game Options settings.bConfirmStop = m_checkbox_confirm_on_stop->isChecked();