summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-07-06 09:55:39 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-07-06 09:55:39 +0200
commit152f02f7e9855cfda6807c20f9319d22eadd6976 (patch)
tree9c18ebd2520f65c3f30e46c5025f159dc0f3e3b2
parentb4df9eb5f1f4a0ac2b1272fc34d4b8aad473008b (diff)
downloadsink-152f02f7e9855cfda6807c20f9319d22eadd6976.tar.gz
sink-152f02f7e9855cfda6807c20f9319d22eadd6976.zip
Make sure the connection works
-rw-r--r--common/genericresource.cpp50
1 files changed, 31 insertions, 19 deletions
diff --git a/common/genericresource.cpp b/common/genericresource.cpp
index 5522174..2b9e7b2 100644
--- a/common/genericresource.cpp
+++ b/common/genericresource.cpp
@@ -279,27 +279,16 @@ GenericResource::GenericResource(const QByteArray &resourceType, const QByteArra
279 } 279 }
280 return KAsync::error<void>(-1, "Invalid inspection command."); 280 return KAsync::error<void>(-1, "Invalid inspection command.");
281 }); 281 });
282 QObject::connect(mProcessor, &CommandProcessor::error, [this](int errorCode, const QString &msg) { onProcessorError(errorCode, msg); }); 282 {
283 QObject::connect(mPipeline.data(), &Pipeline::revisionUpdated, this, &Resource::revisionUpdated); 283 auto ret =QObject::connect(mProcessor, &CommandProcessor::error, [this](int errorCode, const QString &msg) { onProcessorError(errorCode, msg); });
284 Q_ASSERT(ret);
285 }
286 {
287 auto ret = QObject::connect(mPipeline.data(), &Pipeline::revisionUpdated, this, &Resource::revisionUpdated);
288 Q_ASSERT(ret);
289 }
284 mClientLowerBoundRevision = mPipeline->cleanedUpRevision(); 290 mClientLowerBoundRevision = mPipeline->cleanedUpRevision();
285 291
286 QObject::connect(mChangeReplay.data(), &ChangeReplay::replayingChanges, [this]() {
287 Sink::Notification n;
288 n.id = "changereplay";
289 n.type = Sink::Notification::Status;
290 n.message = "Replaying changes.";
291 n.code = Sink::ApplicationDomain::BusyStatus;
292 emit notify(n);
293 });
294 QObject::connect(mChangeReplay.data(), &ChangeReplay::changesReplayed, [this]() {
295 Sink::Notification n;
296 n.id = "changereplay";
297 n.type = Sink::Notification::Status;
298 n.message = "All changes have been replayed.";
299 n.code = Sink::ApplicationDomain::ConnectedStatus;
300 emit notify(n);
301 });
302
303 mCommitQueueTimer.setInterval(sCommitInterval); 292 mCommitQueueTimer.setInterval(sCommitInterval);
304 mCommitQueueTimer.setSingleShot(true); 293 mCommitQueueTimer.setSingleShot(true);
305 QObject::connect(&mCommitQueueTimer, &QTimer::timeout, &mUserQueue, &MessageQueue::commit); 294 QObject::connect(&mCommitQueueTimer, &QTimer::timeout, &mUserQueue, &MessageQueue::commit);
@@ -346,6 +335,29 @@ void GenericResource::setupSynchronizer(const QSharedPointer<Synchronizer> &sync
346void GenericResource::setupChangereplay(const QSharedPointer<ChangeReplay> &changeReplay) 335void GenericResource::setupChangereplay(const QSharedPointer<ChangeReplay> &changeReplay)
347{ 336{
348 mChangeReplay = changeReplay; 337 mChangeReplay = changeReplay;
338 {
339 auto ret = QObject::connect(mChangeReplay.data(), &ChangeReplay::replayingChanges, [this]() {
340 Sink::Notification n;
341 n.id = "changereplay";
342 n.type = Sink::Notification::Status;
343 n.message = "Replaying changes.";
344 n.code = Sink::ApplicationDomain::BusyStatus;
345 emit notify(n);
346 });
347 Q_ASSERT(ret);
348 }
349 {
350 auto ret = QObject::connect(mChangeReplay.data(), &ChangeReplay::changesReplayed, [this]() {
351 Sink::Notification n;
352 n.id = "changereplay";
353 n.type = Sink::Notification::Status;
354 n.message = "All changes have been replayed.";
355 n.code = Sink::ApplicationDomain::ConnectedStatus;
356 emit notify(n);
357 });
358 Q_ASSERT(ret);
359 }
360
349 mProcessor->setOldestUsedRevision(mChangeReplay->getLastReplayedRevision()); 361 mProcessor->setOldestUsedRevision(mChangeReplay->getLastReplayedRevision());
350 enableChangeReplay(true); 362 enableChangeReplay(true);
351} 363}