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