DolphinQt2: make Settings a singleton

With this, we can get signals when properties change.
This commit is contained in:
Michael Maltese
2017-05-31 00:17:39 -07:00
parent 95ef785b1f
commit 548522877a
15 changed files with 109 additions and 89 deletions

View File

@ -48,14 +48,14 @@ void GCPadWiiU::ConnectWidgets()
void GCPadWiiU::LoadSettings()
{
m_rumble->setChecked(Settings().IsGCAdapterRumbleEnabled(GetPort()));
m_simulate_bongos->setChecked(Settings().IsGCAdapterSimulatingDKBongos(GetPort()));
m_rumble->setChecked(Settings::Instance().IsGCAdapterRumbleEnabled(GetPort()));
m_simulate_bongos->setChecked(Settings::Instance().IsGCAdapterSimulatingDKBongos(GetPort()));
}
void GCPadWiiU::SaveSettings()
{
Settings().SetGCAdapterRumbleEnabled(GetPort(), m_rumble->isChecked());
Settings().SetGCAdapterSimulatingDKBongos(GetPort(), m_simulate_bongos->isChecked());
Settings::Instance().SetGCAdapterRumbleEnabled(GetPort(), m_rumble->isChecked());
Settings::Instance().SetGCAdapterSimulatingDKBongos(GetPort(), m_simulate_bongos->isChecked());
}
InputConfig* GCPadWiiU::GetConfig()

View File

@ -126,8 +126,9 @@ void MappingWindow::ConnectWidgets()
void MappingWindow::OnDeleteProfilePressed()
{
auto& settings = Settings::Instance();
const QString profile_name = m_profiles_combo->currentText();
if (!Settings().GetProfiles(m_config).contains(profile_name))
if (!settings.GetProfiles(m_config).contains(profile_name))
{
QMessageBox error;
error.setIcon(QMessageBox::Critical);
@ -153,7 +154,7 @@ void MappingWindow::OnDeleteProfilePressed()
QMessageBox result(this);
std::string profile_path = Settings().GetProfileINIPath(m_config, profile_name).toStdString();
std::string profile_path = settings.GetProfileINIPath(m_config, profile_name).toStdString();
File::CreateFullPath(profile_path);
@ -170,7 +171,8 @@ void MappingWindow::OnLoadProfilePressed()
if (profile_name.isEmpty())
return;
std::string profile_path = Settings().GetProfileINIPath(m_config, profile_name).toStdString();
std::string profile_path =
Settings::Instance().GetProfileINIPath(m_config, profile_name).toStdString();
File::CreateFullPath(profile_path);
@ -192,7 +194,8 @@ void MappingWindow::OnSaveProfilePressed()
if (profile_name.isEmpty())
return;
std::string profile_path = Settings().GetProfileINIPath(m_config, profile_name).toStdString();
std::string profile_path =
Settings::Instance().GetProfileINIPath(m_config, profile_name).toStdString();
File::CreateFullPath(profile_path);
@ -297,7 +300,7 @@ void MappingWindow::ChangeMappingType(MappingWindow::Type type)
m_controller = m_config->GetController(GetPort());
m_profiles_combo->addItem(QStringLiteral(""));
for (const auto& item : Settings().GetProfiles(m_config))
for (const auto& item : Settings::Instance().GetProfiles(m_config))
m_profiles_combo->addItem(item);
}