File indexing completed on 2024-05-05 04:59:13
0001 /*************************************************************************** 0002 * Copyright (C) 2007 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 KTTORRENTFILELISTMODEL_H 0022 #define KTTORRENTFILELISTMODEL_H 0023 0024 #include "torrentfilemodel.h" 0025 0026 namespace kt 0027 { 0028 0029 /** 0030 * Model for displaying file trees of a torrent 0031 * @author Joris Guisson 0032 */ 0033 class TorrentFileListModel : public TorrentFileModel 0034 { 0035 Q_OBJECT 0036 public: 0037 TorrentFileListModel(bt::TorrentInterface *tc, DeselectMode mode, QObject *parent); 0038 ~TorrentFileListModel() override; 0039 0040 int rowCount(const QModelIndex &parent) const override; 0041 int columnCount(const QModelIndex &parent) const override; 0042 QVariant headerData(int section, Qt::Orientation orientation, int role) const override; 0043 QVariant data(const QModelIndex &index, int role) const override; 0044 QModelIndex parent(const QModelIndex &index) const override; 0045 QModelIndex index(int row, int column, const QModelIndex &parent) const override; 0046 bool setData(const QModelIndex &index, const QVariant &value, int role) override; 0047 void checkAll() override; 0048 void uncheckAll() override; 0049 void invertCheck() override; 0050 bt::Uint64 bytesToDownload() override; 0051 bt::TorrentFileInterface *indexToFile(const QModelIndex &idx) override; 0052 QString dirPath(const QModelIndex &idx) override; 0053 void changePriority(const QModelIndexList &indexes, bt::Priority newpriority) override; 0054 0055 private: 0056 void invertCheck(const QModelIndex &idx); 0057 }; 0058 } 0059 0060 #endif