From 7686f87d5d4daccad462d62f09351b1f251fdd18 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sun, 17 May 2020 19:30:29 +0200 Subject: [PATCH] Added proper Unicode star icon when jumping to favorite games using the 'Jump to...' quick selector --- THEMES.md | 2 ++ es-app/src/guis/GuiGamelistOptions.cpp | 10 +++++----- es-app/src/guis/GuiGamelistOptions.h | 6 +++--- es-app/src/views/gamelist/BasicGameListView.cpp | 8 ++++---- es-app/src/views/gamelist/BasicGameListView.h | 3 +++ 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/THEMES.md b/THEMES.md index 5c401593b..b9002f3cf 100644 --- a/THEMES.md +++ b/THEMES.md @@ -285,6 +285,7 @@ May 12 21:12:37 lvl2: [selectSound] found, ready to play sound file Example navigationsounds.xml, to be included from the main theme file: +```xml 5 @@ -313,6 +314,7 @@ Example navigationsounds.xml, to be included from the main theme file: +``` #### Defaults diff --git a/es-app/src/guis/GuiGamelistOptions.cpp b/es-app/src/guis/GuiGamelistOptions.cpp index 36d73534e..44d767186 100644 --- a/es-app/src/guis/GuiGamelistOptions.cpp +++ b/es-app/src/guis/GuiGamelistOptions.cpp @@ -50,9 +50,9 @@ GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system) : Gui if (firstFavorite != -1) { if (getGamelist()->getCursor()->getFavorite()) - mJumpToLetterList->add(std::string(1, FAV_CHAR), FAV_CHAR, 1); + mJumpToLetterList->add(FAVORITE_CHAR, FAVORITE_CHAR, 1); else - mJumpToLetterList->add(std::string(1, FAV_CHAR), FAV_CHAR, 0); + mJumpToLetterList->add(FAVORITE_CHAR, FAVORITE_CHAR, 0); } } @@ -69,7 +69,7 @@ GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system) : Gui if (firstFavorite != -1 && file->getFavorite()) continue; - mJumpToLetterList->add(std::string(1, c), c, c == curChar); + mJumpToLetterList->add(std::string(1, c), std::string(1, c), c == curChar); break; } } @@ -80,7 +80,7 @@ GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system) : Gui row.input_handler = [&](InputConfig* config, Input input) { if(config->isMappedTo("a", input) && input.value) { - if(mJumpToLetterList->getSelected() == FAV_CHAR) + if(mJumpToLetterList->getSelected() == FAVORITE_CHAR) { navigationsounds.playThemeNavigationSound(SCROLLSOUND); jumpToFirstFavorite(); @@ -235,7 +235,7 @@ void GuiGamelistOptions::openMetaDataEd() void GuiGamelistOptions::jumpToLetter() { - char letter = mJumpToLetterList->getSelected(); + char letter = mJumpToLetterList->getSelected()[0]; IGameListView* gamelist = getGamelist(); // this is a really shitty way to get a list of files diff --git a/es-app/src/guis/GuiGamelistOptions.h b/es-app/src/guis/GuiGamelistOptions.h index 05b788103..79b95f8ef 100644 --- a/es-app/src/guis/GuiGamelistOptions.h +++ b/es-app/src/guis/GuiGamelistOptions.h @@ -6,6 +6,7 @@ #include "components/OptionListComponent.h" #include "FileData.h" #include "GuiComponent.h" +#include "utils/StringUtil.h" class IGameListView; class SystemData; @@ -29,13 +30,12 @@ private: void findFirstFavorite(); void jumpToFirstFavorite(); - const char FAV_CHAR = '*'; - + const std::string FAVORITE_CHAR = "\uF005"; long firstFavorite = -1; MenuComponent mMenu; - typedef OptionListComponent LetterList; + typedef OptionListComponent LetterList; std::shared_ptr mJumpToLetterList; typedef OptionListComponent SortList; diff --git a/es-app/src/views/gamelist/BasicGameListView.cpp b/es-app/src/views/gamelist/BasicGameListView.cpp index c61253077..ac0eb6137 100644 --- a/es-app/src/views/gamelist/BasicGameListView.cpp +++ b/es-app/src/views/gamelist/BasicGameListView.cpp @@ -62,9 +62,9 @@ void BasicGameListView::populateList(const std::vector& files) continue; if (showFavoriteIcon) - mList.add(("\uF005 ") + file->getName(), file, file->getType() == FOLDER); + mList.add(FAVORITE_GAME_CHAR + " " + file->getName(), file, file->getType() == FOLDER); else if (file->getType() == FOLDER) - mList.add(("\uF07C ") + file->getName(), file, true); + mList.add(FAVORITE_FOLDER_CHAR + " " + file->getName(), file, true); else mList.add(file->getName(), file, false); } @@ -79,13 +79,13 @@ void BasicGameListView::populateList(const std::vector& files) if (showFavoriteIcon) { - mList.add(("\uF005 ") + file->getName(), file, file->getType() == FOLDER); + mList.add(FAVORITE_GAME_CHAR + " " + file->getName(), file, file->getType() == FOLDER); continue; } } if (file->getType() == FOLDER) - mList.add(("\uF07C ") + file->getName(), file, true); + mList.add(FAVORITE_FOLDER_CHAR + " " + file->getName(), file, true); else mList.add(file->getName(), file, false); } diff --git a/es-app/src/views/gamelist/BasicGameListView.h b/es-app/src/views/gamelist/BasicGameListView.h index f1a216b0f..473916678 100644 --- a/es-app/src/views/gamelist/BasicGameListView.h +++ b/es-app/src/views/gamelist/BasicGameListView.h @@ -31,6 +31,9 @@ protected: virtual void addPlaceholder(); TextListComponent mList; + + const std::string FAVORITE_GAME_CHAR = "\uF005"; + const std::string FAVORITE_FOLDER_CHAR = "\uF07C"; }; #endif // ES_APP_VIEWS_GAME_LIST_BASIC_GAME_LIST_VIEW_H