From ff925cf5734d5d7a8798d5f2df05e66518c65731 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Fri, 28 Feb 2014 20:39:07 -0500 Subject: [PATCH] gui: Add songs to favorite playlist Signed-off-by: Anna Schumaker --- gui/tabs.cpp | 14 ++++++++++++++ include/tabs.h | 1 + 2 files changed, 15 insertions(+) diff --git a/gui/tabs.cpp b/gui/tabs.cpp index 6027ff4c..6898b534 100644 --- a/gui/tabs.cpp +++ b/gui/tabs.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -180,6 +181,17 @@ bool Tab :: tab_add_to_queue(unsigned int n) return true; } +bool Tab :: tab_favorite_selected() +{ + std::vector 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 diff --git a/include/tabs.h b/include/tabs.h index 6a97ed92..41b45c7e 100644 --- a/include/tabs.h +++ b/include/tabs.h @@ -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