mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Qt: Put Wii SD card path and SD sync folder fields in the WiiPane.
This commit is contained in:
@ -5,10 +5,12 @@
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QDir>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QListWidget>
|
||||
#include <QPushButton>
|
||||
#include <QSlider>
|
||||
@ -16,6 +18,7 @@
|
||||
#include <QStringList>
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
#include "Core/Config/MainSettings.h"
|
||||
@ -23,7 +26,9 @@
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
|
||||
#include "DolphinQt/QtUtils/DolphinFileDialog.h"
|
||||
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
|
||||
#include "DolphinQt/QtUtils/SignalBlocking.h"
|
||||
#include "DolphinQt/Settings.h"
|
||||
#include "DolphinQt/Settings/USBDeviceAddToWhitelistDialog.h"
|
||||
|
||||
@ -163,15 +168,49 @@ void WiiPane::CreateSDCard()
|
||||
sd_settings_group->setLayout(sd_settings_group_layout);
|
||||
m_main_layout->addWidget(sd_settings_group);
|
||||
|
||||
int row = 0;
|
||||
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."));
|
||||
m_allow_sd_writes_checkbox = new QCheckBox(tr("Allow Writes to SD Card"));
|
||||
sd_settings_group_layout->addWidget(m_sd_card_checkbox, row, 0, 1, 1);
|
||||
sd_settings_group_layout->addWidget(m_allow_sd_writes_checkbox, row, 1, 1, 1);
|
||||
++row;
|
||||
|
||||
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);
|
||||
{
|
||||
QHBoxLayout* hlayout = new QHBoxLayout;
|
||||
m_sd_raw_edit = new QLineEdit(QString::fromStdString(File::GetUserPath(F_WIISDCARDIMAGE_IDX)));
|
||||
connect(m_sd_raw_edit, &QLineEdit::editingFinished,
|
||||
[this] { SetSDRaw(m_sd_raw_edit->text()); });
|
||||
QPushButton* sdcard_open = new NonDefaultQPushButton(QStringLiteral("..."));
|
||||
connect(sdcard_open, &QPushButton::clicked, this, &WiiPane::BrowseSDRaw);
|
||||
hlayout->addWidget(new QLabel(tr("SD Card Path:")));
|
||||
hlayout->addWidget(m_sd_raw_edit);
|
||||
hlayout->addWidget(sdcard_open);
|
||||
|
||||
sd_settings_group_layout->addLayout(hlayout, row, 0, 1, 2);
|
||||
++row;
|
||||
}
|
||||
|
||||
m_sync_sd_folder_checkbox =
|
||||
new QCheckBox(tr("Automatically sync with Folder on emulation start and end"));
|
||||
sd_settings_group_layout->addWidget(m_sync_sd_folder_checkbox, row, 0, 1, 2);
|
||||
++row;
|
||||
|
||||
{
|
||||
QHBoxLayout* hlayout = new QHBoxLayout;
|
||||
m_sd_sync_folder_edit =
|
||||
new QLineEdit(QString::fromStdString(File::GetUserPath(D_WIISDCARDSYNCFOLDER_IDX)));
|
||||
connect(m_sd_sync_folder_edit, &QLineEdit::editingFinished,
|
||||
[this] { SetSDSyncFolder(m_sd_sync_folder_edit->text()); });
|
||||
QPushButton* sdcard_open = new NonDefaultQPushButton(QStringLiteral("..."));
|
||||
connect(sdcard_open, &QPushButton::clicked, this, &WiiPane::BrowseSDSyncFolder);
|
||||
hlayout->addWidget(new QLabel(tr("SD Sync Folder:")));
|
||||
hlayout->addWidget(m_sd_sync_folder_edit);
|
||||
hlayout->addWidget(sdcard_open);
|
||||
|
||||
sd_settings_group_layout->addLayout(hlayout, row, 0, 1, 2);
|
||||
++row;
|
||||
}
|
||||
}
|
||||
|
||||
void WiiPane::CreateWhitelistedUSBPassthroughDevices()
|
||||
@ -329,3 +368,35 @@ void WiiPane::PopulateUSBPassthroughListWidget()
|
||||
}
|
||||
ValidateSelectionState();
|
||||
}
|
||||
|
||||
void WiiPane::BrowseSDRaw()
|
||||
{
|
||||
QString file = QDir::toNativeSeparators(DolphinFileDialog::getOpenFileName(
|
||||
this, tr("Select a SD Card Image"),
|
||||
QString::fromStdString(Config::Get(Config::MAIN_WII_SD_CARD_IMAGE_PATH)),
|
||||
tr("SD Card Image (*.raw);;"
|
||||
"All Files (*)")));
|
||||
if (!file.isEmpty())
|
||||
SetSDRaw(file);
|
||||
}
|
||||
|
||||
void WiiPane::SetSDRaw(const QString& path)
|
||||
{
|
||||
Config::SetBase(Config::MAIN_WII_SD_CARD_IMAGE_PATH, path.toStdString());
|
||||
SignalBlocking(m_sd_raw_edit)->setText(path);
|
||||
}
|
||||
|
||||
void WiiPane::BrowseSDSyncFolder()
|
||||
{
|
||||
QString file = QDir::toNativeSeparators(DolphinFileDialog::getExistingDirectory(
|
||||
this, tr("Select a Folder to sync with the SD Card Image"),
|
||||
QString::fromStdString(Config::Get(Config::MAIN_WII_SD_CARD_SYNC_FOLDER_PATH))));
|
||||
if (!file.isEmpty())
|
||||
SetSDSyncFolder(file);
|
||||
}
|
||||
|
||||
void WiiPane::SetSDSyncFolder(const QString& path)
|
||||
{
|
||||
Config::SetBase(Config::MAIN_WII_SD_CARD_SYNC_FOLDER_PATH, path.toStdString());
|
||||
SignalBlocking(m_sd_sync_folder_edit)->setText(path);
|
||||
}
|
||||
|
Reference in New Issue
Block a user