From 18dca1e3ac2a04bf89474423757596bc3b628240 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 23 Jul 2014 01:00:51 +0200 Subject: [PATCH] AnalyzerTool: Make runMode and toolMode value members Change-Id: Iaf89bc399db65e17345effb2e9767692786b5ca8 Reviewed-by: Christian Stenger --- src/plugins/analyzerbase/ianalyzertool.cpp | 21 +++++++++++++++++++++ src/plugins/analyzerbase/ianalyzertool.h | 11 ++++++++--- src/plugins/qmlprofiler/qmlprofilertool.cpp | 12 ++---------- src/plugins/qmlprofiler/qmlprofilertool.h | 3 --- src/plugins/valgrind/callgrindtool.cpp | 12 ++---------- src/plugins/valgrind/callgrindtool.h | 3 --- src/plugins/valgrind/memchecktool.cpp | 13 +++---------- src/plugins/valgrind/memchecktool.h | 3 --- 8 files changed, 36 insertions(+), 42 deletions(-) diff --git a/src/plugins/analyzerbase/ianalyzertool.cpp b/src/plugins/analyzerbase/ianalyzertool.cpp index 7998678884e..8f03388949f 100644 --- a/src/plugins/analyzerbase/ianalyzertool.cpp +++ b/src/plugins/analyzerbase/ianalyzertool.cpp @@ -36,6 +36,27 @@ IAnalyzerTool::IAnalyzerTool(QObject *parent) : QObject(parent) {} + /// Returns the run mode for this tool. +ProjectExplorer::RunMode IAnalyzerTool::runMode() const +{ + return m_runMode; +} + +void IAnalyzerTool::setRunMode(ProjectExplorer::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) : QAction(parent) {} diff --git a/src/plugins/analyzerbase/ianalyzertool.h b/src/plugins/analyzerbase/ianalyzertool.h index 7b37eb419ee..baadaa10632 100644 --- a/src/plugins/analyzerbase/ianalyzertool.h +++ b/src/plugins/analyzerbase/ianalyzertool.h @@ -67,8 +67,8 @@ class ANALYZER_EXPORT IAnalyzerTool : public QObject public: explicit IAnalyzerTool(QObject *parent = 0); - /// Returns the run mode for this tool. - virtual ProjectExplorer::RunMode runMode() const = 0; + ProjectExplorer::RunMode runMode() const; + void setRunMode(ProjectExplorer::RunMode mode); /** * The mode in which this tool should preferably be run @@ -82,7 +82,8 @@ public: ReleaseMode, AnyMode }; - virtual ToolMode toolMode() const = 0; + ToolMode toolMode() const; + void setToolMode(ToolMode mode); /// Creates all widgets used by the tool. /// Returns a control widget which will be shown in the status bar when @@ -95,6 +96,10 @@ public: ProjectExplorer::RunConfiguration *runConfiguration) = 0; virtual void startTool(StartMode mode) = 0; + +private: + ProjectExplorer::RunMode m_runMode; + ToolMode m_toolMode; }; /** diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index be95ab4689e..ea38d267f84 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -112,6 +112,8 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent) : IAnalyzerTool(parent), d(new QmlProfilerToolPrivate) { setObjectName(QLatin1String("QmlProfilerTool")); + setRunMode(QmlProfilerRunMode); + setToolMode(AnyMode); d->m_profilerState = 0; d->m_viewContainer = 0; @@ -161,16 +163,6 @@ QmlProfilerTool::~QmlProfilerTool() delete d; } -RunMode QmlProfilerTool::runMode() const -{ - return QmlProfilerRunMode; -} - -IAnalyzerTool::ToolMode QmlProfilerTool::toolMode() const -{ - return AnyMode; -} - AnalyzerRunControl *QmlProfilerTool::createRunControl(const AnalyzerStartParameters &sp, RunConfiguration *runConfiguration) { diff --git a/src/plugins/qmlprofiler/qmlprofilertool.h b/src/plugins/qmlprofiler/qmlprofilertool.h index 49ab19592df..9c87a530546 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.h +++ b/src/plugins/qmlprofiler/qmlprofilertool.h @@ -48,9 +48,6 @@ public: explicit QmlProfilerTool(QObject *parent); ~QmlProfilerTool(); - ProjectExplorer::RunMode runMode() const; - ToolMode toolMode() const; - Analyzer::AnalyzerRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp, ProjectExplorer::RunConfiguration *runConfiguration = 0); diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index 47710e7d23d..bea2787fa8a 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -498,6 +498,8 @@ CallgrindTool::CallgrindTool(QObject *parent) { d = new CallgrindToolPrivate(this); setObjectName(QLatin1String("CallgrindTool")); + setRunMode(CallgrindRunMode); + setToolMode(ReleaseMode); connect(EditorManager::instance(), SIGNAL(editorOpened(Core::IEditor*)), d, SLOT(editorOpened(Core::IEditor*))); @@ -508,16 +510,6 @@ CallgrindTool::~CallgrindTool() delete d; } -RunMode CallgrindTool::runMode() const -{ - return CallgrindRunMode; -} - -IAnalyzerTool::ToolMode CallgrindTool::toolMode() const -{ - return ReleaseMode; -} - AnalyzerRunControl *CallgrindTool::createRunControl(const AnalyzerStartParameters &sp, RunConfiguration *runConfiguration) { diff --git a/src/plugins/valgrind/callgrindtool.h b/src/plugins/valgrind/callgrindtool.h index 8aa5b85972b..e0c88298687 100644 --- a/src/plugins/valgrind/callgrindtool.h +++ b/src/plugins/valgrind/callgrindtool.h @@ -45,9 +45,6 @@ public: CallgrindTool(QObject *parent); ~CallgrindTool(); - ProjectExplorer::RunMode runMode() const; - ToolMode toolMode() const; - Analyzer::AnalyzerRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp, ProjectExplorer::RunConfiguration *runConfiguration = 0); QWidget *createWidgets(); diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp index 41741a22355..9d7197db7a1 100644 --- a/src/plugins/valgrind/memchecktool.cpp +++ b/src/plugins/valgrind/memchecktool.cpp @@ -193,7 +193,10 @@ MemcheckTool::MemcheckTool(QObject *parent) m_errorProxyModel = 0; m_errorView = 0; m_filterMenu = 0; + setObjectName(QLatin1String("MemcheckTool")); + setRunMode(MemcheckRunMode); + setToolMode(DebugMode); m_filterProjectAction = new QAction(tr("External Errors"), this); m_filterProjectAction->setToolTip( @@ -284,16 +287,6 @@ void MemcheckTool::maybeActiveRunConfigurationChanged() updateFromSettings(); } -RunMode MemcheckTool::runMode() const -{ - return MemcheckRunMode; -} - -IAnalyzerTool::ToolMode MemcheckTool::toolMode() const -{ - return DebugMode; -} - class FrameFinder : public ErrorListModel::RelevantFrameFinder { public: diff --git a/src/plugins/valgrind/memchecktool.h b/src/plugins/valgrind/memchecktool.h index 615e9b95155..904073befbd 100644 --- a/src/plugins/valgrind/memchecktool.h +++ b/src/plugins/valgrind/memchecktool.h @@ -81,8 +81,6 @@ class MemcheckTool : public ValgrindTool public: MemcheckTool(QObject *parent); - ProjectExplorer::RunMode runMode() const; - private slots: void settingsDestroyed(QObject *settings); void maybeActiveRunConfigurationChanged(); @@ -99,7 +97,6 @@ private slots: void loadExternalXmlLogFile(); private: - ToolMode toolMode() const; QWidget *createWidgets(); void setBusyCursor(bool busy);