mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-04-10 19:15:13 +00:00
Fixed a small issue when selecting games as favorites using the shortcut button.
This commit is contained in:
parent
f4cfcbed65
commit
d13b249570
|
@ -217,6 +217,7 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
|
||||||
FileData* entryToUpdate = getCursor();
|
FileData* entryToUpdate = getCursor();
|
||||||
bool favoritesSorting;
|
bool favoritesSorting;
|
||||||
bool removedLastFavorite = false;
|
bool removedLastFavorite = false;
|
||||||
|
bool selectLastEntry = false;
|
||||||
bool isEditing = CollectionSystemsManager::get()->isEditing();
|
bool isEditing = CollectionSystemsManager::get()->isEditing();
|
||||||
bool foldersOnTop = Settings::getInstance()->getBool("FoldersOnTop");
|
bool foldersOnTop = Settings::getInstance()->getBool("FoldersOnTop");
|
||||||
// If the current list only contains folders, then treat it as if the folders
|
// If the current list only contains folders, then treat it as if the folders
|
||||||
|
@ -236,47 +237,62 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
|
||||||
// Add favorite flag.
|
// Add favorite flag.
|
||||||
if (!getCursor()->getFavorite()) {
|
if (!getCursor()->getFavorite()) {
|
||||||
// If it's a folder and folders are sorted on top, select the current entry.
|
// If it's a folder and folders are sorted on top, select the current entry.
|
||||||
if (foldersOnTop && getCursor()->getType() == FOLDER)
|
if (foldersOnTop && getCursor()->getType() == FOLDER) {
|
||||||
entryToSelect = getCursor();
|
entryToSelect = getCursor();
|
||||||
|
}
|
||||||
// If it's the first entry to be marked as favorite, select the next entry.
|
// If it's the first entry to be marked as favorite, select the next entry.
|
||||||
else if (getCursor() == getFirstEntry())
|
else if (getCursor() == getFirstEntry()) {
|
||||||
entryToSelect = getNextEntry();
|
entryToSelect = getNextEntry();
|
||||||
|
}
|
||||||
|
else if (getCursor() == getLastEntry() &&
|
||||||
|
getPreviousEntry()->getFavorite()) {
|
||||||
|
entryToSelect = getLastEntry();
|
||||||
|
selectLastEntry = true;
|
||||||
|
}
|
||||||
// If we are on the favorite marking boundary, select the next entry.
|
// If we are on the favorite marking boundary, select the next entry.
|
||||||
else if (getCursor()->getFavorite() != getPreviousEntry()->getFavorite())
|
else if (getCursor()->getFavorite() != getPreviousEntry()->getFavorite()) {
|
||||||
entryToSelect = getNextEntry();
|
entryToSelect = getNextEntry();
|
||||||
|
}
|
||||||
// If we mark the second entry as favorite and the first entry is not a
|
// If we mark the second entry as favorite and the first entry is not a
|
||||||
// favorite, then select this entry if they are of the same type.
|
// favorite, then select this entry if they are of the same type.
|
||||||
else if (getPreviousEntry() == getFirstEntry() &&
|
else if (getPreviousEntry() == getFirstEntry() &&
|
||||||
getCursor()->getType() == getPreviousEntry()->getType())
|
getCursor()->getType() == getPreviousEntry()->getType()) {
|
||||||
entryToSelect = getPreviousEntry();
|
entryToSelect = getPreviousEntry();
|
||||||
|
}
|
||||||
// For all other scenarios try to select the next entry, and if it doesn't
|
// For all other scenarios try to select the next entry, and if it doesn't
|
||||||
// exist, select the previous entry.
|
// exist, select the previous entry.
|
||||||
else
|
else {
|
||||||
entryToSelect = getCursor() != getNextEntry() ?
|
entryToSelect = getCursor() != getNextEntry() ?
|
||||||
getNextEntry() : getPreviousEntry();
|
getNextEntry() : getPreviousEntry();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Remove favorite flag.
|
// Remove favorite flag.
|
||||||
else {
|
else {
|
||||||
// If it's a folder and folders are sorted on top, select the current entry.
|
// If it's a folder and folders are sorted on top, select the current entry.
|
||||||
if (foldersOnTop && getCursor()->getType() == FOLDER)
|
if (foldersOnTop && getCursor()->getType() == FOLDER) {
|
||||||
entryToSelect = getCursor();
|
entryToSelect = getCursor();
|
||||||
|
}
|
||||||
// If it's the last entry, select the previous entry.
|
// If it's the last entry, select the previous entry.
|
||||||
else if (getCursor() == getLastEntry())
|
else if (getCursor() == getLastEntry()) {
|
||||||
entryToSelect = getPreviousEntry();
|
entryToSelect = getPreviousEntry();
|
||||||
|
}
|
||||||
// If we are on the favorite marking boundary, select the previous entry,
|
// If we are on the favorite marking boundary, select the previous entry,
|
||||||
// unless folders are sorted on top and the previous entry is a folder.
|
// unless folders are sorted on top and the previous entry is a folder.
|
||||||
else if (foldersOnTop &&
|
else if (foldersOnTop &&
|
||||||
getCursor()->getFavorite() != getNextEntry()->getFavorite())
|
getCursor()->getFavorite() != getNextEntry()->getFavorite()) {
|
||||||
entryToSelect = getPreviousEntry()->getType() == FOLDER ?
|
entryToSelect = getPreviousEntry()->getType() == FOLDER ?
|
||||||
getCursor() : getPreviousEntry();
|
getCursor() : getPreviousEntry();
|
||||||
|
}
|
||||||
// If we are on the favorite marking boundary, select the previous entry.
|
// If we are on the favorite marking boundary, select the previous entry.
|
||||||
else if (getCursor()->getFavorite() != getNextEntry()->getFavorite())
|
else if (getCursor()->getFavorite() != getNextEntry()->getFavorite()) {
|
||||||
entryToSelect = getPreviousEntry();
|
entryToSelect = getPreviousEntry();
|
||||||
|
}
|
||||||
// For all other scenarios try to select the next entry, and if it doesn't
|
// For all other scenarios try to select the next entry, and if it doesn't
|
||||||
// exist, select the previous entry.
|
// exist, select the previous entry.
|
||||||
else
|
else {
|
||||||
entryToSelect = getCursor() != getNextEntry() ?
|
entryToSelect = getCursor() != getNextEntry() ?
|
||||||
getNextEntry() : getPreviousEntry();
|
getNextEntry() : getPreviousEntry();
|
||||||
|
}
|
||||||
|
|
||||||
// If we removed the last favorite marking, set the flag to jump to the
|
// If we removed the last favorite marking, set the flag to jump to the
|
||||||
// first list entry after the sorting has been performed.
|
// first list entry after the sorting has been performed.
|
||||||
|
@ -343,13 +359,18 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
|
||||||
else if (CollectionSystemsManager::get()->toggleGameInCollection(entryToUpdate)) {
|
else if (CollectionSystemsManager::get()->toggleGameInCollection(entryToUpdate)) {
|
||||||
// Jump to the first entry in the gamelist if the last favorite was unmarked.
|
// Jump to the first entry in the gamelist if the last favorite was unmarked.
|
||||||
if (foldersOnTop && removedLastFavorite &&
|
if (foldersOnTop && removedLastFavorite &&
|
||||||
!entryToUpdate->getSystem()->isCustomCollection())
|
!entryToUpdate->getSystem()->isCustomCollection()) {
|
||||||
ViewController::get()->getGameListView(entryToUpdate->getSystem())->
|
ViewController::get()->getGameListView(entryToUpdate->getSystem())->
|
||||||
setCursor(ViewController::get()->getGameListView(entryToUpdate->
|
setCursor(ViewController::get()->getGameListView(entryToUpdate->
|
||||||
getSystem())->getFirstGameEntry());
|
getSystem())->getFirstGameEntry());
|
||||||
|
}
|
||||||
else if (removedLastFavorite &&
|
else if (removedLastFavorite &&
|
||||||
!entryToUpdate->getSystem()->isCustomCollection())
|
!entryToUpdate->getSystem()->isCustomCollection()) {
|
||||||
setCursor(getFirstEntry());
|
setCursor(getFirstEntry());
|
||||||
|
}
|
||||||
|
else if (selectLastEntry) {
|
||||||
|
setCursor(getLastEntry());
|
||||||
|
}
|
||||||
// Display the indication icons which show what games are part of the
|
// Display the indication icons which show what games are part of the
|
||||||
// custom collection currently being edited. This is done cheaply using
|
// custom collection currently being edited. This is done cheaply using
|
||||||
// onFileChanged() which will trigger populateList().
|
// onFileChanged() which will trigger populateList().
|
||||||
|
|
Loading…
Reference in a new issue