Add Confirm Popups for Achievements Logout and Hardcore Off

This commit is contained in:
LillyJadeKatrin 2024-07-24 22:15:06 -04:00
parent cb4437f884
commit 9e64904909
1 changed files with 20 additions and 2 deletions

View File

@ -21,6 +21,7 @@
#include "DolphinQt/Config/ControllerInterface/ControllerInterfaceWindow.h"
#include "DolphinQt/Config/ToolTipControls/ToolTipCheckBox.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
#include "DolphinQt/QtUtils/SignalBlocking.h"
#include "DolphinQt/Settings.h"
@ -253,12 +254,29 @@ void AchievementSettingsWidget::Login()
void AchievementSettingsWidget::Logout()
{
AchievementManager::GetInstance().Logout();
SaveSettings();
auto confirm = ModalMessageBox::question(
this, tr("Confirm Logout"), tr("Are you sure you want to log out of RetroAchievements?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::NoButton, Qt::ApplicationModal);
if (confirm == QMessageBox::Yes)
{
AchievementManager::GetInstance().Logout();
SaveSettings();
}
}
void AchievementSettingsWidget::ToggleHardcore()
{
if (Config::Get(Config::RA_HARDCORE_ENABLED))
{
auto confirm = ModalMessageBox::question(
this, tr("Confirm Hardcore Off"), tr("Are you sure you want to turn hardcore mode off?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::NoButton, Qt::ApplicationModal);
if (confirm != QMessageBox::Yes)
{
SignalBlocking(m_common_hardcore_enabled_input)->setChecked(true);
return;
}
}
SaveSettings();
emit Settings::Instance().HardcoreStateChanged();
}