Qt: Implement browse button for BIOS path
This commit is contained in:
parent
2694181811
commit
f05f5aeb2b
|
@ -1,5 +1,8 @@
|
||||||
#include "consolesettingswidget.h"
|
#include "consolesettingswidget.h"
|
||||||
#include "settingwidgetbinder.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 */)
|
ConsoleSettingsWidget::ConsoleSettingsWidget(QtHostInterface* host_interface, QWidget* parent /* = nullptr */)
|
||||||
: QWidget(parent), m_host_interface(host_interface)
|
: 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,
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.enableSpeedLimiter,
|
||||||
"General/SpeedLimiterEnabled");
|
"General/SpeedLimiterEnabled");
|
||||||
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.pauseOnStart, "General/StartPaused");
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.pauseOnStart, "General/StartPaused");
|
||||||
|
|
||||||
|
connect(m_ui.biosPathBrowse, &QPushButton::pressed, this, &ConsoleSettingsWidget::onBrowseBIOSPathButtonClicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleSettingsWidget::~ConsoleSettingsWidget() = default;
|
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);
|
explicit ConsoleSettingsWidget(QtHostInterface* host_interface, QWidget* parent = nullptr);
|
||||||
~ConsoleSettingsWidget();
|
~ConsoleSettingsWidget();
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void onBrowseBIOSPathButtonClicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ConsoleSettingsWidget m_ui;
|
Ui::ConsoleSettingsWidget m_ui;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue