summaryrefslogtreecommitdiffstats
path: root/filestreemodel.h
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2010-06-20 15:51:42 +0200
committerArno <am@disconnect.de>2010-06-20 15:51:42 +0200
commitf81a83e91b77d41384667eec02409be05e088a06 (patch)
tree87b940010c56ba6da83961eb77483ba6853c7c6a /filestreemodel.h
parentbdbc5a75e82f3635449848977cbefa19d51c0c9b (diff)
downloadSheMov-f81a83e91b77d41384667eec02409be05e088a06.tar.gz
SheMov-f81a83e91b77d41384667eec02409be05e088a06.tar.bz2
SheMov-f81a83e91b77d41384667eec02409be05e088a06.zip
Started implementation of FilesTreeModel
No visible representation yet. Implemented setData for quality and dvdno, but not tested yet. Dunno yet if anything else has to be editable.
Diffstat (limited to 'filestreemodel.h')
-rw-r--r--filestreemodel.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/filestreemodel.h b/filestreemodel.h
new file mode 100644
index 0000000..0db1f39
--- /dev/null
+++ b/filestreemodel.h
@@ -0,0 +1,40 @@
+/*
+ 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 <QSqlDatabase>
+#include <QList>
+
+#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<int> &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