Move clear game list to new menu

This commit is contained in:
iota97 2020-03-02 08:34:26 +01:00
parent e3c130d238
commit d8405b6f5b
4 changed files with 37 additions and 37 deletions

View File

@ -722,9 +722,6 @@ void GameSettingsScreen::CreateViews() {
#endif
systemSettings->Add(new CheckBox(&g_Config.bCheckForNewVersion, sy->T("VersionCheck", "Check for new versions of PPSSPP")));
if (g_Config.iMaxRecent > 0)
systemSettings->Add(new Choice(sy->T("Clear Recent Games List")))->OnClick.Handle(this, &GameSettingsScreen::OnClearRecents);
const std::string bgPng = GetSysDirectory(DIRECTORY_SYSTEM) + "background.png";
const std::string bgJpg = GetSysDirectory(DIRECTORY_SYSTEM) + "background.jpg";
if (File::Exists(bgPng) || File::Exists(bgJpg)) {
@ -988,12 +985,6 @@ UI::EventReturn GameSettingsScreen::OnSavePathOther(UI::EventParams &e) {
#endif
UI::EventReturn GameSettingsScreen::OnClearRecents(UI::EventParams &e) {
g_Config.recentIsos.clear();
OnRecentChanged.Trigger(e);
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnChangeBackground(UI::EventParams &e) {
const std::string bgPng = GetSysDirectory(DIRECTORY_SYSTEM) + "background.png";
const std::string bgJpg = GetSysDirectory(DIRECTORY_SYSTEM) + "background.jpg";

View File

@ -36,7 +36,6 @@ public:
void onFinish(DialogResult result) override;
void sendMessage(const char *message, const char *value) override;
std::string tag() const override { return "settings"; }
UI::Event OnRecentChanged;
protected:
void CreateViews() override;
@ -86,7 +85,6 @@ private:
UI::EventReturn OnChangeNickname(UI::EventParams &e);
UI::EventReturn OnChangeproAdhocServerAddress(UI::EventParams &e);
UI::EventReturn OnChangeMacAddress(UI::EventParams &e);
UI::EventReturn OnClearRecents(UI::EventParams &e);
UI::EventReturn OnChangeBackground(UI::EventParams &e);
UI::EventReturn OnFullscreenChange(UI::EventParams &e);
UI::EventReturn OnDisplayLayoutEditor(UI::EventParams &e);

View File

@ -861,6 +861,25 @@ UI::EventReturn GameBrowser::NavigateClick(UI::EventParams &e) {
return UI::EVENT_DONE;
}
UI::EventReturn GameBrowser::GridSettingsClick(UI::EventParams &e) {
auto sy = GetI18NCategory("System");
auto gridSettings = new GridSettingsScreen(sy->T("Games list settings"));
gridSettings->OnRecentChanged.Handle(this, &GameBrowser::OnRecentClear);
if (e.v)
gridSettings->SetPopupOrigin(e.v);
screenManager_->push(gridSettings);
return UI::EVENT_DONE;
}
UI::EventReturn GameBrowser::OnRecentClear(UI::EventParams &e) {
screenManager_->RecreateAllViews();
if (host) {
host->UpdateUI();
}
return UI::EVENT_DONE;
}
MainScreen::MainScreen() : highlightProgress_(0.0f), prevHighlightProgress_(0.0f), backFromStore_(false), lockBackgroundAudio_(false) {
System_SendMessage("event", "mainscreen");
SetBackgroundAudioGame("");
@ -1267,27 +1286,7 @@ UI::EventReturn MainScreen::OnGameSelectedInstant(UI::EventParams &e) {
}
UI::EventReturn MainScreen::OnGameSettings(UI::EventParams &e) {
auto gameSettings = new GameSettingsScreen("", "");
gameSettings->OnRecentChanged.Handle(this, &MainScreen::OnRecentChange);
screenManager()->push(gameSettings);
return UI::EVENT_DONE;
}
UI::EventReturn MainScreen::OnRecentChange(UI::EventParams &e) {
RecreateViews();
if (host) {
host->UpdateUI();
}
return UI::EVENT_DONE;
}
UI::EventReturn GameBrowser::GridSettingsClick(UI::EventParams &e) {
auto sy = GetI18NCategory("System");
auto *gridSettings = new GridSettingsScreen(sy->T("Games list settings"));
if (e.v)
gridSettings->SetPopupOrigin(e.v);
screenManager_->push(gridSettings);
screenManager()->push(new GameSettingsScreen("", ""));
return UI::EVENT_DONE;
}
@ -1456,7 +1455,6 @@ void GridSettingsScreen::CreatePopupContents(UI::ViewGroup *parent) {
ScrollView *scroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, 1.0f));
LinearLayout *items = new LinearLayout(ORIENT_VERTICAL);
items->Add(new ItemHeader(sy->T("View style")));
items->Add(new CheckBox(&g_Config.bGridView1, sy->T("Display Recent on a grid")));
items->Add(new CheckBox(&g_Config.bGridView2, sy->T("Display Games on a grid")));
items->Add(new CheckBox(&g_Config.bGridView3, sy->T("Display Homebrew on a grid")));
@ -1465,9 +1463,14 @@ void GridSettingsScreen::CreatePopupContents(UI::ViewGroup *parent) {
items->Add(new Choice(sy->T("Increase size")))->OnClick.Handle(this, &GridSettingsScreen::GridPlusClick);
items->Add(new Choice(sy->T("Decrease size")))->OnClick.Handle(this, &GridSettingsScreen::GridMinusClick);
items->Add(new ItemHeader(sy->T("Extra info")));
items->Add(new CheckBox(&g_Config.bShowIDOnGameIcon, sy->T("Show ID on game selection screen")));
items->Add(new CheckBox(&g_Config.bShowRegionOnGameIcon, sy->T("Show region flag on game selection screen")));
items->Add(new ItemHeader(sy->T("Display Extra Info")));
items->Add(new CheckBox(&g_Config.bShowIDOnGameIcon, sy->T("Show ID")));
items->Add(new CheckBox(&g_Config.bShowRegionOnGameIcon, sy->T("Show region flag")));
if (g_Config.iMaxRecent > 0) {
items->Add(new ItemHeader(sy->T("Clear Recent")));
items->Add(new Choice(sy->T("Clear Recent Games List")))->OnClick.Handle(this, &GridSettingsScreen::OnRecentClearClick);
}
scroll->Add(items);
parent->Add(scroll);
@ -1482,3 +1485,9 @@ UI::EventReturn GridSettingsScreen::GridMinusClick(UI::EventParams &e) {
g_Config.fGameGridScale = std::max(g_Config.fGameGridScale/1.25f, MIN_GAME_GRID_SCALE);
return UI::EVENT_DONE;
}
UI::EventReturn GridSettingsScreen::OnRecentClearClick(UI::EventParams &e) {
g_Config.recentIsos.clear();
OnRecentChanged.Trigger(e);
return UI::EVENT_DONE;
}

View File

@ -80,6 +80,7 @@ private:
UI::EventReturn HomeClick(UI::EventParams &e);
UI::EventReturn PinToggleClick(UI::EventParams &e);
UI::EventReturn GridSettingsClick(UI::EventParams &e);
UI::EventReturn OnRecentClear(UI::EventParams &e);
UI::ViewGroup *gameList_ = nullptr;
PathBrowser path_;
@ -123,7 +124,6 @@ protected:
// Event handlers
UI::EventReturn OnLoadFile(UI::EventParams &e);
UI::EventReturn OnGameSettings(UI::EventParams &e);
UI::EventReturn OnRecentChange(UI::EventParams &e);
UI::EventReturn OnCredits(UI::EventParams &e);
UI::EventReturn OnSupport(UI::EventParams &e);
UI::EventReturn OnPPSSPPOrg(UI::EventParams &e);
@ -173,10 +173,12 @@ class GridSettingsScreen : public PopupScreen {
public:
GridSettingsScreen(std::string label) : PopupScreen(label) {}
void CreatePopupContents(UI::ViewGroup *parent) override;
UI::Event OnRecentChanged;
private:
UI::EventReturn GridPlusClick(UI::EventParams &e);
UI::EventReturn GridMinusClick(UI::EventParams &e);
UI::EventReturn OnRecentClearClick(UI::EventParams &e);
const float MAX_GAME_GRID_SCALE = 3.0;
const float MIN_GAME_GRID_SCALE = 0.8;
};