diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 796c61cf28..94b34e84ae 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -70,6 +70,8 @@ public: virtual void Draw(UIContext &dc); + UI::Event OnChoice; + private: void UpdateText(); EventReturn HandleClick(EventParams &e); @@ -105,6 +107,11 @@ void PopupMultiChoice::ChoiceCallback(int num) { if (num != -1) { *value_ = num + minVal_; UpdateText(); + + UI::EventParams e; + e.v = this; + e.a = num; + OnChoice.Trigger(e); } } @@ -233,7 +240,7 @@ void GameSettingsScreen::CreateViews() { graphicsSettings->Add(new ItemHeader(gs->T("Rendering Mode"))); static const char *renderingMode[] = { "Non-Buffered Rendering", "Buffered Rendering", "Read Framebuffers To Memory (CPU)", "Read Framebuffers To Memory (GPU)"}; - graphicsSettings->Add(new PopupMultiChoice(&g_Config.iRenderingMode, gs->T("Mode"), renderingMode, 0, 4, gs, screenManager())); + graphicsSettings->Add(new PopupMultiChoice(&g_Config.iRenderingMode, gs->T("Mode"), renderingMode, 0, 4, gs, screenManager()))->OnChoice.Handle(this, &GameSettingsScreen::OnRenderingMode); graphicsSettings->Add(new ItemHeader(gs->T("Frame Rate Control"))); static const char *frameSkip[] = {"Off", "Auto", "1", "2", "3", "4", "5", "6", "7", "8"}; @@ -369,7 +376,9 @@ void GameSettingsScreen::CreateViews() { systemSettings->Add(new Choice(s->T("Change Nickname")))->OnClick.Handle(this, &GameSettingsScreen::OnChangeNickname); #endif systemSettings->Add(new Choice(s->T("Clear Recent Games List")))->OnClick.Handle(this, &GameSettingsScreen::OnClearRecents); - systemSettings->Add(new CheckBox(&enableReports_, s->T("Enable Compatibility Server Reports")))->SetEnabled(Reporting::IsSupported()); + enableReportsCheckbox_ = new CheckBox(&enableReports_, s->T("Enable Compatibility Server Reports")); + enableReportsCheckbox_->SetEnabled(Reporting::IsSupported()); + systemSettings->Add(enableReportsCheckbox_); systemSettings->Add(new Choice(s->T("Developer Tools")))->OnClick.Handle(this, &GameSettingsScreen::OnDeveloperTools); @@ -395,6 +404,12 @@ UI::EventReturn GameSettingsScreen::OnReloadCheats(UI::EventParams &e) { return UI::EVENT_DONE; } +UI::EventReturn GameSettingsScreen::OnRenderingMode(UI::EventParams &e) { + enableReports_ = Reporting::IsEnabled(); + enableReportsCheckbox_->SetEnabled(Reporting::IsSupported()); + return UI::EVENT_DONE; +} + void DrawBackground(float alpha); UI::EventReturn GameSettingsScreen::OnDumpNextFrameToLog(UI::EventParams &e) { diff --git a/UI/GameSettingsScreen.h b/UI/GameSettingsScreen.h index 28485060a7..9689256fb8 100644 --- a/UI/GameSettingsScreen.h +++ b/UI/GameSettingsScreen.h @@ -39,6 +39,7 @@ private: // As we load metadata in the background, we need to be able to update these after the fact. UI::TextView *tvTitle_; UI::TextView *tvGameSize_; + UI::CheckBox *enableReportsCheckbox_; // Event handlers UI::EventReturn OnDownloadPlugin(UI::EventParams &e); @@ -53,6 +54,7 @@ private: UI::EventReturn OnDeveloperTools(UI::EventParams &e); UI::EventReturn OnChangeNickname(UI::EventParams &e); UI::EventReturn OnClearRecents(UI::EventParams &e); + UI::EventReturn OnRenderingMode(UI::EventParams &e); // Temporaries to convert bools to int settings bool cap60FPS_;