/* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. */ #ifndef FILESTREEMODEL_H #define FILESTREEMODEL_H #include #include #include "smtreemodel.h" class QSqlQuery; class FilesTreeModel : public SmTreeModel { Q_OBJECT public: enum CustomRoles { FileNameRole = Qt::UserRole + 1, FullPathRole = Qt::UserRole + 2, SizeRole = Qt::UserRole + 3, DvdNoRole = Qt::UserRole + 4, SizeDisplayRole = Qt::UserRole + 5, FileTypeRole = Qt::UserRole + 6, Md5SumRole = Qt::UserRole + 7, PartNoRole = Qt::UserRole + 8, SeriesPartIdRole = Qt::UserRole + 9, QualityRole = Qt::UserRole + 10, FilesIdRole = Qt::UserRole + 11 }; enum FileTypes { Movie = 1, FrontCover = 2, BackCover = 3, GeneralCover = 4 }; enum Fields { FileName = 0, PartNo = 1, SizeDisplay = 2, Quality = 3, DvdNo = 4, FullPath = 5, Size = 6, FileType = 7, Md5Sum = 8, SeriesPartId = 9, FilesId = 10 }; explicit FilesTreeModel(QStringList &headers, QObject *parent = 0); ~FilesTreeModel(); //data + flags void setIds(const QList &seriesPartIds); QVariant data(const QModelIndex &index, int role) const; bool setData(const QModelIndex &index, const QVariant &value, int role); Qt::ItemFlags flags(const QModelIndex &index) const; private: QSqlDatabase mDb; QSqlQuery *mFilesQuery; QSqlQuery *mUpdateDvdQuery; QSqlQuery *mUpdateQualityQuery; }; #endif // FILESTREEMODEL_H