/*************************************************************************** * TorrentsWindow.h * * Sat Jan 27 14:19:23 2007 * Copyright 2007 Fernando TarĂ­n Morales * icemanf@gmail.com ****************************************************************************/ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA */ #ifndef _TORRENTSWINDOW_H #define _TORRENTSWINDOW_H #include #include "libtorrent/session.hpp" #include "MenuBar.h" #include "Utils.h" #include "Lince/Torrent.h" class TorrentsTab; class MainWindow; class MenuBar; enum TorrentsWindowType { DOWNLOADING_TORRENTS, DOWNLOADED_TORRENTS }; class TorrentsWindow: public Gtk::ScrolledWindow { private: Utils::TorrentModelColumns torrentsColumns; TorrentsWindowType torrentsWindowType; MenuBar * menuBar; TorrentsTab * torrentsTab; bool isCtrlKeyPressed; // Rows Gtk::TreeView torrentsTreeView; Glib::RefPtr refTreeModel; Glib::RefPtr refTreeSelection; Glib::RefPtr m_refActionGroup; // Show columns_autosize Glib::RefPtr showID; Glib::RefPtr showHealth; Glib::RefPtr showName; Glib::RefPtr showSize; Glib::RefPtr showRest; Glib::RefPtr showDownloaded; Glib::RefPtr showUploaded; Glib::RefPtr showRatio; Glib::RefPtr showPercentage; Glib::RefPtr showSeeders; Glib::RefPtr showDownloaders; Glib::RefPtr showStatus; Glib::RefPtr showDSpeed; Glib::RefPtr showUSpeed; Glib::RefPtr showETA; // Row Menu Glib::RefPtr rm_refUIManager; Gtk::Menu* rm_pMenuPopup; // Menu Glib::RefPtr nsm_refUIManager; Gtk::Menu* nsm_pMenuPopup; // Health images enum Health { GOOD, BAD, FIREWALLED, NOTRACKER }; Glib::RefPtr goodHealth, noTrackerHealth; Glib::RefPtr badHealth, firewalledHealth; // Signal to remove torrents when supr key is pressed sigc::signal sig_to_remove_torrents; void setMenuSensitivity(); void updateRow(Lince::Torrent *, Gtk::TreeModel::Row&); void mouse_button_press_event(GdkEventButton* event); void key_press_event(GdkEventKey* event); void key_release_event(GdkEventKey* event); bool focus_in_event(GdkEventFocus*); void hideColumn(int); public: TorrentsWindow(MainWindow*, MenuBar*, TorrentsTab*, TorrentsWindowType); ~TorrentsWindow(); int torrentsSelected(void); bool getSelectedTorrent(int &); bool getSelectedTorrents(std::vector&); int getSelectedRow(void); void setSelectedRow(int position); void removeGivenRow(int tId); void addRow(Lince::Torrent *t); void updateRows(void); void unselectRows(void); void clearRows(void) { refTreeModel->clear(); }; bool isSorted(); void autoSizeColums(void) { torrentsTreeView.columns_autosize(); }; }; #endif /* _TORRENTSWINDOW_H */