Analyzer: Remove IAnalyzerTool::canRun

That's taken care of the run control factories directly now

Change-Id: I1cd7470e78a93459bee878f5e32594e7cf339a91
Reviewed-by: Aurindam Jana <aurindam.jana@digia.com>
This commit is contained in:
hjk
2013-07-31 08:54:45 +02:00
parent 12a32f145c
commit cad3b13bbd
9 changed files with 5 additions and 39 deletions

View File

@@ -119,10 +119,6 @@ public:
virtual AnalyzerRunControl *createRunControl(const AnalyzerStartParameters &sp, virtual AnalyzerRunControl *createRunControl(const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration = 0) = 0; ProjectExplorer::RunConfiguration *runConfiguration = 0) = 0;
/// Returns true if the tool can be run
virtual bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
ProjectExplorer::RunMode mode) const = 0;
virtual void startTool(StartMode mode) = 0; virtual void startTool(StartMode mode) = 0;
/// Called when tools gets selected. /// Called when tools gets selected.

View File

@@ -66,12 +66,9 @@ QmlProfilerRunControlFactory::QmlProfilerRunControlFactory(QObject *parent) :
bool QmlProfilerRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const bool QmlProfilerRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
{ {
if (mode != QmlProfilerRunMode) return mode == QmlProfilerRunMode
return false; && (qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration)
IAnalyzerTool *tool = AnalyzerManager::toolFromRunMode(mode); || qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration));
if (tool)
return tool->canRun(runConfiguration, mode);
return false;
} }
static AnalyzerStartParameters createQmlProfilerStartParameters(RunConfiguration *runConfiguration) static AnalyzerStartParameters createQmlProfilerStartParameters(RunConfiguration *runConfiguration)

View File

@@ -266,14 +266,6 @@ AnalyzerRunControl *QmlProfilerTool::createRunControl(const AnalyzerStartParamet
return engine; return engine;
} }
bool QmlProfilerTool::canRun(RunConfiguration *runConfiguration, RunMode mode) const
{
if (qobject_cast<QmlProjectRunConfiguration *>(runConfiguration)
|| qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration))
return mode == runMode();
return false;
}
static QString sysroot(RunConfiguration *runConfig) static QString sysroot(RunConfiguration *runConfig)
{ {
QTC_ASSERT(runConfig, return QString()); QTC_ASSERT(runConfig, return QString());

View File

@@ -59,9 +59,6 @@ public:
Analyzer::AnalyzerRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp, Analyzer::AnalyzerRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration = 0); ProjectExplorer::RunConfiguration *runConfiguration = 0);
bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
ProjectExplorer::RunMode mode) const;
QWidget *createWidgets(); QWidget *createWidgets();
void startTool(Analyzer::StartMode mode); void startTool(Analyzer::StartMode mode);

View File

@@ -524,11 +524,6 @@ RunMode CallgrindTool::runMode() const
return CallgrindRunMode; return CallgrindRunMode;
} }
bool CallgrindTool::canRun(RunConfiguration *, RunMode mode) const
{
return mode == CallgrindRunMode;
}
QString CallgrindTool::displayName() const QString CallgrindTool::displayName() const
{ {
return tr("Valgrind Function Profiler"); return tr("Valgrind Function Profiler");

View File

@@ -50,7 +50,6 @@ public:
QString displayName() const; QString displayName() const;
QString description() const; QString description() const;
ToolMode toolMode() const; ToolMode toolMode() const;
bool canRun(ProjectExplorer::RunConfiguration *, ProjectExplorer::RunMode mode) const;
void extensionsInitialized(); void extensionsInitialized();

View File

@@ -286,11 +286,6 @@ RunMode MemcheckTool::runMode() const
return MemcheckRunMode; return MemcheckRunMode;
} }
bool MemcheckTool::canRun(RunConfiguration *, RunMode mode) const
{
return mode == MemcheckRunMode;
}
QString MemcheckTool::displayName() const QString MemcheckTool::displayName() const
{ {
return tr("Valgrind Memory Analyzer"); return tr("Valgrind Memory Analyzer");

View File

@@ -88,7 +88,6 @@ public:
ProjectExplorer::RunMode runMode() const; ProjectExplorer::RunMode runMode() const;
QString displayName() const; QString displayName() const;
QString description() const; QString description() const;
bool canRun(ProjectExplorer::RunConfiguration *, ProjectExplorer::RunMode mode) const;
// Create the valgrind settings (for all valgrind tools) // Create the valgrind settings (for all valgrind tools)
Analyzer::AbstractAnalyzerSubConfig *createGlobalSettings(); Analyzer::AbstractAnalyzerSubConfig *createGlobalSettings();

View File

@@ -61,12 +61,8 @@ ValgrindRunControlFactory::ValgrindRunControlFactory(QObject *parent) :
bool ValgrindRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const bool ValgrindRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
{ {
if (mode != CallgrindRunMode && mode != MemcheckRunMode) Q_UNUSED(runConfiguration);
return false; return mode == CallgrindRunMode || mode == MemcheckRunMode;
IAnalyzerTool *tool = AnalyzerManager::toolFromRunMode(mode);
if (tool)
return tool->canRun(runConfiguration, mode);
return false;
} }
static AnalyzerStartParameters createValgrindStartParameters(RunConfiguration *runConfiguration) static AnalyzerStartParameters createValgrindStartParameters(RunConfiguration *runConfiguration)