95064e4537
I plan to introduce a new lib/ that sits between the gui and the backend files (similar to how glibc sits between the kernel and userspace). This gets the rename out of the way before I change my mind again. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
63 lines
1.2 KiB
C++
63 lines
1.2 KiB
C++
/*
|
|
* Copyright 2014 (c) Anna Schumaker.
|
|
*/
|
|
#include <core/deck.h>
|
|
#include <core/library.h>
|
|
#include <core/playlist.h>
|
|
#include <gui/tabs.h>
|
|
|
|
|
|
class CollectionTab : public Tab {
|
|
public:
|
|
CollectionTab();
|
|
~CollectionTab();
|
|
void on_post_init();
|
|
bool on_key_press_event(const std::string &);
|
|
};
|
|
|
|
|
|
CollectionTab :: CollectionTab()
|
|
: Tab(library::get_queue())
|
|
{
|
|
tab_random = get_widget<Gtk::ToggleButton>("o_collection_random");
|
|
tab_search = get_widget<Gtk::SearchEntry>("o_collection_entry");
|
|
tab_size = get_widget<Gtk::Label>("o_collection_size");
|
|
tab_treeview = get_widget<Gtk::TreeView>("o_collection_pq_treeview");
|
|
tab_widget = get_widget<Gtk::Widget>("o_collection_page");
|
|
|
|
tab_finish_init();
|
|
}
|
|
|
|
CollectionTab :: ~CollectionTab()
|
|
{
|
|
tab_unmap();
|
|
}
|
|
|
|
void CollectionTab :: on_post_init()
|
|
{
|
|
tab_init_random();
|
|
}
|
|
|
|
bool CollectionTab :: on_key_press_event(const std::string &key)
|
|
{
|
|
std::vector<unsigned int> ids;
|
|
|
|
if (key != "Delete")
|
|
return Tab :: on_key_press_event(key);
|
|
|
|
tab_selected_ids(ids);
|
|
for (unsigned int i = 0; i < ids.size(); i++)
|
|
playlist :: add(tagdb :: lookup(ids[i]), "Banned");
|
|
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
static CollectionTab *collection_tab;
|
|
|
|
void init_collection_tab()
|
|
{
|
|
collection_tab = new CollectionTab;
|
|
}
|