From d1f0578bf82b72070cbd546b756c97aaa529d581 Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Thu, 1 Mar 2012 16:13:50 +0100 Subject: [PATCH] some changes to get inotify out of win build. removed moc include. --- src/mirall/folderwatcher.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/mirall/folderwatcher.cpp b/src/mirall/folderwatcher.cpp index ed541500e..76604801d 100644 --- a/src/mirall/folderwatcher.cpp +++ b/src/mirall/folderwatcher.cpp @@ -13,7 +13,7 @@ */ // event masks -#include +#include #include #include @@ -23,13 +23,21 @@ #include #include +#include "mirall/folder.h" #include "mirall/inotify.h" #include "mirall/folderwatcher.h" #include "mirall/fileutils.h" -static const uint32_t standard_event_mask = - IN_CLOSE_WRITE | IN_ATTRIB | IN_MOVE | IN_CREATE | IN_DELETE | IN_DELETE_SELF | IN_MOVE_SELF | IN_UNMOUNT | IN_ONLYDIR | IN_DONT_FOLLOW; +#ifdef USE_WATCHER +#include +#endif +static const uint32_t standard_event_mask = +#ifdef USE_WATCHER + IN_CLOSE_WRITE | IN_ATTRIB | IN_MOVE | IN_CREATE | IN_DELETE | IN_DELETE_SELF | IN_MOVE_SELF | IN_UNMOUNT | IN_ONLYDIR | IN_DONT_FOLLOW; +#else + 0; +#endif /* minimum amount of seconds between two events to consider it a new event */ #define DEFAULT_EVENT_INTERVAL_MSEC 1000 @@ -173,7 +181,7 @@ void FolderWatcher::slotINotifyEvent(int mask, int cookie, const QString &path) _lastPath = path; if( ! eventsEnabled() ) return; - +#ifdef USE_WATCHER qDebug() << "** Inotify Event " << mask << " on " << path; // cancel close write events that come after create if (lastMask == IN_CREATE && mask == IN_CLOSE_WRITE @@ -200,12 +208,10 @@ void FolderWatcher::slotINotifyEvent(int mask, int cookie, const QString &path) } else if (mask & IN_DELETE) { //qDebug() << cookie << " DELETE: " << path; -#ifdef USE_WATCHER if (_inotify->directories().contains(path) && QFileInfo(path).isDir()); qDebug() << "(-) Watcher:" << path; _inotify->removePath(path); -#endif } else if (mask & IN_CLOSE_WRITE) { //qDebug() << cookie << " WRITABLE CLOSED: " << path; @@ -243,6 +249,7 @@ void FolderWatcher::slotINotifyEvent(int mask, int cookie, const QString &path) #if 0 _pendingPaths[path] _pendingPaths.append(path); +#endif #endif setProcessTimer(); } @@ -271,4 +278,3 @@ void FolderWatcher::setProcessTimer() } -#include "folderwatcher.moc"