gui: Remove old TabToolbar code
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
bc9efade75
commit
21eb09ced3
|
@ -20,7 +20,6 @@ public:
|
|||
{
|
||||
tab_builder->add_from_file(gui :: share_file("QueueLabel.ui"));
|
||||
tab_builder->get_widget_derived("CollectionLabel", collection_label);
|
||||
tab_toolbar->init(tab_pq, collection_label, tab_window, T_RANDOM);
|
||||
|
||||
collection_label->init(tab_pq);
|
||||
tab_label = collection_label;
|
||||
|
|
|
@ -19,7 +19,6 @@ public:
|
|||
{
|
||||
tab_builder->add_from_file(gui :: share_file("QueueLabel.ui"));
|
||||
tab_builder->get_widget_derived("HistoryLabel", history_label);
|
||||
tab_toolbar->init(tab_pq, history_label, tab_window, 0);
|
||||
|
||||
history_label->init(tab_pq);
|
||||
tab_label = history_label;
|
||||
|
|
|
@ -28,8 +28,6 @@ public:
|
|||
tab_builder->add_from_file(gui :: share_file("QueueLabel.ui"));
|
||||
tab_builder->get_widget_derived("PlaylistLabel", playlist_label);
|
||||
|
||||
tab_toolbar->init(tab_pq, playlist_label, tab_window, 0);
|
||||
|
||||
playlist_label->init(tab_pq);
|
||||
tab_label = playlist_label;
|
||||
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
/*
|
||||
* Copyright 2015 (c) Anna Schumaker.
|
||||
*/
|
||||
#include <gui/queue/toolbar.h>
|
||||
|
||||
QueueToolbar :: QueueToolbar(BaseObjectType *cobject,
|
||||
const Glib::RefPtr<Gtk::Builder> builder)
|
||||
: Gtk::HBox(cobject), _builder(builder)
|
||||
{
|
||||
_builder->get_widget("q_search", q_search);
|
||||
_builder->get_widget("q_switch", _q_switch);
|
||||
_builder->get_widget("q_repeat", _q_repeat);
|
||||
_builder->get_widget("q_random", _q_random);
|
||||
|
||||
q_search->signal_key_release_event().connect(sigc::mem_fun(*this,
|
||||
&QueueToolbar::on_search_key_released));
|
||||
q_search->signal_search_changed().connect(sigc::mem_fun(*this,
|
||||
&QueueToolbar::on_search_changed));
|
||||
}
|
||||
|
||||
QueueToolbar :: ~QueueToolbar()
|
||||
{
|
||||
}
|
||||
|
||||
void QueueToolbar :: init(queue *queue, QueueLabel *label,
|
||||
QueueWindow *window, unsigned int flags)
|
||||
{
|
||||
_queue = queue;
|
||||
_q_label = label;
|
||||
_q_window = window;
|
||||
|
||||
if (flags & T_SWITCH) {
|
||||
_q_switch->property_active().signal_changed().connect(
|
||||
sigc::mem_fun(*this, &QueueToolbar::on_switch_toggled));
|
||||
_q_switch->set_active(queue_has_flag(_queue, Q_ENABLED));
|
||||
_q_switch->show();
|
||||
}
|
||||
|
||||
if (flags & T_RANDOM) {
|
||||
_q_random->signal_toggled().connect(sigc::mem_fun(*this,
|
||||
&QueueToolbar::on_random_toggled));
|
||||
_q_random->set_active(queue_has_flag(_queue, Q_RANDOM));
|
||||
_q_random->show();
|
||||
}
|
||||
|
||||
if (flags & T_REPEAT) {
|
||||
_q_repeat->signal_toggled().connect(sigc::mem_fun(*this,
|
||||
&QueueToolbar::on_repeat_toggled));
|
||||
_q_repeat->set_active(queue_has_flag(_queue, Q_REPEAT));
|
||||
_q_repeat->show();
|
||||
}
|
||||
}
|
||||
|
||||
void QueueToolbar :: on_random_toggled()
|
||||
{
|
||||
if (_q_random->get_active())
|
||||
queue_set_flag(_queue, Q_RANDOM);
|
||||
else
|
||||
queue_unset_flag(_queue, Q_RANDOM);
|
||||
}
|
||||
|
||||
void QueueToolbar :: on_repeat_toggled()
|
||||
{
|
||||
if (_q_repeat->get_active())
|
||||
queue_set_flag(_queue, Q_REPEAT);
|
||||
else
|
||||
queue_unset_flag(_queue, Q_REPEAT);
|
||||
}
|
||||
|
||||
bool QueueToolbar :: on_search_key_released(GdkEventKey *event)
|
||||
{
|
||||
std::string key = gdk_keyval_name(event->keyval);
|
||||
return key == "space";
|
||||
}
|
||||
|
||||
void QueueToolbar :: on_search_changed()
|
||||
{
|
||||
std::string text = q_search->get_text();
|
||||
_q_window->filter(text);
|
||||
}
|
||||
|
||||
void QueueToolbar :: on_switch_toggled()
|
||||
{
|
||||
bool active = _q_switch->get_active();
|
||||
|
||||
if (active)
|
||||
queue_set_flag(_queue, Q_ENABLED);
|
||||
else
|
||||
queue_unset_flag(_queue, Q_ENABLED);
|
||||
|
||||
_q_label->set_sensitive(active);
|
||||
_q_window->set_sensitive(active);
|
||||
}
|
|
@ -85,12 +85,6 @@ QueueTab :: QueueTab(queue *pq, unsigned int num)
|
|||
queue_set_number(num);
|
||||
|
||||
|
||||
/*
|
||||
* Now set up the toolbar
|
||||
*/
|
||||
tab_toolbar->init(pq, q_label, tab_window, T_RANDOM | T_REPEAT | T_SWITCH);
|
||||
|
||||
|
||||
/*
|
||||
* Fill in the page!
|
||||
*/
|
||||
|
|
21
gui/tabs.cpp
21
gui/tabs.cpp
|
@ -78,9 +78,7 @@ 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->add_from_file(gui :: share_file("QueueWindow.ui"));
|
||||
tab_builder->get_widget_derived("QueueToolbar", tab_toolbar);
|
||||
tab_builder->get_widget_derived("QueueWindow", tab_window);
|
||||
|
||||
tab_window->init(tab_pq);
|
||||
|
@ -97,8 +95,6 @@ Tab :: Tab(queue *pq)
|
|||
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();
|
||||
|
||||
tab_runtime_changed();
|
||||
|
@ -188,11 +184,6 @@ void Tab :: tab_unmap()
|
|||
queue_mapping.erase(tab_pq);
|
||||
}
|
||||
|
||||
void Tab :: tab_focus_search()
|
||||
{
|
||||
tab_toolbar->q_search->grab_focus();
|
||||
}
|
||||
|
||||
void Tab :: tab_selected_ids(std::vector<unsigned int> &ids)
|
||||
{
|
||||
Glib::RefPtr<Gtk::TreeSelection> sel = tab_window->q_treeview->get_selection();
|
||||
|
@ -415,14 +406,6 @@ static void on_search_changed()
|
|||
tab->tab_window->filter(text);
|
||||
}
|
||||
|
||||
void tab_focus_search()
|
||||
{
|
||||
int page = Glib :: wrap(GTK_NOTEBOOK(gui_builder_widget("o_notebook")), false)->get_current_page();
|
||||
Tab *tab = find_tab(page);
|
||||
if (tab)
|
||||
tab->tab_focus_search();
|
||||
}
|
||||
|
||||
static void on_new_pq()
|
||||
{
|
||||
Tab *tab = cur_tab();
|
||||
|
@ -468,9 +451,7 @@ static bool on_window_key_pressed(GdkEventKey *event)
|
|||
key = key.substr(3);
|
||||
}
|
||||
|
||||
if (key == "slash")
|
||||
tab_focus_search();
|
||||
else if (key >= "0" && key <= "9") {
|
||||
if (key >= "0" && key <= "9") {
|
||||
unsigned int n = atoi(key.c_str());
|
||||
if (n < tempq_count())
|
||||
notebook->set_current_page(n);
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
* Copyright 2015 (c) Anna Schumaker.
|
||||
*/
|
||||
#ifndef OCARINA_GUI_QUEUE_TOOLBAR_H
|
||||
#define OCARINA_GUI_QUEUE_TOOLBAR_H
|
||||
|
||||
extern "C" {
|
||||
#include <core/queue.h>
|
||||
}
|
||||
#include <gui/queue/label.h>
|
||||
#include <gui/queue/window.h>
|
||||
#include <gtkmm.h>
|
||||
|
||||
enum toolbar_flags {
|
||||
T_RANDOM = (1 << 0),
|
||||
T_REPEAT = (1 << 1),
|
||||
T_SWITCH = (1 << 2),
|
||||
};
|
||||
|
||||
|
||||
class QueueToolbar : public Gtk::HBox {
|
||||
private:
|
||||
Glib::RefPtr<Gtk::Builder> _builder;
|
||||
queue *_queue;
|
||||
QueueLabel *_q_label;
|
||||
QueueWindow *_q_window;
|
||||
|
||||
|
||||
Gtk::ToggleButton *_q_random;
|
||||
Gtk::ToggleButton *_q_repeat;
|
||||
Gtk::Switch *_q_switch;
|
||||
|
||||
public:
|
||||
Gtk::SearchEntry *q_search;
|
||||
|
||||
QueueToolbar(BaseObjectType *, const Glib::RefPtr<Gtk::Builder>);
|
||||
~QueueToolbar();
|
||||
|
||||
void init(queue *, QueueLabel*, QueueWindow*, unsigned int);
|
||||
|
||||
void on_random_toggled();
|
||||
void on_repeat_toggled();
|
||||
bool on_search_key_released(GdkEventKey *event);
|
||||
void on_search_changed();
|
||||
void on_switch_toggled();
|
||||
};
|
||||
|
||||
#endif /* OCARINA_GUI_QUEUE_TOOLBAR_H */
|
|
@ -5,8 +5,8 @@
|
|||
#define OCARINA_TABS_H
|
||||
|
||||
#include <gui/ocarina.h>
|
||||
#include <gui/queue/label.h>
|
||||
#include <gui/queue/model.h>
|
||||
#include <gui/queue/toolbar.h>
|
||||
#include <gui/queue/window.h>
|
||||
#include <core/playlist.h>
|
||||
#include <core/queue.h>
|
||||
|
@ -21,7 +21,6 @@ protected:
|
|||
queue *tab_pq;
|
||||
Gtk::VBox tab_vbox;
|
||||
|
||||
QueueToolbar *tab_toolbar;
|
||||
QueueLabel *tab_label;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.19.0 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.12"/>
|
||||
<object class="GtkBox" id="QueueToolbar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="q_search">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="primary_icon_name">edit-find-symbolic</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="q_switch">
|
||||
<property name="can_focus">True</property>
|
||||
<property name="active">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="q_repeat">
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="focus_on_click">False</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">media-playlist-repeat</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="q_random">
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="focus_on_click">False</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="image2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">media-playlist-shuffle</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
Loading…
Reference in New Issue