summaryrefslogtreecommitdiff
path: root/src/plugins/valgrind
diff options
context:
space:
mode:
authorhjk <hjk121@nokiamail.com>2013-08-07 19:47:30 +0200
committerhjk <hjk121@nokiamail.com>2013-08-08 17:41:39 +0200
commite94183ca2feed8e68e8d1430be2d24632d4a731c (patch)
tree2ccab4191bf3acbdef6f5cbea4596a76f3990134 /src/plugins/valgrind
parent256509541bef7643831859ec4449089a46510af4 (diff)
downloadqt-creator-e94183ca2feed8e68e8d1430be2d24632d4a731c.tar.gz
Analyzer: Introduce AnalzyerAction
This wraps the menu related aspects of an IAnalyzerTool. Change-Id: I065cb5f269a40af2137f434a7cdf915bd9a76839 Reviewed-by: Christiaan Janssen <christiaan.janssen@digia.com>
Diffstat (limited to 'src/plugins/valgrind')
-rw-r--r--src/plugins/valgrind/callgrindtool.cpp16
-rw-r--r--src/plugins/valgrind/callgrindtool.h3
-rw-r--r--src/plugins/valgrind/memchecktool.cpp23
-rw-r--r--src/plugins/valgrind/memchecktool.h4
-rw-r--r--src/plugins/valgrind/valgrindplugin.cpp55
-rw-r--r--src/plugins/valgrind/valgrindtool.cpp3
6 files changed, 56 insertions, 48 deletions
diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp
index e3459747a4..02b1ce74f1 100644
--- a/src/plugins/valgrind/callgrindtool.cpp
+++ b/src/plugins/valgrind/callgrindtool.cpp
@@ -516,27 +516,11 @@ CallgrindTool::~CallgrindTool()
delete d;
}
-Core::Id CallgrindTool::id() const
-{
- return Core::Id("Callgrind");
-}
-
RunMode CallgrindTool::runMode() const
{
return CallgrindRunMode;
}
-QString CallgrindTool::displayName() const
-{
- return tr("Valgrind Function Profiler");
-}
-
-QString CallgrindTool::description() const
-{
- return tr("Valgrind Profile uses the \"callgrind\" tool to "
- "record function calls when a program runs.");
-}
-
IAnalyzerTool::ToolMode CallgrindTool::toolMode() const
{
return ReleaseMode;
diff --git a/src/plugins/valgrind/callgrindtool.h b/src/plugins/valgrind/callgrindtool.h
index 1f7b1e8482..3afb90a28c 100644
--- a/src/plugins/valgrind/callgrindtool.h
+++ b/src/plugins/valgrind/callgrindtool.h
@@ -45,10 +45,7 @@ public:
CallgrindTool(QObject *parent);
~CallgrindTool();
- Core::Id id() const;
ProjectExplorer::RunMode runMode() const;
- QString displayName() const;
- QString description() const;
ToolMode toolMode() const;
void extensionsInitialized();
diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp
index 1004f79f06..17b4baf339 100644
--- a/src/plugins/valgrind/memchecktool.cpp
+++ b/src/plugins/valgrind/memchecktool.cpp
@@ -276,27 +276,11 @@ void MemcheckTool::maybeActiveRunConfigurationChanged()
m_errorProxyModel->setFilterExternalIssues(memcheckSettings->filterExternalIssues());
}
-Core::Id MemcheckTool::id() const
-{
- return Core::Id("Memcheck");
-}
-
RunMode MemcheckTool::runMode() const
{
return MemcheckRunMode;
}
-QString MemcheckTool::displayName() const
-{
- return tr("Valgrind Memory Analyzer");
-}
-
-QString MemcheckTool::description() const
-{
- return tr("Valgrind Analyze Memory uses the \"memcheck\" tool to find "
- "memory leaks");
-}
-
IAnalyzerTool::ToolMode MemcheckTool::toolMode() const
{
return DebugMode;
@@ -537,10 +521,9 @@ void MemcheckTool::finished()
const int issuesFound = m_errorModel->rowCount();
m_goBack->setEnabled(issuesFound > 1);
m_goNext->setEnabled(issuesFound > 1);
- AnalyzerManager::showStatusMessage((issuesFound > 0
- ? AnalyzerManager::tr("Tool \"%1\" finished, %n issues were found.", 0, issuesFound)
- : AnalyzerManager::tr("Tool \"%1\" finished, no issues were found."))
- .arg(displayName()));
+ AnalyzerManager::showStatusMessage(issuesFound > 0
+ ? AnalyzerManager::tr("Memory Analyzer Tool finished, %n issues were found.", 0, issuesFound)
+ : AnalyzerManager::tr("Memory Analyzer Tool finished, no issues were found."));
setBusyCursor(false);
}
diff --git a/src/plugins/valgrind/memchecktool.h b/src/plugins/valgrind/memchecktool.h
index 3cfe63c4df..31db52f60c 100644
--- a/src/plugins/valgrind/memchecktool.h
+++ b/src/plugins/valgrind/memchecktool.h
@@ -84,10 +84,7 @@ class MemcheckTool : public ValgrindTool
public:
MemcheckTool(QObject *parent);
- Core::Id id() const;
ProjectExplorer::RunMode runMode() const;
- QString displayName() const;
- QString description() const;
private slots:
void settingsDestroyed(QObject *settings);
@@ -103,7 +100,6 @@ private slots:
private:
ToolMode toolMode() const;
- void extensionsInitialized() {}
QWidget *createWidgets();
void setBusyCursor(bool busy);
diff --git a/src/plugins/valgrind/valgrindplugin.cpp b/src/plugins/valgrind/valgrindplugin.cpp
index ba2951fdce..1bc8416b04 100644
--- a/src/plugins/valgrind/valgrindplugin.cpp
+++ b/src/plugins/valgrind/valgrindplugin.cpp
@@ -56,6 +56,12 @@ class ProjectSettingsFactory : public AnalyzerSubConfigFactory
}
};
+class ValgrindAction : public AnalyzerAction
+{
+public:
+ ValgrindAction() {}
+};
+
bool ValgrindPlugin::initialize(const QStringList &, QString *)
{
AnalyzerGlobalSettings::registerConfig(new ValgrindGlobalSettings());
@@ -63,12 +69,53 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
IAnalyzerTool *memcheckTool = new MemcheckTool(this);
IAnalyzerTool *callgrindTool = new CallgrindTool(this);
+ ValgrindAction *action = 0;
+
+ QString callgrindToolTip = tr("Valgrind Function Profile uses the "
+ "\"callgrind\" tool to record function calls when a program runs.");
+
+ QString memcheckToolTip = tr("Valgrind Analyze Memory uses the "
+ "\"memcheck\" tool to find memory leaks");
+
if (!Utils::HostOsInfo::isWindowsHost()) {
- AnalyzerManager::addTool(memcheckTool, StartLocal);
- AnalyzerManager::addTool(callgrindTool, StartLocal);
+ action = new ValgrindAction;
+ action->setId("Memcheck.Local");
+ action->setTool(memcheckTool);
+ action->setText(tr("Valgrind Memory Analyzer"));
+ action->setToolTip(memcheckToolTip);
+ action->setMenuGroup(Constants::G_ANALYZER_TOOLS);
+ action->setStartMode(StartLocal);
+ action->setEnabled(false);
+ AnalyzerManager::addAction(action);
+
+ action = new ValgrindAction;
+ action->setId("Callgrind.Local");
+ action->setTool(callgrindTool);
+ action->setText(tr("Valgrind Function Profiler"));
+ action->setToolTip(callgrindToolTip);
+ action->setMenuGroup(Constants::G_ANALYZER_TOOLS);
+ action->setStartMode(StartLocal);
+ action->setEnabled(false);
+ AnalyzerManager::addAction(action);
}
- AnalyzerManager::addTool(memcheckTool, StartRemote);
- AnalyzerManager::addTool(callgrindTool, StartRemote);
+
+ action = new ValgrindAction;
+ action->setId("Memcheck.Remote");
+ action->setTool(memcheckTool);
+ action->setText(tr("Valgrind Memory Analyzer (Remote)"));
+ action->setToolTip(memcheckToolTip);
+ action->setMenuGroup(Constants::G_ANALYZER_REMOTE_TOOLS);
+ action->setStartMode(StartRemote);
+ AnalyzerManager::addAction(action);
+
+ action = new ValgrindAction;
+ action->setId("Callgrind.Remote");
+ action->setTool(callgrindTool);
+ action->setText(tr("Valgrind Function Profiler (Remote)"));
+ action->setToolTip(callgrindToolTip);
+ action->setMenuGroup(Constants::G_ANALYZER_REMOTE_TOOLS);
+ action->setStartMode(StartRemote);
+ AnalyzerManager::addAction(action);
addAutoReleasedObject(new ValgrindRunControlFactory());
diff --git a/src/plugins/valgrind/valgrindtool.cpp b/src/plugins/valgrind/valgrindtool.cpp
index 7df1d7b0c7..42fd0b6a8d 100644
--- a/src/plugins/valgrind/valgrindtool.cpp
+++ b/src/plugins/valgrind/valgrindtool.cpp
@@ -120,7 +120,8 @@ static void startLocalTool(IAnalyzerTool *tool)
default:
QTC_CHECK(false);
}
- const QString toolName = tool->displayName();
+ //const QString toolName = tool->displayName();
+ const QString toolName = AnalyzerManager::tr("Tool"); // FIXME
const QString title = AnalyzerManager::tr("Run %1 in %2 Mode?").arg(toolName).arg(currentMode);
const QString message = AnalyzerManager::tr("<html><head/><body><p>You are trying "
"to run the tool \"%1\" on an application in %2 mode. "