@@ -80,45 +80,81 @@ void AchievementLoginDialog::processLoginResult(bool result, const QString& mess
8080 return ;
8181 }
8282
83- if (!Host::GetBaseBoolSettingValue (" Cheevos" , " Enabled" , false ) &&
84- QtUtils::MessageBoxQuestion (
85- this , tr (" Enable Achievements" ),
86- tr (" Achievement tracking is not currently enabled. Your login will have no effect until "
87- " after tracking is enabled.\n\n Do you want to enable tracking now?" )) == QMessageBox::Yes)
83+ // don't ask to enable etc if we are just reauthenticating
84+ if (m_reason == Achievements::LoginRequestReason::TokenInvalid)
8885 {
86+ accept ();
87+ return ;
88+ }
89+
90+ askToEnableAchievementsAndAccept ();
91+ }
92+
93+ void AchievementLoginDialog::askToEnableAchievementsAndAccept ()
94+ {
95+ if (Host::GetBaseBoolSettingValue (" Cheevos" , " Enabled" , false ))
96+ {
97+ askToEnableHardcoreModeAndAccept ();
98+ return ;
99+ }
100+
101+ QMessageBox* const msgbox =
102+ QtUtils::NewMessageBox (this , QMessageBox::Question, tr (" Enable Achievements" ),
103+ tr (" Achievement tracking is not currently enabled. Your login will have no effect until "
104+ " after tracking is enabled.\n\n Do you want to enable tracking now?" ),
105+ QMessageBox::Yes | QMessageBox::No, QMessageBox::NoButton);
106+ msgbox->connect (msgbox, &QMessageBox::accepted, this , [this ]() {
89107 Host::SetBaseBoolSettingValue (" Cheevos" , " Enabled" , true );
90108 Host::CommitBaseSettingChanges ();
91109 g_emu_thread->applySettings ();
92- }
110+ askToEnableHardcoreModeAndAccept ();
111+ });
112+ msgbox->connect (msgbox, &QMessageBox::rejected, this , &AchievementLoginDialog::accept);
113+ msgbox->open ();
114+ }
93115
94- if (!Host::GetBaseBoolSettingValue (" Cheevos" , " ChallengeMode" , false ) &&
95- QtUtils::MessageBoxQuestion (
96- this , tr (" Enable Hardcore Mode" ),
97- tr (" Hardcore mode is not currently enabled. Enabling hardcore mode allows you to set times, scores, and "
98- " participate in game-specific leaderboards.\n\n However, hardcore mode also prevents the usage of save "
99- " states, cheats and slowdown functionality.\n\n Do you want to enable hardcore mode?" )) == QMessageBox::Yes)
116+ void AchievementLoginDialog::askToEnableHardcoreModeAndAccept ()
117+ {
118+ if (Host::GetBaseBoolSettingValue (" Cheevos" , " ChallengeMode" , false ))
100119 {
120+ askToResetGameAndAccept ();
121+ return ;
122+ }
123+
124+ QMessageBox* const msgbox = QtUtils::NewMessageBox (
125+ this , QMessageBox::Question, tr (" Enable Hardcore Mode" ),
126+ tr (" Hardcore mode is not currently enabled. Enabling hardcore mode allows you to set times, scores, and "
127+ " participate in game-specific leaderboards.\n\n However, hardcore mode also prevents the usage of save "
128+ " states, cheats and slowdown functionality.\n\n Do you want to enable hardcore mode?" ),
129+ QMessageBox::Yes | QMessageBox::No, QMessageBox::NoButton);
130+ msgbox->connect (msgbox, &QMessageBox::accepted, this , [this ]() {
101131 Host::SetBaseBoolSettingValue (" Cheevos" , " ChallengeMode" , true );
102132 Host::CommitBaseSettingChanges ();
103133 g_emu_thread->applySettings ();
134+ askToResetGameAndAccept ();
135+ });
136+ msgbox->connect (msgbox, &QMessageBox::rejected, this , &AchievementLoginDialog::accept);
137+ msgbox->open ();
138+ }
104139
105- bool has_active_game;
106- {
107- auto lock = Achievements::GetLock ();
108- has_active_game = Achievements::HasActiveGame ();
109- }
110-
111- if (has_active_game &&
112- QtUtils::MessageBoxCritical (
113- this , tr (" Reset System" ),
114- tr (" Hardcore mode will not be enabled until the system is reset. Do you want to reset the system now?" )) ==
115- QMessageBox::Yes)
116- {
117- g_emu_thread->resetSystem (true );
118- }
140+ void AchievementLoginDialog::askToResetGameAndAccept ()
141+ {
142+ if (!QtHost::IsSystemValid ())
143+ {
144+ accept ();
145+ return ;
119146 }
120147
121- accept ();
148+ QMessageBox* const msgbox = QtUtils::NewMessageBox (
149+ this , QMessageBox::Question, tr (" Reset System" ),
150+ tr (" Hardcore mode will not be enabled until the system is reset. Do you want to reset the system now?" ),
151+ QMessageBox::Yes | QMessageBox::No, QMessageBox::NoButton);
152+ msgbox->connect (msgbox, &QMessageBox::accepted, this , [this ]() {
153+ g_emu_thread->resetSystem (true );
154+ accept ();
155+ });
156+ msgbox->connect (msgbox, &QMessageBox::rejected, this , &AchievementLoginDialog::accept);
157+ msgbox->open ();
122158}
123159
124160void AchievementLoginDialog::connectUi ()
0 commit comments