mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-12 17:58:53 +01:00
Fixed remembering last selected game and playlist.
This commit is contained in:
parent
a55fd84d58
commit
208fa0c23b
@ -604,6 +604,12 @@ void Page::exitMenu()
|
||||
}
|
||||
|
||||
|
||||
std::string Page::getPlaylistName()
|
||||
{
|
||||
return playlist_->first;
|
||||
}
|
||||
|
||||
|
||||
void Page::nextPlaylist()
|
||||
{
|
||||
MenuInfo_S &info = collections_.back();
|
||||
@ -625,7 +631,7 @@ void Page::nextPlaylist()
|
||||
playlistChange();
|
||||
}
|
||||
|
||||
void Page::favPlaylist()
|
||||
void Page::selectPlaylist(std::string playlist)
|
||||
{
|
||||
MenuInfo_S &info = collections_.back();
|
||||
info.collection->Save();
|
||||
@ -641,11 +647,11 @@ void Page::favPlaylist()
|
||||
if(playlist_ == info.collection->playlists.end()) playlist_ = info.collection->playlists.begin();
|
||||
|
||||
// find the first playlist
|
||||
if(playlist_->second->size() != 0 && playlist_->first == "favorites") break;
|
||||
if(playlist_->second->size() != 0 && playlist_->first == playlist) break;
|
||||
}
|
||||
|
||||
// Do not change playlist if favorites does not exist or if it's empty
|
||||
if ( playlist_->second->size() == 0 || playlist_->first != "favorites")
|
||||
// Do not change playlist if it does not exist or if it's empty
|
||||
if ( playlist_->second->size() == 0 || playlist_->first != playlist)
|
||||
playlist_ = playlist_store;
|
||||
|
||||
activeMenu_->setItems(playlist_->second);
|
||||
|
||||
@ -49,8 +49,9 @@ public:
|
||||
bool popCollection();
|
||||
void enterMenu();
|
||||
void exitMenu();
|
||||
std::string getPlaylistName();
|
||||
void nextPlaylist();
|
||||
void favPlaylist();
|
||||
void selectPlaylist(std::string playlist);
|
||||
void pushMenu(ScrollingList *s);
|
||||
bool isMenusFull();
|
||||
void setLoadSound(Sound *chunk);
|
||||
|
||||
@ -388,18 +388,24 @@ void RetroFE::run()
|
||||
|
||||
bool rememberMenu = false;
|
||||
config_.getProperty("rememberMenu", rememberMenu);
|
||||
bool autoFavorites = true;
|
||||
config_.getProperty("autoFavorites", autoFavorites);
|
||||
|
||||
if (rememberMenu && lastMenuPlaylists_.find(nextPageName) != lastMenuPlaylists_.end())
|
||||
{
|
||||
currentPage_->selectPlaylist(lastMenuPlaylists_[nextPageName]); // Switch to last playlist
|
||||
}
|
||||
else if (autoFavorites)
|
||||
{
|
||||
currentPage_->selectPlaylist("favorites"); // Switch to favorites playlist
|
||||
}
|
||||
|
||||
if(rememberMenu && lastMenuOffsets_.find(nextPageName) != lastMenuOffsets_.end())
|
||||
{
|
||||
currentPage_->setScrollOffsetIndex(lastMenuOffsets_[nextPageName]);
|
||||
}
|
||||
|
||||
bool autoFavorites = true;
|
||||
config_.getProperty("autoFavorites", autoFavorites);
|
||||
|
||||
if (autoFavorites)
|
||||
currentPage_->favPlaylist(); // Switch to favorites if it exists
|
||||
|
||||
currentPage_->resetMenuItems();
|
||||
currentPage_->setNewItemSelected();
|
||||
currentPage_->enterMenu();
|
||||
|
||||
@ -436,7 +442,8 @@ void RetroFE::run()
|
||||
case RETROFE_BACK_MENU_EXIT:
|
||||
if(currentPage_->isIdle())
|
||||
{
|
||||
lastMenuOffsets_[currentPage_->getCollectionName()] = currentPage_->getScrollOffsetIndex();
|
||||
lastMenuOffsets_[currentPage_->getCollectionName()] = currentPage_->getScrollOffsetIndex();
|
||||
lastMenuPlaylists_[currentPage_->getCollectionName()] = currentPage_->getPlaylistName();
|
||||
if (currentPage_->getMenuDepth() == 1)
|
||||
{
|
||||
currentPage_->DeInitialize();
|
||||
|
||||
@ -93,5 +93,6 @@ private:
|
||||
FontCache fontcache_;
|
||||
AttractMode attract_;
|
||||
std::map<std::string, unsigned int> lastMenuOffsets_;
|
||||
std::map<std::string, std::string> lastMenuPlaylists_;
|
||||
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user