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 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();
if(!lhs->collectionInfo->menusort && !lhs->leaf && !rhs->leaf)
return false;
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( )
{
Component::allocateGraphicsMemory( );

View File

@ -74,6 +74,8 @@ public:
void subUp( );
void subDown( );
void subChange( bool increment );
void cfwLetterSubUp( );
void cfwLetterSubDown( );
void random( );
bool isIdle( );
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()
{
if(!(activeMenu_.size() > 0 && activeMenu_[0])) return 0;

View File

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

View File

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

View File

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