mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-31 03:26:47 +01:00
Clean up the OSD click callback code
This commit is contained in:
1 parent
4ccd41110b
commit
a92ff89d5f
9 files changed
+43
-95
No files matched your search
@@ -393,11 +393,9 @@ void DeveloperToolsScreen::CreateUITab(UI::LinearLayout *list) {
|
||||
// This one is clickable
|
||||
list->Add(new Choice(si->T("Success")))->OnClick.Add([&](UI::EventParams &) {
|
||||
g_OSD.Show(OSDType::MESSAGE_SUCCESS, "Success", 0.0f, "clickable");
|
||||
g_OSD.SetClickCallback("clickable", [](bool clicked, void *) {
|
||||
if (clicked) {
|
||||
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.google.com/");
|
||||
}
|
||||
}, nullptr);
|
||||
g_OSD.SetClickCallback("clickable", []() {
|
||||
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.google.com/");
|
||||
});
|
||||
});
|
||||
list->Add(new Choice(sy->T("RetroAchievements")))->OnClick.Add([&](UI::EventParams &) {
|
||||
g_OSD.Show(OSDType::MESSAGE_WARNING, "RetroAchievements warning", "", "I_RETROACHIEVEMENTS_LOGO");
|
||||
|
||||
+4
-3
@@ -1574,9 +1574,10 @@ void EmuScreen::HandleFlip() {
|
||||
auto sy = GetI18NCategory(I18NCat::SYSTEM);
|
||||
avi.Stop();
|
||||
g_OSD.Show(OSDType::MESSAGE_INFO, sy->T("AVI Dump stopped."), 3.0f, "avi_dump");
|
||||
g_OSD.SetClickCallback("avi_dump", [](bool, void *) {
|
||||
System_ShowFileInFolder(avi.LastFilename());
|
||||
}, nullptr);
|
||||
Path lastFilename = avi.LastFilename();
|
||||
g_OSD.SetClickCallback("avi_dump", [lastFilename]() {
|
||||
System_ShowFileInFolder(lastFilename);
|
||||
});
|
||||
startDumping_ = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -251,7 +251,11 @@ std::string GameInfo::GetMTime() const {
|
||||
// Not too meaningful if the object itself is a savedata directory...
|
||||
// Call this under lock.
|
||||
std::vector<Path> GameInfo::GetSaveDataDirectories() {
|
||||
_dbg_assert_(hasFlags & GameInfoFlags::PARAM_SFO); // so we know we have the ID.
|
||||
if (!(hasFlags & GameInfoFlags::PARAM_SFO)) {
|
||||
ERROR_LOG(Log::UI, "Can't get savedata directories if we don't have PARAM_SFO.");
|
||||
return std::vector<Path>();
|
||||
}
|
||||
|
||||
Path memc = GetSysDirectory(DIRECTORY_SAVEDATA);
|
||||
|
||||
std::vector<Path> directories;
|
||||
|
||||
@@ -18,11 +18,9 @@ private:
|
||||
// Uses the current ListType
|
||||
void FillBlockList();
|
||||
|
||||
UI::LinearLayout *comparisonView_ = nullptr;
|
||||
UI::LinearLayout *leftDisasm_ = nullptr;
|
||||
UI::LinearLayout *rightDisasm_ = nullptr;
|
||||
|
||||
UI::LinearLayout *blockListView_ = nullptr;
|
||||
UI::LinearLayout *blockListContainer_ = nullptr;
|
||||
|
||||
void OnSelectBlock(UI::EventParams &e);
|
||||
|
||||
+7
-14
@@ -846,12 +846,10 @@ bool NativeInitGraphics(GraphicsContext *graphicsContext) {
|
||||
// This is a warning, not an error.
|
||||
auto g = GetI18NCategory(I18NCat::GRAPHICS);
|
||||
g_OSD.Show(OSDType::MESSAGE_WARNING, ApplySafeSubstitutions(g->T("Your display is set to a low refresh rate: %1 Hz. 60 Hz or higher is recommended."), (int)displayHz), 8.0f, "low_refresh");
|
||||
g_OSD.SetClickCallback("low_refresh", [](bool clicked, void *) {
|
||||
if (clicked) {
|
||||
// Open the display settings.
|
||||
System_OpenDisplaySettings();
|
||||
}
|
||||
}, nullptr);
|
||||
g_OSD.SetClickCallback("low_refresh", []() {
|
||||
// Open the display settings.
|
||||
System_OpenDisplaySettings();
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1016,14 +1014,9 @@ static void TakeScreenshot(Draw::DrawContext *draw) {
|
||||
if (success) {
|
||||
g_OSD.Show(OSDType::MESSAGE_FILE_LINK, filename.ToVisualString(), 0.0f, "screenshot_link");
|
||||
if (System_GetPropertyBool(SYSPROP_CAN_SHOW_FILE)) {
|
||||
g_OSD.SetClickCallback("screenshot_link", [](bool clicked, void *data) -> void {
|
||||
Path *path = reinterpret_cast<Path *>(data);
|
||||
if (clicked) {
|
||||
System_ShowFileInFolder(*path);
|
||||
} else {
|
||||
delete path;
|
||||
}
|
||||
}, new Path(filename));
|
||||
g_OSD.SetClickCallback("screenshot_link", [filename]() -> void {
|
||||
System_ShowFileInFolder(filename);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
auto err = GetI18NCategory(I18NCat::ERRORS);
|
||||
|
||||
Reference in new issue
Block a user