mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-13 10:18:53 +01:00
Adding button to add to playlists (does not yet save favorites.txt yet)
This commit is contained in:
parent
24d4b37cf7
commit
0ff46605eb
@ -7,7 +7,8 @@ pageDown = B
|
||||
letterUp = N
|
||||
letterDown = M
|
||||
nextPlaylist = P
|
||||
addPlaylist = O
|
||||
addPlaylist = I
|
||||
removePlaylist = O
|
||||
random = R
|
||||
select = Space
|
||||
back = Escape
|
||||
|
||||
@ -76,6 +76,7 @@ bool UserInput::initialize()
|
||||
MapKey("letterUp", KeyCodeLetterUp, false);
|
||||
MapKey("nextPlaylist", KeyCodeNextPlaylist, false);
|
||||
MapKey("addPlaylist", KeyCodeAddPlaylist, false);
|
||||
MapKey("removePlaylist", KeyCodeRemovePlaylist, false);
|
||||
MapKey("random", KeyCodeRandom, false);
|
||||
// these features will need to be implemented at a later time
|
||||
// retVal = MapKey("admin", KeyCodeAdminMode) && retVal;
|
||||
|
||||
@ -42,6 +42,7 @@ public:
|
||||
KeyCodeNextPlaylist,
|
||||
KeyCodeRandom,
|
||||
KeyCodeAddPlaylist,
|
||||
KeyCodeRemovePlaylist,
|
||||
KeyCodeAdminMode,
|
||||
KeyCodeHideItem,
|
||||
KeyCodeQuit,
|
||||
|
||||
@ -645,6 +645,30 @@ void Page::draw()
|
||||
|
||||
}
|
||||
|
||||
void Page::removePlaylist()
|
||||
{
|
||||
if(!selectedItem_) return;
|
||||
|
||||
MenuInfo_S &info = collections_.back();
|
||||
CollectionInfo *collection = info.collection;
|
||||
|
||||
std::vector<Item *> *items = collection->playlists["favorites"];
|
||||
std::vector<Item *> it = std::find(items->begin(), items->end(), selectedItem_);
|
||||
|
||||
if(it != items->end())
|
||||
{
|
||||
items->erase(it);
|
||||
|
||||
items->shrink_to_fit();
|
||||
|
||||
if(activeMenu_)
|
||||
{
|
||||
activeMenu_->deallocateSpritePoints();
|
||||
activeMenu_->allocateSpritePoints();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Page::addPlaylist()
|
||||
{
|
||||
if(!selectedItem_) return;
|
||||
|
||||
@ -450,6 +450,7 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput(Page *page)
|
||||
!input_.keystate(UserInput::KeyCodeLetterDown) &&
|
||||
!input_.keystate(UserInput::KeyCodeNextPlaylist) &&
|
||||
!input_.keystate(UserInput::KeyCodeAddPlaylist) &&
|
||||
!input_.keystate(UserInput::KeyCodeRemovePlaylist) &&
|
||||
!input_.keystate(UserInput::KeyCodeRandom))
|
||||
{
|
||||
keyLastTime_ = 0;
|
||||
@ -482,6 +483,10 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput(Page *page)
|
||||
{
|
||||
page->nextPlaylist();
|
||||
}
|
||||
if(input_.keystate(UserInput::KeyCodeRemovePlaylist))
|
||||
{
|
||||
page->removePlaylist();
|
||||
}
|
||||
if(input_.keystate(UserInput::KeyCodeAddPlaylist))
|
||||
{
|
||||
page->addPlaylist();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user