summaryrefslogtreecommitdiffstats
path: root/smdirmodel.h
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2013-03-20 21:27:35 +0100
committerArno <am@disconnect.de>2013-03-20 21:27:35 +0100
commit03831d3669ea49a99a15aaf5d17724be8c533b85 (patch)
tree618e3fe63b0430a4dbe604153ab588eb811fd183 /smdirmodel.h
parent457e5328c8fbbf236fb163e90d732a35a583fd2d (diff)
downloadSheMov-03831d3669ea49a99a15aaf5d17724be8c533b85.tar.gz
SheMov-03831d3669ea49a99a15aaf5d17724be8c533b85.tar.bz2
SheMov-03831d3669ea49a99a15aaf5d17724be8c533b85.zip
Use a Thread for collecting file data
blocking the GUI isn't nice, so use a separate Thread to gather all the data for SmDirModel. Populating and changing directory works, but modifying a file is most likely broken.
Diffstat (limited to 'smdirmodel.h')
-rw-r--r--smdirmodel.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/smdirmodel.h b/smdirmodel.h
index 3712cba..c8cc69c 100644
--- a/smdirmodel.h
+++ b/smdirmodel.h
@@ -23,12 +23,15 @@
class SmDirWatcher;
class QTimer;
class SmTreeItem;
+class QMutex;
+class SmDataGatherer;
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 { NumFields = 8 };
enum FileDate { Access, Modified, Status };
explicit SmDirModel(const QStringList &headers, QObject *parent = 0);
~SmDirModel();
@@ -36,7 +39,6 @@ class SmDirModel : public SmTreeModel {
virtual bool setData(const QModelIndex &index, const QVariant &value, int role);
bool isDir(const QModelIndex &idx) const;
QFileInfo fileInfo(const QModelIndex &idx) const;
- QDir dir() const { return QDir(mCur); };
public slots:
void setDir(const QString &dir);
@@ -45,7 +47,7 @@ class SmDirModel : public SmTreeModel {
void refresh();
private slots:
- void populate();
+ void populate(SmTreeItem *root);
signals:
void needResize();
@@ -54,9 +56,12 @@ class SmDirModel : public SmTreeModel {
const QList<QVariant> fileData(const QFileInfo &fi) const;
SmDirWatcher *mWatch;
QStringList mHeaders;
+ QString mCurrentDir;
QString mCur;
QTimer *mRunTimer;
QMap<QString, QIcon> mIcons;
+ QMutex *mCollectorMx;
+ SmDataGatherer *mCollector;
};
#endif // SMDIRMODEL_H