Add Confirm Popups for Achievements Logout and Hardcore Off

This commit is contained in:
LillyJadeKatrin 2024-07-24 22:15:06 -04:00
parent 415fa3c6a5
commit 72f682ab13
1 changed files with 21 additions and 3 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"
@ -36,7 +37,7 @@ AchievementSettingsWidget::AchievementSettingsWidget(QWidget* parent) : QWidget(
// If hardcore is enabled when the emulator starts, make sure it turns off what it needs to
if (Config::Get(Config::RA_HARDCORE_ENABLED))
ToggleHardcore();
UpdateHardcoreMode();
}
void AchievementSettingsWidget::UpdateData()
@ -259,13 +260,30 @@ void AchievementSettingsWidget::Login()
}
void AchievementSettingsWidget::Logout()
{
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();
UpdateHardcoreMode();
}