gui: Create QueueToolbar from a single place
Derived classes should already have this available to configure as they see fit. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
319838138a
commit
d0212d47aa
|
@ -5,36 +5,30 @@
|
|||
#include <core/playlist.h>
|
||||
#include <gui/tabs.h>
|
||||
#include <gui/queue/label.h>
|
||||
#include <gui/queue/toolbar.h>
|
||||
#include <gui/queue/window.h>
|
||||
|
||||
|
||||
class CollectionTab : public Tab {
|
||||
private:
|
||||
CollectionLabel *collection_label;
|
||||
QueueToolbar *collection_toolbar;
|
||||
QueueWindow *collection_window;
|
||||
|
||||
public:
|
||||
CollectionTab() : Tab(library::get_queue())
|
||||
{
|
||||
tab_builder->add_from_file(gui :: share_file("QueueWindow.ui"));
|
||||
tab_builder->add_from_file(gui :: share_file("QueueToolbar.ui"));
|
||||
tab_builder->add_from_file(gui :: share_file("QueueLabel.ui"));
|
||||
|
||||
tab_builder->get_widget_derived("CollectionLabel", collection_label);
|
||||
tab_builder->get_widget_derived("QueueToolbar", collection_toolbar);
|
||||
tab_builder->get_widget_derived("QueueWindow", collection_window);
|
||||
|
||||
collection_toolbar->init(tab_pq, collection_label, collection_window, T_RANDOM);
|
||||
tab_toolbar->init(tab_pq, collection_label, collection_window, T_RANDOM);
|
||||
collection_window->init(tab_pq);
|
||||
|
||||
tab_vbox.pack_start(*collection_toolbar, false, true, 2);
|
||||
tab_vbox.pack_start(*collection_window, true, true);
|
||||
|
||||
tab_model = collection_window->q_model;
|
||||
tab_filter = collection_window->q_filter;
|
||||
tab_search = collection_toolbar->q_search;
|
||||
tab_size = collection_label->collection_size;
|
||||
tab_treeview = collection_window->q_treeview;
|
||||
tab_finish_init();
|
||||
|
|
|
@ -4,36 +4,30 @@
|
|||
#include <core/deck.h>
|
||||
#include <gui/tabs.h>
|
||||
#include <gui/queue/label.h>
|
||||
#include <gui/queue/toolbar.h>
|
||||
#include <gui/queue/window.h>
|
||||
|
||||
|
||||
class HistoryTab : public Tab {
|
||||
private:
|
||||
HistoryLabel *history_label;
|
||||
QueueToolbar *history_toolbar;
|
||||
QueueWindow *history_window;
|
||||
|
||||
public:
|
||||
HistoryTab() : Tab(deck :: get_queue())
|
||||
{
|
||||
tab_builder->add_from_file(gui :: share_file("QueueWindow.ui"));
|
||||
tab_builder->add_from_file(gui :: share_file("QueueToolbar.ui"));
|
||||
tab_builder->add_from_file(gui :: share_file("QueueLabel.ui"));
|
||||
|
||||
tab_builder->get_widget_derived("HistoryLabel", history_label);
|
||||
tab_builder->get_widget_derived("QueueToolbar", history_toolbar);
|
||||
tab_builder->get_widget_derived("QueueWindow", history_window);
|
||||
|
||||
history_toolbar->init(tab_pq, history_label, history_window, 0);
|
||||
tab_toolbar->init(tab_pq, history_label, history_window, 0);
|
||||
history_window->init(tab_pq);
|
||||
|
||||
tab_vbox.pack_start(*history_toolbar, false, true, 2);
|
||||
tab_vbox.pack_start(*history_window, true, true);
|
||||
|
||||
tab_model = history_window->q_model;
|
||||
tab_filter = history_window->q_filter;
|
||||
tab_search = history_toolbar->q_search;
|
||||
tab_size = history_label->history_size;
|
||||
tab_treeview = history_window->q_treeview;
|
||||
tab_finish_init();
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include <core/playlist.h>
|
||||
#include <gui/tabs.h>
|
||||
#include <gui/queue/label.h>
|
||||
#include <gui/queue/toolbar.h>
|
||||
#include <gui/queue/window.h>
|
||||
|
||||
|
||||
|
@ -75,35 +74,30 @@ private:
|
|||
|
||||
PlaylistLabel *playlist_label;
|
||||
PlaylistWindow *playlist_window;
|
||||
QueueToolbar *playlist_toolbar;
|
||||
QueueWindow *playlist_tracks;
|
||||
|
||||
public:
|
||||
PlaylistTab() : Tab(playlist :: get_queue())
|
||||
{
|
||||
tab_builder->add_from_file(gui :: share_file("QueueWindow.ui"));
|
||||
tab_builder->add_from_file(gui :: share_file("QueueToolbar.ui"));
|
||||
tab_builder->add_from_file(gui :: share_file("QueueLabel.ui"));
|
||||
tab_builder->add_from_file(gui :: share_file("PlaylistWindow.ui"));
|
||||
|
||||
tab_builder->get_widget_derived("PlaylistLabel", playlist_label);
|
||||
tab_builder->get_widget_derived("PlaylistWindow", playlist_window);
|
||||
tab_builder->get_widget_derived("QueueToolbar", playlist_toolbar);
|
||||
tab_builder->get_widget_derived("QueueWindow", playlist_tracks);
|
||||
|
||||
playlist_toolbar->init(tab_pq, playlist_label, playlist_tracks, 0);
|
||||
tab_toolbar->init(tab_pq, playlist_label, playlist_tracks, 0);
|
||||
playlist_tracks->init(tab_pq);
|
||||
|
||||
playlist_hbox.pack_start(*playlist_window, false, true);
|
||||
playlist_hbox.pack_start(*playlist_tracks, true, true);
|
||||
playlist_hbox.show();
|
||||
|
||||
tab_vbox.pack_start(*playlist_toolbar, false, true, 2);
|
||||
tab_vbox.pack_start(playlist_hbox, true, true);
|
||||
|
||||
tab_model = playlist_tracks->q_model;
|
||||
tab_filter = playlist_tracks->q_filter;
|
||||
tab_search = playlist_toolbar->q_search;
|
||||
tab_treeview = playlist_tracks->q_treeview;
|
||||
tab_finish_init();
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include <core/string.h>
|
||||
#include <gui/tabs.h>
|
||||
#include <gui/queue/label.h>
|
||||
#include <gui/queue/toolbar.h>
|
||||
#include <gui/queue/window.h>
|
||||
|
||||
|
||||
|
@ -40,11 +39,6 @@ private:
|
|||
*/
|
||||
TempLabel *q_label;
|
||||
|
||||
/**
|
||||
* Toolbar widgets
|
||||
*/
|
||||
QueueToolbar *q_toolbar;
|
||||
|
||||
/* Treeview widgets */
|
||||
QueueWindow *q_window;
|
||||
|
||||
|
@ -102,15 +96,13 @@ QueueTab :: QueueTab(Queue *pq, unsigned int num)
|
|||
/*
|
||||
* Now set up the toolbar
|
||||
*/
|
||||
tab_builder->get_widget_derived("QueueToolbar", q_toolbar);
|
||||
q_toolbar->init(pq, q_label, q_window, T_RANDOM | T_REPEAT | T_SWITCH);
|
||||
tab_toolbar->init(pq, q_label, q_window, T_RANDOM | T_REPEAT | T_SWITCH);
|
||||
|
||||
|
||||
/*
|
||||
* Fill in the page!
|
||||
*/
|
||||
|
||||
tab_vbox.pack_start(*q_toolbar, false, true, 2);
|
||||
tab_vbox.pack_start(*q_window, true, true);
|
||||
|
||||
|
||||
|
@ -120,7 +112,6 @@ QueueTab :: QueueTab(Queue *pq, unsigned int num)
|
|||
|
||||
tab_model = q_window->q_model;
|
||||
tab_filter = q_window->q_filter;
|
||||
tab_search = q_toolbar->q_search;
|
||||
tab_size = q_label->temp_size;
|
||||
tab_treeview = q_window->q_treeview;
|
||||
|
||||
|
|
|
@ -33,10 +33,14 @@ Tab :: Tab(Queue *pq)
|
|||
queue_mapping[tab_pq] = this;
|
||||
|
||||
tab_builder = Gtk::Builder::create();
|
||||
tab_builder->add_from_file(gui :: share_file("QueueToolbar.ui"));
|
||||
tab_builder->get_widget_derived("QueueToolbar", tab_toolbar);
|
||||
|
||||
tab_vbox.set_margin_start(1);
|
||||
tab_vbox.set_margin_end(1);
|
||||
tab_vbox.set_homogeneous(false);
|
||||
|
||||
tab_vbox.pack_start(*tab_toolbar, false, true, 2);
|
||||
tab_vbox.show();
|
||||
}
|
||||
|
||||
|
@ -138,7 +142,7 @@ void Tab :: tab_unmap()
|
|||
|
||||
void Tab :: tab_focus_search()
|
||||
{
|
||||
tab_search->grab_focus();
|
||||
tab_toolbar->q_search->grab_focus();
|
||||
}
|
||||
|
||||
void Tab :: tab_selected_ids(std::vector<unsigned int> &ids)
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <gui/ocarina.h>
|
||||
#include <gui/queue/model.h>
|
||||
#include <gui/queue/toolbar.h>
|
||||
#include <core/queue.h>
|
||||
|
||||
class Tab : public QNotifier {
|
||||
|
@ -18,13 +19,14 @@ protected:
|
|||
Queue *tab_pq;
|
||||
Gtk::VBox tab_vbox;
|
||||
|
||||
QueueToolbar *tab_toolbar;
|
||||
|
||||
/**
|
||||
* Widgets that MUST be set by a child class
|
||||
*/
|
||||
Glib::RefPtr<QueueModel> tab_model;
|
||||
Glib::RefPtr<Gtk::TreeModelFilter> tab_filter;
|
||||
|
||||
Gtk::SearchEntry *tab_search;
|
||||
Gtk::TreeView *tab_treeview;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue