From 03831d3669ea49a99a15aaf5d17724be8c533b85 Mon Sep 17 00:00:00 2001 From: Arno Date: Wed, 20 Mar 2013 21:27:35 +0100 Subject: 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. --- smdirwatcher.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'smdirwatcher.h') diff --git a/smdirwatcher.h b/smdirwatcher.h index 0da5b4b..3167aeb 100644 --- a/smdirwatcher.h +++ b/smdirwatcher.h @@ -10,6 +10,11 @@ #include #include +#include +#include +#include + +class SmTreeItem; class SmDirWatcher : public QThread { Q_OBJECT @@ -33,4 +38,31 @@ class SmDirWatcher : public QThread { QString mCurrent; }; +class SmDataGatherer : public QThread { + Q_OBJECT + public: + explicit SmDataGatherer(const int numFields, QObject *parent = 0); + void setCurrent(const QString ¤t, int mode = -1); + + public slots: + void run(); + //void setFile(const QString &fullPath, int event); + //void populate(const QString &dir); + + signals: + void newData(const QList,int); + void population(SmTreeItem*); + void needRefresh(); + + private: + //QList > populate(); + SmTreeItem *populate(); + const QList fileData(const QFileInfo &fi) const; + QString mCurrent; + QMutex mRunMx; + QMutex mSetMx; + int mMode; + const int mNumFields; +}; + #endif // SMDIRWATCHER_H -- cgit v1.2.3-70-g09d2