mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-24 00:29:57 +00:00
Add "Remove From Recent" funtion,more convenient for the users.
This commit is contained in:
parent
156f9dd8f1
commit
c8603c01f8
@ -30,6 +30,7 @@
|
||||
#include "UI/MiscScreens.h"
|
||||
#include "UI/MainScreen.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/Config.h"
|
||||
|
||||
void GameScreen::CreateViews() {
|
||||
GameInfo *info = g_gameInfoCache.GetInfo(gamePath_, true);
|
||||
@ -70,6 +71,9 @@ void GameScreen::CreateViews() {
|
||||
if (host->CanCreateShortcut()) {
|
||||
rightColumnItems->Add(new Choice(ga->T("Create Shortcut")))->OnClick.Handle(this, &GameScreen::OnCreateShortcut);
|
||||
}
|
||||
if (isRecentGame(gamePath_)) {
|
||||
rightColumnItems->Add(new Choice(ga->T("Remove From Recent")))->OnClick.Handle(this, &GameScreen::OnRemoveFromRecent);
|
||||
}
|
||||
|
||||
UI::SetFocusedView(play);
|
||||
}
|
||||
@ -196,3 +200,22 @@ UI::EventReturn GameScreen::OnCreateShortcut(UI::EventParams &e) {
|
||||
}
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
bool GameScreen::isRecentGame(std::string gamePath) {
|
||||
for (auto it = g_Config.recentIsos.begin(); it != g_Config.recentIsos.end(); ++it) {
|
||||
if (!strcmp((*it).c_str(),gamePath.c_str()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
UI::EventReturn GameScreen::OnRemoveFromRecent(UI::EventParams &e) {
|
||||
for (auto it = g_Config.recentIsos.begin(); it != g_Config.recentIsos.end(); ++it) {
|
||||
if (!strcmp((*it).c_str(),gamePath_.c_str())) {
|
||||
g_Config.recentIsos.erase(it);
|
||||
screenManager()->switchScreen(new MainScreen());
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
}
|
||||
return UI::EVENT_DONE;
|
||||
}
|
@ -37,6 +37,7 @@ protected:
|
||||
virtual void DrawBackground(UIContext &dc);
|
||||
void CallbackDeleteSaveData(bool yes);
|
||||
void CallbackDeleteGame(bool yes);
|
||||
bool isRecentGame(std::string gamePath);
|
||||
|
||||
private:
|
||||
// Event handlers
|
||||
@ -46,6 +47,7 @@ private:
|
||||
UI::EventReturn OnDeleteGame(UI::EventParams &e);
|
||||
UI::EventReturn OnSwitchBack(UI::EventParams &e);
|
||||
UI::EventReturn OnCreateShortcut(UI::EventParams &e);
|
||||
UI::EventReturn OnRemoveFromRecent(UI::EventParams &e);
|
||||
|
||||
std::string gamePath_;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user