DolphinQt2: Settings: emit ThemeChanged signal

This commit is contained in:
Michael Maltese 2017-05-31 16:15:48 -07:00
parent d712914d81
commit 5a4ee87d6a
3 changed files with 11 additions and 2 deletions

View File

@ -27,6 +27,12 @@ Settings& Settings::Instance()
return settings; return settings;
} }
void Settings::SetThemeName(const QString& theme_name)
{
SConfig::GetInstance().theme_name = theme_name.toStdString();
emit ThemeChanged();
}
QString Settings::GetThemeDir() const QString Settings::GetThemeDir() const
{ {
return QString::fromStdString(File::GetThemeDir(SConfig::GetInstance().theme_name)); return QString::fromStdString(File::GetThemeDir(SConfig::GetInstance().theme_name));

View File

@ -26,6 +26,7 @@ public:
static Settings& Instance(); static Settings& Instance();
// UI // UI
void SetThemeName(const QString& theme_name);
QString GetThemeDir() const; QString GetThemeDir() const;
QString GetResourcesDir() const; QString GetResourcesDir() const;
QString GetProfilesDir() const; QString GetProfilesDir() const;
@ -109,6 +110,7 @@ public:
void Save(); void Save();
signals: signals:
void ThemeChanged();
void PathAdded(const QString&); void PathAdded(const QString&);
void PathRemoved(const QString&); void PathRemoved(const QString&);

View File

@ -17,6 +17,8 @@
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "DolphinQt2/Settings.h"
InterfacePane::InterfacePane(QWidget* parent) : QWidget(parent) InterfacePane::InterfacePane(QWidget* parent) : QWidget(parent)
{ {
CreateLayout(); CreateLayout();
@ -106,7 +108,7 @@ void InterfacePane::ConnectLayout()
connect(m_checkbox_top_window, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig); connect(m_checkbox_top_window, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig);
connect(m_checkbox_render_to_window, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig); connect(m_checkbox_render_to_window, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig);
connect(m_combobox_theme, static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::activated), connect(m_combobox_theme, static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::activated),
[this](const QString& text) { OnSaveConfig(); }); &Settings::Instance(), &Settings::SetThemeName);
connect(m_combobox_language, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), connect(m_combobox_language, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
[this](int index) { OnSaveConfig(); }); [this](int index) { OnSaveConfig(); });
connect(m_checkbox_confirm_on_stop, &QCheckBox::clicked, this, &InterfacePane::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.bRenderWindowAutoSize = m_checkbox_auto_window->isChecked();
settings.bKeepWindowOnTop = m_checkbox_top_window->isChecked(); settings.bKeepWindowOnTop = m_checkbox_top_window->isChecked();
settings.bRenderToMain = m_checkbox_render_to_window->isChecked(); settings.bRenderToMain = m_checkbox_render_to_window->isChecked();
settings.theme_name = m_combobox_theme->currentText().toStdString();
// In Game Options // In Game Options
settings.bConfirmStop = m_checkbox_confirm_on_stop->isChecked(); settings.bConfirmStop = m_checkbox_confirm_on_stop->isChecked();