diff --git a/UI/DeveloperSettingsPages.cpp b/UI/DeveloperSettingsPages.cpp index e8ad99d11a..82ac37b5dc 100644 --- a/UI/DeveloperSettingsPages.cpp +++ b/UI/DeveloperSettingsPages.cpp @@ -182,7 +182,7 @@ static void BuildGeneralPage(SettingsPage *page) { // Experimental, so not translated yet. page->Setting(&g_Config.bEmulateMediaEngine); - page->Choice("JIT debug tools").OnClick([host](UI::EventParams &e) { + page->Choice("JIT debug tools").OpensScreen().OnClick([host](UI::EventParams &e) { OnJitDebugTools(host); }); page->Setting(&g_Config.bShowDeveloperMenu); @@ -195,7 +195,7 @@ static void BuildGeneralPage(SettingsPage *page) { page->Header({ I18NCat::MAINSETTINGS, "General" }); page->Bool(&g_Config.bEnableLogging, "Enable Logging").OnChange(&OnLoggingChanged); - page->Choice("Logging Channels").OnClick([host](UI::EventParams &e) { + page->Choice("Logging Channels").OpensScreen().OnClick([host](UI::EventParams &e) { host->PageScreenManager()->push(new LogConfigScreen()); }); page->Setting(&g_Config.bEnableFileLogging).Enabled(&g_Config.bEnableLogging); @@ -283,10 +283,10 @@ static void BuildTestsPage(SettingsPage *page) { using namespace UI; SettingsPageHost *host = page->Host(); - page->Choice("Touchscreen Test").OnClick([host](UI::EventParams &e) { + page->Choice("Touchscreen Test").OpensScreen().OnClick([host](UI::EventParams &e) { host->PageScreenManager()->push(new TouchTestScreen(host->PageGamePath())); }); - page->Choice("Framedump tests").OnClick([host](UI::EventParams &e) { + page->Choice("Framedump tests").OpensScreen().OnClick([host](UI::EventParams &e) { host->PageScreenManager()->push(new FrameDumpTestScreen()); }).EnabledFunc([] { return !PSP_IsInited(); @@ -294,7 +294,7 @@ static void BuildTestsPage(SettingsPage *page) { // For now, we only implement GPU driver tests for Vulkan and OpenGL. This is simply // because the D3D drivers are generally solid enough to not need this type of investigation. if (g_Config.iGPUBackend == (int)GPUBackend::VULKAN || g_Config.iGPUBackend == (int)GPUBackend::OPENGL) { - page->Choice("GPU Driver Test").OnClick([host](UI::EventParams &e) { + page->Choice("GPU Driver Test").OpensScreen().OnClick([host](UI::EventParams &e) { OnGPUDriverTest(host); }); } @@ -541,7 +541,7 @@ static void BuildGraphicsPage(SettingsPage *page) { } if (GetGPUBackend() == GPUBackend::VULKAN && SupportsCustomDriver()) { - page->Choice({ I18NCat::GRAPHICS, "AdrenoTools driver manager" }).OnClick([host](UI::EventParams &e) { + page->Choice({ I18NCat::GRAPHICS, "AdrenoTools driver manager" }).OpensScreen().OnClick([host](UI::EventParams &e) { host->PageScreenManager()->push(new DriverManagerScreen(host->PageGamePath())); }); } diff --git a/UI/Settings/ControlsPage.cpp b/UI/Settings/ControlsPage.cpp index 2ca334fc0c..7c68dc3bbd 100644 --- a/UI/Settings/ControlsPage.cpp +++ b/UI/Settings/ControlsPage.cpp @@ -40,10 +40,10 @@ void BuildControlsSettings(SettingsPage *page) { int deviceType = System_GetPropertyInt(SYSPROP_DEVICE_TYPE); page->Header({ I18NCat::MAINSETTINGS, "Controls" }); - page->Choice("Control mapping").OnClick([host](UI::EventParams &e) { + page->Choice("Control mapping").OpensScreen().OnClick([host](UI::EventParams &e) { host->PageScreenManager()->push(new ControlMappingScreen(host->PageGamePath())); }); - page->Choice("Calibrate analog stick").OnClick([host](UI::EventParams &e) { + page->Choice("Calibrate analog stick").OpensScreen().OnClick([host](UI::EventParams &e) { host->PageScreenManager()->push(new AnalogCalibrationScreen(host->PageGamePath())); }); @@ -70,7 +70,7 @@ void BuildControlsSettings(SettingsPage *page) { host->PageScreenManager()->push(new TiltAnalogSettingsScreen(host->PageGamePath())); }); return customizeTilt; - }); + }).OpensScreen(); } else if (System_GetPropertyInt(SYSPROP_DEVICE_TYPE) == DEVICE_TYPE_VR) { // TODO: This seems like a regression page->Setting(&g_Config.bHapticFeedback); } @@ -83,10 +83,10 @@ void BuildControlsSettings(SettingsPage *page) { if ((deviceType != DEVICE_TYPE_TV) && (deviceType != DEVICE_TYPE_VR)) { page->Header("On-screen touch controls"); page->Setting(&g_Config.bShowTouchControls); - page->Choice("Edit touch control layout").OnClick([host](UI::EventParams &e) { + page->Choice("Edit touch control layout").OpensScreen().OnClick([host](UI::EventParams &e) { host->PageScreenManager()->push(new TouchControlLayoutScreen(host->PageGamePath())); }).Enabled(&g_Config.bShowTouchControls); - page->Choice("Gesture mapping").OnClick([host](UI::EventParams &e) { + page->Choice("Gesture mapping").OpensScreen().OnClick([host](UI::EventParams &e) { host->PageScreenManager()->push(new GestureMappingScreen(host->PageGamePath())); }).Enabled(&g_Config.bShowTouchControls); diff --git a/UI/Settings/GraphicsPage.cpp b/UI/Settings/GraphicsPage.cpp index ddc30ff9ec..21e968180a 100644 --- a/UI/Settings/GraphicsPage.cpp +++ b/UI/Settings/GraphicsPage.cpp @@ -250,7 +250,7 @@ void BuildGraphicsSettings(SettingsPage *page) { page->Header("Display"); // Display Layout Editor: To avoid overlapping touch controls on large tablets, meet geeky demands for integer zoom/unstretched image etc. - page->Choice("Display layout & effects").OnClick([host](UI::EventParams &) { + page->Choice("Display layout & effects").OpensScreen().OnClick([host](UI::EventParams &) { host->PageScreenManager()->push(new DisplayLayoutScreen(host->PageGamePath())); }); diff --git a/UI/Settings/SystemPage.cpp b/UI/Settings/SystemPage.cpp index d309e0b58a..44befcf7de 100644 --- a/UI/Settings/SystemPage.cpp +++ b/UI/Settings/SystemPage.cpp @@ -233,7 +233,7 @@ void BuildSystemSettings(SettingsPage *page, SystemPageState *state) { host->PageScreenManager()->push(new MemStickScreen(false)); }); return memstickPath; - }).EnabledFunc([] { + }).OpensScreen().EnabledFunc([] { return !PSP_IsInited(); }); }; diff --git a/UI/Settings/ToolsPage.cpp b/UI/Settings/ToolsPage.cpp index 951fea7485..3dc168178f 100644 --- a/UI/Settings/ToolsPage.cpp +++ b/UI/Settings/ToolsPage.cpp @@ -44,17 +44,17 @@ void BuildToolsSettings(SettingsPage *page) { } // These were moved here so use the wrong translation objects, to avoid having to change all inis... This isn't a sustainable situation :P - page->Choice({ I18NCat::SAVEDATA, "Savedata Manager" }).OnClick([host](UI::EventParams &) { + page->Choice({ I18NCat::SAVEDATA, "Savedata Manager" }).OpensScreen().OnClick([host](UI::EventParams &) { host->PageScreenManager()->push(new SavedataScreen(host->PageGamePath())); }); - page->Choice({ I18NCat::DEVELOPER, "System Information" }).OnClick([host](UI::EventParams &) { + page->Choice({ I18NCat::DEVELOPER, "System Information" }).OpensScreen().OnClick([host](UI::EventParams &) { host->PageScreenManager()->push(new SystemInfoScreen(host->PageGamePath())); }); page->Link({ I18NCat::SYSTEM, "Developer Tools" }, I18NCat::DEVELOPER, &BuildDeveloperToolsPage); - page->Choice({ I18NCat::REMOTEISO, "Remote disc streaming" }).OnClick([host](UI::EventParams &) { + page->Choice({ I18NCat::REMOTEISO, "Remote disc streaming" }).OpensScreen().OnClick([host](UI::EventParams &) { host->PageScreenManager()->push(new RemoteISOScreen(host->PageGamePath())); }); - page->Choice({ I18NCat::SYSTEM, "PSP Firmware" }).OnClick([host](UI::EventParams &) { + page->Choice({ I18NCat::SYSTEM, "PSP Firmware" }).OpensScreen().OnClick([host](UI::EventParams &) { host->PageScreenManager()->push(new FirmwareScreen(host->PageGamePath())); }); } diff --git a/UI/SettingsPage.cpp b/UI/SettingsPage.cpp index 01ba58a31b..f3466fcf8f 100644 --- a/UI/SettingsPage.cpp +++ b/UI/SettingsPage.cpp @@ -347,6 +347,11 @@ static UI::View *CreateSettingView(const SettingItem &item, I18NCat pageCat, UI: } else if (item.disabledPtr) { view->SetDisabledPtr(item.disabledPtr); } + if (item.opensScreen) { + if (UI::Choice *choice = dynamic_cast(view)) { + choice->SetIconRight(ImageID("I_CHEVRON_RIGHT")); + } + } if (item.setup) { item.setup(view); } diff --git a/UI/SettingsPage.h b/UI/SettingsPage.h index a7a0e5b9cf..5d4c631582 100644 --- a/UI/SettingsPage.h +++ b/UI/SettingsPage.h @@ -157,6 +157,8 @@ struct SettingItem { void (*configOnChanged)() = nullptr; // For tweaks the description doesn't cover, called after the view is created. std::function setup; + // Choice or Custom (if its view is a Choice) that opens another screen: shows the same chevron as a Link. + bool opensScreen = false; SettingItem &Enabled(bool *ptr) { enabledPtr = ptr; return *this; } SettingItem &Disabled(bool *ptr) { disabledPtr = ptr; return *this; } @@ -164,6 +166,7 @@ struct SettingItem { SettingItem &OnChange(std::function func) { onChange = std::move(func); return *this; } SettingItem &OnClick(std::function func) { onChange = std::move(func); return *this; } SettingItem &Setup(std::function func) { setup = std::move(func); return *this; } + SettingItem &OpensScreen() { opensScreen = true; return *this; } SettingItem &Default(int value) { defaultValue = value; hasDefault = true; return *this; } SettingItem &Step(int value) { step = value; return *this; } SettingItem &Format(std::string_view fmt) { format = fmt; return *this; }