mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-19 13:15:45 -04:00
Qt: Add setup wizard
This commit is contained in:
@ -1,12 +1,15 @@
|
||||
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||
|
||||
#include "biossettingswidget.h"
|
||||
#include "core/bios.h"
|
||||
#include "qthost.h"
|
||||
#include "qtutils.h"
|
||||
#include "settingsdialog.h"
|
||||
#include "settingwidgetbinder.h"
|
||||
|
||||
#include "core/bios.h"
|
||||
#include "core/settings.h"
|
||||
|
||||
#include <QtWidgets/QFileDialog>
|
||||
#include <algorithm>
|
||||
|
||||
@ -22,9 +25,8 @@ BIOSSettingsWidget::BIOSSettingsWidget(SettingsDialog* dialog, QWidget* parent)
|
||||
dialog->registerWidgetHelp(m_ui.fastBoot, tr("Fast Boot"), tr("Unchecked"),
|
||||
tr("Patches the BIOS to skip the console's boot animation. Does not work with all games, "
|
||||
"but usually safe to enable."));
|
||||
dialog->registerWidgetHelp(
|
||||
m_ui.enableTTYLogging, tr("Enable TTY Logging"), tr("Unchecked"),
|
||||
tr("Logs BIOS calls to printf(). Not all games contain debugging messages."));
|
||||
dialog->registerWidgetHelp(m_ui.enableTTYLogging, tr("Enable TTY Logging"), tr("Unchecked"),
|
||||
tr("Logs BIOS calls to printf(). Not all games contain debugging messages."));
|
||||
|
||||
connect(m_ui.imageNTSCJ, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int index) {
|
||||
if (m_dialog->isPerGameSettings() && index == 0)
|
||||
@ -72,25 +74,34 @@ BIOSSettingsWidget::BIOSSettingsWidget(SettingsDialog* dialog, QWidget* parent)
|
||||
|
||||
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 = BIOS::FindBIOSImagesInDirectory(m_ui.searchDirectory->text().toUtf8().constData());
|
||||
populateDropDownForRegion(ConsoleRegion::NTSC_J, m_ui.imageNTSCJ, images);
|
||||
populateDropDownForRegion(ConsoleRegion::NTSC_U, m_ui.imageNTSCU, images);
|
||||
populateDropDownForRegion(ConsoleRegion::PAL, m_ui.imagePAL, images);
|
||||
auto images = getList(m_ui.searchDirectory->text().toUtf8().constData());
|
||||
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());
|
||||
|
||||
setDropDownValue(m_ui.imageNTSCJ, m_dialog->getStringValue("BIOS", "PathNTSCJ", std::nullopt));
|
||||
setDropDownValue(m_ui.imageNTSCU, m_dialog->getStringValue("BIOS", "PathNTSCU", std::nullopt));
|
||||
setDropDownValue(m_ui.imagePAL, m_dialog->getStringValue("BIOS", "PathPAL", std::nullopt));
|
||||
setDropDownValue(m_ui.imageNTSCJ, m_dialog->getStringValue("BIOS", "PathNTSCJ", std::nullopt),
|
||||
m_dialog->isPerGameSettings());
|
||||
setDropDownValue(m_ui.imageNTSCU, m_dialog->getStringValue("BIOS", "PathNTSCU", std::nullopt),
|
||||
m_dialog->isPerGameSettings());
|
||||
setDropDownValue(m_ui.imagePAL, m_dialog->getStringValue("BIOS", "PathPAL", std::nullopt),
|
||||
m_dialog->isPerGameSettings());
|
||||
}
|
||||
|
||||
void BIOSSettingsWidget::populateDropDownForRegion(ConsoleRegion region, QComboBox* cb,
|
||||
std::vector<std::pair<std::string, const BIOS::ImageInfo*>>& images)
|
||||
std::vector<std::pair<std::string, const BIOS::ImageInfo*>>& images,
|
||||
bool per_game)
|
||||
{
|
||||
QSignalBlocker sb(cb);
|
||||
cb->clear();
|
||||
|
||||
if (m_dialog->isPerGameSettings())
|
||||
if (per_game)
|
||||
cb->addItem(QIcon(QStringLiteral(":/icons/system-search.png")), tr("Use Global Setting"));
|
||||
|
||||
cb->addItem(QIcon(QStringLiteral(":/icons/system-search.png")), tr("Auto-Detect"));
|
||||
@ -117,13 +128,13 @@ void BIOSSettingsWidget::populateDropDownForRegion(ConsoleRegion region, QComboB
|
||||
}
|
||||
}
|
||||
|
||||
void BIOSSettingsWidget::setDropDownValue(QComboBox* cb, const std::optional<std::string>& name)
|
||||
void BIOSSettingsWidget::setDropDownValue(QComboBox* cb, const std::optional<std::string>& name, bool per_game)
|
||||
{
|
||||
QSignalBlocker sb(cb);
|
||||
|
||||
if (!name.has_value() || name->empty())
|
||||
{
|
||||
cb->setCurrentIndex((m_dialog->isPerGameSettings() && name.has_value()) ? 1 : 0);
|
||||
cb->setCurrentIndex((per_game && name.has_value()) ? 1 : 0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user