/*************************************************************************** * LoadTorrentDialog.h * * Thu Nov 22 14:07:55 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 _LOADTORRENTDIALOG_H #define _LOADTORRENTDIALOG_H #include #include "libtorrent/torrent_info.hpp" #include "Utils.h" class LoadTorrentDialog : public Gtk::Dialog{ private: Glib::ustring torrentpathsave, torrentloaddir; std::vector *torrents_data; Gtk::HBox loadHBox, saveHBox; Gtk::Label loadTorrentLabel, saveDirectoryLabel; Gtk::Entry loadTorrentEntry, saveDirectoryEntry; Gtk::Image loadTorrentSelectButtonImage, saveDirectorySelectButtonImage; Gtk::Image loadUriSelectButtonImage, loadDirectorySelectButtonImage; Gtk::Button loadTorrentSelectButton, saveDirectorySelectButton; Gtk::Button loadUriSelectButton, loadDirectorySelectButton; class torrentsNamesModelColumns: public Gtk::TreeModel::ColumnRecord{ public: torrentsNamesModelColumns(){ add(m_position); add(m_name); } Gtk::TreeModelColumn< int > m_position; Gtk::TreeModelColumn< Glib::ustring > m_name; }; Gtk::ScrolledWindow torrentsNamesScrolledWindow; Gtk::TreeView torrentsNamesTreeView; Glib::RefPtr torrentsNamesTreeModel; torrentsNamesModelColumns torrentsNamesColumns; Glib::RefPtr torrentsNamesTreeSelection; class torrentsFilesModelColumns : public Gtk::TreeModel::ColumnRecord{ public: torrentsFilesModelColumns(){ add(m_position); add(m_download); add(m_name); add(m_size); add(m_size_type); add(m_prio_choosen); add(m_priority); } Gtk::TreeModelColumn< int > m_position; Gtk::TreeModelColumn< bool > m_download; Gtk::TreeModelColumn< Glib::ustring > m_name; Gtk::TreeModelColumn< Glib::ustring > m_size; Gtk::TreeModelColumn< libtorrent::size_type > m_size_type; Gtk::TreeModelColumn< Glib::ustring > m_prio_choosen; Gtk::TreeModelColumn< Glib::RefPtr > m_priority; }; Gtk::ScrolledWindow torrentsFilesScrolledWindow; Gtk::TreeView torrentsFilesTreeView; Glib::RefPtr torrentsFilesTreeModel; torrentsFilesModelColumns torrentsFilesColumns; // Priority column Glib::RefPtr pr_refTreeModel; // Menu Glib::RefPtr m_refActionGroup; Glib::RefPtr refUIManager; Gtk::Menu* pMenuPopup; void mouse_button_press_event(GdkEventButton* event); Gtk::Button * okButton; int get_selected_torrents_data_position(); void addTorrentsDataElement(const Glib::ustring &); void addTorrentsNameRow(const Glib::ustring &); void addTorrentsFileRow(int, int, const Glib::ustring &, const libtorrent::size_type &); bool isRowSelected(); void init_dialog(); // Signals void selectAndSetSaveDirectory(); void selectAndSetLoadTorrent(); void selectAndSetLoadDirectory(); void selectAndSetUrl(const Glib::ustring&); void selectAndSetMagnet(const Glib::ustring&); void selectAndSetUri(); void downloadFileToggled(const Glib::ustring &); void setSelectedTorrentsFiles(); void on_cellrenderer_choice_edited(const Glib::ustring& path_string, const Glib::ustring& new_text); void changeName(); void finishDialog(); public: LoadTorrentDialog(const Glib::ustring &,const Glib::ustring &, std::vector *); LoadTorrentDialog(const Glib::ustring &,const Glib::ustring &, std::vector *, std::vector &); ~LoadTorrentDialog(); }; #endif /* _LOADTORRENTDIALOG_H */