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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
/***************************************************************************
* 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 <gtkmm.h>
#include "libtorrent/torrent_info.hpp"
#include "Utils.h"
class LoadTorrentDialog : public Gtk::Dialog{
private:
Glib::ustring torrentpathsave, torrentloaddir;
std::vector<Utils::torrent_data> *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<Gtk::ListStore> torrentsNamesTreeModel;
torrentsNamesModelColumns torrentsNamesColumns;
Glib::RefPtr<Gtk::TreeSelection> 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<Gtk::TreeModel> > m_priority;
};
Gtk::ScrolledWindow torrentsFilesScrolledWindow;
Gtk::TreeView torrentsFilesTreeView;
Glib::RefPtr<Gtk::ListStore> torrentsFilesTreeModel;
torrentsFilesModelColumns torrentsFilesColumns;
// 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);
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<Utils::torrent_data> *);
LoadTorrentDialog(const Glib::ustring &,const Glib::ustring &, std::vector<Utils::torrent_data> *,
std::vector<std::string> &);
~LoadTorrentDialog();
};
#endif /* _LOADTORRENTDIALOG_H */
|