diff options
author | Arno <am@disconnect.de> | 2013-03-16 16:13:05 +0100 |
---|---|---|
committer | Arno <am@disconnect.de> | 2013-03-16 16:13:05 +0100 |
commit | 7bda040f35c6be15dbf1ba007de28849a0803cae (patch) | |
tree | 561995ddb3cd7087dbc6b993c0a5a4cd0166418f /smdirmodel.h | |
parent | 5dbe3b400f798b0d9c5c72bb1fdbf762c603fad8 (diff) | |
download | SheMov-7bda040f35c6be15dbf1ba007de28849a0803cae.tar.gz SheMov-7bda040f35c6be15dbf1ba007de28849a0803cae.tar.bz2 SheMov-7bda040f35c6be15dbf1ba007de28849a0803cae.zip |
First shot at SmDirModel
Gotta take a break here. Hopefully this will end up in a custom
QFilesystemModel, but I'm hitting so many bugs on the way. Some things
haven't worked for ages, I guess.
Anyway, the watcher doesn't do anythying right now, still fixing bugs...
Diffstat (limited to 'smdirmodel.h')
-rw-r--r-- | smdirmodel.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/smdirmodel.h b/smdirmodel.h new file mode 100644 index 0000000..5e1dceb --- /dev/null +++ b/smdirmodel.h @@ -0,0 +1,48 @@ +/* + 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 SMDIRMODEL_H +#define SMDIRMODEL_H + +#include <QStringList> +#include <QVariant> +#include <QModelIndex> +#include <QList> +#include <QFileInfo> + +#include <smtreemodel.h> +#include <smdirwatcher.h> + +class SmDirWatcher; + +class SmDirModel : public SmTreeModel { + Q_OBJECT + public: + enum CustomRoles { NameRole = Qt::UserRole + 1, SizeRole = Qt::UserRole + 2, TypeRole = Qt::UserRole + 3, CreatedRole = Qt::UserRole + 4, Md5sumRole = Qt::UserRole + 5, DurationRole = Qt::UserRole + 6, BitrateRole = Qt::UserRole + 7, FullPathRole = Qt::UserRole + 8 }; + enum Fields { Name = 0, Size = 1, Type = 2, Created = 3, Md5sum = 4, Duration = 5, Bitrate = 6, FullPath = 7 }; + enum FileDate { Access, Modified, Status }; + explicit SmDirModel(const QStringList &headers, QObject *parent = 0); + ~SmDirModel(); + virtual QVariant data(const QModelIndex &index, int role) const; + virtual bool setData(const QModelIndex &index, const QVariant &value, int role); + bool isDir(const QModelIndex &idx) const; + QFileInfo fileInfo(const QModelIndex &idx) const; + + public slots: + void setDir(const QString &dir); + + private: + void populate(); + const QList<QVariant> fileData(const QFileInfo &fi) const; + SmDirWatcher *mWatch; + QStringList mHeaders; + QString mCur; + + +}; + +#endif // SMDIRMODEL_H |