mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-02-27 19:51:32 +01:00
Added support for cyclePlaylist key control.
This commit is contained in:
parent
28a77d8c2f
commit
e6f9192bb8
@ -60,6 +60,7 @@ bool UserInput::initialize()
|
|||||||
MapKey("favPlaylist", KeyCodeFavPlaylist, false);
|
MapKey("favPlaylist", KeyCodeFavPlaylist, false);
|
||||||
MapKey("nextPlaylist", KeyCodeNextPlaylist, false);
|
MapKey("nextPlaylist", KeyCodeNextPlaylist, false);
|
||||||
MapKey("prevPlaylist", KeyCodePrevPlaylist, false);
|
MapKey("prevPlaylist", KeyCodePrevPlaylist, false);
|
||||||
|
MapKey("cyclePlaylist", KeyCodeCyclePlaylist, false);
|
||||||
MapKey("addPlaylist", KeyCodeAddPlaylist, false);
|
MapKey("addPlaylist", KeyCodeAddPlaylist, false);
|
||||||
MapKey("removePlaylist", KeyCodeRemovePlaylist, false);
|
MapKey("removePlaylist", KeyCodeRemovePlaylist, false);
|
||||||
MapKey("random", KeyCodeRandom, false);
|
MapKey("random", KeyCodeRandom, false);
|
||||||
|
|||||||
@ -44,6 +44,7 @@ public:
|
|||||||
KeyCodeFavPlaylist,
|
KeyCodeFavPlaylist,
|
||||||
KeyCodeNextPlaylist,
|
KeyCodeNextPlaylist,
|
||||||
KeyCodePrevPlaylist,
|
KeyCodePrevPlaylist,
|
||||||
|
KeyCodeCyclePlaylist,
|
||||||
KeyCodeRandom,
|
KeyCodeRandom,
|
||||||
KeyCodeMenu,
|
KeyCodeMenu,
|
||||||
KeyCodeAddPlaylist,
|
KeyCodeAddPlaylist,
|
||||||
|
|||||||
@ -1071,6 +1071,43 @@ void Page::selectPlaylist(std::string playlist)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Page::cyclePlaylist(std::vector<std::string> list)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Empty list
|
||||||
|
if (list.size() == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Find the current playlist in the list
|
||||||
|
std::vector<std::string>::iterator it = list.begin();
|
||||||
|
while (*it != getPlaylistName() && it != list.end())
|
||||||
|
++it;
|
||||||
|
|
||||||
|
// If current playlist not found, switch to the first found cycle playlist in the playlist list
|
||||||
|
if (it == list.end())
|
||||||
|
{
|
||||||
|
for (std::vector<std::string>::iterator it2 = list.begin(); it2 != list.end(); ++it2)
|
||||||
|
{
|
||||||
|
selectPlaylist( *it2 );
|
||||||
|
if (*it2 == getPlaylistName())
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Current playlist found; switch to the next found playlist in the list
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for(;; ++it)
|
||||||
|
{
|
||||||
|
if (it == list.end()) it = list.begin(); // wrap
|
||||||
|
selectPlaylist( *it );
|
||||||
|
if (*it == getPlaylistName())
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Page::update(float dt)
|
void Page::update(float dt)
|
||||||
{
|
{
|
||||||
for(MenuVector_T::iterator it = menus_.begin(); it != menus_.end(); it++)
|
for(MenuVector_T::iterator it = menus_.begin(); it != menus_.end(); it++)
|
||||||
|
|||||||
@ -57,6 +57,7 @@ public:
|
|||||||
void nextPlaylist();
|
void nextPlaylist();
|
||||||
void prevPlaylist();
|
void prevPlaylist();
|
||||||
void selectPlaylist(std::string playlist);
|
void selectPlaylist(std::string playlist);
|
||||||
|
void cyclePlaylist(std::vector<std::string> list);
|
||||||
void pushMenu(ScrollingList *s, int index = -1);
|
void pushMenu(ScrollingList *s, int index = -1);
|
||||||
bool isMenusFull();
|
bool isMenusFull();
|
||||||
void setLoadSound(Sound *chunk);
|
void setLoadSound(Sound *chunk);
|
||||||
|
|||||||
@ -1067,6 +1067,16 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput( Page *page )
|
|||||||
page->prevPlaylist( );
|
page->prevPlaylist( );
|
||||||
state = RETROFE_PLAYLIST_REQUEST;
|
state = RETROFE_PLAYLIST_REQUEST;
|
||||||
}
|
}
|
||||||
|
if ( input_.keystate(UserInput::KeyCodeCyclePlaylist) )
|
||||||
|
{
|
||||||
|
attract_.reset( );
|
||||||
|
std::string cycleString;
|
||||||
|
config_.getProperty( "cyclePlaylist", cycleString );
|
||||||
|
std::vector<std::string> cycleVector;
|
||||||
|
Utils::listToVector( cycleString, cycleVector, ',' );
|
||||||
|
page->cyclePlaylist( cycleVector );
|
||||||
|
state = RETROFE_PLAYLIST_REQUEST;
|
||||||
|
}
|
||||||
if ( input_.newKeyPressed(UserInput::KeyCodeRemovePlaylist) )
|
if ( input_.newKeyPressed(UserInput::KeyCodeRemovePlaylist) )
|
||||||
{
|
{
|
||||||
attract_.reset( );
|
attract_.reset( );
|
||||||
|
|||||||
@ -253,3 +253,16 @@ std::string Utils::trimEnds(std::string str)
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Utils::listToVector( std::string str, std::vector<std::string> &vec, char delimiter = ',' )
|
||||||
|
{
|
||||||
|
std::size_t current, previous = 0;
|
||||||
|
current = str.find( delimiter );
|
||||||
|
while (current != std::string::npos)
|
||||||
|
{
|
||||||
|
vec.push_back( Utils::trimEnds( str.substr( previous, current - previous ) ) );
|
||||||
|
previous = current + 1;
|
||||||
|
current = str.find( delimiter, previous );
|
||||||
|
}
|
||||||
|
vec.push_back( Utils::trimEnds( str.substr( previous, current - previous ) ) );
|
||||||
|
}
|
||||||
|
|||||||
@ -35,6 +35,7 @@ public:
|
|||||||
static std::string uppercaseFirst(std::string str);
|
static std::string uppercaseFirst(std::string str);
|
||||||
static std::string filterComments(std::string line);
|
static std::string filterComments(std::string line);
|
||||||
static std::string trimEnds(std::string str);
|
static std::string trimEnds(std::string str);
|
||||||
|
static void listToVector( std::string str, std::vector<std::string> &vec, char delimiter );
|
||||||
|
|
||||||
//todo: there has to be a better way to do this
|
//todo: there has to be a better way to do this
|
||||||
static std::string combinePath(std::list<std::string> &paths);
|
static std::string combinePath(std::list<std::string> &paths);
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
std::string retrofe_version_major = "0";
|
std::string retrofe_version_major = "0";
|
||||||
std::string retrofe_version_minor = "9";
|
std::string retrofe_version_minor = "9";
|
||||||
std::string retrofe_version_build = "2";
|
std::string retrofe_version_build = "3";
|
||||||
|
|
||||||
|
|
||||||
std::string Version::getString( )
|
std::string Version::getString( )
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user