From 152f02f7e9855cfda6807c20f9319d22eadd6976 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 6 Jul 2016 09:55:39 +0200 Subject: Make sure the connection works --- common/genericresource.cpp | 50 ++++++++++++++++++++++++++++------------------ 1 file 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 } return KAsync::error(-1, "Invalid inspection command."); }); - QObject::connect(mProcessor, &CommandProcessor::error, [this](int errorCode, const QString &msg) { onProcessorError(errorCode, msg); }); - QObject::connect(mPipeline.data(), &Pipeline::revisionUpdated, this, &Resource::revisionUpdated); + { + auto ret =QObject::connect(mProcessor, &CommandProcessor::error, [this](int errorCode, const QString &msg) { onProcessorError(errorCode, msg); }); + Q_ASSERT(ret); + } + { + auto ret = QObject::connect(mPipeline.data(), &Pipeline::revisionUpdated, this, &Resource::revisionUpdated); + Q_ASSERT(ret); + } mClientLowerBoundRevision = mPipeline->cleanedUpRevision(); - QObject::connect(mChangeReplay.data(), &ChangeReplay::replayingChanges, [this]() { - Sink::Notification n; - n.id = "changereplay"; - n.type = Sink::Notification::Status; - n.message = "Replaying changes."; - n.code = Sink::ApplicationDomain::BusyStatus; - emit notify(n); - }); - QObject::connect(mChangeReplay.data(), &ChangeReplay::changesReplayed, [this]() { - Sink::Notification n; - n.id = "changereplay"; - n.type = Sink::Notification::Status; - n.message = "All changes have been replayed."; - n.code = Sink::ApplicationDomain::ConnectedStatus; - emit notify(n); - }); - mCommitQueueTimer.setInterval(sCommitInterval); mCommitQueueTimer.setSingleShot(true); QObject::connect(&mCommitQueueTimer, &QTimer::timeout, &mUserQueue, &MessageQueue::commit); @@ -346,6 +335,29 @@ void GenericResource::setupSynchronizer(const QSharedPointer &sync void GenericResource::setupChangereplay(const QSharedPointer &changeReplay) { mChangeReplay = changeReplay; + { + auto ret = QObject::connect(mChangeReplay.data(), &ChangeReplay::replayingChanges, [this]() { + Sink::Notification n; + n.id = "changereplay"; + n.type = Sink::Notification::Status; + n.message = "Replaying changes."; + n.code = Sink::ApplicationDomain::BusyStatus; + emit notify(n); + }); + Q_ASSERT(ret); + } + { + auto ret = QObject::connect(mChangeReplay.data(), &ChangeReplay::changesReplayed, [this]() { + Sink::Notification n; + n.id = "changereplay"; + n.type = Sink::Notification::Status; + n.message = "All changes have been replayed."; + n.code = Sink::ApplicationDomain::ConnectedStatus; + emit notify(n); + }); + Q_ASSERT(ret); + } + mProcessor->setOldestUsedRevision(mChangeReplay->getLastReplayedRevision()); enableChangeReplay(true); } -- cgit v1.2.3