File indexing completed on 2024-05-05 04:59:13
0001 /*************************************************************************** 0002 * Copyright (C) 2007 by Joris Guisson * 0003 * joris.guisson@gmail.com * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License * 0016 * along with this program; if not, write to the * 0017 * Free Software Foundation, Inc., * 0018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 0019 ***************************************************************************/ 0020 #ifndef KT_PEERVIEW_HH 0021 #define KT_PEERVIEW_HH 0022 0023 #include <KSharedConfig> 0024 #include <QTreeWidget> 0025 0026 #include <interfaces/peerinterface.h> 0027 #include <util/ptrmap.h> 0028 0029 class QMenu; 0030 0031 namespace kt 0032 { 0033 class PeerViewModel; 0034 0035 /** 0036 * View which shows a list of peers, of a torrent. 0037 * */ 0038 class PeerView : public QTreeView 0039 { 0040 Q_OBJECT 0041 public: 0042 PeerView(QWidget *parent); 0043 ~PeerView() override; 0044 0045 /// A peer has been added 0046 void peerAdded(bt::PeerInterface *peer); 0047 0048 /// A peer has been removed 0049 void peerRemoved(bt::PeerInterface *peer); 0050 0051 /// Check to see if the GUI needs to be updated 0052 void update(); 0053 0054 /// Remove all items 0055 void removeAll(); 0056 0057 void saveState(KSharedConfigPtr cfg); 0058 void loadState(KSharedConfigPtr cfg); 0059 0060 private Q_SLOTS: 0061 void showContextMenu(const QPoint &pos); 0062 void banPeer(); 0063 void kickPeer(); 0064 0065 private: 0066 QMenu *context_menu; 0067 PeerViewModel *model; 0068 }; 0069 } 0070 0071 #endif