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

View file

@ -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

View file

@ -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<char> LetterList;
typedef OptionListComponent<std::string> LetterList;
std::shared_ptr<LetterList> mJumpToLetterList;
typedef OptionListComponent<const FileData::SortType*> SortList;

View file

@ -62,9 +62,9 @@ void BasicGameListView::populateList(const std::vector<FileData*>& 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<FileData*>& 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);
}

View file

@ -31,6 +31,9 @@ protected:
virtual void addPlaceholder();
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