Skip to content
Permalink
Browse files

Qt/NetPlayDialog: Move settings loading into LoadSettings

  • Loading branch information...
Techjar committed May 30, 2019
1 parent 8046f40 commit 199486ffb6174b45a3089738e434f69e26abc38d
Showing with 31 additions and 27 deletions.
  1. +30 −27 Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp
  2. +1 −0 Source/Core/DolphinQt/NetPlay/NetPlayDialog.h
@@ -74,33 +74,7 @@ NetPlayDialog::NetPlayDialog(QWidget* parent)
CreateChatLayout();
CreatePlayersLayout();
CreateMainLayout();

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);

LoadSettings();
ConnectWidgets();

auto& settings = Settings::Instance().GetQSettings();
@@ -1033,6 +1007,35 @@ std::shared_ptr<const UICommon::GameFile> NetPlayDialog::FindGameFile(const std:
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()
{
Config::ConfigChangeCallbackGuard config_guard;
@@ -66,6 +66,7 @@ class NetPlayDialog : public QDialog, public NetPlay::NetPlayUI
std::string FindGame(const std::string& game) override;
std::shared_ptr<const UICommon::GameFile> FindGameFile(const std::string& game) override;

void LoadSettings();
void SaveSettings();

void ShowMD5Dialog(const std::string& file_identifier) override;

0 comments on commit 199486f

Please sign in to comment.
You can’t perform that action at this time.