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
|
/***************************************************************************
* ClientsInfoNoteBookTab.h
*
* Mon Sep 10 00:35:32 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 _CLIENTSINFONOTEBOOKTAB_H
#define _CLIENTSINFONOTEBOOKTAB_H
#include "gtkmm.h"
#include "Utils.h"
#include "Lince/Torrent.h"
class TorrentInfoTab;
typedef std::map<libtorrent::peer_id, libtorrent::peer_info> PeerMap;
class ClientsInfoNoteBookTab : public Gtk::ScrolledWindow{
private:
Glib::ustring nameTab;
class ClientModelColumns : public Gtk::TreeModel::ColumnRecord{
public:
ClientModelColumns() {add(m_client_flag); add(m_client_ip); add(m_client_country); add(m_client_name);
add(m_client_connection_type); add(m_client_percentage); add(m_client_up_speed); add(m_client_down_speed);
add(m_client_state); add(m_client_up_data); add(m_client_down_data); add(m_up_speed); add(m_down_speed);
add(m_up_data); add(m_down_data); add(has_flag); add(m_pid); add(remove);}
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > m_client_flag;
Gtk::TreeModelColumn<Glib::ustring> m_client_ip;
Gtk::TreeModelColumn<Glib::ustring> m_client_country;
Gtk::TreeModelColumn<Glib::ustring> m_client_name;
Gtk::TreeModelColumn<Glib::ustring> m_client_connection_type;
Gtk::TreeModelColumn<float> m_client_percentage;
Gtk::TreeModelColumn<Glib::ustring> m_client_up_speed;
Gtk::TreeModelColumn<Glib::ustring> m_client_down_speed;
Gtk::TreeModelColumn<Glib::ustring> m_client_state;
Gtk::TreeModelColumn<Glib::ustring> m_client_up_data;
Gtk::TreeModelColumn<Glib::ustring> m_client_down_data;
// Sort Columns
Gtk::TreeModelColumn<float> m_up_speed;
Gtk::TreeModelColumn<float> m_down_speed;
Gtk::TreeModelColumn<float> m_up_data;
Gtk::TreeModelColumn<float> m_down_data;
// Management Data
Gtk::TreeModelColumn<bool> has_flag;
Gtk::TreeModelColumn<bool> remove;
Gtk::TreeModelColumn<libtorrent::peer_id> m_pid;
};
ClientModelColumns clientsColumns;
// Rows
Gtk::TreeView clientsTreeView;
Glib::RefPtr<Gtk::ListStore> refTreeModel;
// Show columns_autosize
Glib::RefPtr<Gtk::ToggleAction> showFlag;
Glib::RefPtr<Gtk::ToggleAction> showIp;
Glib::RefPtr<Gtk::ToggleAction> showCountry;
Glib::RefPtr<Gtk::ToggleAction> showClient;
Glib::RefPtr<Gtk::ToggleAction> showConnectionType;
Glib::RefPtr<Gtk::ToggleAction> showPercentage;
Glib::RefPtr<Gtk::ToggleAction> showUSpeed;
Glib::RefPtr<Gtk::ToggleAction> showDSpeed;
Glib::RefPtr<Gtk::ToggleAction> showState;
Glib::RefPtr<Gtk::ToggleAction> showUData;
Glib::RefPtr<Gtk::ToggleAction> showDData;
Glib::RefPtr<Gtk::ActionGroup> m_refActionGroup;
// Menu client selected
Glib::RefPtr<Gtk::UIManager> refUIManager;
Gtk::Menu* pMenuPopup;
// Menu without client selected
Glib::RefPtr<Gtk::UIManager> n_refUIManager;
Gtk::Menu* n_pMenuPopup;
// Signal to ban a client
sigc::signal<void, Glib::ustring &, int> sig_to_ban_client;
void updateRow(const libtorrent::peer_info &, Gtk::TreeModel::Row &);
void unselectRows();
bool isRowSelected();
void banClient(int);
void mouse_button_press_event(GdkEventButton* event);
void hideColumn(int);
public:
ClientsInfoNoteBookTab(TorrentInfoTab *);
~ClientsInfoNoteBookTab();
const Glib::ustring & getNameTab() { return nameTab; };
void updateClientsInfoNoteBookTab(Lince::Torrent *);
virtual Gtk::Widget * getTabChild(void) { return this; };
};
#endif /* _CLIENTSINFONOTEBOOKTAB_H */
|