~vcs-imports/lince/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/***************************************************************************
 *            LoadSearchedTorrentDialog.h
 *
 *  Fri Oct  3 12:14:53 2008
 *  Copyright  2008  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 _LOADONETORRENTDIALOG_H
#define _LOADONETORRENTDIALOG_H

#include <gtkmm.h>

#include "libtorrent/torrent_info.hpp"

class LoadOneTorrentDialog : public Gtk::Dialog{
	private:
		Glib::ustring torrentname, *torrentpathsave;
		std::vector<int> *priorities;
		std::vector<std::string> *newfilenames;
		
		Gtk::Entry saveDirectoryEntry;
		
		class ModelColumnsLoadTorrentDialog : public Gtk::TreeModel::ColumnRecord{
		public:
			ModelColumnsLoadTorrentDialog(){
				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<Gtk::TreeModel> > m_priority;
		};
	
		Gtk::TreeView dialogTorrentTreeView;
		Glib::RefPtr<Gtk::ListStore> refTreeModel;
		ModelColumnsLoadTorrentDialog columnsDialogTorrent;
	
		// Priority column
		Glib::RefPtr<Gtk::ListStore> pr_refTreeModel;
			
		// Menu
		Glib::RefPtr<Gtk::ActionGroup> m_refActionGroup;
		Glib::RefPtr<Gtk::UIManager> refUIManager;
		Gtk::Menu* pMenuPopup;
	
		void mouse_button_press_event(GdkEventButton* event);
	
		void addRow(int, Glib::ustring &, const libtorrent::size_type &);
		bool isRowSelected();
	
		// Signals
		void selectAndSetSaveDirectory();
		void on_cellrenderer_choice_edited(const Glib::ustring& path_string, const Glib::ustring& new_text);	
		void changeName();
		void downloadFileToggled(const Glib::ustring &);
	
	public:
		LoadOneTorrentDialog(const std::string &, Glib::ustring *, std::vector<int> *, std::vector<std::string> *);
		~LoadOneTorrentDialog();
};

#endif /* LOADSEARCHEDTORRENTDIALOG_H */