Changed letterSub parameter to cfwLetterSub to indicate it's a CFW specific feature. Also changed its behavior to only skip subs when you're in a sub collection itself, and skip letter otherwise.

This commit is contained in:
Pieter Hulshoff
2019-04-15 12:26:49 +02:00
parent 18e268d111
commit ab95151515
7 changed files with 56 additions and 17 deletions

View File

@@ -177,9 +177,10 @@ bool CollectionInfo::itemIsLess(Item *lhs, Item *rhs)
{ {
if(lhs->leaf && !rhs->leaf) return true; if(lhs->leaf && !rhs->leaf) return true;
if(!lhs->leaf && rhs->leaf) return false; 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) if(lhs->collectionInfo->subsSplit && lhs->collectionInfo != rhs->collectionInfo)
return lhs->collectionInfo->lowercaseName() < rhs->collectionInfo->lowercaseName(); return lhs->collectionInfo->lowercaseName() < rhs->collectionInfo->lowercaseName();
if(!lhs->collectionInfo->menusort && !lhs->leaf && !rhs->leaf)
return false;
return lhs->lowercaseFullTitle() < rhs->lowercaseFullTitle(); return lhs->lowercaseFullTitle() < rhs->lowercaseFullTitle();
} }

View File

@@ -406,6 +406,24 @@ void ScrollingList::subChange( bool increment )
} }
void ScrollingList::cfwLetterSubUp( )
{
if (Utils::toLower( collectionName ) != items_->at( (itemIndex_+selectedOffsetIndex_ ) % items_->size( ) )->collectionInfo->lowercaseName( ))
subChange( true );
else
letterChange( true );
}
void ScrollingList::cfwLetterSubDown( )
{
if (Utils::toLower( collectionName ) != items_->at( (itemIndex_+selectedOffsetIndex_ ) % items_->size( ) )->collectionInfo->lowercaseName( ))
subChange( false );
else
letterChange( false );
}
void ScrollingList::allocateGraphicsMemory( ) void ScrollingList::allocateGraphicsMemory( )
{ {
Component::allocateGraphicsMemory( ); Component::allocateGraphicsMemory( );

View File

@@ -74,6 +74,8 @@ public:
void subUp( ); void subUp( );
void subDown( ); void subDown( );
void subChange( bool increment ); void subChange( bool increment );
void cfwLetterSubUp( );
void cfwLetterSubDown( );
void random( ); void random( );
bool isIdle( ); bool isIdle( );
unsigned int getScrollOffsetIndex( ); unsigned int getScrollOffsetIndex( );

View File

@@ -734,6 +734,26 @@ void Page::subScroll(ScrollDirection direction)
} }
void Page::cfwLetterSubScroll(ScrollDirection direction)
{
for(std::vector<ScrollingList *>::iterator it = activeMenu_.begin(); it != activeMenu_.end(); it++)
{
ScrollingList *menu = *it;
if(menu)
{
if(direction == ScrollDirectionForward)
{
menu->cfwLetterSubDown();
}
if(direction == ScrollDirectionBack)
{
menu->cfwLetterSubUp();
}
}
}
}
unsigned int Page::getCollectionSize() unsigned int Page::getCollectionSize()
{ {
if(!(activeMenu_.size() > 0 && activeMenu_[0])) return 0; if(!(activeMenu_.size() > 0 && activeMenu_[0])) return 0;

View File

@@ -67,6 +67,7 @@ public:
void pageScroll(ScrollDirection direction); void pageScroll(ScrollDirection direction);
void letterScroll(ScrollDirection direction); void letterScroll(ScrollDirection direction);
void subScroll(ScrollDirection direction); void subScroll(ScrollDirection direction);
void cfwLetterSubScroll(ScrollDirection direction);
unsigned int getCollectionSize(); unsigned int getCollectionSize();
unsigned int getSelectedIndex(); unsigned int getSelectedIndex();
void selectRandom(); void selectRandom();

View File

@@ -1021,10 +1021,10 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput( Page *page )
if (input_.keystate(UserInput::KeyCodeLetterUp)) if (input_.keystate(UserInput::KeyCodeLetterUp))
{ {
attract_.reset( ); attract_.reset( );
bool letterSub; bool cfwLetterSub;
config_.getProperty( "letterSub", letterSub ); config_.getProperty( "cfwLetterSub", cfwLetterSub );
if (letterSub && page->hasSubs()) if (cfwLetterSub && page->hasSubs())
page->subScroll(Page::ScrollDirectionBack); page->cfwLetterSubScroll(Page::ScrollDirectionBack);
else else
page->letterScroll(Page::ScrollDirectionBack); page->letterScroll(Page::ScrollDirectionBack);
state = RETROFE_MENUJUMP_REQUEST; state = RETROFE_MENUJUMP_REQUEST;
@@ -1032,10 +1032,10 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput( Page *page )
if (input_.keystate(UserInput::KeyCodeLetterDown)) if (input_.keystate(UserInput::KeyCodeLetterDown))
{ {
attract_.reset( ); attract_.reset( );
bool letterSub; bool cfwLetterSub;
config_.getProperty( "letterSub", letterSub ); config_.getProperty( "cfwLetterSub", cfwLetterSub );
if (letterSub && page->hasSubs()) if (cfwLetterSub && page->hasSubs())
page->subScroll(Page::ScrollDirectionForward); page->cfwLetterSubScroll(Page::ScrollDirectionForward);
else else
page->letterScroll(Page::ScrollDirectionForward); page->letterScroll(Page::ScrollDirectionForward);
state = RETROFE_MENUJUMP_REQUEST; state = RETROFE_MENUJUMP_REQUEST;
@@ -1046,13 +1046,13 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput( Page *page )
page->favPlaylist( ); page->favPlaylist( );
state = RETROFE_PLAYLIST_REQUEST; state = RETROFE_PLAYLIST_REQUEST;
} }
if ( input_.newKeyPressed(UserInput::KeyCodeNextPlaylist) ) if ( input_.keystate(UserInput::KeyCodeNextPlaylist) )
{ {
attract_.reset( ); attract_.reset( );
page->nextPlaylist( ); page->nextPlaylist( );
state = RETROFE_PLAYLIST_REQUEST; state = RETROFE_PLAYLIST_REQUEST;
} }
if ( input_.newKeyPressed(UserInput::KeyCodePrevPlaylist) ) if ( input_.keystate(UserInput::KeyCodePrevPlaylist) )
{ {
attract_.reset( ); attract_.reset( );
page->prevPlaylist( ); page->prevPlaylist( );
@@ -1227,14 +1227,11 @@ CollectionInfo *RetroFE::getCollection(std::string collectionName)
} }
closedir( dp ); closedir( dp );
collection->sortItems( );
bool menuSort = true; bool menuSort = true;
config_.getProperty( "collections." + collectionName + ".list.menuSort", menuSort ); config_.getProperty( "collections." + collectionName + ".list.menuSort", menuSort );
if ( menuSort )
{
collection->sortItems( );
}
MenuParser mp; MenuParser mp;
mp.buildMenuItems( collection, menuSort); mp.buildMenuItems( collection, menuSort);

View File

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