diff --git a/gui/history.cpp b/gui/history.cpp index 9b0f9f65..aee8ba7e 100644 --- a/gui/history.cpp +++ b/gui/history.cpp @@ -3,18 +3,51 @@ */ #include #include +#include +#include +#include class HistoryTab : public Tab { +private: + Glib::RefPtr builder; + Gtk::VBox history_vbox; + + HistoryLabel *history_label; + QueueToolbar *history_toolbar; + QueueWindow *history_window; + public: HistoryTab() : Tab(deck :: get_queue()) { - tab_search = gui :: get_widget("o_history_entry"); - tab_size = gui :: get_widget("o_history_size"); - tab_treeview = gui :: get_widget("o_history_treeview"); - tab_widget = gui :: get_widget("o_history_page"); + builder = Gtk::Builder::create(); + builder->add_from_file(gui :: share_file("QueueWindow.ui")); + builder->add_from_file(gui :: share_file("QueueToolbar.ui")); + builder->add_from_file(gui :: share_file("QueueLabel.ui")); + builder->get_widget_derived("HistoryLabel", history_label); + builder->get_widget_derived("QueueToolbar", history_toolbar); + builder->get_widget_derived("QueueWindow", history_window); + + history_toolbar->q_switch->hide(); + history_toolbar->q_repeat->hide(); + + history_vbox.set_margin_left(1); + history_vbox.set_margin_right(1); + history_vbox.set_homogeneous(false); + history_vbox.pack_start(*history_toolbar, false, true, 2); + history_vbox.pack_start(*history_window, true, true); + history_vbox.show(); + + tab_random = history_toolbar->q_random; + tab_repeat = history_toolbar->q_repeat; + tab_search = history_toolbar->q_search; + tab_size = history_label->history_size; + tab_treeview = history_window->q_treeview; + tab_widget = &history_vbox; tab_finish_init(); + + gui :: get_widget("o_notebook")->insert_page(history_vbox, *history_label, 0); } ~HistoryTab() diff --git a/gui/queue/label.cpp b/gui/queue/label.cpp index c6c01c40..7a47a6d2 100644 --- a/gui/queue/label.cpp +++ b/gui/queue/label.cpp @@ -17,6 +17,19 @@ CollectionLabel :: ~CollectionLabel() +HistoryLabel :: HistoryLabel(BaseObjectType *cobject, + const Glib::RefPtr builder) + : Gtk::HBox(cobject), _builder(builder) +{ + _builder->get_widget("history_size", history_size); +} + +HistoryLabel :: ~HistoryLabel() +{ +} + + + TempLabel :: TempLabel(BaseObjectType *cobject, const Glib::RefPtr builder) : Gtk::HBox(cobject), _builder(builder) diff --git a/gui/tabs.cpp b/gui/tabs.cpp index 8554737c..636827f4 100644 --- a/gui/tabs.cpp +++ b/gui/tabs.cpp @@ -490,8 +490,8 @@ void init_tabs() } /* Initialize other tabs */ - init_collection_tab(); init_history_tab(); + init_collection_tab(); init_queue_tabs(); } diff --git a/include/gui/queue/label.h b/include/gui/queue/label.h index cf9b5a4a..2ecbf641 100644 --- a/include/gui/queue/label.h +++ b/include/gui/queue/label.h @@ -20,6 +20,19 @@ public: +class HistoryLabel : public Gtk::HBox { +private: + Glib::RefPtr _builder; + +public: + Gtk::Label *history_size; + + HistoryLabel(BaseObjectType *, const Glib::RefPtr); + ~HistoryLabel(); +}; + + + class TempLabel : public Gtk::HBox { private: Glib::RefPtr _builder; diff --git a/share/ocarina/QueueLabel.ui b/share/ocarina/QueueLabel.ui index fd238191..70c5b960 100644 --- a/share/ocarina/QueueLabel.ui +++ b/share/ocarina/QueueLabel.ui @@ -58,6 +58,63 @@ + + True + False + 5 + + + True + False + document-open-recent + 1 + + + False + True + 0 + + + + + True + False + vertical + + + True + False + <big>History</big> + True + center + + + True + True + 0 + + + + + True + False + 0 + center + + + True + True + 1 + + + + + True + True + 1 + + + True False diff --git a/share/ocarina/ocarina6.glade b/share/ocarina/ocarina6.glade index 10d8cf55..959f1cd5 100644 --- a/share/ocarina/ocarina6.glade +++ b/share/ocarina/ocarina6.glade @@ -237,260 +237,6 @@ left True True - - - True - False - 1 - 1 - vertical - - - True - True - 5 - 5 - 5 - 5 - edit-find-symbolic - False - False - - - False - True - 0 - - - - - True - True - 5 - 5 - 5 - in - - - True - True - False - True - 9 - - - multiple - - - - - True - fixed - 20 - # - True - - - - 0 - - - - - - - True - fixed - 300 - Title - True - - - - 1 - - - - - - - True - fixed - 60 - Length - True - - - - 2 - - - - - - - True - fixed - 100 - Artist - True - - - - 3 - - - - - - - True - fixed - 100 - Album - True - - - - 4 - - - - - - - True - fixed - 45 - Year - True - - - - 5 - - - - - - - True - fixed - 100 - Genre - True - - - - 6 - - - - - - - True - fixed - 60 - Count - True - - - - 7 - - - - - - - True - fixed - 1 - Played - True - - - - 8 - - - - - - - - - True - True - 1 - - - - - - - True - False - 5 - - - True - False - document-open-recent - 1 - - - False - True - 0 - - - - - True - False - vertical - - - True - False - 1 - <big>History</big> - True - center - - - True - True - 0 - - - - - True - False - 0 - center - - - True - True - 1 - - - - - True - True - 1 - - - - - False - - True @@ -732,9 +478,6 @@ - - 1 - @@ -771,7 +514,6 @@ Manager - 1 False @@ -980,7 +722,7 @@ Manager - 2 + 1 @@ -1018,7 +760,7 @@ Manager - 2 + 1 False