Commit 96dd315f authored by hjk's avatar hjk

ProjectExplorer: Remove RunWorkerState::Failed

It is always acted upon essentially the same as Done, but
complicates the scheme.

Change-Id: I8d9161fb162195a533c7ed29e251c3f486479dc9
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent a62d979d
...@@ -508,7 +508,7 @@ namespace Internal { ...@@ -508,7 +508,7 @@ namespace Internal {
enum class RunWorkerState enum class RunWorkerState
{ {
Initialized, Starting, Running, Stopping, Done, Failed Initialized, Starting, Running, Stopping, Done
}; };
static QString stateName(RunWorkerState s) static QString stateName(RunWorkerState s)
...@@ -520,7 +520,6 @@ static QString stateName(RunWorkerState s) ...@@ -520,7 +520,6 @@ static QString stateName(RunWorkerState s)
SN(RunWorkerState::Running) SN(RunWorkerState::Running)
SN(RunWorkerState::Stopping) SN(RunWorkerState::Stopping)
SN(RunWorkerState::Done) SN(RunWorkerState::Done)
SN(RunWorkerState::Failed)
} }
return QString("<unknown: %1>").arg(int(s)); return QString("<unknown: %1>").arg(int(s));
# undef SN # undef SN
...@@ -812,12 +811,6 @@ void RunControlPrivate::continueStart() ...@@ -812,12 +811,6 @@ void RunControlPrivate::continueStart()
case RunWorkerState::Stopping: case RunWorkerState::Stopping:
debugMessage(" " + workerId + " currently stopping"); debugMessage(" " + workerId + " currently stopping");
continue; continue;
case RunWorkerState::Failed:
// Should not happen.
debugMessage(" " + workerId + " failed before");
QTC_CHECK(false);
//setState(RunControlState::Stopped);
break;
case RunWorkerState::Done: case RunWorkerState::Done:
debugMessage(" " + workerId + " was done before"); debugMessage(" " + workerId + " was done before");
break; break;
...@@ -877,9 +870,6 @@ void RunControlPrivate::continueStopOrFinish() ...@@ -877,9 +870,6 @@ void RunControlPrivate::continueStopOrFinish()
case RunWorkerState::Done: case RunWorkerState::Done:
debugMessage(" " + workerId + " was Done. Good."); debugMessage(" " + workerId + " was Done. Good.");
break; break;
case RunWorkerState::Failed:
debugMessage(" " + workerId + " was Failed. Good");
break;
} }
} else { } else {
debugMessage("Found unknown deleted worker"); debugMessage("Found unknown deleted worker");
...@@ -926,7 +916,7 @@ void RunControlPrivate::onWorkerStarted(RunWorker *worker) ...@@ -926,7 +916,7 @@ void RunControlPrivate::onWorkerStarted(RunWorker *worker)
void RunControlPrivate::onWorkerFailed(RunWorker *worker, const QString &msg) void RunControlPrivate::onWorkerFailed(RunWorker *worker, const QString &msg)
{ {
worker->d->state = RunWorkerState::Failed; worker->d->state = RunWorkerState::Done;
showError(msg); showError(msg);
initiateStop(); initiateStop();
...@@ -952,7 +942,7 @@ void RunControlPrivate::onWorkerStopped(RunWorker *worker) ...@@ -952,7 +942,7 @@ void RunControlPrivate::onWorkerStopped(RunWorker *worker)
default: default:
debugMessage(workerId + " stopped unexpectedly in state" debugMessage(workerId + " stopped unexpectedly in state"
+ stateName(worker->d->state)); + stateName(worker->d->state));
worker->d->state = RunWorkerState::Failed; worker->d->state = RunWorkerState::Done;
break; break;
} }
...@@ -964,7 +954,6 @@ void RunControlPrivate::onWorkerStopped(RunWorker *worker) ...@@ -964,7 +954,6 @@ void RunControlPrivate::onWorkerStopped(RunWorker *worker)
for (RunWorker *dependent : worker->d->stopDependencies) { for (RunWorker *dependent : worker->d->stopDependencies) {
switch (dependent->d->state) { switch (dependent->d->state) {
case RunWorkerState::Done: case RunWorkerState::Done:
case RunWorkerState::Failed:
break; break;
case RunWorkerState::Initialized: case RunWorkerState::Initialized:
dependent->d->state = RunWorkerState::Done; dependent->d->state = RunWorkerState::Done;
...@@ -1002,9 +991,6 @@ void RunControlPrivate::onWorkerStopped(RunWorker *worker) ...@@ -1002,9 +991,6 @@ void RunControlPrivate::onWorkerStopped(RunWorker *worker)
case RunWorkerState::Done: case RunWorkerState::Done:
debugMessage(" " + workerId + " was Done. Good."); debugMessage(" " + workerId + " was Done. Good.");
break; break;
case RunWorkerState::Failed:
debugMessage(" " + workerId + " was Failed. Good");
break;
} }
} else { } else {
debugMessage("Found unknown deleted worker"); debugMessage("Found unknown deleted worker");
...@@ -1466,8 +1452,7 @@ bool RunWorkerPrivate::canStop() const ...@@ -1466,8 +1452,7 @@ bool RunWorkerPrivate::canStop() const
return false; return false;
for (RunWorker *worker : stopDependencies) { for (RunWorker *worker : stopDependencies) {
QTC_ASSERT(worker, continue); QTC_ASSERT(worker, continue);
if (worker->d->state != RunWorkerState::Done if (worker->d->state != RunWorkerState::Done)
&& worker->d->state != RunWorkerState::Failed)
return false; return false;
} }
return true; return true;
...@@ -1497,7 +1482,7 @@ void RunWorkerPrivate::timerEvent(QTimerEvent *ev) ...@@ -1497,7 +1482,7 @@ void RunWorkerPrivate::timerEvent(QTimerEvent *ev)
or a log parser. or a log parser.
A \c RunWorker has a simple state model covering the \c Initialized, A \c RunWorker has a simple state model covering the \c Initialized,
\c Starting, \c Running, \c Stopping, \c Done, and \c Failed states. \c Starting, \c Running, \c Stopping, and \c Done states.
In the course of the operation of tools several \c RunWorkers In the course of the operation of tools several \c RunWorkers
may co-operate and form a combined state that is presented may co-operate and form a combined state that is presented
...@@ -1677,11 +1662,6 @@ bool RunWorker::supportsReRunning() const ...@@ -1677,11 +1662,6 @@ bool RunWorker::supportsReRunning() const
return d->supportsReRunning; return d->supportsReRunning;
} }
bool RunWorker::hasFailed() const
{
return d->state == RunWorkerState::Failed;
}
QString RunWorker::userMessageForProcessError(QProcess::ProcessError error, const QString &program) QString RunWorker::userMessageForProcessError(QProcess::ProcessError error, const QString &program)
{ {
QString failedToStart = tr("The process failed to start."); QString failedToStart = tr("The process failed to start.");
......
...@@ -350,7 +350,6 @@ public: ...@@ -350,7 +350,6 @@ public:
void reportFailure(const QString &msg = QString()); void reportFailure(const QString &msg = QString());
void setSupportsReRunning(bool reRunningSupported); void setSupportsReRunning(bool reRunningSupported);
bool supportsReRunning() const; bool supportsReRunning() const;
bool hasFailed() const;
static QString userMessageForProcessError(QProcess::ProcessError, const QString &programName); static QString userMessageForProcessError(QProcess::ProcessError, const QString &programName);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment