mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-12 09:48:51 +01:00
Fixed sorting for playlists other than favorites.
This commit is contained in:
parent
04cae80445
commit
1680c8467d
@ -181,25 +181,31 @@ void CollectionInfo::sortItems()
|
||||
}
|
||||
|
||||
|
||||
void CollectionInfo::sortFavoriteItems()
|
||||
void CollectionInfo::sortPlaylists()
|
||||
{
|
||||
|
||||
std::vector<Item *> *allItems = playlists["all"];
|
||||
std::vector<Item *> favItems;
|
||||
for(std::vector <Item *>::iterator itFav = playlists["favorites"]->begin(); itFav != playlists["favorites"]->end(); itFav++)
|
||||
{
|
||||
favItems.push_back((*itFav));
|
||||
}
|
||||
playlists["favorites"]->clear();
|
||||
|
||||
std::vector<Item *> toSortItems;
|
||||
|
||||
for(std::vector <Item *>::iterator itAll = allItems->begin(); itAll != allItems->end(); itAll++)
|
||||
for ( Playlists_T::iterator itP = playlists.begin( ); itP != playlists.end( ); itP++ )
|
||||
{
|
||||
for(std::vector <Item *>::iterator itFav = favItems.begin(); itFav != favItems.end(); itFav++)
|
||||
if ( itP->second != allItems )
|
||||
{
|
||||
if ((*itAll) == (*itFav))
|
||||
toSortItems.clear();
|
||||
for(std::vector <Item *>::iterator itSort = itP->second->begin(); itSort != itP->second->end(); itSort++)
|
||||
{
|
||||
playlists["favorites"]->push_back((*itAll));
|
||||
toSortItems.push_back((*itSort));
|
||||
}
|
||||
itP->second->clear();
|
||||
for(std::vector <Item *>::iterator itAll = allItems->begin(); itAll != allItems->end(); itAll++)
|
||||
{
|
||||
for(std::vector <Item *>::iterator itSort = toSortItems.begin(); itSort != toSortItems.end(); itSort++)
|
||||
{
|
||||
if ((*itAll) == (*itSort))
|
||||
{
|
||||
itP->second->push_back((*itAll));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ public:
|
||||
std::string settingsPath() const;
|
||||
bool Save();
|
||||
void sortItems();
|
||||
void sortFavoriteItems();
|
||||
void sortPlaylists();
|
||||
void addSubcollection(CollectionInfo *info);
|
||||
void extensionList(std::vector<std::string> &extensions);
|
||||
std::string name;
|
||||
|
||||
@ -996,7 +996,7 @@ void Page::removePlaylist()
|
||||
if(it != items->end())
|
||||
{
|
||||
items->erase(it);
|
||||
collection->sortFavoriteItems();
|
||||
collection->sortPlaylists();
|
||||
collection->saveRequest = true;
|
||||
}
|
||||
collection->Save();
|
||||
@ -1014,7 +1014,7 @@ void Page::addPlaylist()
|
||||
if(playlist_->first != "favorites" && std::find(items->begin(), items->end(), selectedItem_) == items->end())
|
||||
{
|
||||
items->push_back(selectedItem_);
|
||||
collection->sortFavoriteItems();
|
||||
collection->sortPlaylists();
|
||||
collection->saveRequest = true;
|
||||
}
|
||||
collection->Save();
|
||||
|
||||
@ -1210,7 +1210,7 @@ CollectionInfo *RetroFE::getCollection(std::string collectionName)
|
||||
mp.buildMenuItems( collection, menuSort );
|
||||
|
||||
cib.addPlaylists( collection );
|
||||
collection->sortFavoriteItems( );
|
||||
collection->sortPlaylists( );
|
||||
|
||||
// Add extra info, if available
|
||||
for ( std::vector<Item *>::iterator it = collection->items.begin( ); it != collection->items.end( ); it++ )
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
std::string retrofe_version_major = "0";
|
||||
std::string retrofe_version_minor = "8";
|
||||
std::string retrofe_version_build = "15b5";
|
||||
std::string retrofe_version_build = "15b6";
|
||||
|
||||
|
||||
std::string Version::getString( )
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user