mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-04-08 20:23:05 +02:00
Supporting favorites
This commit is contained in:
@@ -51,6 +51,18 @@ CollectionInfo::~CollectionInfo()
|
||||
}
|
||||
|
||||
|
||||
Playlists_T::iterator pit = playlists.begin();
|
||||
|
||||
while(pit != playlists.end())
|
||||
{
|
||||
if(pit->second != &items)
|
||||
{
|
||||
delete pit->second;
|
||||
}
|
||||
playlists.erase(pit);
|
||||
pit = playlists.begin();
|
||||
}
|
||||
|
||||
std::vector<Item *>::iterator it = items.begin();
|
||||
while(it != items.end())
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
std::string launcher;
|
||||
std::vector<Item *> items;
|
||||
|
||||
typedef std::map<std::string, std::vector <Item *> > Playlists_T;
|
||||
typedef std::map<std::string, std::vector <Item *> *> Playlists_T;
|
||||
Playlists_T playlists;
|
||||
|
||||
private:
|
||||
|
||||
@@ -279,6 +279,8 @@ bool CollectionInfoBuilder::ImportDirectory(CollectionInfo *info, std::string me
|
||||
std::vector<std::string>::iterator extensionsIt;
|
||||
|
||||
info->extensionList(extensions);
|
||||
info->playlists["all"] = &info->items;
|
||||
info->playlists["favorites"] = new std::vector<Item *>();
|
||||
|
||||
|
||||
dp = opendir(path.c_str());
|
||||
@@ -300,10 +302,11 @@ bool CollectionInfoBuilder::ImportDirectory(CollectionInfo *info, std::string me
|
||||
}
|
||||
}
|
||||
}
|
||||
for(std::map<std::string, Item *>::iterator it = favoritesFilter.begin(); it != favoritesFilter.end(); it++)
|
||||
{
|
||||
info->playlists["favorites"].push_back(it->second);
|
||||
}
|
||||
// add the favorites list
|
||||
for(std::map<std::string, Item *>::iterator it = favoritesFilter.begin(); it != favoritesFilter.end(); it++)
|
||||
{
|
||||
info->playlists["favorites"]->push_back(it->second);
|
||||
}
|
||||
|
||||
while((dirp = readdir(dp)) != NULL)
|
||||
{
|
||||
@@ -334,7 +337,6 @@ bool CollectionInfoBuilder::ImportDirectory(CollectionInfo *info, std::string me
|
||||
i->collectionInfo = info;
|
||||
|
||||
info->items.push_back(i);
|
||||
info->playlists["include"].push_back(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,9 +149,6 @@ bool MenuParser::buildLegacyXmlMenu(CollectionInfo *collection, bool sort)
|
||||
}
|
||||
|
||||
|
||||
std::sort( collection->items.begin(), collection->items.end(), VectorSort);
|
||||
|
||||
// todo: sorting should occur within the collection itself, not externally
|
||||
if(sort)
|
||||
{
|
||||
// sort the menu if requested
|
||||
|
||||
Reference in New Issue
Block a user