Permalink
Browse files

UI: Send prompt results even on back/cancel.

Before, if you went to the GPU backend prompt, and canceled, it would
never call the callback, and so the g_Config value never got reset.
  • Loading branch information...
unknownbrackets committed Dec 3, 2017
1 parent d6b7cde commit cde6b3d3e43d8f2ae22f07aa6e0359a4bcd92bce
Showing with 8 additions and 3 deletions.
  1. +6 −3 UI/MiscScreens.cpp
  2. +2 −0 UI/MiscScreens.h
@@ -275,22 +275,25 @@ void PromptScreen::CreateViews() {
Choice *yesButton = rightColumnItems->Add(new Choice(yesButtonText_));
yesButton->OnClick.Handle(this, &PromptScreen::OnYes);
root_->SetDefaultFocusView(yesButton);
if (noButtonText_ != "")
if (!noButtonText_.empty())
rightColumnItems->Add(new Choice(noButtonText_))->OnClick.Handle(this, &PromptScreen::OnNo);
}
UI::EventReturn PromptScreen::OnYes(UI::EventParams &e) {
callback_(true);
TriggerFinish(DR_OK);
return UI::EVENT_DONE;
}
UI::EventReturn PromptScreen::OnNo(UI::EventParams &e) {
callback_(false);
TriggerFinish(DR_CANCEL);
return UI::EVENT_DONE;
}
void PromptScreen::TriggerFinish(DialogResult result) {
callback_(result == DR_OK || result == DR_YES);
UIDialogScreenWithBackground::TriggerFinish(result);
}
PostProcScreen::PostProcScreen(const std::string &title) : ListPopupScreen(title) {
I18NCategory *ps = GetI18NCategory("PostShaders");
ReloadAllPostShaderInfo();
@@ -78,6 +78,8 @@ class PromptScreen : public UIDialogScreenWithBackground {
void CreateViews() override;
void TriggerFinish(DialogResult result) override;
private:
UI::EventReturn OnYes(UI::EventParams &e);
UI::EventReturn OnNo(UI::EventParams &e);

0 comments on commit cde6b3d

Please sign in to comment.