ProjectExplorer: Extend centralized state handling

Add some customization hooks to make tools aware of target errors
and vice versa.

Change-Id: I4d815087297a3fa1d1d6d52daeed7c4ae0f624bf
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2017-05-02 15:03:56 +02:00
parent 9ee0cec3bc
commit 5d8d3fbdc7
6 changed files with 187 additions and 30 deletions

View File

@@ -343,7 +343,7 @@ public:
bool isMasterEngine() const { return m_engine->isMasterEngine(); }
DebuggerRunTool *runTool() const
{ return m_masterEngine ? m_masterEngine->runTool() : m_runTool.data(); }
RunControl *runControl() const { return runTool()->runControl(); }
RunControl *runControl() const;
void setRemoteSetupState(RemoteSetupState state);
DebuggerEngine *m_engine = nullptr; // Not owned.
@@ -1147,6 +1147,12 @@ void DebuggerEnginePrivate::doFinishDebugger()
m_runTool->debuggingFinished();
}
RunControl *DebuggerEnginePrivate::runControl() const
{
DebuggerRunTool *tool = runTool();
return tool ? tool->runControl() : nullptr;
}
void DebuggerEnginePrivate::setRemoteSetupState(RemoteSetupState state)
{
bool allowedTransition = false;
@@ -1315,6 +1321,7 @@ void DebuggerEngine::setState(DebuggerState state, bool forced)
showMessage(msg, LogDebug);
updateViews();
QTC_ASSERT(runTool(), return);
runTool()->stateChanged(d->m_state);
if (isSlaveEngine())
@@ -1542,9 +1549,7 @@ RunControl *DebuggerEngine::runControl() const
DebuggerRunTool *DebuggerEngine::runTool() const
{
// if (DebuggerRunControl *rc = d->runControl())
// return qobject_cast<DebuggerRunTool *>(rc->toolRunner());
return d->m_runTool;
return d->m_masterEngine ? d->m_masterEngine->runTool() : d->m_runTool.data();
}
Terminal *DebuggerEngine::terminal() const