Analyzer: Remove AnalyzerRunControl::runnable() and .connection()

These re-implementations are conceptually "too specific". Rather let
the indiviual tools handle there expectations themselves.

Change-Id: I0bbea407b2241816a40d19eb1dbb0a7589cbda7b
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
hjk
2016-01-28 18:24:08 +01:00
parent b2c6ea47b1
commit 249a36b573
10 changed files with 24 additions and 26 deletions

View File

@@ -28,7 +28,6 @@
#include "analyzerruncontrol.h" #include "analyzerruncontrol.h"
#include "ianalyzertool.h" #include "ianalyzertool.h"
#include "analyzermanager.h" #include "analyzermanager.h"
#include "analyzerstartparameters.h"
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/runconfigurationaspects.h> #include <projectexplorer/runconfigurationaspects.h>
@@ -58,16 +57,6 @@ AnalyzerRunControl::AnalyzerRunControl(RunConfiguration *runConfiguration, Core:
this, &AnalyzerRunControl::stopIt); this, &AnalyzerRunControl::stopIt);
} }
const StandardRunnable &AnalyzerRunControl::runnable() const
{
return RunControl::runnable().as<StandardRunnable>();
}
const AnalyzerConnection &AnalyzerRunControl::connection() const
{
return RunControl::connection().as<AnalyzerConnection>();
}
void AnalyzerRunControl::stopIt() void AnalyzerRunControl::stopIt()
{ {
if (stop() == RunControl::StoppedSynchronously) if (stop() == RunControl::StoppedSynchronously)

View File

@@ -27,10 +27,9 @@
#ifndef ANALYZERRUNCONTROL_H #ifndef ANALYZERRUNCONTROL_H
#define ANALYZERRUNCONTROL_H #define ANALYZERRUNCONTROL_H
#include "analyzerstartparameters.h" #include "analyzerbase_global.h"
#include <projectexplorer/runconfiguration.h> #include <projectexplorer/runconfiguration.h>
#include <projectexplorer/runnables.h>
#include <utils/outputformat.h> #include <utils/outputformat.h>
@@ -59,9 +58,6 @@ public:
virtual void pause() {} virtual void pause() {}
virtual void unpause() {} virtual void unpause() {}
const ProjectExplorer::StandardRunnable &runnable() const;
const AnalyzerConnection &connection() const;
virtual void notifyRemoteSetupDone(quint16) {} virtual void notifyRemoteSetupDone(quint16) {}
virtual void notifyRemoteFinished() {} virtual void notifyRemoteFinished() {}

View File

@@ -31,6 +31,7 @@
#include <analyzerbase/ianalyzertool.h> #include <analyzerbase/ianalyzertool.h>
#include <analyzerbase/analyzermanager.h> #include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerruncontrol.h> #include <analyzerbase/analyzerruncontrol.h>
#include <analyzerbase/analyzerstartparameters.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>

View File

@@ -34,6 +34,8 @@
#include <analyzerbase/analyzermanager.h> #include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerruncontrol.h> #include <analyzerbase/analyzerruncontrol.h>
#include <analyzerbase/analyzerstartparameters.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>

View File

@@ -29,6 +29,8 @@
#include "qmlprofilertool.h" #include "qmlprofilertool.h"
#include <analyzerbase/analyzermanager.h> #include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerstartparameters.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <coreplugin/helpmanager.h> #include <coreplugin/helpmanager.h>
@@ -109,9 +111,12 @@ bool QmlProfilerRunControl::startEngine()
d->m_tool->finalizeRunControl(this); d->m_tool->finalizeRunControl(this);
QTC_ASSERT(d->m_profilerState, return false); QTC_ASSERT(d->m_profilerState, return false);
if (connection().analyzerPort != 0) QTC_ASSERT(connection().is<AnalyzerConnection>(), return false);
emit processRunning(connection().analyzerPort); auto conn = connection().as<AnalyzerConnection>();
else if (connection().analyzerSocket.isEmpty())
if (conn.analyzerPort != 0)
emit processRunning(conn.analyzerPort);
else if (conn.analyzerSocket.isEmpty())
d->m_noDebugOutputTimer.start(); d->m_noDebugOutputTimer.start();
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppRunning); d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppRunning);
@@ -233,7 +238,7 @@ void QmlProfilerRunControl::processIsRunning(quint16 port)
d->m_noDebugOutputTimer.stop(); d->m_noDebugOutputTimer.stop();
if (port == 0) if (port == 0)
port = connection().analyzerPort; port = connection().as<AnalyzerConnection>().analyzerPort;
if (port != 0) if (port != 0)
emit processRunning(port); emit processRunning(port);
} }

View File

