|
Freya
0.0.1
A Gtk3 MPD Client
|
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_DATABASE_FOGI85CP 00032 #define FREYA_DATABASE_FOGI85CP 00033 00034 #include <gtkmm.h> 00035 #include "../../MPD/AbstractItemlist.hh" 00036 #include "../../MPD/AbstractClientUser.hh" 00037 #include "../../MPD/Client.hh" 00038 #include "../../MPD/Directory.hh" 00039 00040 #include "DatabasePopup.hh" 00041 #include "../AbstractBrowser.hh" 00042 00043 namespace Browser 00044 { 00052 class Database : 00053 public AbstractBrowser, 00054 public MPD::AbstractItemlist, 00055 public MPD::AbstractClientUser 00056 { 00057 public: 00064 Database(MPD::Client& client, Glib::RefPtr<Gtk::Builder>& builder); 00065 virtual ~Database(); 00066 00074 Gtk::Widget * get_container(); 00075 00083 void add_item(MPD::AbstractComposite * pItem); 00084 00085 private: 00086 00087 /* Menu signals */ 00088 void on_menu_db_add_clicked(); 00089 void on_menu_db_add_all_clicked(); 00090 void on_menu_db_update_clicked(); 00091 void on_menu_db_rescan_clicked(); 00092 void on_menu_db_replace_clicked(); 00093 00094 /* GUI Signals */ 00095 void on_item_activated(const Gtk::TreeModel::Path& path); 00096 void on_home_button_clicked(); 00097 void on_search_entry_activated(); 00098 bool on_button_press_event(GdkEventButton* event); 00099 bool on_key_press_handler(GdkEventKey * event); 00100 00101 /* Client Signals */ 00102 void on_client_update(enum mpd_idle event, MPD::NotifyData& data); 00103 void on_connection_change(bool server_changed, bool is_connected); 00104 00105 /* Logic */ 00106 void go_one_up(); 00107 void set_current_path(const char * path); 00108 void focus_item_starting_with(const char * prefix); 00109 00118 class ModelColumns : public Gtk::TreeModel::ColumnRecord 00119 { 00120 public: 00121 ModelColumns() 00122 { 00123 add(m_col_path); 00124 add(m_col_name); 00125 add(m_col_icon); 00126 add(m_col_is_file); 00127 } 00128 00129 Gtk::TreeModelColumn<Glib::ustring> m_col_name; 00130 Gtk::TreeModelColumn<Glib::ustring> m_col_path; 00131 Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf>> m_col_icon; 00132 Gtk::TreeModelColumn<bool> m_col_is_file; 00133 }; 00134 00135 // MEMBERS // 00136 00137 /* Actual widgets */ 00138 Gtk::IconView * mp_IView; 00139 Gtk::Box * mp_ParentBox; 00140 Gtk::Button * mp_HomeButton, * mp_DirUpButton; 00141 Gtk::Label * mp_StatusLabel; 00142 Glib::RefPtr<Gdk::Pixbuf> m_FileIcon, m_DirIcon; 00143 Gtk::Entry * mp_SearchEntry; 00144 00145 /* Models behind */ 00146 ModelColumns m_Columns; 00147 Glib::RefPtr<Gtk::ListStore> m_DirStore; 00148 00149 /* The current path shown (NULL for root) */ 00150 std::string mp_Path; 00151 00152 /* Popup menu */ 00153 DatabasePopup * mp_Popup; 00154 00155 /* A local memcache of the db files */ 00156 MPD::AbstractItemGenerator * mp_Cache; 00157 00158 }; 00159 } 00160 00161 #endif /* end of include guard: DATABASE_FOGI85CP */
1.8.0