gui: Delete key removes tracks from queues
This was the behavior before I started my rewrite. Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
parent
463409acdf
commit
d83609bc21
|
@ -70,6 +70,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void setup_treeview();
|
void setup_treeview();
|
||||||
void on_post_init();
|
void on_post_init();
|
||||||
|
bool on_key_press_event(const std::string &);
|
||||||
void tab_set_size();
|
void tab_set_size();
|
||||||
void queue_set_number(unsigned int);
|
void queue_set_number(unsigned int);
|
||||||
void on_tab_reordered();
|
void on_tab_reordered();
|
||||||
|
@ -214,6 +215,31 @@ void QueueTab :: on_post_init()
|
||||||
tab_init_repeat();
|
tab_init_repeat();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QueueTab :: 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() returns track_ids and not
|
||||||
|
* playlist_ids,so we can't use it here =(
|
||||||
|
*/
|
||||||
|
Glib::RefPtr<Gtk::TreeSelection> sel = tab_treeview->get_selection();
|
||||||
|
std::vector<Gtk::TreeModel::Path> rows = sel->get_selected_rows();
|
||||||
|
Gtk::TreeModel::Path path;
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < rows.size(); i++) {
|
||||||
|
path = tab_filter->convert_path_to_child_path(rows[i]);
|
||||||
|
ids.push_back(path[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (unsigned int i = ids.size(); i > 0; i--)
|
||||||
|
tab_pq->del(ids[i-1]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void QueueTab :: tab_set_size()
|
void QueueTab :: tab_set_size()
|
||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
|
|
18
gui/tabs.cpp
18
gui/tabs.cpp
|
@ -541,24 +541,6 @@ public:
|
||||||
void on_focus_search();
|
void on_focus_search();
|
||||||
};
|
};
|
||||||
|
|
||||||
bool OcarinaPage::on_delete_selected()
|
|
||||||
{
|
|
||||||
Glib::RefPtr<Gtk::TreeSelection> sel = page_view.get_selection();
|
|
||||||
if (sel->count_selected_rows() == 0)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if ((unsigned int)notebook->page_num(*this) >= deck :: size())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
std::vector<Gtk::TreeModel::Path>::reverse_iterator it;
|
|
||||||
std::vector<Gtk::TreeModel::Path> rows = sel->get_selected_rows();
|
|
||||||
for (it = rows.rbegin(); it != rows.rend(); it++) {
|
|
||||||
unsigned int id = filter->convert_path_to_child_path(*it)[0];
|
|
||||||
model->queue->del(id);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OcarinaPage::on_favorite_selected()
|
bool OcarinaPage::on_favorite_selected()
|
||||||
{
|
{
|
||||||
Glib::RefPtr<Gtk::TreeSelection> sel = page_view.get_selection();
|
Glib::RefPtr<Gtk::TreeSelection> sel = page_view.get_selection();
|
||||||
|
|
|
@ -11,13 +11,13 @@
|
||||||
class Tab {
|
class Tab {
|
||||||
private:
|
private:
|
||||||
std::set<unsigned int> visible_ids;
|
std::set<unsigned int> visible_ids;
|
||||||
Glib::RefPtr<Gtk::TreeModelFilter> tab_filter;
|
|
||||||
unsigned int tab_sorting_count;
|
unsigned int tab_sorting_count;
|
||||||
std::string tab_sorting_title;
|
std::string tab_sorting_title;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Playqueue *tab_pq;
|
Playqueue *tab_pq;
|
||||||
Glib::RefPtr<PlayqueueModel> tab_model;
|
Glib::RefPtr<PlayqueueModel> tab_model;
|
||||||
|
Glib::RefPtr<Gtk::TreeModelFilter> tab_filter;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue