From 360de9a3725283fc793b9e2df5d1cf1bed64fcfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 1 Jan 2023 21:33:11 +0100 Subject: [PATCH] RemoteISO screens: Make them dialogs so ESC works to exit them on PC. Also fix the background on the main one, and in savedata manager. See #16605 --- UI/DevScreens.h | 4 +++- UI/GameSettingsScreen.cpp | 6 +++--- UI/RemoteISOScreen.cpp | 7 +++---- UI/RemoteISOScreen.h | 10 +++++----- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/UI/DevScreens.h b/UI/DevScreens.h index 687f5e6e11..b40985e574 100644 --- a/UI/DevScreens.h +++ b/UI/DevScreens.h @@ -106,8 +106,10 @@ private: void OnCompleted(DialogResult result) override; }; -class SystemInfoScreen : public UIDialogScreenWithBackground { +class SystemInfoScreen : public UIDialogScreenWithGameBackground { public: + SystemInfoScreen(const Path &filename) : UIDialogScreenWithGameBackground(filename) {} + const char *tag() const override { return "SystemInfo"; } void CreateViews() override; diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 2210c6d901..e0d12bc974 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -1635,7 +1635,7 @@ UI::EventReturn GameSettingsScreen::OnDeveloperTools(UI::EventParams &e) { } UI::EventReturn GameSettingsScreen::OnRemoteISO(UI::EventParams &e) { - screenManager()->push(new RemoteISOScreen()); + screenManager()->push(new RemoteISOScreen(gamePath_)); return UI::EVENT_DONE; } @@ -1667,13 +1667,13 @@ UI::EventReturn GameSettingsScreen::OnTiltCustomize(UI::EventParams &e) { }; UI::EventReturn GameSettingsScreen::OnSavedataManager(UI::EventParams &e) { - auto saveData = new SavedataScreen(Path()); + auto saveData = new SavedataScreen(gamePath_); screenManager()->push(saveData); return UI::EVENT_DONE; } UI::EventReturn GameSettingsScreen::OnSysInfo(UI::EventParams &e) { - screenManager()->push(new SystemInfoScreen()); + screenManager()->push(new SystemInfoScreen(gamePath_)); return UI::EVENT_DONE; } diff --git a/UI/RemoteISOScreen.cpp b/UI/RemoteISOScreen.cpp index 26b5c7c36d..33a212f34f 100644 --- a/UI/RemoteISOScreen.cpp +++ b/UI/RemoteISOScreen.cpp @@ -263,11 +263,10 @@ static bool LoadGameList(const Path &url, std::vector &games) { return !games.empty(); } -RemoteISOScreen::RemoteISOScreen() { -} +RemoteISOScreen::RemoteISOScreen(const Path &filename) : UIDialogScreenWithGameBackground(filename) {} void RemoteISOScreen::update() { - UIScreenWithBackground::update(); + UIDialogScreenWithBackground::update(); if (!WebServerStopped(WebServerFlags::DISCS)) { auto result = IsServerAllowed(g_Config.iRemoteISOPort); @@ -414,7 +413,7 @@ void RemoteISOConnectScreen::CreateViews() { void RemoteISOConnectScreen::update() { auto ri = GetI18NCategory("RemoteISO"); - UIScreenWithBackground::update(); + UIDialogScreenWithBackground::update(); ScanStatus s = GetStatus(); switch (s) { diff --git a/UI/RemoteISOScreen.h b/UI/RemoteISOScreen.h index 53bc2706ed..49f89eb392 100644 --- a/UI/RemoteISOScreen.h +++ b/UI/RemoteISOScreen.h @@ -25,9 +25,9 @@ #include "UI/MiscScreens.h" #include "UI/MainScreen.h" -class RemoteISOScreen : public UIScreenWithBackground { +class RemoteISOScreen : public UIDialogScreenWithGameBackground { public: - RemoteISOScreen(); + RemoteISOScreen(const Path &filename); const char *tag() const override { return "RemoteISO"; } @@ -54,7 +54,7 @@ enum class ScanStatus { LOADED, }; -class RemoteISOConnectScreen : public UIScreenWithBackground { +class RemoteISOConnectScreen : public UIDialogScreenWithBackground { public: RemoteISOConnectScreen(); ~RemoteISOConnectScreen(); @@ -70,7 +70,7 @@ protected: void ExecuteLoad(); bool FindServer(std::string &resultHost, int &resultPort); - UI::TextView *statusView_; + UI::TextView *statusView_ = nullptr; ScanStatus status_ = ScanStatus::SCANNING; std::string statusMessage_; @@ -78,7 +78,7 @@ protected: std::thread *scanThread_; std::mutex statusLock_; std::string host_; - int port_; + int port_ = -1; std::string url_; std::vector games_; };