mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 15:45:42 +00:00
Qt: Implement browse button for BIOS path
This commit is contained in:
parent
2694181811
commit
f05f5aeb2b
|
@ -1,5 +1,8 @@
|
|||
#include "consolesettingswidget.h"
|
||||
#include "settingwidgetbinder.h"
|
||||
#include <QtWidgets/QFileDialog>
|
||||
|
||||
static constexpr char BIOS_IMAGE_FILTER[] = "Binary Images (*.bin);;All Files (*.*)";
|
||||
|
||||
ConsoleSettingsWidget::ConsoleSettingsWidget(QtHostInterface* host_interface, QWidget* parent /* = nullptr */)
|
||||
: QWidget(parent), m_host_interface(host_interface)
|
||||
|
@ -14,6 +17,20 @@ ConsoleSettingsWidget::ConsoleSettingsWidget(QtHostInterface* host_interface, QW
|
|||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.enableSpeedLimiter,
|
||||
"General/SpeedLimiterEnabled");
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.pauseOnStart, "General/StartPaused");
|
||||
|
||||
connect(m_ui.biosPathBrowse, &QPushButton::pressed, this, &ConsoleSettingsWidget::onBrowseBIOSPathButtonClicked);
|
||||
}
|
||||
|
||||
ConsoleSettingsWidget::~ConsoleSettingsWidget() = default;
|
||||
|
||||
void ConsoleSettingsWidget::onBrowseBIOSPathButtonClicked()
|
||||
{
|
||||
QString path = QFileDialog::getOpenFileName(this, tr("Select BIOS Image"), QString(), tr(BIOS_IMAGE_FILTER));
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
|
||||
m_ui.biosPath->setText(path);
|
||||
|
||||
m_host_interface->putSettingValue("BIOS/Path", path);
|
||||
m_host_interface->applySettings();
|
||||
}
|
||||
|
|
|
@ -14,6 +14,9 @@ public:
|
|||
explicit ConsoleSettingsWidget(QtHostInterface* host_interface, QWidget* parent = nullptr);
|
||||
~ConsoleSettingsWidget();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onBrowseBIOSPathButtonClicked();
|
||||
|
||||
private:
|
||||
Ui::ConsoleSettingsWidget m_ui;
|
||||
|
||||
|
|
Loading…
Reference in a new issue