File indexing completed on 2024-05-05 04:59:14
0001 /*************************************************************************** 0002 * Copyright (C) 2008 by Joris Guisson and Ivan Vasic * 0003 * joris.guisson@gmail.com * 0004 * ivasic@gmail.com * 0005 * * 0006 * This program is free software; you can redistribute it and/or modify * 0007 * it under the terms of the GNU General Public License as published by * 0008 * the Free Software Foundation; either version 2 of the License, or * 0009 * (at your option) any later version. * 0010 * * 0011 * This program is distributed in the hope that it will be useful, * 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0014 * GNU General Public License for more details. * 0015 * * 0016 * You should have received a copy of the GNU General Public License * 0017 * along with this program; if not, write to the * 0018 * Free Software Foundation, Inc., * 0019 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 0020 ***************************************************************************/ 0021 #ifndef KTWEBSEEDSMODEL_H 0022 #define KTWEBSEEDSMODEL_H 0023 0024 #include <QAbstractTableModel> 0025 #include <util/constants.h> 0026 0027 namespace bt 0028 { 0029 class TorrentInterface; 0030 } 0031 0032 namespace kt 0033 { 0034 0035 /** 0036 @author 0037 */ 0038 class WebSeedsModel : public QAbstractTableModel 0039 { 0040 Q_OBJECT 0041 0042 public: 0043 WebSeedsModel(QObject *parent); 0044 ~WebSeedsModel() override; 0045 0046 /** 0047 * Change the current torrent. 0048 * @param tc 0049 */ 0050 void changeTC(bt::TorrentInterface *tc); 0051 0052 /** 0053 * See if we need to update the model 0054 */ 0055 bool update(); 0056 0057 int rowCount(const QModelIndex &parent) const override; 0058 int columnCount(const QModelIndex &parent) const override; 0059 QVariant headerData(int section, Qt::Orientation orientation, int role) const override; 0060 QVariant data(const QModelIndex &index, int role) const override; 0061 0062 private: 0063 struct Item { 0064 QString status; 0065 bt::Uint64 downloaded; 0066 bt::Uint32 speed; 0067 }; 0068 bt::TorrentInterface *curr_tc; 0069 QList<Item> items; 0070 }; 0071 } 0072 0073 #endif