diff options
Diffstat (limited to 'filestreemodel.h')
-rw-r--r-- | filestreemodel.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/filestreemodel.h b/filestreemodel.h index 405878b..2a9519f 100644 --- a/filestreemodel.h +++ b/filestreemodel.h @@ -21,9 +21,9 @@ class SeriesTreeModel; 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, SeriesPartRole = Qt::UserRole + 12, DisplayNameRole = Qt::UserRole + 13 }; + 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, SeriesPartRole = Qt::UserRole + 12, DisplayNameRole = Qt::UserRole + 13, SizeDurationRole = Qt::UserRole + 14 }; 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, SeriesPart = 11, DisplayName = 12 }; + enum Fields { FileName = 0, PartNo = 1, SizeDisplay = 2, Quality = 3, DvdNo = 4, FullPath = 5, Size = 6, FileType = 7, Md5Sum = 8, SeriesPartId = 9, FilesId = 10, SeriesPart = 11, DisplayName = 12, SizeDuration = 13 }; enum Mode { Normal = 0, Archived = 1, Local = 2 }; explicit FilesTreeModel(QStringList &headers, QObject *parent = 0); const QHash<int, QString> fileTypes() const { return mFileTypes; } @@ -39,8 +39,10 @@ class FilesTreeModel : public SmTreeModel { bool setData(const QModelIndex &index, const QVariant &value, int role); Qt::ItemFlags flags(const QModelIndex &index) const; QHash<QString, QString> filesBySeriesPartId(int seriesPartId) const; - QList<QMap<QString, QString> > streamInfo(const QModelIndex &idx); - QMap<QString, QString> pictureInfo(const QModelIndex &idx); + QList<QMap<QString, QString> > streamInfo(const QModelIndex &idx) const; + QList<QMap<QString, QString> > streamInfo(const QString &path) const; + QMap<QString, QString> pictureInfo(const QString &path) const; + QMap<QString, QString> pictureInfo(const QModelIndex &idx) const; QMap<QString, QString> pictureMetaInfo(const QModelIndex &idx); //file manipulation @@ -48,6 +50,10 @@ class FilesTreeModel : public SmTreeModel { bool deleteFile(const QModelIndex &file); bool deleteFiles(const QModelIndexList &files); + //misc + void readCache(); + void writeCache(); + private: //functions void populate(QSqlQuery &filesQuery); @@ -64,8 +70,10 @@ class FilesTreeModel : public SmTreeModel { QHash<int, QString> mFileTypes; QHash<int, QString> mCoverTypes; QHash<int, QString> mModeNames; + QHash<QString, QString> mPicsDurationCache; SeriesTreeModel *mSeriesModel; int mMode; + const int mMagic; }; #endif // FILESTREEMODEL_H |