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 #include "torrentfilemodel.h" 0022 0023 #include <interfaces/torrentfileinterface.h> 0024 #include <interfaces/torrentinterface.h> 0025 0026 namespace kt 0027 { 0028 TorrentFileModel::TorrentFileModel(bt::TorrentInterface *tc, DeselectMode mode, QObject *parent) 0029 : QAbstractItemModel(parent) 0030 , tc(tc) 0031 , mode(mode) 0032 , file_names_editable(false) 0033 { 0034 } 0035 0036 TorrentFileModel::~TorrentFileModel() 0037 { 0038 } 0039 0040 QByteArray TorrentFileModel::saveExpandedState(QSortFilterProxyModel *, QTreeView *) 0041 { 0042 return QByteArray(); 0043 } 0044 0045 void TorrentFileModel::loadExpandedState(QSortFilterProxyModel *, QTreeView *, const QByteArray &) 0046 { 0047 } 0048 0049 void TorrentFileModel::missingFilesMarkedDND() 0050 { 0051 beginResetModel(); 0052 endResetModel(); 0053 } 0054 0055 void TorrentFileModel::update() 0056 { 0057 } 0058 0059 void TorrentFileModel::onCodecChange() 0060 { 0061 beginResetModel(); 0062 endResetModel(); 0063 } 0064 0065 Qt::ItemFlags TorrentFileModel::flags(const QModelIndex &index) const 0066 { 0067 if (!index.isValid()) 0068 return Qt::NoItemFlags; 0069 0070 Qt::ItemFlags flags = Qt::ItemIsSelectable | Qt::ItemIsEnabled; 0071 if (tc->getStats().multi_file_torrent) 0072 flags |= Qt::ItemIsUserCheckable; 0073 0074 if (fileNamesEditable() && index.column() == 0) 0075 flags |= Qt::ItemIsEditable; 0076 0077 return flags; 0078 } 0079 0080 void TorrentFileModel::filePercentageChanged(bt::TorrentFileInterface *file, float percentage) 0081 { 0082 Q_UNUSED(file) 0083 Q_UNUSED(percentage) 0084 } 0085 0086 void TorrentFileModel::filePreviewChanged(bt::TorrentFileInterface *file, bool preview) 0087 { 0088 Q_UNUSED(file) 0089 Q_UNUSED(preview) 0090 } 0091 } 0092 0093 #include "moc_torrentfilemodel.cpp"