@@ -30,6 +30,7 @@
#include <analyzerbase/ianalyzertool.h> #include <analyzerbase/ianalyzertool.h>
#include <analyzerbase/analyzerruncontrol.h> #include <analyzerbase/analyzerruncontrol.h>
#include <analyzerbase/analyzerstartparameters.h>
#include <analyzerbase/analyzermanager.h> #include <analyzerbase/analyzermanager.h>
#include <debugger/debuggerrunconfigurationaspect.h> #include <debugger/debuggerrunconfigurationaspect.h>

View File

@@ -39,6 +39,7 @@
#include <analyzerbase/analyzermanager.h> #include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerruncontrol.h> #include <analyzerbase/analyzerruncontrol.h>
#include <analyzerbase/analyzerstartparameters.h>
#include <utils/fancymainwindow.h> #include <utils/fancymainwindow.h>
#include <utils/fileinprojectfinder.h> #include <utils/fileinprojectfinder.h>
@@ -222,7 +223,7 @@ void QmlProfilerTool::finalizeRunControl(QmlProfilerRunControl *runControl)
runControl->registerProfilerStateManager(d->m_profilerState); runControl->registerProfilerStateManager(d->m_profilerState);
// FIXME: Check that there's something sensible in sp.connParams // FIXME: Check that there's something sensible in sp.connParams
auto &connection = runControl->connection(); auto connection = runControl->connection().as<AnalyzerConnection>();
if (!connection.analyzerSocket.isEmpty()) if (!connection.analyzerSocket.isEmpty())
d->m_profilerConnections->setLocalSocket(connection.analyzerSocket); d->m_profilerConnections->setLocalSocket(connection.analyzerSocket);
else else

View File

@@ -33,6 +33,7 @@
#include <analyzerbase/analyzermanager.h> #include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerruncontrol.h> #include <analyzerbase/analyzerruncontrol.h>
#include <analyzerbase/analyzerstartparameters.h>
#include <analyzerbase/ianalyzertool.h> #include <analyzerbase/ianalyzertool.h>
#include <debugger/debuggerruncontrol.h> #include <debugger/debuggerruncontrol.h>

View File

@@ -151,7 +151,7 @@ void MemcheckWithGdbRunControl::startDebugger()
const qint64 valgrindPid = runner()->valgrindProcess()->pid(); const qint64 valgrindPid = runner()->valgrindProcess()->pid();
Debugger::DebuggerStartParameters sp; Debugger::DebuggerStartParameters sp;
sp.inferior.executable = runnable().executable; sp.inferior = runnable().as<StandardRunnable>();
sp.startMode = Debugger::AttachToRemoteServer; sp.startMode = Debugger::AttachToRemoteServer;
sp.displayName = QString::fromLatin1("VGdb %1").arg(valgrindPid); sp.displayName = QString::fromLatin1("VGdb %1").arg(valgrindPid);
sp.remoteChannel = QString::fromLatin1("| vgdb --pid=%1").arg(valgrindPid); sp.remoteChannel = QString::fromLatin1("| vgdb --pid=%1").arg(valgrindPid);

View File

@@ -28,13 +28,15 @@
#include "valgrindsettings.h" #include "valgrindsettings.h"
#include "valgrindplugin.h" #include "valgrindplugin.h"
#include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerstartparameters.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/ioutputpane.h> #include <coreplugin/ioutputpane.h>
#include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/progressmanager/futureprogress.h> #include <coreplugin/progressmanager/futureprogress.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <projectexplorer/runconfiguration.h> #include <projectexplorer/runconfiguration.h>
#include <analyzerbase/analyzermanager.h>
#include <QApplication> #include <QApplication>
#include <QMainWindow> #include <QMainWindow>
@@ -85,9 +87,9 @@ bool ValgrindRunControl::startEngine()
ValgrindRunner *run = runner(); ValgrindRunner *run = runner();
run->setValgrindExecutable(m_settings->valgrindExecutable()); run->setValgrindExecutable(m_settings->valgrindExecutable());
run->setValgrindArguments(genericToolArguments() + toolArguments()); run->setValgrindArguments(genericToolArguments() + toolArguments());
run->setConnectionParameters(connection().connParams); run->setConnectionParameters(connection().as<AnalyzerConnection>().connParams);
run->setUseStartupProject(!m_isCustomStart); run->setUseStartupProject(!m_isCustomStart);
run->setDebuggee(runnable()); run->setDebuggee(runnable().as<StandardRunnable>());
connect(run, &ValgrindRunner::processOutputReceived, connect(run, &ValgrindRunner::processOutputReceived,
this, &ValgrindRunControl::receiveProcessOutput); this, &ValgrindRunControl::receiveProcessOutput);
@@ -111,7 +113,7 @@ void ValgrindRunControl::stopEngine()
QString ValgrindRunControl::executable() const QString ValgrindRunControl::executable() const
{ {
return runnable().executable; return runnable().as<StandardRunnable>().executable;
} }
QStringList ValgrindRunControl::genericToolArguments() const QStringList ValgrindRunControl::genericToolArguments() const