Start fs watching with a delay of 2 seconds to don't catch the journal changes.

This commit is contained in:
Klaas Freitag 2012-12-06 18:38:45 +01:00
parent a124dcd4e8
commit 8af257a4cd
4 changed files with 22 additions and 13 deletions

View file

@ -217,11 +217,6 @@ cleanup:
qDebug() << "CSync run took " << t.elapsed() << " Milliseconds";
qDebug() << "CSync Waiting a bit to let OS finish up IO";
#ifdef Q_OS_WIN
Sleep(2000);
#else
::sleep(2);
#endif
qDebug() << "CSync End Waiting";
emit(finished());

View file

@ -280,7 +280,7 @@ void Folder::slotSyncStarted()
void Folder::slotSyncFinished(const SyncResult &result)
{
_watcher->setEventsEnabled(true);
_watcher->setEventsEnabledDelayed(2000);
qDebug() << "OO folder slotSyncFinished: result: " << int(result.status()) << " local: " << result.localRunOnly();
emit syncStateChange();

View file

@ -102,6 +102,12 @@ bool FolderWatcher::eventsEnabled() const
return _eventsEnabled;
}
void FolderWatcher::setEventsEnabledDelayed( int delay_msec )
{
qDebug() << "Starting Event logging again in " << delay_msec << " milliseconds";
QTimer::singleShot( delay_msec, this, SLOT(setEventsEnabled()));
}
void FolderWatcher::setEventsEnabled(bool enabled)
{
qDebug() << " * event notification " << (enabled ? "enabled" : "disabled");

View file

@ -75,13 +75,6 @@ public:
*/
bool eventsEnabled() const;
/**
* Enabled or disables folderChanged() events.
* If disabled, events are accumulated and emptied
* the next time a folderChanged() event happens.
*/
void setEventsEnabled(bool enabled);
/**
* Clear all pending events
*/
@ -100,6 +93,21 @@ public:
void setEventInterval(int seconds);
QStringList ignores() const;
public slots:
/**
* Enabled or disables folderChanged() events.
* If disabled, events are accumulated and emptied
* the next time a folderChanged() event happens.
*/
void setEventsEnabled(bool enabled=true);
/**
* @brief setEventsEnabledDelayed - start event logging after a while
* @param delay - delay time in milliseconds
* @param enabled - enable the events.
*/
void setEventsEnabledDelayed( int );
signals:
/**
* Emitted when one of the paths is changed