Skip to content
1 change: 1 addition & 0 deletions RetroFE/Source/Collection/CollectionInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class CollectionInfo
std::string metadataType;
std::string launcher;
std::vector<Item *> items;
std::vector<Item*> playlistItems;

typedef std::map<std::string, std::vector <Item *> *> Playlists_T;
Playlists_T playlists;
Expand Down
31 changes: 31 additions & 0 deletions RetroFE/Source/Collection/CollectionInfoBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ void CollectionInfoBuilder::addPlaylists(CollectionInfo *info)
info->playlists["favorites"] = new std::vector<Item *>();
return;
}
std::map<std::string, Item*> playlistItems;

while((dirp = readdir(dp)) != NULL)
{
Expand All @@ -445,6 +446,14 @@ void CollectionInfoBuilder::addPlaylists(CollectionInfo *info)

info->playlists[basename] = new std::vector<Item *>();

Item* playlistItem = new Item();
playlistItem->name = basename;
playlistItem->title = basename;
playlistItem->fullTitle = basename;
playlistItem->leaf = false;
playlistItem->collectionInfo = info;
playlistItems[basename] = playlistItem;

// add the playlist list
for(std::map<std::string, Item *>::iterator it = playlistFilter.begin(); it != playlistFilter.end(); it++)
{
Expand Down Expand Up @@ -480,6 +489,28 @@ void CollectionInfoBuilder::addPlaylists(CollectionInfo *info)
}
}
}
// if cyclePlaylist then order playlist menu items by that
std::string cycleString;
conf_.getProperty("cyclePlaylist", cycleString);
std::vector<std::string> cycleVector;
Utils::listToVector(cycleString, cycleVector, ',');
if (cycleVector.size())
{
// add in order according to cycle list
for (std::vector<std::string>::iterator itP = cycleVector.begin(); itP != cycleVector.end(); itP++)
{
if (playlistItems[*itP]) {
info->playlistItems.push_back(playlistItems[*itP]);
}
}
}
else {
// convert lookup playlist map to vector
for (std::map<std::string, Item*>::iterator itP = playlistItems.begin(); itP != playlistItems.end(); itP++)
{
info->playlistItems.push_back(itP->second);
}
}

if (dp) closedir(dp);

Expand Down
16 changes: 14 additions & 2 deletions RetroFE/Source/Graphics/Component/ScrollingList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ ScrollingList::ScrollingList( Configuration &c,
Page &p,
bool layoutMode,
bool commonMode,
bool playlistType,
Font *font,
std::string layoutKey,
std::string imageType,
Expand All @@ -52,6 +53,7 @@ ScrollingList::ScrollingList( Configuration &c,
, horizontalScroll( false )
, layoutMode_( layoutMode )
, commonMode_( commonMode )
, playlistType_( playlistType )
, spriteList_( NULL )
, scrollPoints_( NULL )
, tweenPoints_( NULL )
Expand All @@ -76,6 +78,7 @@ ScrollingList::ScrollingList( const ScrollingList &copy )
, horizontalScroll( copy.horizontalScroll )
, layoutMode_( copy.layoutMode_ )
, commonMode_( copy.commonMode_ )
, playlistType_(copy.playlistType_)
, spriteList_( NULL )
, itemIndex_( 0 )
, selectedOffsetIndex_( copy.selectedOffsetIndex_ )
Expand Down Expand Up @@ -108,13 +111,17 @@ ScrollingList::~ScrollingList( )
}
}

std::vector<Item*> ScrollingList::getItems()
{
return *items_;
}

void ScrollingList::setItems( std::vector<Item *> *items )
{
items_ = items;
if ( items_ )
if (items_)
{
itemIndex_ = loopDecrement( 0, selectedOffsetIndex_, items_->size( ) );
itemIndex_ = loopDecrement(0, selectedOffsetIndex_, items_->size());
}
}

Expand Down Expand Up @@ -764,6 +771,8 @@ bool ScrollingList::allocateTexture( unsigned int index, Item *item )
names.push_back( item->rating );
if ( typeLC == "score" )
names.push_back( item->score );
if (typeLC.rfind("playlist", 0) == 0)
names.push_back(item->name);
names.push_back("default");

for ( unsigned int n = 0; n < names.size() && !t; ++n )
Expand Down Expand Up @@ -1050,6 +1059,9 @@ void ScrollingList::updateScrollPeriod( )

void ScrollingList::scroll( bool forward )
{
// playlist menus don't scroll
if (playlistType_)
return;

if ( !items_ || items_->size( ) == 0 ) return;
if ( !scrollPoints_ || scrollPoints_->size( ) == 0 ) return;
Expand Down
3 changes: 3 additions & 0 deletions RetroFE/Source/Graphics/Component/ScrollingList.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ class ScrollingList : public Component
Page &p,
bool layoutMode,
bool commonMode,
bool playlistType,
Font *font,
std::string layoutKey,
std::string imageType,
std::string videoType );

ScrollingList( const ScrollingList &copy );
virtual ~ScrollingList( );
std::vector<Item*> getItems();
void triggerEnterEvent( );
void triggerExitEvent( );
void triggerMenuEnterEvent( int menuIndex = -1 );
Expand Down Expand Up @@ -101,6 +103,7 @@ class ScrollingList : public Component
void resetScrollPeriod( );
void updateScrollPeriod( );
void scroll( bool forward );
bool playlistType_;//todo make getter

private:

Expand Down
Loading