Freya  0.0.1
A Gtk3 MPD Client
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
src/Browser/Queue/Queue.hh
Go to the documentation of this file.
00001 /***********************************************************
00002 * This file is part of Freya
00003 * - A free MPD Gtk3 MPD Client -
00004 *
00005 * Authors: Christopher Pahl, Christoph Piechula,
00006 *          Eduard Schneider
00007 *
00008 * Copyright (C) [2011-2012]
00009 * Hosted at: https://github.com/studentkittens/Freya
00010 *
00011 *              __..--''``---....___   _..._    __
00012 *    /// //_.-'    .-/";  `        ``<._  ``.''_ `. / // /
00013 *   ///_.-' _..--.'_                        `( ) ) // //
00014 *   / (_..-' // (< _     ;_..__               ; `' / ///
00015 *    / // // //  `-._,_)' // / ``--...____..-' /// / //
00016 *  Ascii-Art by Felix Lee <flee@cse.psu.edu>
00017 *
00018 * Freya is free software: you can redistribute it and/or modify
00019 * it under the terms of the GNU General Public License as published by
00020 * the Free Software Foundation, either version 3 of the License, or
00021 * (at your option) any later version.
00022 *
00023 * Freya is distributed in the hope that it will be useful,
00024 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00025 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00026 * GNU General Public License for more details.
00027 *
00028 * You should have received a copy of the GNU General Public License
00029 * along with Freya. If not, see <http://www.gnu.org/licenses/>.
00030 **************************************************************/
00031 #ifndef FREYA_QUEUE_H
00032 #define FREYA_QUEUE_H
00033 
00034 #include <gtkmm.h>
00035 #include "../../MPD/AbstractItemlist.hh"
00036 #include "../../MPD/AbstractClientUser.hh"
00037 #include "../../MPD/Client.hh"
00038 
00039 #include "QueuePopup.hh"
00040 #include "QueueMerger.hh"
00041 #include "QueueModelColumns.hh"
00042 #include "PlaylistAddDialog.hh"
00043 #include "../AbstractBrowser.hh"
00044 
00045 namespace Browser
00046 {
00053     class Queue : public AbstractBrowser, public MPD::AbstractClientUser
00054     {
00055     public:
00056         Queue(MPD::Client& client, Glib::RefPtr<Gtk::Builder>& builder);
00057         virtual ~Queue();
00058 
00064         Gtk::Widget * get_container();
00065 
00066     private:
00067 
00068         /* Init */
00069         void configure_columns();
00070         void configure_signals();
00071 
00072         /* Implemtend from AbstractItemlist */
00073         void add_item(void * pSong);
00074 
00075         /* Util */
00076         void merge_changes(MPD::Song * pSong);
00077 
00078         /* Implemented from AbstractClientUser */
00079         void on_client_update(enum mpd_idle event, MPD::NotifyData& data);
00080         void on_connection_change(bool server_changed, bool is_connected);
00081 
00082         /* Menuhandling */
00083         void on_menu_clear_clicked();
00084         void on_menu_remove_clicked();
00085         void on_menu_add_as_pl_clicked();
00086 
00087         /* Other */
00088         void on_row_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
00089         bool on_filter_row_visible(const Gtk::TreeModel::const_iterator& iter);
00090         void on_entry_activate();
00091         void on_entry_clear_icon(Gtk::EntryIconPosition icon_pos, const GdkEventButton* event);
00092         bool on_key_press_handler(GdkEventKey * event);
00093 
00094         /*----------------------*/
00095         /*----------------------*/
00096         /*----------------------*/
00097 
00098         Glib::ustring m_FilterText;
00099 
00100         /* Treeview related */
00101         QueueModelColumns m_Columns;
00102 
00103         /* View of the list */
00104         Gtk::TreeView * mp_TreeView;
00105 
00106         /* Actual data */
00107         Glib::RefPtr<Gtk::ListStore> m_refTreeModel;
00108 
00109         /* Filtered data */
00110         Glib::RefPtr<Gtk::TreeModelFilter> m_refTreeModelFilter;
00111 
00112         /* Selected data */
00113         Glib::RefPtr<Gtk::TreeSelection> m_TreeSelection;
00114 
00115         /* Popup */
00116         QueuePopup * mp_Popup;
00117 
00118         /* other widgets */
00119         Gtk::Entry * mp_Entry;
00120         Gtk::Box * mp_QueueBox;
00121         PlaylistAddDialog * mp_AddDialog;
00122 
00123         /* Current Song */
00124         MPD::Song * mp_CurrentSong;
00125 
00126         /* Handles updating the queue */
00127         QueueMerger * mp_Merger;
00128     };
00129 }
00130 #endif //FREYA_QUEUE_H