forked from qt-creator/qt-creator
ProjectExplorer: Introduce an "essential" flag for RunWorker
An essential RunWorker triggers the whole RunControl to stop if it spontaneously stops. Change-Id: Ia05b927e306022e99b45cc8cd7ab9636f4d3c129 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -547,6 +547,7 @@ public:
|
|||||||
int stopWatchdogInterval = 0; // 5000;
|
int stopWatchdogInterval = 0; // 5000;
|
||||||
int stopWatchdogTimerId = -1;
|
int stopWatchdogTimerId = -1;
|
||||||
bool supportsReRunning = true;
|
bool supportsReRunning = true;
|
||||||
|
bool essential = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class RunControlState
|
enum class RunControlState
|
||||||
@@ -954,6 +955,10 @@ void RunControlPrivate::onWorkerStopped(RunWorker *worker)
|
|||||||
if (state == RunControlState::Finishing || state == RunControlState::Stopping) {
|
if (state == RunControlState::Finishing || state == RunControlState::Stopping) {
|
||||||
continueStopOrFinish();
|
continueStopOrFinish();
|
||||||
return;
|
return;
|
||||||
|
} else if (worker->isEssential()) {
|
||||||
|
debugMessage(workerId + " is essential. Stopping all others.");
|
||||||
|
initiateStop();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (RunWorker *dependent : worker->d->stopDependencies) {
|
for (RunWorker *dependent : worker->d->stopDependencies) {
|
||||||
@@ -1701,6 +1706,16 @@ QString RunWorker::userMessageForProcessError(QProcess::ProcessError error, cons
|
|||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RunWorker::isEssential() const
|
||||||
|
{
|
||||||
|
return d->essential;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RunWorker::setEssential(bool essential)
|
||||||
|
{
|
||||||
|
d->essential = essential;
|
||||||
|
}
|
||||||
|
|
||||||
void RunWorker::start()
|
void RunWorker::start()
|
||||||
{
|
{
|
||||||
reportStarted();
|
reportStarted();
|
||||||
|
|||||||
@@ -353,6 +353,9 @@ public:
|
|||||||
|
|
||||||
static QString userMessageForProcessError(QProcess::ProcessError, const QString &programName);
|
static QString userMessageForProcessError(QProcess::ProcessError, const QString &programName);
|
||||||
|
|
||||||
|
bool isEssential() const;
|
||||||
|
void setEssential(bool essential);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void started();
|
void started();
|
||||||
void stopped();
|
void stopped();
|
||||||
|
|||||||
Reference in New Issue
Block a user