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()
|
void Page::nextPlaylist()
|
||||||
{
|
{
|
||||||
MenuInfo_S &info = collections_.back();
|
MenuInfo_S &info = collections_.back();
|
||||||
@ -625,7 +631,7 @@ void Page::nextPlaylist()
|
|||||||
playlistChange();
|
playlistChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Page::favPlaylist()
|
void Page::selectPlaylist(std::string playlist)
|
||||||
{
|
{
|
||||||
MenuInfo_S &info = collections_.back();
|
MenuInfo_S &info = collections_.back();
|
||||||
info.collection->Save();
|
info.collection->Save();
|
||||||
@ -641,11 +647,11 @@ void Page::favPlaylist()
|
|||||||
if(playlist_ == info.collection->playlists.end()) playlist_ = info.collection->playlists.begin();
|
if(playlist_ == info.collection->playlists.end()) playlist_ = info.collection->playlists.begin();
|
||||||
|
|
||||||
// find the first playlist
|
// 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
|
// Do not change playlist if it does not exist or if it's empty
|
||||||
if ( playlist_->second->size() == 0 || playlist_->first != "favorites")
|
if ( playlist_->second->size() == 0 || playlist_->first != playlist)
|
||||||
playlist_ = playlist_store;
|
playlist_ = playlist_store;
|
||||||
|
|
||||||
activeMenu_->setItems(playlist_->second);
|
activeMenu_->setItems(playlist_->second);
|
||||||
|
|||||||
@ -49,8 +49,9 @@ public:
|
|||||||
bool popCollection();
|
bool popCollection();
|
||||||
void enterMenu();
|
void enterMenu();
|
||||||
void exitMenu();
|
void exitMenu();
|
||||||
|
std::string getPlaylistName();
|
||||||
void nextPlaylist();
|
void nextPlaylist();
|
||||||
void favPlaylist();
|
void selectPlaylist(std::string playlist);
|
||||||
void pushMenu(ScrollingList *s);
|
void pushMenu(ScrollingList *s);
|
||||||
bool isMenusFull();
|
bool isMenusFull();
|
||||||
void setLoadSound(Sound *chunk);
|
void setLoadSound(Sound *chunk);
|
||||||
|
|||||||
@ -388,18 +388,24 @@ void RetroFE::run()
|
|||||||
|
|
||||||
bool rememberMenu = false;
|
bool rememberMenu = false;
|
||||||
config_.getProperty("rememberMenu", rememberMenu);
|
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())
|
if(rememberMenu && lastMenuOffsets_.find(nextPageName) != lastMenuOffsets_.end())
|
||||||
{
|
{
|
||||||
currentPage_->setScrollOffsetIndex(lastMenuOffsets_[nextPageName]);
|
currentPage_->setScrollOffsetIndex(lastMenuOffsets_[nextPageName]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool autoFavorites = true;
|
currentPage_->resetMenuItems();
|
||||||
config_.getProperty("autoFavorites", autoFavorites);
|
|
||||||
|
|
||||||
if (autoFavorites)
|
|
||||||
currentPage_->favPlaylist(); // Switch to favorites if it exists
|
|
||||||
|
|
||||||
currentPage_->setNewItemSelected();
|
currentPage_->setNewItemSelected();
|
||||||
currentPage_->enterMenu();
|
currentPage_->enterMenu();
|
||||||
|
|
||||||
@ -436,7 +442,8 @@ void RetroFE::run()
|
|||||||
case RETROFE_BACK_MENU_EXIT:
|
case RETROFE_BACK_MENU_EXIT:
|
||||||
if(currentPage_->isIdle())
|
if(currentPage_->isIdle())
|
||||||
{
|
{
|
||||||
lastMenuOffsets_[currentPage_->getCollectionName()] = currentPage_->getScrollOffsetIndex();
|
lastMenuOffsets_[currentPage_->getCollectionName()] = currentPage_->getScrollOffsetIndex();
|
||||||
|
lastMenuPlaylists_[currentPage_->getCollectionName()] = currentPage_->getPlaylistName();
|
||||||
if (currentPage_->getMenuDepth() == 1)
|
if (currentPage_->getMenuDepth() == 1)
|
||||||
{
|
{
|
||||||
currentPage_->DeInitialize();
|
currentPage_->DeInitialize();
|
||||||
|
|||||||
@ -93,5 +93,6 @@ private:
|
|||||||
FontCache fontcache_;
|
FontCache fontcache_;
|
||||||
AttractMode attract_;
|
AttractMode attract_;
|
||||||
std::map<std::string, unsigned int> lastMenuOffsets_;
|
std::map<std::string, unsigned int> lastMenuOffsets_;
|
||||||
|
std::map<std::string, std::string> lastMenuPlaylists_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user