mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-28 06:10:12 +00:00
Qt: Fix return code confusion in AchievementLoginDialog
We were passing the wrong code to QDialog::done(). Qt defines 0 as Rejected and 1 as Accepted. This had no practical impact because callers were also using the inverted logic. The accepted()/rejected() signals were emitted incorrectly but nothing is using them at the moment. Still, to prevent further issues and improve code readability, flip the logic and prefer accept()/reject() over done().
This commit is contained in:
parent
1026902389
commit
3b90d18c6a
@ -65,7 +65,7 @@ void AchievementLoginDialog::cancelClicked()
|
||||
});
|
||||
}
|
||||
|
||||
done(1);
|
||||
reject();
|
||||
}
|
||||
|
||||
void AchievementLoginDialog::processLoginResult(bool result, const QString& message)
|
||||
@ -119,7 +119,7 @@ void AchievementLoginDialog::processLoginResult(bool result, const QString& mess
|
||||
}
|
||||
}
|
||||
|
||||
done(0);
|
||||
accept();
|
||||
}
|
||||
|
||||
void AchievementLoginDialog::connectUi()
|
||||
|
@ -221,7 +221,7 @@ void AchievementSettingsWidget::onLoginLogoutPressed()
|
||||
|
||||
AchievementLoginDialog login(this, Achievements::LoginRequestReason::UserInitiated);
|
||||
int res = login.exec();
|
||||
if (res != 0)
|
||||
if (res == QDialog::Rejected)
|
||||
return;
|
||||
|
||||
updateLoginState();
|
||||
|
@ -325,7 +325,7 @@ void AudioSettingsWidget::onStretchSettingsClicked()
|
||||
std::nullopt :
|
||||
std::optional<bool>(AudioStreamParameters::DEFAULT_STRETCH_USE_AA_FILTER));
|
||||
|
||||
dlg.done(0);
|
||||
dlg.reject();
|
||||
|
||||
QMetaObject::invokeMethod(this, &AudioSettingsWidget::onStretchSettingsClicked, Qt::QueuedConnection);
|
||||
});
|
||||
|
@ -78,7 +78,7 @@ void CoverDownloadDialog::onCloseClicked()
|
||||
if (m_thread)
|
||||
cancelThread();
|
||||
|
||||
done(0);
|
||||
reject();
|
||||
}
|
||||
|
||||
void CoverDownloadDialog::updateEnabled()
|
||||
|
@ -926,12 +926,12 @@ void CheatCodeEditorDialog::saveClicked()
|
||||
tr("Failed to save cheat code:\n%1").arg(QString::fromStdString(error.GetDescription())));
|
||||
}
|
||||
|
||||
done(1);
|
||||
accept();
|
||||
}
|
||||
|
||||
void CheatCodeEditorDialog::cancelClicked()
|
||||
{
|
||||
done(0);
|
||||
reject();
|
||||
}
|
||||
|
||||
void CheatCodeEditorDialog::onOptionTypeChanged(int index)
|
||||
|
@ -30,7 +30,7 @@ InputBindingDialog::InputBindingDialog(SettingsInterface* sif, InputBindingInfo:
|
||||
connect(m_ui.addBinding, &QPushButton::clicked, this, &InputBindingDialog::onAddBindingButtonClicked);
|
||||
connect(m_ui.removeBinding, &QPushButton::clicked, this, &InputBindingDialog::onRemoveBindingButtonClicked);
|
||||
connect(m_ui.clearBindings, &QPushButton::clicked, this, &InputBindingDialog::onClearBindingsButtonClicked);
|
||||
connect(m_ui.buttonBox, &QDialogButtonBox::rejected, [this]() { done(0); });
|
||||
connect(m_ui.buttonBox, &QDialogButtonBox::rejected, [this]() { reject(); });
|
||||
updateList();
|
||||
|
||||
// Only show the sensitivity controls for binds where it's applicable.
|
||||
|
@ -38,7 +38,7 @@ void SelectDiscDialog::onListItemActivated(const QTreeWidgetItem* item)
|
||||
return;
|
||||
|
||||
m_selected_path = item->data(0, Qt::UserRole).toString().toStdString();
|
||||
done(1);
|
||||
accept();
|
||||
}
|
||||
|
||||
void SelectDiscDialog::updateStartEnabled()
|
||||
@ -53,12 +53,12 @@ void SelectDiscDialog::updateStartEnabled()
|
||||
|
||||
void SelectDiscDialog::onSelectClicked()
|
||||
{
|
||||
done(1);
|
||||
accept();
|
||||
}
|
||||
|
||||
void SelectDiscDialog::onCancelClicked()
|
||||
{
|
||||
done(0);
|
||||
reject();
|
||||
}
|
||||
|
||||
void SelectDiscDialog::populateList(const std::string& disc_set_name)
|
||||
|
@ -698,7 +698,7 @@ void SetupWizardDialog::onAchievementsLoginLogoutClicked()
|
||||
|
||||
AchievementLoginDialog login(this, Achievements::LoginRequestReason::UserInitiated);
|
||||
int res = login.exec();
|
||||
if (res != 0)
|
||||
if (res == QDialog::Rejected)
|
||||
return;
|
||||
|
||||
updateAchievementsEnableState();
|
||||
|
Loading…
x
Reference in New Issue
Block a user