/*************************************************************************** * NoteBook.h * * Sat Feb 17 22:11:07 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 Library 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 _NOTEBOOK_H #define _NOTEBOOK_H #include #include "libtorrent/session.hpp" #include "Notifications.h" #include "TorrentsTab.h" #include "OptionsTab.h" #include "StatisticsTab.h" #include "TorrentInfoTab.h" #include "LogTab.h" #include "SearchTab.h" #include "Utils.h" #include "Lince/Torrent.h" #include "Lince/TorrentsManager.h" class MainWindow; class MenuBar; #if HAVE_LIBNOTIFY class Notifications; #endif typedef std::list TorrentsInfoTab; class NoteBookManager: public Gtk::Notebook{ private: class TorrentsTab TT; class OptionsTab OT; class StatisticsTab ST; class LogTab LT; class SearchTab SChT; TorrentsInfoTab TIT; class MenuBar *menuBar; #if HAVE_LIBNOTIFY class Notifications *notifications; #endif int last_page; std::vector page_positions; void updatePagePositions(int value); void on_my_switch_page(Gtk::Widget*, guint); bool isInfoTabListed(const libtorrent::sha1_hash &, TorrentsInfoTab::iterator &); public: #if HAVE_LIBNOTIFY NoteBookManager(MainWindow *, MenuBar *, Notifications *); #else NoteBookManager(MainWindow *, MenuBar *); #endif ~NoteBookManager(); enum TabsPositions { FIRST_TAB, TORRENTS_TAB=FIRST_TAB, OPTIONS_TAB, STATISTICS_TAB, LOG_TAB, SEARCH_TAB, LAST_TAB }; void setActivePage(int page) { set_current_page(page_positions[page]); }; void getSelectedTabName(Glib::ustring &); void removeCurrentTab(); int getActivePage(); bool isTorrentsTabSelected(); bool isTorrentsInfoTabSelected(); // TorrentsTab void addTorrentsTab(void); void removeTorrentsTab(void); void clearTorrentsList() { TT.clearTorrentsList(); }; void updateDownloadingTorrents() { TT.updateDownloadingTorrents(); }; void updateDownloadedTorrents() { TT.updateDownloadedTorrents(); }; void addTorrent(Lince::Torrent *t) { TT.addTorrent(t); TT.autoSizeDownloadingTorrentsColumns(); }; void addFinshedTorrent(Lince::Torrent *t) { TT.addFinishedTorrent(t); TT.autoSizeDownloadedTorrentsColumns();}; void removeDownloadingRowGivenTID(int tId) { TT.removeDownloadingRowGivenTID(tId); TT.autoSizeDownloadingTorrentsColumns(); }; void removeDownloadedRowGivenTID(int tId) { TT.removeDownloadedRowGivenTID(tId); TT.autoSizeDownloadedTorrentsColumns(); }; void setSelectedDownloadingRow(int tId) { TT.setSelectedDownloadingRow(tId); }; void setSelectedDownloadedRow(int tId) { TT.setSelectedDownloadedRow(tId); }; void setTorrentsTabPaneSeparatorPosition(int position) { TT.setPaneSeparatorPosition(position); }; int getTorrentsTabPaneSeparatorPosition() { return TT.getPaneSeparatorPosition(); }; int getDownloadingSelectedRow() { return TT.getDownloadingSelectedRow(); }; int getDownloadedSelectedRow() { return TT.getDownloadedSelectedRow(); }; int getDownloadingSelectedTorrents(void) { return TT.getDownloadingSelectedTorrents(); }; Lince::torrentPosition getSelectedTorrentPosition(void) { return TT.getSelectedTorrentPosition(); }; std::vector getSelectedTorrentsPositions(void) { return TT.getSelectedTorrentsPositions(); }; bool isDownloadingSorted() { return TT.isDownloadingSorted(); }; bool isDownloadedSorted() { return TT.isDownloadedSorted(); }; bool isTorrentsTabShown(void) { return TT.isTabShown(); }; // OptionsTab void addOptionsTab(void); void removeOptionsTab(void); void setOptionsGuiSetupManager(GuiSetupManager * gsm ) { OT.setGuiSetupManager(gsm); }; void setOptionsFirstWindow(void) { OT.setConnectionWindow(); }; void updateIpFilterData() { OT.updateIpFilterData(); }; void setMaxConfigUploadSpeed(int value) { OT.setMaxConfigUploadSpeed(value); }; void setMaxConfigDownloadSpeed(int value) { OT.setMaxConfigDownloadSpeed(value); }; void setMaxConfigConnects(int value) { OT.setMaxConfigConnects(value); }; void setMaxConfigUploadSlots(int value) { OT.setMaxConfigUploadSlots(value); }; bool isOptionsTabShown(void) { return OT.isTabShown(); }; // StatisticsTab void addStatisticsTab(void); void removeStatisticsTab(void); void showGraphStats(bool value) { ST.showGraphStats(value); }; void updateGraphics(void) { ST.updateGraphics(); }; void setMaxUploadSpeed(float speed) { ST.setMaxUploadSpeed(speed); }; void setMaxDownloadSpeed(float speed) { ST.setMaxDownloadSpeed(speed); }; void addCurrentUploadSpeed(float value) { ST.addCurrentUploadSpeed(value); }; void addCurrentDownloadSpeed(float value) { ST.addCurrentDownloadSpeed(value); }; void updateDownloadSpeed(float value) { ST.updateDownloadSpeed(value); }; void updateDownloadSession(float value) { ST.updateDownloadSession(value); }; void updateDownloadTotal(int64_t value) { ST.updateDownloadTotal(value); }; void updateUploadSpeed(float value) { ST.updateUploadSpeed(value); }; void updateUploadSession(float value) { ST.updateUploadSession(value); }; void updateUploadTotal(int64_t value) { ST.updateUploadTotal(value); }; void updateShareSession() { ST.updateShareSession(); }; void updateShareTotal() { ST.updateShareTotal(); }; void updateTimeSession(double value) { ST.updateTimeSession(value); }; void updateTimeTotal(double value) { ST.updateTimeTotal(value); }; void updateCurrentDownloadingSize(int64_t value) { ST.updateCurrentDownloadingSize(value); }; void updateTotalDownloadingSize(int64_t value) { ST.updateTotalDownloadingSize(value); }; void updateDownloadingRatio() { ST.updateDownloadingRatio(); }; void updateTotalSharedSize(int64_t value) { ST.updateTotalSharedSize(value); }; bool isStatisticsTabShown(void) { return ST.isTabShown(); }; // LogTab void addLogTab(void); void removeLogTab(void); void setLogTabActive(bool value) { LT.setLogTabActive(value); }; void setLogLevel(int value) { LT.setLogLevel(value); }; void setMaxLogSize(int64_t value) { LT.setMaxLogSize(value); }; void setLogSaveToFile(bool value) { LT.setSaveToFile(value); }; void setLogColoredOutput(bool value) { LT.setColoredOutput(value); }; void setLogAutoScroll(bool value) { LT.setAutoScroll(value); }; void setFileName(const Glib::ustring & fname) { LT.setFileName(fname); }; void flushLogMessages(void) { LT.flushMessages(); } bool isLogTabShown(void) { return LT.isTabShown(); }; // Notifications #if HAVE_LIBNOTIFY void setShowNotifications(bool value) { notifications->showNotifications(value); }; void setNotifyMessage(int type, bool value) { notifications->setNotifyMessage(type, value); }; void setNotifyFromSystray(bool value) { notifications->showNotificationsFromSystray(value); }; void flushNotification(void) { notifications->flushNotification(); }; #endif // Search Tab void addSearchTab(void); void removeSearchTab(void); void setSearchSetupManager(GuiSetupManager * gsm ) { SChT.setGuiSetupManager(gsm); }; bool isSearchTabShown(void) { return SChT.isTabShown(); }; // TorrentsInfoTab void addTorrentInfoTab(Lince::Torrent *); void updateTorrentsInfoTab(); void removeInfoTab(const libtorrent::sha1_hash &); bool isTorrentInfoTabShown(const libtorrent::sha1_hash &); // Bans management void banClient(Glib::ustring&, int); bool unbanClient(Glib::ustring &); Lince::torrentPosition getSelectedTorrentInfoTabPosition(void); //Gtk::Notebook * getNoteBook(void) { return ¬ebook; }; }; #endif /* _NOTEBOOK_H */