Use polymorphism to distinguish folder / file items in torrent content model

Step to address issue #24.
This commit is contained in:
Christophe Dumez
2012-08-26 18:10:32 +03:00
parent 30be83d445
commit 0fdacf4d54
13 changed files with 507 additions and 297 deletions

View File

@@ -51,7 +51,7 @@ public:
bool allFiltered() const;
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const;
virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
TorrentContentModelItem::FileType getType(const QModelIndex& index) const;
TorrentContentModelItem::ItemType itemType(const QModelIndex& index) const;
int getFileIndex(const QModelIndex& index);
virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
virtual Qt::ItemFlags flags(const QModelIndex& index) const;
@@ -70,7 +70,7 @@ public slots:
void selectNone();
private:
TorrentContentModelItem* m_rootItem;
TorrentContentModelFolder* m_rootItem;
QVector<TorrentContentModelItem*> m_filesIndex;
};