summaryrefslogtreecommitdiffstats
path: root/smdirwatcher.cpp
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2013-04-06 05:39:29 +0200
committerArno <am@disconnect.de>2013-04-06 05:39:29 +0200
commit02335902fb63e7bc1ebd5931dae93b754dc469ea (patch)
treecfe6ecdef2743db36bc5915497626993f554b884 /smdirwatcher.cpp
parent046503ba7830427fcd055da569326f0ac814b979 (diff)
downloadSheMov-02335902fb63e7bc1ebd5931dae93b754dc469ea.tar.gz
SheMov-02335902fb63e7bc1ebd5931dae93b754dc469ea.tar.bz2
SheMov-02335902fb63e7bc1ebd5931dae93b754dc469ea.zip
Show pic size in SmDirModel
If file is an image, grab the size and add it to the model. Also, remove some leftover debug statements from SmTreeView.
Diffstat (limited to 'smdirwatcher.cpp')
-rw-r--r--smdirwatcher.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/smdirwatcher.cpp b/smdirwatcher.cpp
index 069ebfe..eaff3b3 100644
--- a/smdirwatcher.cpp
+++ b/smdirwatcher.cpp
@@ -10,6 +10,7 @@
#include <QDateTime>
#include <QDir>
#include <QSemaphore>
+#include <QImage>
#include <sys/inotify.h>
#include <stropts.h>
@@ -23,12 +24,12 @@
extern int errno;
-SmDirWatcher::SmDirWatcher(QObject *parent) : QThread(parent), mFd(0), mDescr(0) {
+SmDirWatcher::SmDirWatcher(int numFields, QObject *parent) : QThread(parent), mFd(0), mDescr(0) {
mBufLen = 1024 * (sizeof(struct inotify_event) + 16);
mINdata = new char[mBufLen];
mFd = inotify_init();
- mCollector = new SmDataColletor(8, this);
+ mCollector = new SmDataColletor(numFields, this);
mSemFree = new QSemaphore(1024);
mSemUsed = new QSemaphore;
mDataQueue = new QQueue<QPair<QString, DWEvent> >();
@@ -146,5 +147,10 @@ const QList<QVariant> SmDataColletor::fileData(const QFileInfo &fi) const{
}
data << Helper::md5Sum(fi.absoluteFilePath());
data << si << fi.absoluteFilePath();
+ if(mime.startsWith("image")){
+ data << QImage(fi.absoluteFilePath()).size();
+ }else{
+ data << QVariant();
+ }
return data;
}