From 4e45cab2c1631f9202f0ac19d53c002b8d4cd90e Mon Sep 17 00:00:00 2001 From: Duncan Mac-Vicar P Date: Mon, 4 Apr 2011 18:41:14 +0200 Subject: - lot of stability improvements - the crash with threads goes away by using QMap - add a polling timer --- src/mirall/folderwatcher.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/mirall/folderwatcher.h') diff --git a/src/mirall/folderwatcher.h b/src/mirall/folderwatcher.h index 5c3442747..6ca9acf03 100644 --- a/src/mirall/folderwatcher.h +++ b/src/mirall/folderwatcher.h @@ -3,6 +3,7 @@ #ifndef MIRALL_FOLDERWATCHER_H #define MIRALL_FOLDERWATCHER_H +#include #include #include #include @@ -42,6 +43,14 @@ public: */ QString root() const; + /** + * Add an ignore pattern that will not be + * notified + * + * You can use wildcards + */ + void addIgnore(const QString &pattern); + /** * If true, folderChanged() events are sent * at least as often as eventInterval() seconds. @@ -67,6 +76,19 @@ public: */ void setEventInterval(int seconds); + /** + * The minimum amounts of seconds to wait before + * doing a full sync to see if the remote changed + */ + int pollInterval() const; + + /** + * Sets minimum amounts of seconds that will separate + * poll intervals + */ + void setPollInterval(int seconds); + + signals: /** * Emitted when one of the paths is changed @@ -81,20 +103,29 @@ protected slots: void slotAddFolderRecursive(const QString &path); // called when the manually process timer triggers void slotProcessTimerTimeout(); + void slotPollTimerTimeout(); void slotProcessPaths(); + private: bool _eventsEnabled; int _eventInterval; + int _pollInterval; + INotify *_inotify; QString _root; // paths pending to notified QStringList _pendingPaths; + QTimer *_processTimer; + // poll timer for remote syncs + QTimer *_pollTimer; + QTime _lastEventTime; // to cancel events that belong to the same action int _lastMask; QString _lastPath; + QStringList _ignores; }; } -- cgit v1.2.3