diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp index 1c38f856385..ac5910a67a1 100644 --- a/src/plugins/projectexplorer/runconfiguration.cpp +++ b/src/plugins/projectexplorer/runconfiguration.cpp @@ -570,8 +570,10 @@ public: QVariantMap data; int startWatchdogInterval = 0; int startWatchdogTimerId = -1; + std::function startWatchdogCallback; int stopWatchdogInterval = 0; // 5000; int stopWatchdogTimerId = -1; + std::function stopWatchdogCallback; bool supportsReRunning = true; bool essential = false; }; @@ -1562,11 +1564,17 @@ bool RunWorkerPrivate::canStop() const void RunWorkerPrivate::timerEvent(QTimerEvent *ev) { if (ev->timerId() == startWatchdogTimerId) { - q->reportFailure(tr("Worker start timed out.")); + if (startWatchdogCallback) + startWatchdogCallback(); + else + q->reportFailure(tr("Worker start timed out.")); return; } if (ev->timerId() == stopWatchdogTimerId) { - q->reportFailure(tr("Worker stop timed out.")); + if (stopWatchdogCallback) + stopWatchdogCallback(); + else + q->reportFailure(tr("Worker stop timed out.")); return; } } @@ -1760,14 +1768,16 @@ void RunWorker::setId(const QString &id) d->id = id; } -void RunWorker::setStartTimeout(int ms) +void RunWorker::setStartTimeout(int ms, const std::function &callback) { d->startWatchdogInterval = ms; + d->startWatchdogCallback = callback; } -void RunWorker::setStopTimeout(int ms) +void RunWorker::setStopTimeout(int ms, const std::function &callback) { d->stopWatchdogInterval = ms; + d->stopWatchdogCallback = callback; } void RunWorker::recordData(const QString &channel, const QVariant &data) diff --git a/src/plugins/projectexplorer/runconfiguration.h b/src/plugins/projectexplorer/runconfiguration.h index 51f5c7b2e25..f938f3a93d8 100644 --- a/src/plugins/projectexplorer/runconfiguration.h +++ b/src/plugins/projectexplorer/runconfiguration.h @@ -347,8 +347,8 @@ public: void setDisplayName(const QString &id) { setId(id); } // FIXME: Obsoleted by setId. void setId(const QString &id); - void setStartTimeout(int ms); - void setStopTimeout(int ms); + void setStartTimeout(int ms, const std::function &callback = {}); + void setStopTimeout(int ms, const std::function &callback = {}); void recordData(const QString &channel, const QVariant &data); QVariant recordedData(const QString &channel) const;