mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-28 14:20:30 +00:00
Qt: Use QDialog::Accepted/Rejected in more places
This commit is contained in:
parent
842f7414d9
commit
976bf834ed
@ -220,8 +220,7 @@ void AchievementSettingsWidget::onLoginLogoutPressed()
|
||||
}
|
||||
|
||||
AchievementLoginDialog login(this, Achievements::LoginRequestReason::UserInitiated);
|
||||
int res = login.exec();
|
||||
if (res == QDialog::Rejected)
|
||||
if (login.exec() == QDialog::Rejected)
|
||||
return;
|
||||
|
||||
updateLoginState();
|
||||
|
@ -401,7 +401,7 @@ bool ControllerBindingWidget::doMultipleDeviceAutomaticBinding(QWidget* parent,
|
||||
connect(&bb, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
|
||||
layout->addWidget(&bb);
|
||||
|
||||
if (dialog.exec() == 0)
|
||||
if (dialog.exec() == QDialog::Rejected)
|
||||
return false;
|
||||
|
||||
auto lock = Host::GetSettingsLock();
|
||||
|
@ -186,7 +186,7 @@ void DebuggerWindow::onFollowAddressTriggered()
|
||||
void DebuggerWindow::onAddBreakpointTriggered()
|
||||
{
|
||||
DebuggerAddBreakpointDialog dlg(this);
|
||||
if (!dlg.exec())
|
||||
if (dlg.exec() == QDialog::Rejected)
|
||||
return;
|
||||
|
||||
addBreakpoint(dlg.getType(), dlg.getAddress());
|
||||
|
@ -635,7 +635,7 @@ void GameCheatSettingsWidget::newCode()
|
||||
{
|
||||
Cheats::CodeInfo new_code;
|
||||
CheatCodeEditorDialog dlg(this, &new_code, getGroupNames());
|
||||
if (!dlg.exec())
|
||||
if (dlg.exec() == QDialog::Rejected)
|
||||
{
|
||||
// cancelled
|
||||
return;
|
||||
@ -653,7 +653,7 @@ void GameCheatSettingsWidget::editCode(const std::string_view code_name)
|
||||
return;
|
||||
|
||||
CheatCodeEditorDialog dlg(this, code, getGroupNames());
|
||||
if (!dlg.exec())
|
||||
if (dlg.exec() == QDialog::Rejected)
|
||||
{
|
||||
// no changes
|
||||
return;
|
||||
@ -949,7 +949,7 @@ void CheatCodeEditorDialog::onRangeMaxChanged(int value)
|
||||
void CheatCodeEditorDialog::onEditChoiceClicked()
|
||||
{
|
||||
GameCheatCodeChoiceEditorDialog dlg(this, m_new_options);
|
||||
if (dlg.exec())
|
||||
if (dlg.exec() == QDialog::Accepted)
|
||||
m_new_options = dlg.getNewOptions();
|
||||
}
|
||||
|
||||
|
@ -1331,7 +1331,7 @@ void GraphicsSettingsWidget::onTextureReplacementOptionsClicked()
|
||||
idlg.setLabelText(tr("Texture Replacement Configuration (config.yaml)"));
|
||||
idlg.setTextValue(QString::fromStdString(config.ExportToYAML(false)));
|
||||
idlg.setOkButtonText(tr("Save"));
|
||||
if (idlg.exec())
|
||||
if (idlg.exec() != QDialog::Rejected)
|
||||
{
|
||||
const QString path = QFileDialog::getSaveFileName(&dlg, tr("Save Configuration"), QString(),
|
||||
tr("Configuration Files (config.yaml)"));
|
||||
|
@ -471,7 +471,7 @@ void InputVibrationBindingWidget::onClicked()
|
||||
input_dialog.setComboBoxEditable(false);
|
||||
input_dialog.setComboBoxItems(std::move(input_options));
|
||||
input_dialog.setTextValue(current);
|
||||
if (input_dialog.exec() == 0)
|
||||
if (input_dialog.exec() == QDialog::Rejected)
|
||||
return;
|
||||
|
||||
const QString new_value(input_dialog.textValue());
|
||||
|
@ -697,7 +697,7 @@ std::string MainWindow::getDeviceDiscPath(const QString& title)
|
||||
input_dialog.setOptions(QInputDialog::UseListViewForComboBoxItems);
|
||||
input_dialog.setComboBoxEditable(false);
|
||||
input_dialog.setComboBoxItems(std::move(input_options));
|
||||
if (input_dialog.exec() == 0)
|
||||
if (input_dialog.exec() == QDialog::Rejected)
|
||||
return ret;
|
||||
|
||||
const int selected_index = input_dialog.comboBoxItems().indexOf(input_dialog.textValue());
|
||||
@ -1065,7 +1065,7 @@ const GameList::Entry* MainWindow::resolveDiscSetEntry(const GameList::Entry* en
|
||||
const int res = dlg.exec();
|
||||
lock.lock();
|
||||
|
||||
return res ? GameList::GetEntryForPath(dlg.getSelectedDiscPath()) : nullptr;
|
||||
return res == QDialog::Accepted ? GameList::GetEntryForPath(dlg.getSelectedDiscPath()) : nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<SystemBootParameters> MainWindow::getSystemBootParameters(std::string file)
|
||||
|
@ -721,13 +721,10 @@ MemoryCardRenameFileDialog::~MemoryCardRenameFileDialog() = default;
|
||||
std::string MemoryCardRenameFileDialog::promptForNewName(QWidget* parent, std::string_view old_name)
|
||||
{
|
||||
MemoryCardRenameFileDialog dlg(parent, old_name);
|
||||
if (dlg.exec() == QDialog::Rejected)
|
||||
return {};
|
||||
|
||||
std::string ret;
|
||||
if (dlg.exec() != 1)
|
||||
return ret;
|
||||
|
||||
ret = dlg.m_ui.fullFilename->text().toStdString();
|
||||
return ret;
|
||||
return dlg.m_ui.fullFilename->text().toStdString();
|
||||
}
|
||||
|
||||
void MemoryCardRenameFileDialog::setupAdditionalUi()
|
||||
|
Loading…
x
Reference in New Issue
Block a user