Added subsSplit global settings to keep different subcollections separated

in the menu.
Added clearInputClear support for playlist change.
This commit is contained in:
Pieter Hulshoff 2018-05-27 00:09:06 +02:00
parent 445fd7ae6e
commit 39671bcee5
4 changed files with 29 additions and 2 deletions

View File

@ -44,6 +44,7 @@ CollectionInfo::CollectionInfo(std::string name,
, saveRequest(false)
, metadataType(metadataType)
, menusort(true)
, subsSplit(false)
, metadataPath_(metadataPath)
, extensions_(extensions)
{
@ -158,6 +159,13 @@ void CollectionInfo::extensionList(std::vector<std::string> &extensionlist)
}
}
std::string CollectionInfo::lowercaseName()
{
std::string lcstr = name;
std::transform(lcstr.begin(), lcstr.end(), lcstr.begin(), ::tolower);
return lcstr;
}
void CollectionInfo::addSubcollection(CollectionInfo *newinfo)
{
items.insert(items.begin(), newinfo->items.begin(), newinfo->items.end());
@ -168,6 +176,8 @@ bool CollectionInfo::itemIsLess(Item *lhs, Item *rhs)
if(lhs->leaf && !rhs->leaf) return true;
if(!lhs->leaf && rhs->leaf) return false;
if(!lhs->collectionInfo->menusort && lhs->leaf && rhs->leaf) return false;
if(lhs->collectionInfo->subsSplit && lhs->collectionInfo != rhs->collectionInfo)
return lhs->collectionInfo->lowercaseName() < rhs->collectionInfo->lowercaseName();
return lhs->lowercaseFullTitle() < rhs->lowercaseFullTitle();
}

View File

@ -33,6 +33,7 @@ public:
void addSubcollection(CollectionInfo *info);
void extensionList(std::vector<std::string> &extensions);
std::string name;
std::string lowercaseName();
std::string listpath;
bool saveRequest;
std::string metadataType;
@ -43,6 +44,7 @@ public:
Playlists_T playlists;
bool menusort;
bool subsSplit;
private:
std::string metadataPath_;
std::string extensions_;

View File

@ -481,6 +481,15 @@ void RetroFE::run( )
case RETROFE_PLAYLIST_ENTER:
if (currentPage_->isIdle( ))
{
bool collectionInputClear = false;
config_.getProperty( "collectionInputClear", collectionInputClear );
if ( collectionInputClear )
{
// Empty event queue
SDL_Event e;
while ( SDL_PollEvent( &e ) );
input_.resetStates( );
}
state = RETROFE_IDLE;
}
break;
@ -1161,9 +1170,14 @@ Page *RetroFE::loadSplashPage( )
CollectionInfo *RetroFE::getCollection(std::string collectionName)
{
// Check if subcollections should be merged or split
bool subsSplit = false;
config_.getProperty( "subsSplit", subsSplit );
// Build the collection
CollectionInfoBuilder cib(config_, *metadb_);
CollectionInfo *collection = cib.buildCollection( collectionName );
collection->subsSplit = subsSplit;
cib.injectMetadata( collection );
DIR *dp;
@ -1191,6 +1205,7 @@ CollectionInfo *RetroFE::getCollection(std::string collectionName)
CollectionInfo *subcollection = cib.buildCollection( basename, collectionName );
collection->addSubcollection( subcollection );
subcollection->subsSplit = subsSplit;
cib.injectMetadata( subcollection );
}
}
@ -1206,7 +1221,7 @@ CollectionInfo *RetroFE::getCollection(std::string collectionName)
}
MenuParser mp;
mp.buildMenuItems( collection, menuSort );
mp.buildMenuItems( collection, menuSort);
cib.addPlaylists( collection );
collection->sortPlaylists( );

View File

@ -21,7 +21,7 @@
std::string retrofe_version_major = "0";
std::string retrofe_version_minor = "8";
std::string retrofe_version_build = "15b8";
std::string retrofe_version_build = "15b10";
std::string Version::getString( )