2009-11-14 13:37:45 +03:00
|
|
|
/*
|
|
|
|
* Bittorrent Client using Qt4 and libtorrent.
|
|
|
|
* Copyright (C) 2006 Christophe Dumez
|
|
|
|
*
|
|
|
|
* 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 2
|
|
|
|
* 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 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.
|
|
|
|
*
|
|
|
|
* In addition, as a special exception, the copyright holders give permission to
|
|
|
|
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
|
|
|
* modified versions of it that use the same license as the "OpenSSL" library),
|
|
|
|
* and distribute the linked executables. You must obey the GNU General Public
|
|
|
|
* License in all respects for all of the code used other than "OpenSSL". If you
|
|
|
|
* modify file(s), you may extend this exception to your version of the file(s),
|
|
|
|
* but you are not obligated to do so. If you do not wish to do so, delete this
|
|
|
|
* exception statement from your version.
|
|
|
|
*
|
|
|
|
* Contact : chris@qbittorrent.org
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PEERLISTWIDGET_H
|
|
|
|
#define PEERLISTWIDGET_H
|
|
|
|
|
|
|
|
#include <QTreeView>
|
|
|
|
#include <QHash>
|
2009-11-15 13:00:07 +03:00
|
|
|
#include <QPointer>
|
2009-11-15 15:57:25 +03:00
|
|
|
#include <QSet>
|
2009-11-14 13:37:45 +03:00
|
|
|
#include "qtorrenthandle.h"
|
2009-11-14 16:33:55 +03:00
|
|
|
#include "misc.h"
|
2009-11-14 13:37:45 +03:00
|
|
|
|
|
|
|
class QStandardItemModel;
|
|
|
|
class QStandardItem;
|
|
|
|
class QSortFilterProxyModel;
|
|
|
|
class PeerListDelegate;
|
2009-11-14 16:33:55 +03:00
|
|
|
class ReverseResolution;
|
2009-11-15 13:00:07 +03:00
|
|
|
class PropertiesWidget;
|
2009-11-14 13:37:45 +03:00
|
|
|
|
|
|
|
class PeerListWidget : public QTreeView {
|
2009-11-14 16:33:55 +03:00
|
|
|
Q_OBJECT
|
2009-11-14 13:37:45 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
QStandardItemModel *listModel;
|
|
|
|
PeerListDelegate *listDelegate;
|
|
|
|
QSortFilterProxyModel * proxyModel;
|
|
|
|
QHash<QString, QStandardItem*> peerItems;
|
2009-11-15 15:57:25 +03:00
|
|
|
QSet<QString> missingFlags;
|
2009-11-15 13:00:07 +03:00
|
|
|
QPointer<ReverseResolution> resolver;
|
|
|
|
PropertiesWidget* properties;
|
2009-11-15 15:57:25 +03:00
|
|
|
bool display_flags;
|
2009-11-14 13:37:45 +03:00
|
|
|
|
|
|
|
public:
|
2009-11-15 13:00:07 +03:00
|
|
|
PeerListWidget(PropertiesWidget *parent);
|
2009-11-14 16:33:55 +03:00
|
|
|
~PeerListWidget();
|
2009-11-14 13:37:45 +03:00
|
|
|
|
2009-11-14 16:33:55 +03:00
|
|
|
public slots:
|
2009-11-15 15:57:25 +03:00
|
|
|
void loadPeers(const QTorrentHandle &h, bool force_hostname_resolution=false);
|
2009-11-14 16:33:55 +03:00
|
|
|
QStandardItem* addPeer(QString ip, peer_info peer);
|
|
|
|
void updatePeer(QString ip, peer_info peer);
|
|
|
|
void handleResolved(QString ip, QString hostname);
|
2009-11-15 13:00:07 +03:00
|
|
|
void updatePeerHostNameResolutionState();
|
2009-11-15 15:57:25 +03:00
|
|
|
void updatePeerCountryResolutionState();
|
2009-11-15 13:00:07 +03:00
|
|
|
void clear();
|
2009-11-15 11:40:26 +03:00
|
|
|
|
|
|
|
protected slots:
|
|
|
|
void loadSettings();
|
|
|
|
void saveSettings() const;
|
2009-11-17 14:46:43 +03:00
|
|
|
void showPeerListMenu(QPoint);
|
2009-11-14 13:37:45 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PEERLISTWIDGET_H
|