kget
chunkdownloadmodel.h
Go to the documentation of this file.00001
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef KTCHUNKDOWNLOADMODEL_H
00024 #define KTCHUNKDOWNLOADMODEL_H
00025
00026 #include <QAbstractTableModel>
00027 #include <interfaces/chunkdownloadinterface.h>
00028
00029
00030 namespace bt
00031 {
00032 class TorrentInterface;
00033 }
00034
00035 namespace kt
00036 {
00037
00041 class ChunkDownloadModel : public QAbstractTableModel
00042 {
00043 Q_OBJECT
00044 public:
00045 ChunkDownloadModel(QObject* parent);
00046 virtual ~ChunkDownloadModel();
00047
00049 void downloadAdded(bt::ChunkDownloadInterface* cd);
00050
00052 void downloadRemoved(bt::ChunkDownloadInterface* cd);
00053
00055 void changeTC(bt::TorrentInterface* tc);
00056
00057 void update();
00058
00059 void clear();
00060
00061 virtual int rowCount(const QModelIndex & parent) const;
00062 virtual int columnCount(const QModelIndex & parent) const;
00063 virtual QVariant headerData(int section, Qt::Orientation orientation,int role) const;
00064 virtual QVariant data(const QModelIndex & index,int role) const;
00065 virtual bool removeRows(int row,int count,const QModelIndex & parent);
00066 virtual bool insertRows(int row,int count,const QModelIndex & parent);
00067 private:
00068 struct Item
00069 {
00070 mutable bt::ChunkDownloadInterface::Stats stats;
00071 bt::ChunkDownloadInterface* cd;
00072 QString files;
00073
00074 Item(bt::ChunkDownloadInterface* cd,const QString & files);
00075
00076 bool changed() const;
00077 QVariant data(int col) const;
00078 QVariant dataForSorting(int col) const;
00079 };
00080
00081 QList<Item> items;
00082 bt::TorrentInterface* tc;
00083 };
00084
00085 }
00086
00087 #endif