gui: Add songs to favorite playlist

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
Anna Schumaker 2014-02-28 20:39:07 -05:00 committed by Anna Schumaker
parent d83609bc21
commit ff925cf573
2 changed files with 15 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#include <callback.h>
#include <deck.h>
#include <filter.h>
#include <playlist.h>
#include <tabs.h>
#include <map>
@ -180,6 +181,17 @@ bool Tab :: tab_add_to_queue(unsigned int n)
return true;
}
bool Tab :: tab_favorite_selected()
{
std::vector<unsigned int> ids;
tab_selected_ids(ids);
for (unsigned int i = 0; i < ids.size(); i++)
playlist :: add("Favorites", ids[i]);
return true;
}
/**
@ -214,6 +226,8 @@ bool Tab :: on_key_press_event(const std::string &key)
{
if (key >= "0" && key <= "9")
return tab_add_to_queue(atoi(key.c_str()));
else if (key == "f")
return tab_favorite_selected();
else if (key == "q" || key == "r")
return tab_queue_selected(key == "r");
else

View File

@ -62,6 +62,7 @@ public:
void tab_queue_add(Playqueue *);
bool tab_queue_selected(bool);
bool tab_add_to_queue(unsigned int);
bool tab_favorite_selected();
/**
* internal callback functions that can be overridden if necessary