Qt/WiiPane: Add checkbox for SD card folder syncing.

This commit is contained in:
Admiral H. Curtiss 2022-04-18 00:48:39 +02:00
parent 77d4591fb4
commit 4bf75c950b
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
2 changed files with 46 additions and 20 deletions

View File

@ -56,6 +56,7 @@ void WiiPane::CreateLayout()
{
m_main_layout = new QVBoxLayout;
CreateMisc();
CreateSDCard();
CreateWhitelistedUSBPassthroughDevices();
CreateWiiRemoteSettings();
m_main_layout->addStretch(1);
@ -73,14 +74,17 @@ void WiiPane::ConnectLayout()
&WiiPane::OnSaveConfig);
connect(m_screensaver_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
connect(m_pal60_mode_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
connect(m_sd_card_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
connect(m_allow_sd_writes_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
connect(m_connect_keyboard_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
connect(&Settings::Instance(), &Settings::SDCardInsertionChanged, m_sd_card_checkbox,
&QCheckBox::setChecked);
connect(&Settings::Instance(), &Settings::USBKeyboardConnectionChanged,
m_connect_keyboard_checkbox, &QCheckBox::setChecked);
// SD Card Settings
connect(m_sd_card_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
connect(m_allow_sd_writes_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
connect(m_sync_sd_folder_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
// Whitelisted USB Passthrough Devices
connect(m_whitelist_usb_list, &QListWidget::itemClicked, this, &WiiPane::ValidateSelectionState);
connect(m_whitelist_usb_add_button, &QPushButton::clicked, this,
@ -108,8 +112,6 @@ void WiiPane::CreateMisc()
m_main_layout->addWidget(misc_settings_group);
m_pal60_mode_checkbox = new QCheckBox(tr("Use PAL60 Mode (EuRGB60)"));
m_screensaver_checkbox = new QCheckBox(tr("Enable Screen Saver"));
m_sd_card_checkbox = new QCheckBox(tr("Insert SD Card"));
m_allow_sd_writes_checkbox = new QCheckBox(tr("Allow Writes to SD Card"));
m_connect_keyboard_checkbox = new QCheckBox(tr("Connect USB Keyboard"));
m_aspect_ratio_choice_label = new QLabel(tr("Aspect Ratio:"));
@ -141,20 +143,35 @@ void WiiPane::CreateMisc()
"(576i) for PAL games.\nMay not work for all games."));
m_screensaver_checkbox->setToolTip(tr("Dims the screen after five minutes of inactivity."));
m_system_language_choice->setToolTip(tr("Sets the Wii system language."));
m_sd_card_checkbox->setToolTip(tr("Supports SD and SDHC. Default size is 128 MB."));
m_connect_keyboard_checkbox->setToolTip(tr("May cause slow down in Wii Menu and some games."));
misc_settings_group_layout->addWidget(m_pal60_mode_checkbox, 0, 0, 1, 1);
misc_settings_group_layout->addWidget(m_sd_card_checkbox, 0, 1, 1, 1);
misc_settings_group_layout->addWidget(m_connect_keyboard_checkbox, 0, 1, 1, 1);
misc_settings_group_layout->addWidget(m_screensaver_checkbox, 1, 0, 1, 1);
misc_settings_group_layout->addWidget(m_allow_sd_writes_checkbox, 1, 1, 1, 1);
misc_settings_group_layout->addWidget(m_connect_keyboard_checkbox, 2, 1, 1, 1);
misc_settings_group_layout->addWidget(m_aspect_ratio_choice_label, 3, 0, 1, 1);
misc_settings_group_layout->addWidget(m_aspect_ratio_choice, 3, 1, 1, 1);
misc_settings_group_layout->addWidget(m_system_language_choice_label, 4, 0, 1, 1);
misc_settings_group_layout->addWidget(m_system_language_choice, 4, 1, 1, 1);
misc_settings_group_layout->addWidget(m_sound_mode_choice_label, 5, 0, 1, 1);
misc_settings_group_layout->addWidget(m_sound_mode_choice, 5, 1, 1, 1);
misc_settings_group_layout->addWidget(m_aspect_ratio_choice_label, 2, 0, 1, 1);
misc_settings_group_layout->addWidget(m_aspect_ratio_choice, 2, 1, 1, 1);
misc_settings_group_layout->addWidget(m_system_language_choice_label, 3, 0, 1, 1);
misc_settings_group_layout->addWidget(m_system_language_choice, 3, 1, 1, 1);
misc_settings_group_layout->addWidget(m_sound_mode_choice_label, 4, 0, 1, 1);
misc_settings_group_layout->addWidget(m_sound_mode_choice, 4, 1, 1, 1);
}
void WiiPane::CreateSDCard()
{
auto* sd_settings_group = new QGroupBox(tr("SD Card Settings"));
auto* sd_settings_group_layout = new QGridLayout();
sd_settings_group->setLayout(sd_settings_group_layout);
m_main_layout->addWidget(sd_settings_group);
m_sd_card_checkbox = new QCheckBox(tr("Insert SD Card"));
m_allow_sd_writes_checkbox = new QCheckBox(tr("Allow Writes to SD Card"));
m_sync_sd_folder_checkbox = new QCheckBox(tr("Sync with Folder"));
m_sd_card_checkbox->setToolTip(tr("Supports SD and SDHC. Default size is 128 MB."));
sd_settings_group_layout->addWidget(m_sd_card_checkbox, 0, 0, 1, 1);
sd_settings_group_layout->addWidget(m_allow_sd_writes_checkbox, 0, 1, 1, 1);
sd_settings_group_layout->addWidget(m_sync_sd_folder_checkbox, 1, 0, 1, 1);
}
void WiiPane::CreateWhitelistedUSBPassthroughDevices()
@ -232,13 +249,15 @@ void WiiPane::LoadConfig()
{
m_screensaver_checkbox->setChecked(Config::Get(Config::SYSCONF_SCREENSAVER));
m_pal60_mode_checkbox->setChecked(Config::Get(Config::SYSCONF_PAL60));
m_sd_card_checkbox->setChecked(Settings::Instance().IsSDCardInserted());
m_allow_sd_writes_checkbox->setChecked(Config::Get(Config::MAIN_ALLOW_SD_WRITES));
m_connect_keyboard_checkbox->setChecked(Settings::Instance().IsUSBKeyboardConnected());
m_aspect_ratio_choice->setCurrentIndex(Config::Get(Config::SYSCONF_WIDESCREEN));
m_system_language_choice->setCurrentIndex(Config::Get(Config::SYSCONF_LANGUAGE));
m_sound_mode_choice->setCurrentIndex(Config::Get(Config::SYSCONF_SOUND_MODE));
m_sd_card_checkbox->setChecked(Settings::Instance().IsSDCardInserted());
m_allow_sd_writes_checkbox->setChecked(Config::Get(Config::MAIN_ALLOW_SD_WRITES));
m_sync_sd_folder_checkbox->setChecked(Config::Get(Config::MAIN_WII_SD_CARD_ENABLE_FOLDER_SYNC));
PopulateUSBPassthroughListWidget();
m_wiimote_ir_sensor_position->setCurrentIndex(
@ -254,8 +273,6 @@ void WiiPane::OnSaveConfig()
Config::SetBase(Config::SYSCONF_SCREENSAVER, m_screensaver_checkbox->isChecked());
Config::SetBase(Config::SYSCONF_PAL60, m_pal60_mode_checkbox->isChecked());
Settings::Instance().SetSDCardInserted(m_sd_card_checkbox->isChecked());
Config::SetBase(Config::MAIN_ALLOW_SD_WRITES, m_allow_sd_writes_checkbox->isChecked());
Settings::Instance().SetUSBKeyboardConnected(m_connect_keyboard_checkbox->isChecked());
Config::SetBase<u32>(Config::SYSCONF_SENSOR_BAR_POSITION,
@ -266,6 +283,11 @@ void WiiPane::OnSaveConfig()
Config::SetBase<bool>(Config::SYSCONF_WIDESCREEN, m_aspect_ratio_choice->currentIndex());
Config::SetBase<u32>(Config::SYSCONF_SOUND_MODE, m_sound_mode_choice->currentIndex());
Config::SetBase(Config::SYSCONF_WIIMOTE_MOTOR, m_wiimote_motor->isChecked());
Settings::Instance().SetSDCardInserted(m_sd_card_checkbox->isChecked());
Config::SetBase(Config::MAIN_ALLOW_SD_WRITES, m_allow_sd_writes_checkbox->isChecked());
Config::SetBase(Config::MAIN_WII_SD_CARD_ENABLE_FOLDER_SYNC,
m_sync_sd_folder_checkbox->isChecked());
}
void WiiPane::ValidateSelectionState()

View File

@ -24,6 +24,7 @@ private:
void CreateLayout();
void ConnectLayout();
void CreateMisc();
void CreateSDCard();
void CreateWhitelistedUSBPassthroughDevices();
void CreateWiiRemoteSettings();
@ -42,8 +43,6 @@ private:
// Misc Settings
QCheckBox* m_screensaver_checkbox;
QCheckBox* m_pal60_mode_checkbox;
QCheckBox* m_sd_card_checkbox;
QCheckBox* m_allow_sd_writes_checkbox;
QCheckBox* m_connect_keyboard_checkbox;
QComboBox* m_system_language_choice;
QLabel* m_system_language_choice_label;
@ -52,6 +51,11 @@ private:
QComboBox* m_sound_mode_choice;
QLabel* m_sound_mode_choice_label;
// SD Card Settings
QCheckBox* m_sd_card_checkbox;
QCheckBox* m_allow_sd_writes_checkbox;
QCheckBox* m_sync_sd_folder_checkbox;
// Whitelisted USB Passthrough Devices
QListWidget* m_whitelist_usb_list;
QPushButton* m_whitelist_usb_add_button;