mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-15 18:49:51 +01:00
Settings: Show a chevron on choices that open another screen
Links to other pages already had one. SettingItem::OpensScreen() gives the same to choices (and custom items that are choices) that open a full screen, like control mapping or the savedata manager. Ones that open popups don't get it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
7b96bbfbc2
commit
8e72082d3e
7 files changed
+25
-17
No files matched your search
@@ -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()));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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()));
|
||||
});
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ void BuildSystemSettings(SettingsPage *page, SystemPageState *state) {
|
||||
host->PageScreenManager()->push(new MemStickScreen(false));
|
||||
});
|
||||
return memstickPath;
|
||||
}).EnabledFunc([] {
|
||||
}).OpensScreen().EnabledFunc([] {
|
||||
return !PSP_IsInited();
|
||||
});
|
||||
};
|
||||
|
||||
@@ -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()));
|
||||
});
|
||||
}
|
||||
@@ -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<UI::Choice *>(view)) {
|
||||
choice->SetIconRight(ImageID("I_CHEVRON_RIGHT"));
|
||||
}
|
||||
}
|
||||
if (item.setup) {
|
||||
item.setup(view);
|
||||
}
|
||||
|
||||
@@ -157,6 +157,8 @@ struct SettingItem {
|
||||
void (*configOnChanged)() = nullptr;
|
||||
// For tweaks the description doesn't cover, called after the view is created.
|
||||
std::function<void(UI::View *)> 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<void(UI::EventParams &)> func) { onChange = std::move(func); return *this; }
|
||||
SettingItem &OnClick(std::function<void(UI::EventParams &)> func) { onChange = std::move(func); return *this; }
|
||||
SettingItem &Setup(std::function<void(UI::View *)> 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; }
|
||||
|
||||
Reference in new issue
Block a user