Qt: Remove BIOS search directory from per-game settings

Rather than just disabling it and confusing the user.
This commit is contained in:
Stenzek 2024-07-21 16:20:53 +10:00
parent b4136d2834
commit 2938602d75
No known key found for this signature in database
5 changed files with 27 additions and 19 deletions

View file

@ -64,24 +64,33 @@ BIOSSettingsWidget::BIOSSettingsWidget(SettingsWindow* dialog, QWidget* parent)
connect(m_ui.refresh, &QPushButton::clicked, this, &BIOSSettingsWidget::refreshList);
m_ui.searchDirectory->setText(QString::fromStdString(EmuFolders::Bios));
if (!m_dialog->isPerGameSettings())
{
SettingWidgetBinder::BindWidgetToFolderSetting(sif, m_ui.searchDirectory, m_ui.browseSearchDirectory,
m_ui.openSearchDirectory, nullptr, "BIOS", "SearchDirectory",
Path::Combine(EmuFolders::DataRoot, "bios"));
connect(m_ui.searchDirectory, &QLineEdit::textChanged, this, &BIOSSettingsWidget::refreshList);
}
else
{
m_ui.mainLayout->removeWidget(m_ui.directoryGroupBox);
delete m_ui.directoryGroupBox;
m_ui.directoryGroupBox = nullptr;
m_ui.directoryGroupBoxLabel = nullptr;
m_ui.directoryGroupBoxLayout = nullptr;
m_ui.directoryGroupBoxHorizontalLayout = nullptr;
m_ui.searchDirectory = nullptr;
m_ui.browseSearchDirectory = nullptr;
}
refreshList();
}
BIOSSettingsWidget::~BIOSSettingsWidget() = default;
std::vector<std::pair<std::string, const BIOS::ImageInfo*>> BIOSSettingsWidget::getList(const char* directory)
{
return BIOS::FindBIOSImagesInDirectory(directory);
}
void BIOSSettingsWidget::refreshList()
{
auto images = getList(m_ui.searchDirectory->text().toUtf8().constData());
auto images = BIOS::FindBIOSImagesInDirectory(EmuFolders::Bios.c_str());
populateDropDownForRegion(ConsoleRegion::NTSC_J, m_ui.imageNTSCJ, images, m_dialog->isPerGameSettings());
populateDropDownForRegion(ConsoleRegion::NTSC_U, m_ui.imageNTSCU, images, m_dialog->isPerGameSettings());
populateDropDownForRegion(ConsoleRegion::PAL, m_ui.imagePAL, images, m_dialog->isPerGameSettings());

View file

@ -26,7 +26,6 @@ public:
std::vector<std::pair<std::string, const BIOS::ImageInfo*>>& images,
bool per_game);
static void setDropDownValue(QComboBox* cb, const std::optional<std::string>& name, bool per_game);
static std::vector<std::pair<std::string, const BIOS::ImageInfo*>> getList(const char* directory);
private Q_SLOTS:
void refreshList();

View file

@ -10,7 +10,7 @@
<height>330</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="mainLayout">
<property name="leftMargin">
<number>0</number>
</property>
@ -115,13 +115,13 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<widget class="QGroupBox" name="directoryGroupBox">
<property name="title">
<string>BIOS Directory</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<layout class="QGridLayout" name="directoryGroupBoxLayout">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="directoryGroupBoxLabel">
<property name="text">
<string>DuckStation will search for BIOS images in this directory.</string>
</property>
@ -131,7 +131,7 @@
</widget>
</item>
<item row="1" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="directoryGroupBoxHorizontalLayout">
<item>
<widget class="QLineEdit" name="searchDirectory"/>
</item>

View file

@ -61,7 +61,7 @@ InterfaceSettingsWidget::InterfaceSettingsWidget(SettingsWindow* dialog, QWidget
if (!m_dialog->isPerGameSettings())
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.startFullscreen, "Main", "StartFullscreen", false);
else
m_ui.startFullscreen->setEnabled(false);
SettingWidgetBinder::SetAvailability(m_ui.startFullscreen, false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.doubleClickTogglesFullscreen, "Main",
"DoubleClickTogglesFullscreen", true);

View file

@ -223,7 +223,7 @@ void SetupWizardDialog::setupBIOSPage()
void SetupWizardDialog::refreshBiosList()
{
auto list = BIOSSettingsWidget::getList(m_ui.biosSearchDirectory->text().toUtf8().constData());
auto list = BIOS::FindBIOSImagesInDirectory(m_ui.biosSearchDirectory->text().toUtf8().constData());
BIOSSettingsWidget::populateDropDownForRegion(ConsoleRegion::NTSC_U, m_ui.imageNTSCU, list, false);
BIOSSettingsWidget::populateDropDownForRegion(ConsoleRegion::NTSC_J, m_ui.imageNTSCJ, list, false);
BIOSSettingsWidget::populateDropDownForRegion(ConsoleRegion::PAL, m_ui.imagePAL, list, false);