Added proper Unicode star icon when jumping to favorite games using the 'Jump to...' quick selector

This commit is contained in:
Leon Styhre 2020-05-17 19:30:29 +02:00
parent 6028ec8444
commit 7686f87d5d
5 changed files with 17 additions and 12 deletions

View file

@ -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: Example navigationsounds.xml, to be included from the main theme file:
```xml
<theme> <theme>
<formatVersion>5</formatVersion> <formatVersion>5</formatVersion>
<feature supported="navigationsounds"> <feature supported="navigationsounds">
@ -313,6 +314,7 @@ Example navigationsounds.xml, to be included from the main theme file:
</view> </view>
</feature> </feature>
</theme> </theme>
```
#### Defaults #### Defaults

View file

@ -50,9 +50,9 @@ GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system) : Gui
if (firstFavorite != -1) if (firstFavorite != -1)
{ {
if (getGamelist()->getCursor()->getFavorite()) if (getGamelist()->getCursor()->getFavorite())
mJumpToLetterList->add(std::string(1, FAV_CHAR), FAV_CHAR, 1); mJumpToLetterList->add(FAVORITE_CHAR, FAVORITE_CHAR, 1);
else 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()) if (firstFavorite != -1 && file->getFavorite())
continue; continue;
mJumpToLetterList->add(std::string(1, c), c, c == curChar); mJumpToLetterList->add(std::string(1, c), std::string(1, c), c == curChar);
break; break;
} }
} }
@ -80,7 +80,7 @@ GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system) : Gui
row.input_handler = [&](InputConfig* config, Input input) { row.input_handler = [&](InputConfig* config, Input input) {
if(config->isMappedTo("a", input) && input.value) if(config->isMappedTo("a", input) && input.value)
{ {
if(mJumpToLetterList->getSelected() == FAV_CHAR) if(mJumpToLetterList->getSelected() == FAVORITE_CHAR)
{ {
navigationsounds.playThemeNavigationSound(SCROLLSOUND); navigationsounds.playThemeNavigationSound(SCROLLSOUND);
jumpToFirstFavorite(); jumpToFirstFavorite();
@ -235,7 +235,7 @@ void GuiGamelistOptions::openMetaDataEd()
void GuiGamelistOptions::jumpToLetter() void GuiGamelistOptions::jumpToLetter()
{ {
char letter = mJumpToLetterList->getSelected(); char letter = mJumpToLetterList->getSelected()[0];
IGameListView* gamelist = getGamelist(); IGameListView* gamelist = getGamelist();
// this is a really shitty way to get a list of files // this is a really shitty way to get a list of files

View file

@ -6,6 +6,7 @@
#include "components/OptionListComponent.h" #include "components/OptionListComponent.h"
#include "FileData.h" #include "FileData.h"
#include "GuiComponent.h" #include "GuiComponent.h"
#include "utils/StringUtil.h"
class IGameListView; class IGameListView;
class SystemData; class SystemData;
@ -29,13 +30,12 @@ private:
void findFirstFavorite(); void findFirstFavorite();
void jumpToFirstFavorite(); void jumpToFirstFavorite();
const char FAV_CHAR = '*'; const std::string FAVORITE_CHAR = "\uF005";
long firstFavorite = -1; long firstFavorite = -1;
MenuComponent mMenu; MenuComponent mMenu;
typedef OptionListComponent<char> LetterList; typedef OptionListComponent<std::string> LetterList;
std::shared_ptr<LetterList> mJumpToLetterList; std::shared_ptr<LetterList> mJumpToLetterList;
typedef OptionListComponent<const FileData::SortType*> SortList; typedef OptionListComponent<const FileData::SortType*> SortList;

View file

@ -62,9 +62,9 @@ void BasicGameListView::populateList(const std::vector<FileData*>& files)
continue; continue;
if (showFavoriteIcon) 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) else if (file->getType() == FOLDER)
mList.add(("\uF07C ") + file->getName(), file, true); mList.add(FAVORITE_FOLDER_CHAR + " " + file->getName(), file, true);
else else
mList.add(file->getName(), file, false); mList.add(file->getName(), file, false);
} }
@ -79,13 +79,13 @@ void BasicGameListView::populateList(const std::vector<FileData*>& files)
if (showFavoriteIcon) if (showFavoriteIcon)
{ {
mList.add(("\uF005 ") + file->getName(), file, file->getType() == FOLDER); mList.add(FAVORITE_GAME_CHAR + " " + file->getName(), file, file->getType() == FOLDER);
continue; continue;
} }
} }
if (file->getType() == FOLDER) if (file->getType() == FOLDER)
mList.add(("\uF07C ") + file->getName(), file, true); mList.add(FAVORITE_FOLDER_CHAR + " " + file->getName(), file, true);
else else
mList.add(file->getName(), file, false); mList.add(file->getName(), file, false);
} }

View file

@ -31,6 +31,9 @@ protected:
virtual void addPlaceholder(); virtual void addPlaceholder();
TextListComponent<FileData*> mList; TextListComponent<FileData*> 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 #endif // ES_APP_VIEWS_GAME_LIST_BASIC_GAME_LIST_VIEW_H