mirror of
https://github.com/stenzek/duckstation.git
synced 2026-02-04 05:04:33 +00:00
Qt: Remove a few more instances of QDialog::exec() (#3623)
This commit is contained in:
@@ -57,17 +57,18 @@ AboutDialog::~AboutDialog() = default;
|
||||
|
||||
void AboutDialog::showThirdPartyNotices(QWidget* parent)
|
||||
{
|
||||
QDialog dialog(parent);
|
||||
dialog.setMinimumSize(700, 400);
|
||||
dialog.setWindowTitle(tr("DuckStation Third-Party Notices"));
|
||||
QDialog* const dialog = new QDialog(parent);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dialog->setMinimumSize(700, 400);
|
||||
dialog->setWindowTitle(tr("DuckStation Third-Party Notices"));
|
||||
|
||||
QIcon icon;
|
||||
icon.addFile(QString::fromUtf8(":/icons/duck.png"), QSize(), QIcon::Normal, QIcon::Off);
|
||||
dialog.setWindowIcon(icon);
|
||||
dialog->setWindowIcon(icon);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(&dialog);
|
||||
QVBoxLayout* layout = new QVBoxLayout(dialog);
|
||||
|
||||
QTextBrowser* tb = new QTextBrowser(&dialog);
|
||||
QTextBrowser* tb = new QTextBrowser(dialog);
|
||||
tb->setAcceptRichText(true);
|
||||
tb->setReadOnly(true);
|
||||
tb->setOpenExternalLinks(true);
|
||||
@@ -83,9 +84,9 @@ void AboutDialog::showThirdPartyNotices(QWidget* parent)
|
||||
}
|
||||
layout->addWidget(tb, 1);
|
||||
|
||||
QDialogButtonBox* bb = new QDialogButtonBox(QDialogButtonBox::Close, &dialog);
|
||||
connect(bb, &QDialogButtonBox::rejected, &dialog, &QDialog::accept);
|
||||
QDialogButtonBox* bb = new QDialogButtonBox(QDialogButtonBox::Close, dialog);
|
||||
connect(bb, &QDialogButtonBox::rejected, dialog, &QDialog::accept);
|
||||
layout->addWidget(bb, 0);
|
||||
|
||||
dialog.exec();
|
||||
dialog->open();
|
||||
}
|
||||
|
||||
@@ -18,5 +18,4 @@ public:
|
||||
|
||||
private:
|
||||
Ui::AboutDialog m_ui;
|
||||
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@ AchievementLoginDialog::AchievementLoginDialog(QWidget* parent, Achievements::Lo
|
||||
title_font.setPixelSize(20);
|
||||
m_ui.titleLabel->setFont(title_font);
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
// Adjust text if needed based on reason.
|
||||
if (reason == Achievements::LoginRequestReason::TokenInvalid)
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Achievements {
|
||||
enum class LoginRequestReason;
|
||||
}
|
||||
|
||||
class AchievementLoginDialog : public QDialog
|
||||
class AchievementLoginDialog final : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
<ui version="4.0">
|
||||
<class>AchievementLoginDialog</class>
|
||||
<widget class="QDialog" name="AchievementLoginDialog">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::WindowModality::WindowModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@@ -28,9 +25,6 @@
|
||||
<property name="windowTitle">
|
||||
<string comment="Window title">RetroAchievements Login</string>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
|
||||
@@ -240,7 +240,7 @@ void AchievementSettingsWidget::onLoginLogoutPressed()
|
||||
|
||||
AchievementLoginDialog* login = new AchievementLoginDialog(this, Achievements::LoginRequestReason::UserInitiated);
|
||||
connect(login, &AchievementLoginDialog::accepted, this, &AchievementSettingsWidget::onLoginCompleted);
|
||||
login->show();
|
||||
login->open();
|
||||
}
|
||||
|
||||
void AchievementSettingsWidget::onLoginCompleted()
|
||||
|
||||
@@ -281,9 +281,10 @@ void AudioSettingsWidget::onOutputMutedChanged(int new_state)
|
||||
|
||||
void AudioSettingsWidget::onStretchSettingsClicked()
|
||||
{
|
||||
QDialog dlg(QtUtils::GetRootWidget(this));
|
||||
QDialog* const dlg = new QDialog(QtUtils::GetRootWidget(this));
|
||||
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||
Ui::AudioStretchSettingsDialog dlgui;
|
||||
dlgui.setupUi(&dlg);
|
||||
dlgui.setupUi(dlg);
|
||||
dlgui.icon->setPixmap(QIcon::fromTheme(QStringLiteral("volume-up-line")).pixmap(32));
|
||||
dlgui.buttonBox->button(QDialogButtonBox::Close)->setDefault(true);
|
||||
|
||||
@@ -302,8 +303,8 @@ void AudioSettingsWidget::onStretchSettingsClicked()
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, dlgui.useAAFilter, "Audio", "StretchUseAAFilter",
|
||||
AudioStreamParameters::DEFAULT_STRETCH_USE_AA_FILTER);
|
||||
|
||||
connect(dlgui.buttonBox, &QDialogButtonBox::rejected, &dlg, &QDialog::accept);
|
||||
connect(dlgui.buttonBox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked, this, [this, &dlg]() {
|
||||
connect(dlgui.buttonBox, &QDialogButtonBox::rejected, dlg, &QDialog::accept);
|
||||
connect(dlgui.buttonBox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked, this, [this, dlg]() {
|
||||
m_dialog->setIntSettingValue("Audio", "StretchSequenceLengthMS",
|
||||
m_dialog->isPerGameSettings() ?
|
||||
std::nullopt :
|
||||
@@ -325,12 +326,12 @@ void AudioSettingsWidget::onStretchSettingsClicked()
|
||||
std::nullopt :
|
||||
std::optional<bool>(AudioStreamParameters::DEFAULT_STRETCH_USE_AA_FILTER));
|
||||
|
||||
dlg.reject();
|
||||
dlg->reject();
|
||||
|
||||
QMetaObject::invokeMethod(this, &AudioSettingsWidget::onStretchSettingsClicked, Qt::QueuedConnection);
|
||||
});
|
||||
|
||||
dlg.exec();
|
||||
dlg->open();
|
||||
}
|
||||
|
||||
void AudioSettingsWidget::resetVolume(bool fast_forward)
|
||||
|
||||
@@ -194,7 +194,6 @@ void ConsoleSettingsWidget::onEnableCPUClockSpeedControlChecked(int state)
|
||||
|
||||
QMessageBox* const mb = QtUtils::NewMessageBox(QMessageBox::Warning, tr("CPU Overclocking Warning"), message,
|
||||
QMessageBox::NoButton, QMessageBox::NoButton, Qt::WindowModal, this);
|
||||
mb->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
const QPushButton* const yes_button =
|
||||
mb->addButton(tr("Yes, I will confirm bugs without overclocking before reporting."), QMessageBox::YesRole);
|
||||
const QPushButton* const no_button = mb->addButton(tr("No, take me back to safety."), QMessageBox::NoRole);
|
||||
|
||||
@@ -368,101 +368,13 @@ void ControllerBindingWidget::doDeviceAutomaticBinding(const QString& device)
|
||||
|
||||
void ControllerBindingWidget::onMultipleDeviceAutomaticBindingTriggered()
|
||||
{
|
||||
QDialog* const dialog = new MultipleDeviceAutobindDialog(this, m_dialog, m_port_number);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
// force a refresh after mapping
|
||||
if (doMultipleDeviceAutomaticBinding(this, m_dialog, m_port_number))
|
||||
onTypeChanged();
|
||||
}
|
||||
connect(dialog, &QDialog::accepted, this, [this] { onTypeChanged(); });
|
||||
|
||||
bool ControllerBindingWidget::doMultipleDeviceAutomaticBinding(QWidget* parent, ControllerSettingsWindow* parent_dialog,
|
||||
u32 port)
|
||||
{
|
||||
QDialog dialog(parent);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(&dialog);
|
||||
QLabel help(tr("Select the devices from the list below that you want to bind to this controller."), &dialog);
|
||||
layout->addWidget(&help);
|
||||
|
||||
QListWidget list(&dialog);
|
||||
list.setSelectionMode(QListWidget::SingleSelection);
|
||||
layout->addWidget(&list);
|
||||
|
||||
for (const InputDeviceListModel::Device& dev : g_emu_thread->getInputDeviceListModel()->getDeviceList())
|
||||
{
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
item->setText(QStringLiteral("%1 (%2)").arg(dev.identifier).arg(dev.display_name));
|
||||
item->setData(Qt::UserRole, dev.identifier);
|
||||
item->setIcon(InputDeviceListModel::getIconForKey(dev.key));
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
item->setCheckState(Qt::Unchecked);
|
||||
list.addItem(item);
|
||||
}
|
||||
|
||||
QDialogButtonBox bb(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, &dialog);
|
||||
connect(&bb, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
|
||||
connect(&bb, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
|
||||
layout->addWidget(&bb);
|
||||
|
||||
if (dialog.exec() == QDialog::Rejected)
|
||||
return false;
|
||||
|
||||
auto lock = Host::GetSettingsLock();
|
||||
const bool global = (!parent_dialog || parent_dialog->isEditingGlobalSettings());
|
||||
SettingsInterface& si =
|
||||
*(global ? Host::Internal::GetBaseSettingsLayer() : parent_dialog->getEditingSettingsInterface());
|
||||
|
||||
// first device should clear mappings
|
||||
bool tried_any = false;
|
||||
bool mapped_any = false;
|
||||
const int count = list.count();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
QListWidgetItem* item = list.item(i);
|
||||
if (item->checkState() != Qt::Checked)
|
||||
continue;
|
||||
|
||||
tried_any = true;
|
||||
|
||||
const QString identifier = item->data(Qt::UserRole).toString();
|
||||
std::vector<std::pair<GenericInputBinding, std::string>> mapping =
|
||||
InputManager::GetGenericBindingMapping(identifier.toStdString());
|
||||
if (mapping.empty())
|
||||
{
|
||||
lock.unlock();
|
||||
QtUtils::MessageBoxCritical(
|
||||
parent, tr("Automatic Mapping"),
|
||||
tr("No generic bindings were generated for device '%1'. The controller/source may not "
|
||||
"support automatic mapping.")
|
||||
.arg(identifier));
|
||||
lock.lock();
|
||||
continue;
|
||||
}
|
||||
|
||||
mapped_any |= InputManager::MapController(si, port, mapping, !mapped_any);
|
||||
}
|
||||
|
||||
lock.unlock();
|
||||
|
||||
if (!tried_any)
|
||||
{
|
||||
QtUtils::MessageBoxInformation(parent, tr("Automatic Mapping"), tr("No devices were selected."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mapped_any)
|
||||
{
|
||||
if (global)
|
||||
{
|
||||
QtHost::SaveGameSettings(&si, false);
|
||||
g_emu_thread->reloadGameSettings(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
QtHost::QueueSettingsSave();
|
||||
g_emu_thread->reloadInputBindings();
|
||||
}
|
||||
}
|
||||
|
||||
return mapped_any;
|
||||
dialog->open();
|
||||
}
|
||||
|
||||
void ControllerBindingWidget::saveAndRefresh()
|
||||
@@ -1077,3 +989,98 @@ ControllerCustomSettingsDialog::ControllerCustomSettingsDialog(QWidget* parent,
|
||||
}
|
||||
|
||||
ControllerCustomSettingsDialog::~ControllerCustomSettingsDialog() = default;
|
||||
|
||||
MultipleDeviceAutobindDialog::MultipleDeviceAutobindDialog(QWidget* parent, ControllerSettingsWindow* settings_window,
|
||||
u32 port)
|
||||
: QDialog(parent), m_settings_window(settings_window), m_port(port)
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
layout->addWidget(new QLabel(tr("Select the devices from the list below that you want to bind to this controller.")));
|
||||
|
||||
m_list = new QListWidget;
|
||||
m_list->setSelectionMode(QListWidget::SingleSelection);
|
||||
layout->addWidget(m_list);
|
||||
|
||||
for (const InputDeviceListModel::Device& dev : g_emu_thread->getInputDeviceListModel()->getDeviceList())
|
||||
{
|
||||
QListWidgetItem* item = new QListWidgetItem;
|
||||
item->setIcon(InputDeviceListModel::getIconForKey(dev.key));
|
||||
item->setText(QStringLiteral("%1 (%2)").arg(dev.identifier).arg(dev.display_name));
|
||||
item->setData(Qt::UserRole, dev.identifier);
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
item->setCheckState(Qt::Unchecked);
|
||||
m_list->addItem(item);
|
||||
}
|
||||
|
||||
QDialogButtonBox* bb = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
connect(bb, &QDialogButtonBox::accepted, this, &MultipleDeviceAutobindDialog::doAutomaticBinding);
|
||||
connect(bb, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
layout->addWidget(bb);
|
||||
}
|
||||
|
||||
MultipleDeviceAutobindDialog::~MultipleDeviceAutobindDialog() = default;
|
||||
|
||||
void MultipleDeviceAutobindDialog::doAutomaticBinding()
|
||||
{
|
||||
auto lock = Host::GetSettingsLock();
|
||||
const bool global = (!m_settings_window || m_settings_window->isEditingGlobalSettings());
|
||||
SettingsInterface* si =
|
||||
global ? Host::Internal::GetBaseSettingsLayer() : m_settings_window->getEditingSettingsInterface();
|
||||
|
||||
// first device should clear mappings
|
||||
bool tried_any = false;
|
||||
bool mapped_any = false;
|
||||
const int count = m_list->count();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
const QListWidgetItem* item = m_list->item(i);
|
||||
if (item->checkState() != Qt::Checked)
|
||||
continue;
|
||||
|
||||
tried_any = true;
|
||||
|
||||
const QString identifier = item->data(Qt::UserRole).toString();
|
||||
std::vector<std::pair<GenericInputBinding, std::string>> mapping =
|
||||
InputManager::GetGenericBindingMapping(identifier.toStdString());
|
||||
if (mapping.empty())
|
||||
{
|
||||
lock.unlock();
|
||||
QtUtils::MessageBoxCritical(
|
||||
this, tr("Automatic Mapping"),
|
||||
tr("No generic bindings were generated for device '%1'. The controller/source may not "
|
||||
"support automatic mapping.")
|
||||
.arg(identifier));
|
||||
lock.lock();
|
||||
continue;
|
||||
}
|
||||
|
||||
mapped_any |= InputManager::MapController(*si, m_port, mapping, !mapped_any);
|
||||
}
|
||||
|
||||
lock.unlock();
|
||||
|
||||
if (!tried_any)
|
||||
{
|
||||
QtUtils::MessageBoxInformation(this, tr("Automatic Mapping"), tr("No devices were selected."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (mapped_any)
|
||||
{
|
||||
if (global)
|
||||
{
|
||||
QtHost::SaveGameSettings(si, false);
|
||||
g_emu_thread->reloadGameSettings(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
QtHost::QueueSettingsSave();
|
||||
g_emu_thread->reloadInputBindings();
|
||||
}
|
||||
accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
reject();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,8 +38,6 @@ public:
|
||||
ALWAYS_INLINE u32 getPortNumber() const { return m_port_number; }
|
||||
ALWAYS_INLINE const QIcon& getIcon() { return m_icon; }
|
||||
|
||||
static bool doMultipleDeviceAutomaticBinding(QWidget* parent, ControllerSettingsWindow* parent_dialog, u32 port);
|
||||
|
||||
private:
|
||||
void populateControllerTypes();
|
||||
void populateWidgets();
|
||||
@@ -142,11 +140,29 @@ private:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class ControllerCustomSettingsDialog : public QDialog
|
||||
class ControllerCustomSettingsDialog final : public QDialog
|
||||
{
|
||||
public:
|
||||
explicit ControllerCustomSettingsDialog(QWidget* parent, SettingsInterface* sif, const std::string& section,
|
||||
std::span<const SettingInfo> settings, const char* tr_context,
|
||||
const QString& window_title);
|
||||
ControllerCustomSettingsDialog(QWidget* parent, SettingsInterface* sif, const std::string& section,
|
||||
std::span<const SettingInfo> settings, const char* tr_context,
|
||||
const QString& window_title);
|
||||
~ControllerCustomSettingsDialog();
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class MultipleDeviceAutobindDialog final : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MultipleDeviceAutobindDialog(QWidget* parent, ControllerSettingsWindow* settings_window, u32 port);
|
||||
~MultipleDeviceAutobindDialog();
|
||||
|
||||
private:
|
||||
void doAutomaticBinding();
|
||||
|
||||
QListWidget* m_list;
|
||||
ControllerSettingsWindow* m_settings_window;
|
||||
u32 m_port;
|
||||
};
|
||||
|
||||
@@ -104,10 +104,11 @@ void ControllerGlobalSettingsWidget::sdlHelpTextLinkClicked(const QString& link)
|
||||
{
|
||||
if (link == QStringLiteral("ADVANCED_SDL_OPTIONS"))
|
||||
{
|
||||
ControllerCustomSettingsDialog dialog(m_dialog, m_dialog->getEditingSettingsInterface(), "InputSources",
|
||||
SDLInputSource::GetAdvancedSettingsInfo(), "SDLInputSource",
|
||||
tr("Advanced SDL Options"));
|
||||
dialog.exec();
|
||||
QDialog* const dlg = new ControllerCustomSettingsDialog(m_dialog, m_dialog->getEditingSettingsInterface(),
|
||||
"InputSources", SDLInputSource::GetAdvancedSettingsInfo(),
|
||||
"SDLInputSource", tr("Advanced SDL Options"));
|
||||
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dlg->open();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,25 +139,25 @@ void ControllerGlobalSettingsWidget::ledSettingsClicked()
|
||||
return;
|
||||
}
|
||||
|
||||
QDialog dlg(this);
|
||||
dlg.setWindowTitle(tr("Controller LED Settings"));
|
||||
dlg.setFixedWidth(450);
|
||||
dlg.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
QDialog* const dlg = new QDialog(this);
|
||||
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dlg->setWindowTitle(tr("Controller LED Settings"));
|
||||
dlg->setFixedWidth(450);
|
||||
dlg->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
|
||||
QVBoxLayout* const main_layout = new QVBoxLayout(&dlg);
|
||||
QVBoxLayout* const main_layout = new QVBoxLayout(dlg);
|
||||
|
||||
QHBoxLayout* const heading_layout = new QHBoxLayout();
|
||||
QLabel* const icon = new QLabel(&dlg);
|
||||
icon->setPixmap(QIcon::fromTheme(QStringLiteral("lightbulb-line")).pixmap(32, 32));
|
||||
QHBoxLayout* const heading_layout = new QHBoxLayout;
|
||||
QLabel* const icon = new QLabel;
|
||||
icon->setPixmap(QIcon::fromTheme(QStringLiteral("lightbulb-line")).pixmap(32));
|
||||
QLabel* const heading = new QLabel(
|
||||
tr("<strong>Controller LED Settings</strong><br>\nThe \"alternate\" color is used when analog mode is active."),
|
||||
&dlg);
|
||||
tr("<strong>Controller LED Settings</strong><br>\nThe \"alternate\" color is used when analog mode is active."));
|
||||
heading->setWordWrap(true);
|
||||
heading_layout->addWidget(icon, 0, Qt::AlignTop | Qt::AlignLeft);
|
||||
heading_layout->addWidget(heading, 1);
|
||||
main_layout->addLayout(heading_layout);
|
||||
|
||||
QScrollArea* const scroll_area = new QScrollArea(&dlg);
|
||||
QScrollArea* const scroll_area = new QScrollArea;
|
||||
scroll_area->setWidgetResizable(true);
|
||||
scroll_area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
scroll_area->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
@@ -173,12 +174,13 @@ void ControllerGlobalSettingsWidget::ledSettingsClicked()
|
||||
if (dev.key.source_type != InputSourceType::SDL)
|
||||
continue;
|
||||
|
||||
QGroupBox* const gbox = new QGroupBox(QStringLiteral("%1: %2").arg(dev.identifier).arg(dev.display_name), &dlg);
|
||||
QGroupBox* const gbox = new QGroupBox(QStringLiteral("%1: %2").arg(dev.identifier).arg(dev.display_name));
|
||||
QGridLayout* const gbox_layout = new QGridLayout(gbox);
|
||||
|
||||
for (u32 active = 0; active < 2; active++)
|
||||
{
|
||||
gbox_layout->addWidget(new QLabel(active ? tr("Alternate Mode:") : tr("Normal Mode:"), &dlg),
|
||||
static_cast<int>(active), 0);
|
||||
gbox_layout->addWidget(new QLabel(active ? tr("Alternate Mode:") : tr("Normal Mode:")), static_cast<int>(active),
|
||||
0);
|
||||
|
||||
ColorPickerButton* const button = new ColorPickerButton(gbox);
|
||||
button->setColor(SDLInputSource::ParseRGBForPlayerId(
|
||||
@@ -197,9 +199,10 @@ void ControllerGlobalSettingsWidget::ledSettingsClicked()
|
||||
|
||||
scroll_area_layout->addStretch(1);
|
||||
|
||||
QDialogButtonBox* const bbox = new QDialogButtonBox(QDialogButtonBox::Close, &dlg);
|
||||
connect(bbox, &QDialogButtonBox::rejected, &dlg, &QDialog::accept);
|
||||
QDialogButtonBox* const bbox = new QDialogButtonBox(QDialogButtonBox::Close, dlg);
|
||||
bbox->button(QDialogButtonBox::Close)->setDefault(true);
|
||||
connect(bbox, &QDialogButtonBox::rejected, dlg, &QDialog::accept);
|
||||
main_layout->addWidget(bbox);
|
||||
|
||||
dlg.exec();
|
||||
dlg->open();
|
||||
}
|
||||
|
||||
@@ -178,11 +178,10 @@ void DebuggerWindow::onTraceTriggered()
|
||||
|
||||
void DebuggerWindow::onAddBreakpointTriggered()
|
||||
{
|
||||
DebuggerAddBreakpointDialog dlg(this);
|
||||
if (dlg.exec() == QDialog::Rejected)
|
||||
return;
|
||||
|
||||
addBreakpoint(dlg.getType(), dlg.getAddress());
|
||||
DebuggerAddBreakpointDialog* const dlg = new DebuggerAddBreakpointDialog(this);
|
||||
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||
connect(dlg, &QDialog::accepted, this, [this, dlg] { addBreakpoint(dlg->getType(), dlg->getAddress()); });
|
||||
dlg->open();
|
||||
}
|
||||
|
||||
void DebuggerWindow::onToggleBreakpointTriggered()
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<property name="windowTitle">
|
||||
<string>Cheat Code Editor</string>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
|
||||
@@ -402,7 +402,6 @@ void GameCheatSettingsWidget::checkForMasterDisable()
|
||||
"cheat will not have any effect until game settings are enabled. Do you want to do this now?"),
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::NoButton, Qt::WindowModal, this);
|
||||
QCheckBox* cb = new QCheckBox(mbox);
|
||||
cb->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
cb->setText(tr("Do not show again"));
|
||||
mbox->setCheckBox(cb);
|
||||
|
||||
@@ -423,7 +422,6 @@ void GameCheatSettingsWidget::checkForMasterDisable()
|
||||
"effect until cheats are enabled for this game. Do you want to do this now?"),
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::NoButton, Qt::WindowModal, this);
|
||||
QCheckBox* cb = new QCheckBox(mbox);
|
||||
cb->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
cb->setText(tr("Do not show again"));
|
||||
cb->setChecked(m_master_enable_ignored);
|
||||
mbox->setCheckBox(cb);
|
||||
@@ -616,17 +614,17 @@ void GameCheatSettingsWidget::importCodes(const std::string& file_contents)
|
||||
|
||||
void GameCheatSettingsWidget::newCode()
|
||||
{
|
||||
Cheats::CodeInfo new_code;
|
||||
CheatCodeEditorDialog dlg(this, &new_code, getGroupNames());
|
||||
if (dlg.exec() == QDialog::Rejected)
|
||||
{
|
||||
// cancelled
|
||||
return;
|
||||
}
|
||||
std::unique_ptr<Cheats::CodeInfo> new_code = std::make_unique<Cheats::CodeInfo>();
|
||||
CheatCodeEditorDialog* const dlg = new CheatCodeEditorDialog(this, new_code.get(), getGroupNames());
|
||||
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
// no need to reload cheats yet, it's not active. just refresh the list
|
||||
reloadList();
|
||||
g_emu_thread->reloadCheats(true, false, false, true);
|
||||
connect(dlg, &QDialog::accepted, this, [this, code = std::move(new_code)] {
|
||||
// no need to reload cheats yet, it's not active. just refresh the list
|
||||
reloadList();
|
||||
g_emu_thread->reloadCheats(true, false, false, true);
|
||||
});
|
||||
|
||||
dlg->open();
|
||||
}
|
||||
|
||||
void GameCheatSettingsWidget::editCode(const std::string_view code_name)
|
||||
@@ -635,15 +633,15 @@ void GameCheatSettingsWidget::editCode(const std::string_view code_name)
|
||||
if (!code)
|
||||
return;
|
||||
|
||||
CheatCodeEditorDialog dlg(this, code, getGroupNames());
|
||||
if (dlg.exec() == QDialog::Rejected)
|
||||
{
|
||||
// no changes
|
||||
return;
|
||||
}
|
||||
CheatCodeEditorDialog* const dlg = new CheatCodeEditorDialog(this, code, getGroupNames());
|
||||
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
reloadList();
|
||||
g_emu_thread->reloadCheats(true, true, false, true);
|
||||
connect(dlg, &QDialog::accepted, this, [this] {
|
||||
reloadList();
|
||||
g_emu_thread->reloadCheats(true, true, false, true);
|
||||
});
|
||||
|
||||
dlg->open();
|
||||
}
|
||||
|
||||
void GameCheatSettingsWidget::removeCode(const std::string_view code_name, bool confirm)
|
||||
@@ -952,9 +950,10 @@ void CheatCodeEditorDialog::onRangeMaxChanged(int value)
|
||||
|
||||
void CheatCodeEditorDialog::onEditChoiceClicked()
|
||||
{
|
||||
GameCheatCodeChoiceEditorDialog dlg(this, m_new_options);
|
||||
if (dlg.exec() == QDialog::Accepted)
|
||||
m_new_options = dlg.getNewOptions();
|
||||
GameCheatCodeChoiceEditorDialog* const dlg = new GameCheatCodeChoiceEditorDialog(this, m_new_options);
|
||||
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||
connect(dlg, &QDialog::accepted, this, [this, dlg] { m_new_options = dlg->getNewOptions(); });
|
||||
dlg->open();
|
||||
}
|
||||
|
||||
void CheatCodeEditorDialog::setupAdditionalUi(const QStringList& group_names)
|
||||
|
||||
@@ -88,7 +88,7 @@ private:
|
||||
bool m_master_enable_ignored = false;
|
||||
};
|
||||
|
||||
class CheatCodeEditorDialog : public QDialog
|
||||
class CheatCodeEditorDialog final : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -115,7 +115,7 @@ private:
|
||||
Cheats::CodeOptionList m_new_options;
|
||||
};
|
||||
|
||||
class GameCheatCodeChoiceEditorDialog : public QDialog
|
||||
class GameCheatCodeChoiceEditorDialog final : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -370,11 +370,10 @@ void GameSummaryWidget::populateTracksInfo()
|
||||
|
||||
void GameSummaryWidget::onCompatibilityCommentsClicked()
|
||||
{
|
||||
QDialog* dlg = new QDialog(QtUtils::GetRootWidget(this));
|
||||
QDialog* const dlg = new QDialog(QtUtils::GetRootWidget(this));
|
||||
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dlg->resize(QSize(700, 400));
|
||||
dlg->setWindowModality(Qt::WindowModal);
|
||||
dlg->setWindowTitle(tr("Compatibility Report"));
|
||||
dlg->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(dlg);
|
||||
|
||||
@@ -386,7 +385,7 @@ void GameSummaryWidget::onCompatibilityCommentsClicked()
|
||||
connect(bb, &QDialogButtonBox::rejected, dlg, &QDialog::accept);
|
||||
layout->addWidget(bb);
|
||||
|
||||
dlg->show();
|
||||
dlg->open();
|
||||
}
|
||||
|
||||
void GameSummaryWidget::onInputProfileChanged(int index)
|
||||
|
||||
@@ -1286,108 +1286,128 @@ void GraphicsSettingsWidget::onGPUThreadChanged()
|
||||
m_ui.maxQueuedFramesLabel->setEnabled(enabled);
|
||||
}
|
||||
|
||||
void GraphicsSettingsWidget::onTextureReplacementOptionsClicked()
|
||||
namespace {
|
||||
class TextureReplacementSettingsDialog final : public QDialog
|
||||
{
|
||||
QDialog dlg(QtUtils::GetRootWidget(this));
|
||||
public:
|
||||
TextureReplacementSettingsDialog(SettingsWindow* settings_window, QWidget* parent);
|
||||
|
||||
Ui::TextureReplacementSettingsDialog dlgui;
|
||||
dlgui.setupUi(&dlg);
|
||||
dlgui.icon->setPixmap(QIcon::fromTheme(QStringLiteral("image-fill")).pixmap(32));
|
||||
private:
|
||||
void onExportClicked();
|
||||
|
||||
Ui::TextureReplacementSettingsDialog m_ui;
|
||||
};
|
||||
|
||||
TextureReplacementSettingsDialog::TextureReplacementSettingsDialog(SettingsWindow* settings_window, QWidget* parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
m_ui.icon->setPixmap(QIcon::fromTheme(QStringLiteral("image-fill")).pixmap(32));
|
||||
|
||||
constexpr Settings::TextureReplacementSettings::Configuration default_replacement_config;
|
||||
SettingsInterface* const sif = m_dialog->getSettingsInterface();
|
||||
SettingsInterface* const sif = settings_window->getSettingsInterface();
|
||||
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, dlgui.dumpTexturePages, "TextureReplacements", "DumpTexturePages",
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.dumpTexturePages, "TextureReplacements", "DumpTexturePages",
|
||||
default_replacement_config.dump_texture_pages);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, dlgui.dumpFullTexturePages, "TextureReplacements",
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.dumpFullTexturePages, "TextureReplacements",
|
||||
"DumpFullTexturePages",
|
||||
default_replacement_config.dump_full_texture_pages);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, dlgui.dumpC16Textures, "TextureReplacements", "DumpC16Textures",
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.dumpC16Textures, "TextureReplacements", "DumpC16Textures",
|
||||
default_replacement_config.dump_c16_textures);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, dlgui.reducePaletteRange, "TextureReplacements",
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.reducePaletteRange, "TextureReplacements",
|
||||
"ReducePaletteRange", default_replacement_config.reduce_palette_range);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, dlgui.convertCopiesToWrites, "TextureReplacements",
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.convertCopiesToWrites, "TextureReplacements",
|
||||
"ConvertCopiesToWrites",
|
||||
default_replacement_config.convert_copies_to_writes);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, dlgui.replacementScaleLinearFilter, "TextureReplacements",
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.replacementScaleLinearFilter, "TextureReplacements",
|
||||
"ReplacementScaleLinearFilter",
|
||||
default_replacement_config.replacement_scale_linear_filter);
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, dlgui.maxVRAMWriteSplits, "TextureReplacements",
|
||||
"MaxVRAMWriteSplits", default_replacement_config.max_vram_write_splits);
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, dlgui.maxVRAMWriteCoalesceWidth, "TextureReplacements",
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.maxVRAMWriteSplits, "TextureReplacements", "MaxVRAMWriteSplits",
|
||||
default_replacement_config.max_vram_write_splits);
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.maxVRAMWriteCoalesceWidth, "TextureReplacements",
|
||||
"MaxVRAMWriteCoalesceWidth",
|
||||
default_replacement_config.max_vram_write_coalesce_width);
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, dlgui.maxVRAMWriteCoalesceHeight, "TextureReplacements",
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.maxVRAMWriteCoalesceHeight, "TextureReplacements",
|
||||
"MaxVRAMWriteCoalesceHeight",
|
||||
default_replacement_config.max_vram_write_coalesce_height);
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, dlgui.minDumpedTextureWidth, "TextureReplacements",
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.minDumpedTextureWidth, "TextureReplacements",
|
||||
"DumpTextureWidthThreshold",
|
||||
default_replacement_config.texture_dump_width_threshold);
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, dlgui.minDumpedTextureHeight, "TextureReplacements",
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.minDumpedTextureHeight, "TextureReplacements",
|
||||
"DumpTextureHeightThreshold",
|
||||
default_replacement_config.texture_dump_height_threshold);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, dlgui.setTextureDumpAlphaChannel, "TextureReplacements",
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.setTextureDumpAlphaChannel, "TextureReplacements",
|
||||
"DumpTextureForceAlphaChannel",
|
||||
default_replacement_config.dump_texture_force_alpha_channel);
|
||||
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, dlgui.minDumpedVRAMWriteWidth, "TextureReplacements",
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.minDumpedVRAMWriteWidth, "TextureReplacements",
|
||||
"DumpVRAMWriteWidthThreshold",
|
||||
default_replacement_config.vram_write_dump_width_threshold);
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, dlgui.minDumpedVRAMWriteHeight, "TextureReplacements",
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.minDumpedVRAMWriteHeight, "TextureReplacements",
|
||||
"DumpVRAMWriteHeightThreshold",
|
||||
default_replacement_config.vram_write_dump_height_threshold);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, dlgui.setVRAMWriteAlphaChannel, "TextureReplacements",
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.setVRAMWriteAlphaChannel, "TextureReplacements",
|
||||
"DumpVRAMWriteForceAlphaChannel",
|
||||
default_replacement_config.dump_vram_write_force_alpha_channel);
|
||||
|
||||
dlgui.dumpFullTexturePages->setEnabled(
|
||||
m_dialog->getEffectiveBoolValue("TextureReplacements", "DumpTexturePages", false));
|
||||
connect(dlgui.dumpTexturePages, &QCheckBox::checkStateChanged, this, [this, full_cb = dlgui.dumpFullTexturePages]() {
|
||||
full_cb->setEnabled(m_dialog->getEffectiveBoolValue("TextureReplacements", "DumpTexturePages", false));
|
||||
m_ui.dumpFullTexturePages->setEnabled(
|
||||
settings_window->getEffectiveBoolValue("TextureReplacements", "DumpTexturePages", false));
|
||||
connect(m_ui.dumpTexturePages, &QCheckBox::checkStateChanged, this, [this, settings_window] {
|
||||
m_ui.dumpFullTexturePages->setEnabled(
|
||||
settings_window->getEffectiveBoolValue("TextureReplacements", "DumpTexturePages", false));
|
||||
});
|
||||
connect(dlgui.closeButton, &QPushButton::clicked, &dlg, &QDialog::accept);
|
||||
connect(dlgui.exportButton, &QPushButton::clicked, &dlg, [&dlg, &dlgui]() {
|
||||
Settings::TextureReplacementSettings::Configuration config;
|
||||
|
||||
config.dump_texture_pages = dlgui.dumpTexturePages->isChecked();
|
||||
config.dump_full_texture_pages = dlgui.dumpFullTexturePages->isChecked();
|
||||
config.dump_c16_textures = dlgui.dumpC16Textures->isChecked();
|
||||
config.reduce_palette_range = dlgui.reducePaletteRange->isChecked();
|
||||
config.convert_copies_to_writes = dlgui.convertCopiesToWrites->isChecked();
|
||||
config.replacement_scale_linear_filter = dlgui.replacementScaleLinearFilter->isChecked();
|
||||
config.max_vram_write_splits = static_cast<u16>(dlgui.maxVRAMWriteSplits->value());
|
||||
config.max_vram_write_coalesce_width = static_cast<u16>(dlgui.maxVRAMWriteCoalesceWidth->value());
|
||||
config.max_vram_write_coalesce_height = static_cast<u16>(dlgui.maxVRAMWriteCoalesceHeight->value());
|
||||
config.texture_dump_width_threshold = static_cast<u16>(dlgui.minDumpedTextureWidth->value());
|
||||
config.texture_dump_height_threshold = static_cast<u16>(dlgui.minDumpedTextureHeight->value());
|
||||
config.dump_texture_force_alpha_channel = dlgui.setTextureDumpAlphaChannel->isChecked();
|
||||
config.vram_write_dump_width_threshold = static_cast<u16>(dlgui.minDumpedVRAMWriteWidth->value());
|
||||
config.vram_write_dump_height_threshold = static_cast<u16>(dlgui.minDumpedVRAMWriteHeight->value());
|
||||
config.dump_vram_write_force_alpha_channel = dlgui.setTextureDumpAlphaChannel->isChecked();
|
||||
|
||||
QInputDialog idlg(&dlg);
|
||||
idlg.resize(600, 400);
|
||||
idlg.setWindowTitle(tr("Texture Replacement Configuration"));
|
||||
idlg.setInputMode(QInputDialog::TextInput);
|
||||
idlg.setOption(QInputDialog::UsePlainTextEditForTextInput);
|
||||
idlg.setLabelText(tr("Texture Replacement Configuration (config.yaml)"));
|
||||
idlg.setTextValue(QString::fromStdString(config.ExportToYAML(false)));
|
||||
idlg.setOkButtonText(tr("Save"));
|
||||
if (idlg.exec() != QDialog::Rejected)
|
||||
{
|
||||
const QString path = QFileDialog::getSaveFileName(&dlg, tr("Save Configuration"), QString(),
|
||||
tr("Configuration Files (config.yaml)"));
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
|
||||
Error error;
|
||||
if (!FileSystem::WriteStringToFile(QDir::toNativeSeparators(path).toUtf8().constData(),
|
||||
idlg.textValue().toStdString(), &error))
|
||||
{
|
||||
QtUtils::MessageBoxCritical(&dlg, tr("Write Failed"), QString::fromStdString(error.GetDescription()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
dlg.exec();
|
||||
connect(m_ui.closeButton, &QAbstractButton::clicked, this, &QDialog::accept);
|
||||
connect(m_ui.exportButton, &QAbstractButton::clicked, this, &TextureReplacementSettingsDialog::onExportClicked);
|
||||
}
|
||||
|
||||
void TextureReplacementSettingsDialog::onExportClicked()
|
||||
{
|
||||
Settings::TextureReplacementSettings::Configuration config;
|
||||
|
||||
config.dump_texture_pages = m_ui.dumpTexturePages->isChecked();
|
||||
config.dump_full_texture_pages = m_ui.dumpFullTexturePages->isChecked();
|
||||
config.dump_c16_textures = m_ui.dumpC16Textures->isChecked();
|
||||
config.reduce_palette_range = m_ui.reducePaletteRange->isChecked();
|
||||
config.convert_copies_to_writes = m_ui.convertCopiesToWrites->isChecked();
|
||||
config.replacement_scale_linear_filter = m_ui.replacementScaleLinearFilter->isChecked();
|
||||
config.max_vram_write_splits = static_cast<u16>(m_ui.maxVRAMWriteSplits->value());
|
||||
config.max_vram_write_coalesce_width = static_cast<u16>(m_ui.maxVRAMWriteCoalesceWidth->value());
|
||||
config.max_vram_write_coalesce_height = static_cast<u16>(m_ui.maxVRAMWriteCoalesceHeight->value());
|
||||
config.texture_dump_width_threshold = static_cast<u16>(m_ui.minDumpedTextureWidth->value());
|
||||
config.texture_dump_height_threshold = static_cast<u16>(m_ui.minDumpedTextureHeight->value());
|
||||
config.dump_texture_force_alpha_channel = m_ui.setTextureDumpAlphaChannel->isChecked();
|
||||
config.vram_write_dump_width_threshold = static_cast<u16>(m_ui.minDumpedVRAMWriteWidth->value());
|
||||
config.vram_write_dump_height_threshold = static_cast<u16>(m_ui.minDumpedVRAMWriteHeight->value());
|
||||
config.dump_vram_write_force_alpha_channel = m_ui.setTextureDumpAlphaChannel->isChecked();
|
||||
|
||||
QInputDialog idlg(this);
|
||||
idlg.resize(600, 400);
|
||||
idlg.setWindowTitle(tr("Texture Replacement Configuration"));
|
||||
idlg.setInputMode(QInputDialog::TextInput);
|
||||
idlg.setOption(QInputDialog::UsePlainTextEditForTextInput);
|
||||
idlg.setLabelText(tr("Texture Replacement Configuration (config.yaml)"));
|
||||
idlg.setTextValue(QString::fromStdString(config.ExportToYAML(false)));
|
||||
idlg.setOkButtonText(tr("Save As..."));
|
||||
if (idlg.exec() != QDialog::Rejected)
|
||||
{
|
||||
const QString path =
|
||||
QFileDialog::getSaveFileName(this, tr("Save Configuration"), QString(), tr("Configuration Files (config.yaml)"));
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
|
||||
Error error;
|
||||
if (!FileSystem::WriteStringToFile(QDir::toNativeSeparators(path).toUtf8().constData(),
|
||||
idlg.textValue().toStdString(), &error))
|
||||
{
|
||||
QtUtils::MessageBoxCritical(this, tr("Write Failed"), QString::fromStdString(error.GetDescription()));
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void GraphicsSettingsWidget::onTextureReplacementOptionsClicked()
|
||||
{
|
||||
QDialog* const dlg = new TextureReplacementSettingsDialog(m_dialog, QtUtils::GetRootWidget(this));
|
||||
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dlg->open();
|
||||
}
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
<ui version="4.0">
|
||||
<class>InputBindingDialog</class>
|
||||
<widget class="QDialog" name="InputBindingDialog">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::WindowModality::WindowModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@@ -16,9 +13,6 @@
|
||||
<property name="windowTitle">
|
||||
<string>Edit Bindings</string>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="title">
|
||||
|
||||
@@ -410,11 +410,11 @@ void InputBindingWidget::unhookInputManager()
|
||||
|
||||
void InputBindingWidget::openDialog()
|
||||
{
|
||||
InputBindingDialog* dlg =
|
||||
QDialog* const dlg =
|
||||
new InputBindingDialog(m_sif, m_bind_type, m_section_name, m_key_name, m_bindings, QtUtils::GetRootWidget(this));
|
||||
dlg->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
connect(dlg, &InputBindingDialog::finished, this, &InputBindingWidget::reloadBinding);
|
||||
dlg->show();
|
||||
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||
connect(dlg, &QDialog::finished, this, &InputBindingWidget::reloadBinding);
|
||||
dlg->open();
|
||||
}
|
||||
|
||||
void InputBindingWidget::showEffectBindingDialog()
|
||||
|
||||
@@ -1161,8 +1161,7 @@ bool MainWindow::openResumeStateDialog(const std::string& path, const std::strin
|
||||
|
||||
QDialog* const dlg = new QDialog(this);
|
||||
dlg->setWindowTitle(tr("Load Resume State"));
|
||||
dlg->setWindowModality(Qt::WindowModal);
|
||||
dlg->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
QVBoxLayout* const main_layout = new QVBoxLayout(dlg);
|
||||
main_layout->setSpacing(10);
|
||||
@@ -1238,7 +1237,7 @@ bool MainWindow::openResumeStateDialog(const std::string& path, const std::strin
|
||||
|
||||
main_layout->addWidget(bbox);
|
||||
|
||||
dlg->show();
|
||||
dlg->open();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1287,7 +1286,6 @@ void MainWindow::promptForDiscChange(const QString& path)
|
||||
QtUtils::NewMessageBox(QMessageBox::Question, tr("Confirm Disc Change"),
|
||||
tr("Do you want to swap discs or boot the new image (via system reset)?"),
|
||||
QMessageBox::NoButton, QMessageBox::NoButton, Qt::WindowModal, lock.getDialogParent());
|
||||
mb->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
/*const QAbstractButton* const swap_button = */ mb->addButton(tr("Swap Disc"), QMessageBox::YesRole);
|
||||
const QAbstractButton* const reset_button = mb->addButton(tr("Reset"), QMessageBox::NoRole);
|
||||
@@ -1578,8 +1576,9 @@ void MainWindow::onDiscordServerActionTriggered()
|
||||
|
||||
void MainWindow::onAboutActionTriggered()
|
||||
{
|
||||
AboutDialog about(this);
|
||||
about.exec();
|
||||
QDialog* const about = new AboutDialog(this);
|
||||
about->setAttribute(Qt::WA_DeleteOnClose);
|
||||
about->open();
|
||||
}
|
||||
|
||||
void MainWindow::onGameListRefreshProgress(const QString& status, int current, int total)
|
||||
@@ -3080,7 +3079,6 @@ void MainWindow::requestShutdown(bool allow_confirm, bool allow_save_to_state, b
|
||||
quit_afterwards ? tr("Are you sure you want to exit the application?") :
|
||||
tr("Are you sure you want to close the current game?"),
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes, Qt::WindowModal, lock.getDialogParent());
|
||||
msgbox->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
QCheckBox* const save_cb = new QCheckBox(tr("Save State For Resume"), msgbox);
|
||||
save_cb->setChecked(allow_save_to_state && save_state);
|
||||
@@ -3245,7 +3243,7 @@ void MainWindow::onAchievementsLoginRequested(Achievements::LoginRequestReason r
|
||||
|
||||
AchievementLoginDialog* dlg = new AchievementLoginDialog(lock.getDialogParent(), reason);
|
||||
connect(dlg, &AchievementLoginDialog::finished, this, [lock = std::move(lock)]() {});
|
||||
dlg->show();
|
||||
dlg->open();
|
||||
}
|
||||
|
||||
void MainWindow::onAchievementsLoginSuccess(const QString& username, quint32 points, quint32 sc_points,
|
||||
|
||||
@@ -701,25 +701,32 @@ void MemoryCardEditorWindow::doRenameSaveFile()
|
||||
if (!fi)
|
||||
return;
|
||||
|
||||
const std::string new_name = MemoryCardRenameFileDialog::promptForNewName(this, fi->filename);
|
||||
if (new_name.empty())
|
||||
return;
|
||||
MemoryCardRenameFileDialog* const dlg = new MemoryCardRenameFileDialog(this, fi->filename);
|
||||
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
Error error;
|
||||
if (!MemoryCardImage::RenameFile(&card->data, *fi, new_name, &error))
|
||||
{
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"),
|
||||
tr("Failed to rename save file %1:\n%2")
|
||||
.arg(QString::fromStdString(fi->filename))
|
||||
.arg(QString::fromStdString(error.GetDescription())));
|
||||
return;
|
||||
}
|
||||
connect(dlg, &QDialog::accepted, this, [=, this] {
|
||||
const std::string new_name = dlg->getNewName();
|
||||
if (new_name.empty())
|
||||
return;
|
||||
|
||||
clearSelection();
|
||||
setCardDirty(card);
|
||||
updateCardTable(card);
|
||||
updateCardBlocksFree(card);
|
||||
updateButtonState();
|
||||
Error error;
|
||||
if (!MemoryCardImage::RenameFile(&card->data, *fi, new_name, &error))
|
||||
{
|
||||
QtUtils::MessageBoxCritical(this, tr("Error"),
|
||||
tr("Failed to rename save file %1:\n%2")
|
||||
.arg(QString::fromStdString(fi->filename))
|
||||
.arg(QString::fromStdString(error.GetDescription())));
|
||||
return;
|
||||
}
|
||||
|
||||
clearSelection();
|
||||
setCardDirty(card);
|
||||
updateCardTable(card);
|
||||
updateCardBlocksFree(card);
|
||||
updateButtonState();
|
||||
});
|
||||
|
||||
dlg->open();
|
||||
}
|
||||
|
||||
void MemoryCardEditorWindow::importCard(Card* card)
|
||||
@@ -837,12 +844,12 @@ std::tuple<MemoryCardEditorWindow::Card*, const MemoryCardImage::FileInfo*> Memo
|
||||
}
|
||||
|
||||
if (sel.isEmpty())
|
||||
return std::tuple<Card*, const MemoryCardImage::FileInfo*>(nullptr, nullptr);
|
||||
return {nullptr, nullptr};
|
||||
|
||||
const int index = sel.front().topRow();
|
||||
Assert(index >= 0 && static_cast<u32>(index) < card->files.size());
|
||||
|
||||
return std::tuple<Card*, const MemoryCardImage::FileInfo*>(card, &card->files[index]);
|
||||
return {card, &card->files[index]};
|
||||
}
|
||||
|
||||
void MemoryCardEditorWindow::updateButtonState()
|
||||
@@ -877,13 +884,9 @@ MemoryCardRenameFileDialog::MemoryCardRenameFileDialog(QWidget* parent, std::str
|
||||
|
||||
MemoryCardRenameFileDialog::~MemoryCardRenameFileDialog() = default;
|
||||
|
||||
std::string MemoryCardRenameFileDialog::promptForNewName(QWidget* parent, std::string_view old_name)
|
||||
std::string MemoryCardRenameFileDialog::getNewName() const
|
||||
{
|
||||
MemoryCardRenameFileDialog dlg(parent, old_name);
|
||||
if (dlg.exec() == QDialog::Rejected)
|
||||
return {};
|
||||
|
||||
return dlg.m_ui.fullFilename->text().toStdString();
|
||||
return m_ui.fullFilename->text().toStdString();
|
||||
}
|
||||
|
||||
void MemoryCardRenameFileDialog::setupAdditionalUi()
|
||||
|
||||
@@ -107,11 +107,12 @@ private:
|
||||
class MemoryCardRenameFileDialog final : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MemoryCardRenameFileDialog(QWidget* parent, std::string_view old_name);
|
||||
~MemoryCardRenameFileDialog() override;
|
||||
|
||||
static std::string promptForNewName(QWidget* parent, std::string_view old_name);
|
||||
std::string getNewName() const;
|
||||
|
||||
private:
|
||||
void setupAdditionalUi();
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
|
||||
@@ -185,7 +185,9 @@ void PostProcessingChainConfigWidget::updateButtonsAndConfigPane(std::optional<u
|
||||
|
||||
void PostProcessingChainConfigWidget::onAddButtonClicked()
|
||||
{
|
||||
PostProcessingSelectShaderDialog* dialog = new PostProcessingSelectShaderDialog(this);
|
||||
PostProcessingSelectShaderDialog* const dialog = new PostProcessingSelectShaderDialog(this);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
connect(dialog, &QDialog::accepted, this, [this, dialog]() {
|
||||
const std::string selected_shader = dialog->getSelectedShader();
|
||||
if (selected_shader.empty())
|
||||
@@ -208,7 +210,7 @@ void PostProcessingChainConfigWidget::onAddButtonClicked()
|
||||
commitSettingsUpdate();
|
||||
});
|
||||
|
||||
dialog->show();
|
||||
dialog->open();
|
||||
}
|
||||
|
||||
void PostProcessingChainConfigWidget::onRemoveButtonClicked()
|
||||
@@ -665,9 +667,6 @@ PostProcessingSelectShaderDialog::PostProcessingSelectShaderDialog(QWidget* pare
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
setWindowModality(Qt::WindowModal);
|
||||
|
||||
m_ui.searchIcon->setPixmap(QIcon::fromTheme("mag-line").pixmap(16));
|
||||
|
||||
m_ui.filterGroup->setId(m_ui.filterGLSL, static_cast<int>(PostProcessing::ShaderType::GLSL));
|
||||
|
||||
@@ -2163,7 +2163,6 @@ void Host::ConfirmMessageAsync(std::string_view title, std::string_view message,
|
||||
QMessageBox* const msgbox =
|
||||
QtUtils::NewMessageBox(QMessageBox::Question, title, message, QMessageBox::NoButton, QMessageBox::NoButton,
|
||||
Qt::WindowModal, lock.getDialogParent());
|
||||
msgbox->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
QPushButton* const yes_button = msgbox->addButton(yes_text, QMessageBox::AcceptRole);
|
||||
msgbox->addButton(no_text, QMessageBox::RejectRole);
|
||||
|
||||
@@ -283,6 +283,7 @@ QMessageBox* QtUtils::NewMessageBox(QMessageBox::Icon icon, const QString& title
|
||||
new QMessageBox(icon, QString(), title, buttons, parent ? QtUtils::GetRootWidget(parent) : nullptr);
|
||||
msgbox->setInformativeText(text);
|
||||
#endif
|
||||
msgbox->setAttribute(Qt::WA_DeleteOnClose);
|
||||
msgbox->setIcon(icon);
|
||||
SetMessageBoxStyle(msgbox, modality);
|
||||
return msgbox;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "setupwizarddialog.h"
|
||||
#include "achievementlogindialog.h"
|
||||
#include "biossettingswidget.h"
|
||||
#include "controllerbindingwidgets.h"
|
||||
#include "controllersettingwidgetbinder.h"
|
||||
#include "graphicssettingswidget.h"
|
||||
@@ -13,6 +14,7 @@
|
||||
#include "settingwidgetbinder.h"
|
||||
|
||||
#include "core/achievements.h"
|
||||
#include "core/bios.h"
|
||||
#include "core/controller.h"
|
||||
|
||||
#include "util/input_manager.h"
|
||||
@@ -490,10 +492,11 @@ void SetupWizardDialog::doDeviceAutomaticBinding(u32 port, QLabel* update_label,
|
||||
|
||||
void SetupWizardDialog::doMultipleDeviceAutomaticBinding(u32 port, QLabel* update_label)
|
||||
{
|
||||
if (!ControllerBindingWidget::doMultipleDeviceAutomaticBinding(this, nullptr, port))
|
||||
return;
|
||||
|
||||
update_label->setText(findCurrentDeviceForPort(port));
|
||||
QDialog* const dialog = new MultipleDeviceAutobindDialog(this, nullptr, port);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
connect(dialog, &QDialog::accepted, this,
|
||||
[this, port, update_label] { update_label->setText(findCurrentDeviceForPort(port)); });
|
||||
dialog->open();
|
||||
}
|
||||
|
||||
void SetupWizardDialog::setupGraphicsPage(bool initial)
|
||||
@@ -625,7 +628,7 @@ void SetupWizardDialog::onAchievementsLoginLogoutClicked()
|
||||
|
||||
AchievementLoginDialog* login = new AchievementLoginDialog(this, Achievements::LoginRequestReason::UserInitiated);
|
||||
connect(login, &AchievementLoginDialog::accepted, this, &SetupWizardDialog::onAchievementsLoginCompleted);
|
||||
login->show();
|
||||
login->open();
|
||||
}
|
||||
|
||||
void SetupWizardDialog::onAchievementsLoginCompleted()
|
||||
|
||||
@@ -3,19 +3,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "biossettingswidget.h"
|
||||
|
||||
#include "ui_setupwizarddialog.h"
|
||||
|
||||
#include "core/bios.h"
|
||||
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QVector>
|
||||
#include <QtWidgets/QDialog>
|
||||
#include <QtWidgets/QLabel>
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
class SetupWizardDialog final : public QDialog
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user