diff options
author | hjk <hjk121@nokiamail.com> | 2013-08-07 19:47:30 +0200 |
---|---|---|
committer | hjk <hjk121@nokiamail.com> | 2013-08-08 17:41:39 +0200 |
commit | e94183ca2feed8e68e8d1430be2d24632d4a731c (patch) | |
tree | 2ccab4191bf3acbdef6f5cbea4596a76f3990134 /src/plugins/valgrind/valgrindplugin.cpp | |
parent | 256509541bef7643831859ec4449089a46510af4 (diff) | |
download | qt-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/valgrindplugin.cpp')
-rw-r--r-- | src/plugins/valgrind/valgrindplugin.cpp | 55 |
1 files changed, 51 insertions, 4 deletions
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()); |