mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-17 22:55:38 +00:00
Moved the favorite and folder character constants to a more logical location.
This commit is contained in:
parent
6b43cdf5d6
commit
605aa4ba8e
|
@ -130,9 +130,6 @@ public:
|
|||
// Return sort type based on a string description.
|
||||
FileData::SortType getSortTypeFromString(std::string desc);
|
||||
|
||||
const std::string FAVORITE_CHAR = "\uF005";
|
||||
const std::string FOLDER_CHAR = "\uF07C";
|
||||
|
||||
protected:
|
||||
FileData* mSourceFileData;
|
||||
FileData* mParent;
|
||||
|
|
|
@ -595,7 +595,7 @@ void SystemScreensaver::generateOverlayInfo()
|
|||
|
||||
std::string favoriteChar;
|
||||
if (mCurrentGame->getFavorite())
|
||||
favoriteChar = " " + mCurrentGame->FAVORITE_CHAR;
|
||||
favoriteChar = " " + ViewController::FAVORITE_CHAR;
|
||||
|
||||
const std::string gameName = Utils::String::toUpper(mGameName) + favoriteChar;
|
||||
const std::string systemName = Utils::String::toUpper(mSystemName);
|
||||
|
|
|
@ -41,8 +41,6 @@ GuiGamelistOptions::GuiGamelistOptions(
|
|||
|
||||
// Check that it's not a placeholder folder - if it is, only show "Filter Options".
|
||||
FileData* file = getGamelist()->getCursor();
|
||||
FAVORITE_CHAR = file->FAVORITE_CHAR;
|
||||
FOLDER_CHAR = file->FOLDER_CHAR;
|
||||
fromPlaceholder = file->isPlaceHolder();
|
||||
ComponentListRow row;
|
||||
|
||||
|
@ -77,19 +75,21 @@ GuiGamelistOptions::GuiGamelistOptions(
|
|||
// Don't include the folder name starting characters if folders are sorted on top
|
||||
// unless the list only contains folders.
|
||||
if (!mOnlyHasFolders && mFoldersOnTop && file->getType() == FOLDER) {
|
||||
mCurrentFirstCharacter = FOLDER_CHAR;
|
||||
mCurrentFirstCharacter = ViewController::FOLDER_CHAR;
|
||||
}
|
||||
else {
|
||||
// Check if the currently selected game is a favorite.
|
||||
bool isFavorite = false;
|
||||
if (mFirstLetterIndex.size() == 1 && mFirstLetterIndex.front() == FAVORITE_CHAR)
|
||||
if (mFirstLetterIndex.size() == 1 && mFirstLetterIndex.front() ==
|
||||
ViewController::FAVORITE_CHAR)
|
||||
isFavorite = true;
|
||||
else if (mFirstLetterIndex.size() > 1 && (mFirstLetterIndex.front() == FAVORITE_CHAR ||
|
||||
mFirstLetterIndex[1] == FAVORITE_CHAR))
|
||||
else if (mFirstLetterIndex.size() > 1 && (mFirstLetterIndex.front() ==
|
||||
ViewController::FAVORITE_CHAR || mFirstLetterIndex[1] ==
|
||||
ViewController::FAVORITE_CHAR))
|
||||
isFavorite = true;
|
||||
|
||||
if (mFavoritesSorting && file->getFavorite() && isFavorite)
|
||||
mCurrentFirstCharacter = FAVORITE_CHAR;
|
||||
mCurrentFirstCharacter = ViewController::FAVORITE_CHAR;
|
||||
else
|
||||
mCurrentFirstCharacter = toupper(file->getSortName().front());
|
||||
}
|
||||
|
@ -237,8 +237,8 @@ GuiGamelistOptions::~GuiGamelistOptions()
|
|||
|
||||
// Has the user changed the letter using the quick selector?
|
||||
if (mCurrentFirstCharacter != mJumpToLetterList->getSelected()) {
|
||||
if (mJumpToLetterList->getSelected() == FAVORITE_CHAR ||
|
||||
mJumpToLetterList->getSelected() == FOLDER_CHAR)
|
||||
if (mJumpToLetterList->getSelected() == ViewController::FAVORITE_CHAR ||
|
||||
mJumpToLetterList->getSelected() == ViewController::FOLDER_CHAR)
|
||||
jumpToFirstRow();
|
||||
else
|
||||
jumpToLetter();
|
||||
|
@ -395,8 +395,8 @@ void GuiGamelistOptions::jumpToLetter()
|
|||
getParent()->getChildrenListToDisplay();
|
||||
|
||||
for (unsigned int i = 0; i < files.size(); i++) {
|
||||
if (mFavoritesSorting && (mFirstLetterIndex.front() == FAVORITE_CHAR ||
|
||||
mFirstLetterIndex.front() == FOLDER_CHAR)) {
|
||||
if (mFavoritesSorting && (mFirstLetterIndex.front() == ViewController::FAVORITE_CHAR ||
|
||||
mFirstLetterIndex.front() == ViewController::FOLDER_CHAR)) {
|
||||
if (static_cast<char>(toupper(files.at(i)->getSortName().front())) ==
|
||||
letter && !files.at(i)->getFavorite()) {
|
||||
if (!mOnlyHasFolders && mFoldersOnTop && files.at(i)->getType() == FOLDER) {
|
||||
|
@ -424,7 +424,7 @@ void GuiGamelistOptions::jumpToLetter()
|
|||
|
||||
void GuiGamelistOptions::jumpToFirstRow()
|
||||
{
|
||||
if (mFoldersOnTop && mJumpToLetterList->getSelected() == FAVORITE_CHAR) {
|
||||
if (mFoldersOnTop && mJumpToLetterList->getSelected() == ViewController::FAVORITE_CHAR) {
|
||||
// Get the gamelist.
|
||||
const std::vector<FileData*>& files = getGamelist()->getCursor()->
|
||||
getParent()->getChildrenListToDisplay();
|
||||
|
|
|
@ -61,9 +61,6 @@ private:
|
|||
bool isCustomCollectionGroup;
|
||||
std::vector<std::string> mFirstLetterIndex;
|
||||
std::string mCurrentFirstCharacter;
|
||||
std::string FAVORITE_CHAR;
|
||||
std::string FOLDER_CHAR;
|
||||
|
||||
};
|
||||
|
||||
#endif // ES_APP_GUIS_GUI_GAME_LIST_OPTIONS_H
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include "Window.h"
|
||||
|
||||
ViewController* ViewController::sInstance = nullptr;
|
||||
const std::string ViewController::FAVORITE_CHAR = "\uF005";
|
||||
const std::string ViewController::FOLDER_CHAR = "\uF07C";
|
||||
|
||||
ViewController* ViewController::get()
|
||||
{
|
||||
|
|
|
@ -104,6 +104,9 @@ public:
|
|||
std::shared_ptr<SystemView> getSystemListView();
|
||||
void removeGameListView(SystemData* system);
|
||||
|
||||
static const std::string FAVORITE_CHAR;
|
||||
static const std::string FOLDER_CHAR;
|
||||
|
||||
private:
|
||||
ViewController(Window* window);
|
||||
static ViewController* sInstance;
|
||||
|
|
|
@ -18,9 +18,6 @@
|
|||
BasicGameListView::BasicGameListView(Window* window, FileData* root)
|
||||
: ISimpleGameListView(window, root), mList(window)
|
||||
{
|
||||
FAVORITE_CHAR = root->FAVORITE_CHAR;
|
||||
FOLDER_CHAR = root->FOLDER_CHAR;
|
||||
|
||||
mList.setSize(mSize.x(), mSize.y() * 0.8f);
|
||||
mList.setPosition(0, mSize.y() * 0.2f);
|
||||
mList.setDefaultZIndex(20);
|
||||
|
@ -87,12 +84,12 @@ void BasicGameListView::populateList(const std::vector<FileData*>& files, FileDa
|
|||
}
|
||||
if ((*it)->getFavorite() && favoriteStar &&
|
||||
mRoot->getSystem()->getName() != "favorites") {
|
||||
mList.add(inCollectionPrefix + FAVORITE_CHAR + " " + (*it)->getName(),
|
||||
mList.add(inCollectionPrefix + ViewController::FAVORITE_CHAR + " " + (*it)->getName(),
|
||||
*it, ((*it)->getType() == FOLDER));
|
||||
}
|
||||
else if ((*it)->getType() == FOLDER &&
|
||||
mRoot->getSystem()->getName() != "collections") {
|
||||
mList.add(FOLDER_CHAR + " " + (*it)->getName(), *it, true);
|
||||
mList.add(ViewController::FOLDER_CHAR + " " + (*it)->getName(), *it, true);
|
||||
}
|
||||
else {
|
||||
mList.add(inCollectionPrefix + (*it)->getName(), *it, ((*it)->getType() == FOLDER));
|
||||
|
|
|
@ -389,8 +389,6 @@ void ISimpleGameListView::generateGamelistInfo(FileData* cursor, FileData* first
|
|||
|
||||
void ISimpleGameListView::generateFirstLetterIndex(const std::vector<FileData*>& files)
|
||||
{
|
||||
const std::string favoriteChar = mRoot->FAVORITE_CHAR;
|
||||
const std::string folderChar = mRoot->FOLDER_CHAR;
|
||||
std::string firstChar;
|
||||
|
||||
bool onlyFavorites = true;
|
||||
|
@ -443,8 +441,8 @@ void ISimpleGameListView::generateFirstLetterIndex(const std::vector<FileData*>&
|
|||
// If there are any favorites and/or folders in the list, insert their respective
|
||||
// Unicode characters at the beginning of the vector.
|
||||
if (hasFavorites)
|
||||
mFirstLetterIndex.insert(mFirstLetterIndex.begin(), favoriteChar);
|
||||
mFirstLetterIndex.insert(mFirstLetterIndex.begin(), ViewController::FAVORITE_CHAR);
|
||||
|
||||
if (hasFolders)
|
||||
mFirstLetterIndex.insert(mFirstLetterIndex.begin(), folderChar);
|
||||
mFirstLetterIndex.insert(mFirstLetterIndex.begin(), ViewController::FOLDER_CHAR);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue