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
|
/***************************************************************************
* FilesInfoNoteBookTab.h
*
* Mon Sep 10 00:49:59 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 _FILESINFONOTEBOOKTAB_H
#define _FILESINFONOTEBOOKTAB_H
#include "gtkmm.h"
#include "Utils.h"
#include "Lince/Torrent.h"
class TorrentInfoTab;
class FilesInfoNoteBookTab: public Gtk::ScrolledWindow{
private:
Glib::ustring nameTab;
class FilesModelColumns : public Gtk::TreeModel::ColumnRecord{
public:
FilesModelColumns() { add(m_file_download); add(m_file_firstpiece);
add(m_file_lastpiece); add(m_file_name); add(m_file_percentage);
add(m_file_size); add(m_prio_choosen); add(m_file_priority);
add(file_size); add(file_index);}
Gtk::TreeModelColumn<bool> m_file_download;
Gtk::TreeModelColumn<int> m_file_firstpiece;
Gtk::TreeModelColumn<int> m_file_lastpiece;
Gtk::TreeModelColumn<Glib::ustring> m_file_name;
Gtk::TreeModelColumn<Glib::ustring> m_file_size;
Gtk::TreeModelColumn<int> m_file_percentage;
//Gtk::TreeModelColumn<Glib::ustring> m_file_priority;
Gtk::TreeModelColumn<Glib::ustring> m_prio_choosen;
Gtk::TreeModelColumn< Glib::RefPtr<Gtk::TreeModel> > m_file_priority;
// Sort Column
Gtk::TreeModelColumn<int> file_size;
// File position
Gtk::TreeModelColumn<int> file_index;
};
FilesModelColumns filesColumns;
// Rows
Gtk::TreeView filesTreeView;
Glib::RefPtr<Gtk::ListStore> refTreeModel;
// Priority column
Glib::RefPtr<Gtk::ListStore> pr_refTreeModel;
bool isModelFilled;
// Used to update percentage just when needed
int downloadedPieces;
int getFilePercentage(int, int, const libtorrent::bitfield &);
void mouse_button_press_event(GdkEventButton* event);
void downloadFileToggled(const Glib::ustring &s);
void on_cellrenderer_choice_edited(const Glib::ustring& path_string,
const Glib::ustring& new_text);
void unselectRows();
// Signal to change de the priority
sigc::signal<bool, int, int> sig_to_change_file_priority;
public:
FilesInfoNoteBookTab(TorrentInfoTab *);
~FilesInfoNoteBookTab();
const Glib::ustring & getNameTab() { return nameTab; };
void updateFilesInfoNoteBookTab(Lince::Torrent *);
virtual Gtk::Widget * getTabChild(void) { return this; };
};
#endif /* _FILESINFONOTEBOOKTAB_H */
|