From d073dae00bad89b5f59a90388d18b1adf1c1f3b2 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Fri, 9 Apr 2021 19:16:27 +0200 Subject: [PATCH] A dummy entry is now displayed in the game options menu if the system has no games. --- es-app/src/guis/GuiGamelistOptions.cpp | 27 ++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/es-app/src/guis/GuiGamelistOptions.cpp b/es-app/src/guis/GuiGamelistOptions.cpp index ef428eb7d..1641eba9d 100644 --- a/es-app/src/guis/GuiGamelistOptions.cpp +++ b/es-app/src/guis/GuiGamelistOptions.cpp @@ -142,7 +142,7 @@ GuiGamelistOptions::GuiGamelistOptions( } // Add the filters entry, unless this is the grouped custom collections system or if there - // are no games (which should only happen for ungrouped custom collections). + // are no games for the system. if (!mIsCustomCollectionGroup && system->getRootFolder()->getChildren().size() > 0) { if (system->getName() != "recent" && Settings::getInstance()->getBool("GamelistFilters")) { row.elements.clear(); @@ -153,6 +153,16 @@ GuiGamelistOptions::GuiGamelistOptions( mMenu.addRow(row); } } + // Add a dummy entry when applicable as the menu looks quite ugly if it's just blank. + else if (!CollectionSystemsManager::get()->isEditing() && + mSystem->getRootFolder()->getChildren().size() == 0 && + !mIsCustomCollectionGroup && !mIsCustomCollection) { + row.elements.clear(); + row.addElement(std::make_shared + (mWindow, "THIS SYSTEM HAS NO GAMES", + Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true); + mMenu.addRow(row); + } std::string customSystem; if (Settings::getInstance()->getBool("UseCustomCollectionsSystem")) @@ -207,7 +217,8 @@ GuiGamelistOptions::GuiGamelistOptions( } // Buttons. Logic to apply or cancel settings are handled by the destructor. - mMenu.addButton("APPLY", "apply", [&] { delete this; }); + if (!(!mIsCustomCollectionGroup && system->getRootFolder()->getChildren().size() == 0)) + mMenu.addButton("APPLY", "apply", [&] { delete this; }); mMenu.addButton("CANCEL", "cancel", [&] { mCancelled = true; delete this; }); // Center the menu. @@ -272,7 +283,8 @@ GuiGamelistOptions::~GuiGamelistOptions() } } - NavigationSounds::getInstance()->playThemeNavigationSound(SCROLLSOUND); + if (mSystem->getRootFolder()->getChildren().size() != 0) + NavigationSounds::getInstance()->playThemeNavigationSound(SCROLLSOUND); } void GuiGamelistOptions::openGamelistFilter() @@ -318,12 +330,16 @@ void GuiGamelistOptions::startEditMode() ViewController::get()->getGameListView((*it))->getCursor(), false); } + if (mSystem->getRootFolder()->getChildren().size() == 0) + NavigationSounds::getInstance()->playThemeNavigationSound(SCROLLSOUND); delete this; } void GuiGamelistOptions::exitEditMode() { CollectionSystemsManager::get()->exitEditMode(); + if (mSystem->getRootFolder()->getChildren().size() == 0) + NavigationSounds::getInstance()->playThemeNavigationSound(SCROLLSOUND); delete this; } @@ -501,7 +517,10 @@ std::vector GuiGamelistOptions::getHelpPrompts() { auto prompts = mMenu.getHelpPrompts(); prompts.push_back(HelpPrompt("a", "select")); - prompts.push_back(HelpPrompt("b", "close (apply)")); + if (mSystem->getRootFolder()->getChildren().size() != 0) + prompts.push_back(HelpPrompt("b", "close (apply)")); + else + prompts.push_back(HelpPrompt("b", "close (cancel)")); prompts.push_back(HelpPrompt("select", "close (cancel)")); return prompts; }