Qt/NetPlayDialog: Move settings loading into LoadSettings

This commit is contained in:
Techjar 2019-05-30 17:44:02 -04:00
parent 8046f40784
commit 199486ffb6
2 changed files with 31 additions and 27 deletions

View File

@ -74,33 +74,7 @@ NetPlayDialog::NetPlayDialog(QWidget* parent)
CreateChatLayout(); CreateChatLayout();
CreatePlayersLayout(); CreatePlayersLayout();
CreateMainLayout(); CreateMainLayout();
LoadSettings();
const int buffer_size = Config::Get(Config::NETPLAY_BUFFER_SIZE);
const bool write_save_sdcard_data = Config::Get(Config::NETPLAY_WRITE_SAVE_SDCARD_DATA);
const bool load_wii_save = Config::Get(Config::NETPLAY_LOAD_WII_SAVE);
const bool sync_saves = Config::Get(Config::NETPLAY_SYNC_SAVES);
const bool sync_codes = Config::Get(Config::NETPLAY_SYNC_CODES);
const bool record_inputs = Config::Get(Config::NETPLAY_RECORD_INPUTS);
const bool reduce_polling_rate = Config::Get(Config::NETPLAY_REDUCE_POLLING_RATE);
const bool strict_settings_sync = Config::Get(Config::NETPLAY_STRICT_SETTINGS_SYNC);
const bool host_input_authority = Config::Get(Config::NETPLAY_HOST_INPUT_AUTHORITY);
const bool sync_all_wii_saves = Config::Get(Config::NETPLAY_SYNC_ALL_WII_SAVES);
const bool golf_mode = Config::Get(Config::NETPLAY_GOLF_MODE);
const bool golf_mode_overlay = Config::Get(Config::NETPLAY_GOLF_MODE_OVERLAY);
m_buffer_size_box->setValue(buffer_size);
m_save_sd_action->setChecked(write_save_sdcard_data);
m_load_wii_action->setChecked(load_wii_save);
m_sync_save_data_action->setChecked(sync_saves);
m_sync_codes_action->setChecked(sync_codes);
m_record_input_action->setChecked(record_inputs);
m_reduce_polling_rate_action->setChecked(reduce_polling_rate);
m_strict_settings_sync_action->setChecked(strict_settings_sync);
m_host_input_authority_action->setChecked(host_input_authority);
m_sync_all_wii_saves_action->setChecked(sync_all_wii_saves);
m_golf_mode_action->setChecked(golf_mode);
m_golf_mode_overlay_action->setChecked(golf_mode_overlay);
ConnectWidgets(); ConnectWidgets();
auto& settings = Settings::Instance().GetQSettings(); auto& settings = Settings::Instance().GetQSettings();
@ -1033,6 +1007,35 @@ std::shared_ptr<const UICommon::GameFile> NetPlayDialog::FindGameFile(const std:
return nullptr; return nullptr;
} }
void NetPlayDialog::LoadSettings()
{
const int buffer_size = Config::Get(Config::NETPLAY_BUFFER_SIZE);
const bool write_save_sdcard_data = Config::Get(Config::NETPLAY_WRITE_SAVE_SDCARD_DATA);
const bool load_wii_save = Config::Get(Config::NETPLAY_LOAD_WII_SAVE);
const bool sync_saves = Config::Get(Config::NETPLAY_SYNC_SAVES);
const bool sync_codes = Config::Get(Config::NETPLAY_SYNC_CODES);
const bool record_inputs = Config::Get(Config::NETPLAY_RECORD_INPUTS);
const bool reduce_polling_rate = Config::Get(Config::NETPLAY_REDUCE_POLLING_RATE);
const bool strict_settings_sync = Config::Get(Config::NETPLAY_STRICT_SETTINGS_SYNC);
const bool host_input_authority = Config::Get(Config::NETPLAY_HOST_INPUT_AUTHORITY);
const bool sync_all_wii_saves = Config::Get(Config::NETPLAY_SYNC_ALL_WII_SAVES);
const bool golf_mode = Config::Get(Config::NETPLAY_GOLF_MODE);
const bool golf_mode_overlay = Config::Get(Config::NETPLAY_GOLF_MODE_OVERLAY);
m_buffer_size_box->setValue(buffer_size);
m_save_sd_action->setChecked(write_save_sdcard_data);
m_load_wii_action->setChecked(load_wii_save);
m_sync_save_data_action->setChecked(sync_saves);
m_sync_codes_action->setChecked(sync_codes);
m_record_input_action->setChecked(record_inputs);
m_reduce_polling_rate_action->setChecked(reduce_polling_rate);
m_strict_settings_sync_action->setChecked(strict_settings_sync);
m_host_input_authority_action->setChecked(host_input_authority);
m_sync_all_wii_saves_action->setChecked(sync_all_wii_saves);
m_golf_mode_action->setChecked(golf_mode);
m_golf_mode_overlay_action->setChecked(golf_mode_overlay);
}
void NetPlayDialog::SaveSettings() void NetPlayDialog::SaveSettings()
{ {
Config::ConfigChangeCallbackGuard config_guard; Config::ConfigChangeCallbackGuard config_guard;

View File

@ -66,6 +66,7 @@ public:
std::string FindGame(const std::string& game) override; std::string FindGame(const std::string& game) override;
std::shared_ptr<const UICommon::GameFile> FindGameFile(const std::string& game) override; std::shared_ptr<const UICommon::GameFile> FindGameFile(const std::string& game) override;
void LoadSettings();
void SaveSettings(); void SaveSettings();
void ShowMD5Dialog(const std::string& file_identifier) override; void ShowMD5Dialog(const std::string& file_identifier) override;