aboutsummaryrefslogtreecommitdiff
path: root/lib/connection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/connection.cpp')
-rw-r--r--lib/connection.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp
index 0fb301d1..b702c1f9 100644
--- a/lib/connection.cpp
+++ b/lib/connection.cpp
@@ -57,7 +57,6 @@
#include <QtCore/QElapsedTimer>
#include <QtCore/QFile>
#include <QtCore/QMimeDatabase>
-#include <QtCore/QTimer>
#include <QtCore/QRegularExpression>
#include <QtCore/QStandardPaths>
#include <QtCore/QStringBuilder>
@@ -518,23 +517,21 @@ void Connection::sync(int timeout)
});
}
-void Connection::syncLoop(int timeout, int msecBetween)
+void Connection::syncLoop(int timeout)
{
if (d->syncLoopConnection && d->syncTimeout == timeout) {
qCInfo(MAIN) << "Attempt to run sync loop but there's one already "
"running; nothing will be done";
return;
}
- std::swap(d->syncTimeout, timeout); // swap() is for the nice log below
+ std::swap(d->syncTimeout, timeout);
if (d->syncLoopConnection) {
qCInfo(MAIN) << "Timeout for next syncs changed from"
<< timeout << "to" << d->syncTimeout;
} else {
- d->syncLoopConnection =
- connect(this, &Connection::syncDone, this, [this, msecBetween] {
- QTimer::singleShot(msecBetween, this,
- &Connection::syncLoopIteration);
- });
+ d->syncLoopConnection = connect(this, &Connection::syncDone,
+ this, &Connection::syncLoopIteration,
+ Qt::QueuedConnection);
syncLoopIteration(); // initial sync to start the loop
}
}