Analyzer: Remove IAnalyzerTool::m_toolMode member

It's always known from the context when needed.

Change-Id: Ibf314dfb779190e89b775acab784ed71acff2c83
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
hjk
2015-02-18 12:01:05 +01:00
parent e058dbe775
commit 64be0004a6
5 changed files with 7 additions and 27 deletions

View File

@@ -72,16 +72,6 @@ void AnalyzerAction::setRunMode(ProjectExplorer::RunMode mode)
m_runMode = mode; m_runMode = mode;
} }
IAnalyzerTool::ToolMode IAnalyzerTool::toolMode() const
{
return m_toolMode;
}
void IAnalyzerTool::setToolMode(IAnalyzerTool::ToolMode mode)
{
m_toolMode = mode;
}
AnalyzerAction::AnalyzerAction(QObject *parent) AnalyzerAction::AnalyzerAction(QObject *parent)
: QAction(parent) : QAction(parent)
{} {}
@@ -102,7 +92,7 @@ static bool buildTypeAccepted(IAnalyzerTool::ToolMode toolMode,
return false; return false;
} }
void IAnalyzerTool::startLocalTool(RunMode runMode) void IAnalyzerTool::startLocalTool(ToolMode toolMode, RunMode runMode)
{ {
// Make sure mode is shown. // Make sure mode is shown.
AnalyzerManager::showMode(); AnalyzerManager::showMode();
@@ -120,13 +110,13 @@ void IAnalyzerTool::startLocalTool(RunMode runMode)
// Check the project for whether the build config is in the correct mode // Check the project for whether the build config is in the correct mode
// if not, notify the user and urge him to use the correct mode. // if not, notify the user and urge him to use the correct mode.
if (!buildTypeAccepted(toolMode(), buildType)) { if (!buildTypeAccepted(toolMode, buildType)) {
const QString currentMode = buildType == BuildConfiguration::Debug const QString currentMode = buildType == BuildConfiguration::Debug
? AnalyzerManager::tr("Debug") ? AnalyzerManager::tr("Debug")
: AnalyzerManager::tr("Release"); : AnalyzerManager::tr("Release");
QString toolModeString; QString toolModeString;
switch (toolMode()) { switch (toolMode) {
case IAnalyzerTool::DebugMode: case IAnalyzerTool::DebugMode:
toolModeString = AnalyzerManager::tr("Debug"); toolModeString = AnalyzerManager::tr("Debug");
break; break;

View File

@@ -80,8 +80,6 @@ public:
ReleaseMode, ReleaseMode,
AnyMode AnyMode
}; };
ToolMode toolMode() const;
void setToolMode(ToolMode mode);
/// Creates all widgets used by the tool. /// Creates all widgets used by the tool.
/// Returns a control widget which will be shown in the status bar when /// Returns a control widget which will be shown in the status bar when
@@ -95,11 +93,8 @@ public:
virtual void startTool(StartMode mode) = 0; virtual void startTool(StartMode mode) = 0;
void startLocalTool(ProjectExplorer::RunMode runMode); void startLocalTool(ToolMode toolMode, ProjectExplorer::RunMode runMode);
void startRemoteTool(ProjectExplorer::RunMode runMode); void startRemoteTool(ProjectExplorer::RunMode runMode);
private:
ToolMode m_toolMode;
}; };
/** /**

View File

@@ -124,7 +124,6 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent)
: IAnalyzerTool(parent), d(new QmlProfilerToolPrivate) : IAnalyzerTool(parent), d(new QmlProfilerToolPrivate)
{ {
setObjectName(QLatin1String("QmlProfilerTool")); setObjectName(QLatin1String("QmlProfilerTool"));
setToolMode(AnyMode);
d->m_profilerState = 0; d->m_profilerState = 0;
d->m_viewContainer = 0; d->m_viewContainer = 0;

View File

@@ -502,7 +502,6 @@ CallgrindTool::CallgrindTool(QObject *parent)
{ {
d = new CallgrindToolPrivate(this); d = new CallgrindToolPrivate(this);
setObjectName(QLatin1String("CallgrindTool")); setObjectName(QLatin1String("CallgrindTool"));
setToolMode(ReleaseMode);
connect(EditorManager::instance(), &EditorManager::editorOpened, connect(EditorManager::instance(), &EditorManager::editorOpened,
d, &CallgrindToolPrivate::editorOpened); d, &CallgrindToolPrivate::editorOpened);
@@ -560,7 +559,7 @@ AnalyzerRunControl *CallgrindToolPrivate::createRunControl(const AnalyzerStartPa
void CallgrindTool::startTool(StartMode mode) void CallgrindTool::startTool(StartMode mode)
{ {
if (mode == StartLocal) if (mode == StartLocal)
startLocalTool(CallgrindRunMode); startLocalTool(ReleaseMode, CallgrindRunMode);
if (mode == StartRemote) if (mode == StartRemote)
startRemoteTool(CallgrindRunMode); startRemoteTool(CallgrindRunMode);
d->setBusyCursor(true); d->setBusyCursor(true);

View File

@@ -196,7 +196,6 @@ MemcheckTool::MemcheckTool(QObject *parent)
m_filterMenu = 0; m_filterMenu = 0;
setObjectName(QLatin1String("MemcheckTool")); setObjectName(QLatin1String("MemcheckTool"));
setToolMode(DebugMode);
m_filterProjectAction = new QAction(tr("External Errors"), this); m_filterProjectAction = new QAction(tr("External Errors"), this);
m_filterProjectAction->setToolTip( m_filterProjectAction->setToolTip(
@@ -601,7 +600,7 @@ void MemcheckTool::setBusyCursor(bool busy)
void MemcheckTool::startTool(StartMode mode) void MemcheckTool::startTool(StartMode mode)
{ {
if (mode == StartLocal) if (mode == StartLocal)
startLocalTool(MemcheckRunMode); startLocalTool(DebugMode, MemcheckRunMode);
if (mode == StartRemote) if (mode == StartRemote)
startRemoteTool(MemcheckRunMode); startRemoteTool(MemcheckRunMode);
} }
@@ -612,16 +611,14 @@ MemcheckWithGdbTool::MemcheckWithGdbTool(QObject *parent) :
setObjectName(QLatin1String("MemcheckWithGdbTool")); setObjectName(QLatin1String("MemcheckWithGdbTool"));
} }
void MemcheckWithGdbTool::startTool(Analyzer::StartMode mode) void MemcheckWithGdbTool::startTool(Analyzer::StartMode mode)
{ {
if (mode == StartLocal) if (mode == StartLocal)
startLocalTool(MemcheckWithGdbRunMode); startLocalTool(DebugMode, MemcheckWithGdbRunMode);
if (mode == StartRemote) if (mode == StartRemote)
startRemoteTool(MemcheckWithGdbRunMode); startRemoteTool(MemcheckWithGdbRunMode);
} }
MemcheckRunControl *MemcheckWithGdbTool::createMemcheckRunControl(const AnalyzerStartParameters &sp, MemcheckRunControl *MemcheckWithGdbTool::createMemcheckRunControl(const AnalyzerStartParameters &sp,
RunConfiguration *runConfiguration) RunConfiguration *runConfiguration)
{ {