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);
|
AchievementLoginDialog login(this, Achievements::LoginRequestReason::UserInitiated);
|
||||||
int res = login.exec();
|
if (login.exec() == QDialog::Rejected)
|
||||||
if (res == QDialog::Rejected)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
updateLoginState();
|
updateLoginState();
|
||||||
|
@ -401,7 +401,7 @@ bool ControllerBindingWidget::doMultipleDeviceAutomaticBinding(QWidget* parent,
|
|||||||
connect(&bb, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
|
connect(&bb, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
|
||||||
layout->addWidget(&bb);
|
layout->addWidget(&bb);
|
||||||
|
|
||||||
if (dialog.exec() == 0)
|
if (dialog.exec() == QDialog::Rejected)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto lock = Host::GetSettingsLock();
|
auto lock = Host::GetSettingsLock();
|
||||||
|
@ -186,7 +186,7 @@ void DebuggerWindow::onFollowAddressTriggered()
|
|||||||
void DebuggerWindow::onAddBreakpointTriggered()
|
void DebuggerWindow::onAddBreakpointTriggered()
|
||||||
{
|
{
|
||||||
DebuggerAddBreakpointDialog dlg(this);
|
DebuggerAddBreakpointDialog dlg(this);
|
||||||
if (!dlg.exec())
|
if (dlg.exec() == QDialog::Rejected)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
addBreakpoint(dlg.getType(), dlg.getAddress());
|
addBreakpoint(dlg.getType(), dlg.getAddress());
|
||||||
|
@ -635,7 +635,7 @@ void GameCheatSettingsWidget::newCode()
|
|||||||
{
|
{
|
||||||
Cheats::CodeInfo new_code;
|
Cheats::CodeInfo new_code;
|
||||||
CheatCodeEditorDialog dlg(this, &new_code, getGroupNames());
|
CheatCodeEditorDialog dlg(this, &new_code, getGroupNames());
|
||||||
if (!dlg.exec())
|
if (dlg.exec() == QDialog::Rejected)
|
||||||
{
|
{
|
||||||
// cancelled
|
// cancelled
|
||||||
return;
|
return;
|
||||||
@ -653,7 +653,7 @@ void GameCheatSettingsWidget::editCode(const std::string_view code_name)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
CheatCodeEditorDialog dlg(this, code, getGroupNames());
|
CheatCodeEditorDialog dlg(this, code, getGroupNames());
|
||||||
if (!dlg.exec())
|
if (dlg.exec() == QDialog::Rejected)
|
||||||
{
|
{
|
||||||
// no changes
|
// no changes
|
||||||
return;
|
return;
|
||||||
@ -949,7 +949,7 @@ void CheatCodeEditorDialog::onRangeMaxChanged(int value)
|
|||||||
void CheatCodeEditorDialog::onEditChoiceClicked()
|
void CheatCodeEditorDialog::onEditChoiceClicked()
|
||||||
{
|
{
|
||||||
GameCheatCodeChoiceEditorDialog dlg(this, m_new_options);
|
GameCheatCodeChoiceEditorDialog dlg(this, m_new_options);
|
||||||
if (dlg.exec())
|
if (dlg.exec() == QDialog::Accepted)
|
||||||
m_new_options = dlg.getNewOptions();
|
m_new_options = dlg.getNewOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1331,7 +1331,7 @@ void GraphicsSettingsWidget::onTextureReplacementOptionsClicked()
|
|||||||
idlg.setLabelText(tr("Texture Replacement Configuration (config.yaml)"));
|
idlg.setLabelText(tr("Texture Replacement Configuration (config.yaml)"));
|
||||||
idlg.setTextValue(QString::fromStdString(config.ExportToYAML(false)));
|
idlg.setTextValue(QString::fromStdString(config.ExportToYAML(false)));
|
||||||
idlg.setOkButtonText(tr("Save"));
|
idlg.setOkButtonText(tr("Save"));
|
||||||
if (idlg.exec())
|
if (idlg.exec() != QDialog::Rejected)
|
||||||
{
|
{
|
||||||
const QString path = QFileDialog::getSaveFileName(&dlg, tr("Save Configuration"), QString(),
|
const QString path = QFileDialog::getSaveFileName(&dlg, tr("Save Configuration"), QString(),
|
||||||
tr("Configuration Files (config.yaml)"));
|
tr("Configuration Files (config.yaml)"));
|
||||||
|
@ -471,7 +471,7 @@ void InputVibrationBindingWidget::onClicked()
|
|||||||
input_dialog.setComboBoxEditable(false);
|
input_dialog.setComboBoxEditable(false);
|
||||||
input_dialog.setComboBoxItems(std::move(input_options));
|
input_dialog.setComboBoxItems(std::move(input_options));
|
||||||
input_dialog.setTextValue(current);
|
input_dialog.setTextValue(current);
|
||||||
if (input_dialog.exec() == 0)
|
if (input_dialog.exec() == QDialog::Rejected)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const QString new_value(input_dialog.textValue());
|
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.setOptions(QInputDialog::UseListViewForComboBoxItems);
|
||||||
input_dialog.setComboBoxEditable(false);
|
input_dialog.setComboBoxEditable(false);
|
||||||
input_dialog.setComboBoxItems(std::move(input_options));
|
input_dialog.setComboBoxItems(std::move(input_options));
|
||||||
if (input_dialog.exec() == 0)
|
if (input_dialog.exec() == QDialog::Rejected)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
const int selected_index = input_dialog.comboBoxItems().indexOf(input_dialog.textValue());
|
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();
|
const int res = dlg.exec();
|
||||||
lock.lock();
|
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)
|
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)
|
std::string MemoryCardRenameFileDialog::promptForNewName(QWidget* parent, std::string_view old_name)
|
||||||
{
|
{
|
||||||
MemoryCardRenameFileDialog dlg(parent, old_name);
|
MemoryCardRenameFileDialog dlg(parent, old_name);
|
||||||
|
if (dlg.exec() == QDialog::Rejected)
|
||||||
|
return {};
|
||||||
|
|
||||||
std::string ret;
|
return dlg.m_ui.fullFilename->text().toStdString();
|
||||||
if (dlg.exec() != 1)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
ret = dlg.m_ui.fullFilename->text().toStdString();
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemoryCardRenameFileDialog::setupAdditionalUi()
|
void MemoryCardRenameFileDialog::setupAdditionalUi()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user