Debugger: Make DebuggerRunTool (more) responsible for output

Make DebuggerRunTool accessible to downstream users, but remove
the non-standard handleApplicationOutput from the run control
itself to move it closer to the base run control.

LogChannel and Utils::OutputFormat should merge at some time.

Change-Id: I47b0f0067e1427b25e47036c3d4bc6ed5eed6189
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2017-04-10 13:57:05 +02:00
parent a585a59f61
commit 49b98f1149
4 changed files with 84 additions and 82 deletions

View File

@@ -553,32 +553,6 @@ void DebuggerEngine::setRegisterValue(const QString &name, const QString &value)
Q_UNUSED(value);
}
void DebuggerEngine::showMessage(const QString &msg, int channel, int timeout) const
{
if (d->m_masterEngine) {
d->m_masterEngine->showMessage(msg, channel, timeout);
return;
}
//if (msg.size() && msg.at(0).isUpper() && msg.at(1).isUpper())
// qDebug() << qPrintable(msg) << "IN STATE" << state();
if (channel == ConsoleOutput)
debuggerConsole()->printItem(ConsoleItem::DefaultType, msg);
Internal::showMessage(msg, channel, timeout);
switch (channel) {
case AppOutput:
case AppError:
case AppStuff:
if (d->m_runControl)
d->m_runControl->handleApplicationOutput(msg, channel);
else
qWarning("Warning: %s (no active run control)", qPrintable(msg));
break;
default:
break;
}
}
void DebuggerEngine::startDebugger(DebuggerRunControl *runControl)
{
QTC_ASSERT(runControl, notifyEngineSetupFailed(); return);
@@ -1453,6 +1427,12 @@ bool DebuggerEngine::isReverseDebugging() const
return Internal::isReverseDebugging();
}
void DebuggerEngine::showMessage(const QString &msg, int channel, int timeout) const
{
if (DebuggerRunTool *tool = runTool())
tool->showMessage(msg, channel, timeout);
}
// Called by DebuggerRunControl.
void DebuggerEngine::quitDebugger()
{
@@ -1514,6 +1494,13 @@ DebuggerRunControl *DebuggerEngine::runControl() const
return d->runControl();
}
DebuggerRunTool *DebuggerEngine::runTool() const
{
if (DebuggerRunControl *rc = d->runControl())
return static_cast<DebuggerRunTool *>(rc->toolRunner());
return nullptr;
}
Terminal *DebuggerEngine::terminal() const
{
return &d->m_terminal;