From bfab461fc4404a31dc5a52de98ab83f7998ce90d Mon Sep 17 00:00:00 2001 From: The Dax Date: Sat, 28 Jun 2014 23:44:24 -0400 Subject: [PATCH] Hide various UI options related to recent games when iMaxRecents < 0. --- UI/GameScreen.cpp | 5 +++++ UI/GameSettingsScreen.cpp | 3 ++- UI/MainScreen.cpp | 46 +++++++++++++++++++++++---------------- 3 files changed, 34 insertions(+), 20 deletions(-) diff --git a/UI/GameScreen.cpp b/UI/GameScreen.cpp index 9a38a5c877..6c9458ea03 100644 --- a/UI/GameScreen.cpp +++ b/UI/GameScreen.cpp @@ -225,6 +225,9 @@ UI::EventReturn GameScreen::OnCreateShortcut(UI::EventParams &e) { } bool GameScreen::isRecentGame(const std::string &gamePath) { + if (g_Config.iMaxRecent <= 0) + return false; + for (auto it = g_Config.recentIsos.begin(); it != g_Config.recentIsos.end(); ++it) { #ifdef _WIN32 if (!strcmpIgnore((*it).c_str(), gamePath.c_str(), "\\","/")) @@ -237,6 +240,8 @@ bool GameScreen::isRecentGame(const std::string &gamePath) { } UI::EventReturn GameScreen::OnRemoveFromRecent(UI::EventParams &e) { + if (g_Config.iMaxRecent <= 0) + return UI::EVENT_DONE; for (auto it = g_Config.recentIsos.begin(); it != g_Config.recentIsos.end(); ++it) { #ifdef _WIN32 if (!strcmpIgnore((*it).c_str(), gamePath_.c_str(), "\\","/")) { diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 42cbc0997f..de62ebc512 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -379,7 +379,8 @@ void GameSettingsScreen::CreateViews() { #endif systemSettings->Add(new CheckBox(&g_Config.bCheckForNewVersion, s->T("VersionCheck", "Check for new versions of PPSSPP"))); - systemSettings->Add(new Choice(s->T("Clear Recent Games List")))->OnClick.Handle(this, &GameSettingsScreen::OnClearRecents); + if (g_Config.iMaxRecent > 0) + systemSettings->Add(new Choice(s->T("Clear Recent Games List")))->OnClick.Handle(this, &GameSettingsScreen::OnClearRecents); systemSettings->Add(new Choice(s->T("Restore Default Settings")))->OnClick.Handle(this, &GameSettingsScreen::OnRestoreDefaultSettings); systemSettings->Add(new CheckBox(&g_Config.bEnableAutoLoad, s->T("Auto Load Newest Savestate"))); diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index aac12c62ee..5d08d9b92b 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -732,13 +732,21 @@ void MainScreen::CreateViews() { leftColumn->SetClip(true); - ScrollView *scrollRecentGames = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); + if (g_Config.iMaxRecent > 0) { + ScrollView *scrollRecentGames = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); + GameBrowser *tabRecentGames = new GameBrowser( + "!RECENT", false, &g_Config.bGridView1, "", "", 0, + new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); + scrollRecentGames->Add(tabRecentGames); + leftColumn->AddTab(m->T("Recent"), scrollRecentGames); + tabRecentGames->OnChoice.Handle(this, &MainScreen::OnGameSelectedInstant); + tabRecentGames->OnHoldChoice.Handle(this, &MainScreen::OnGameSelected); + tabRecentGames->OnHighlight.Handle(this, &MainScreen::OnGameHighlight); + } + ScrollView *scrollAllGames = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); ScrollView *scrollHomebrew = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); - GameBrowser *tabRecentGames = new GameBrowser( - "!RECENT", false, &g_Config.bGridView1, "", "", 0, - new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); GameBrowser *tabAllGames = new GameBrowser(g_Config.currentDirectory, true, &g_Config.bGridView2, m->T("How to get games"), "http://www.ppsspp.org/getgames.html", 0, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); @@ -752,27 +760,24 @@ void MainScreen::CreateViews() { hbStore->OnClick.Handle(this, &MainScreen::OnHomebrewStore); } - scrollRecentGames->Add(tabRecentGames); scrollAllGames->Add(tabAllGames); scrollHomebrew->Add(tabHomebrew); - leftColumn->AddTab(m->T("Recent"), scrollRecentGames); leftColumn->AddTab(m->T("Games"), scrollAllGames); leftColumn->AddTab(m->T("Homebrew & Demos"), scrollHomebrew); - tabRecentGames->OnChoice.Handle(this, &MainScreen::OnGameSelectedInstant); tabAllGames->OnChoice.Handle(this, &MainScreen::OnGameSelectedInstant); tabHomebrew->OnChoice.Handle(this, &MainScreen::OnGameSelectedInstant); - tabRecentGames->OnHoldChoice.Handle(this, &MainScreen::OnGameSelected); + tabAllGames->OnHoldChoice.Handle(this, &MainScreen::OnGameSelected); tabHomebrew->OnHoldChoice.Handle(this, &MainScreen::OnGameSelected); - tabRecentGames->OnHighlight.Handle(this, &MainScreen::OnGameHighlight); + tabAllGames->OnHighlight.Handle(this, &MainScreen::OnGameHighlight); tabHomebrew->OnHighlight.Handle(this, &MainScreen::OnGameHighlight); if (g_Config.recentIsos.size() > 0) { leftColumn->SetCurrentTab(0); - } else { + } else if (g_Config.iMaxRecent > 0) { leftColumn->SetCurrentTab(1); } @@ -1245,25 +1250,28 @@ void UmdReplaceScreen::CreateViews() { rightColumnItems->SetSpacing(0.0f); rightColumn->Add(rightColumnItems); - ScrollView *scrollRecentGames = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); + if (g_Config.iMaxRecent > 0) { + ScrollView *scrollRecentGames = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); + GameBrowser *tabRecentGames = new GameBrowser( + "!RECENT", false, &g_Config.bGridView1, "", "", 0, + new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); + scrollRecentGames->Add(tabRecentGames); + leftColumn->AddTab(m->T("Recent"), scrollRecentGames); + tabRecentGames->OnChoice.Handle(this, &UmdReplaceScreen::OnGameSelectedInstant); + tabRecentGames->OnHoldChoice.Handle(this, &UmdReplaceScreen::OnGameSelected); + } ScrollView *scrollAllGames = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); - GameBrowser *tabRecentGames = new GameBrowser( - "!RECENT", false, &g_Config.bGridView1, "", "", 0, - new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); GameBrowser *tabAllGames = new GameBrowser(g_Config.currentDirectory, true, &g_Config.bGridView2, m->T("How to get games"), "http://www.ppsspp.org/getgames.html", 0, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); - scrollRecentGames->Add(tabRecentGames); scrollAllGames->Add(tabAllGames); - leftColumn->AddTab(m->T("Recent"), scrollRecentGames); leftColumn->AddTab(m->T("Games"), scrollAllGames); - tabRecentGames->OnChoice.Handle(this, &UmdReplaceScreen::OnGameSelectedInstant); tabAllGames->OnChoice.Handle(this, &UmdReplaceScreen::OnGameSelectedInstant); - tabRecentGames->OnHoldChoice.Handle(this, &UmdReplaceScreen::OnGameSelected); + tabAllGames->OnHoldChoice.Handle(this, &UmdReplaceScreen::OnGameSelected); rightColumnItems->Add(new Choice(d->T("Cancel")))->OnClick.Handle(this, &UmdReplaceScreen::OnCancel); @@ -1271,7 +1279,7 @@ void UmdReplaceScreen::CreateViews() { if (g_Config.recentIsos.size() > 0) { leftColumn->SetCurrentTab(0); - }else{ + } else if (g_Config.iMaxRecent > 0) { leftColumn->SetCurrentTab(1); }