summaryrefslogtreecommitdiff
path: root/src/plugins/valgrind/callgrindtool.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/valgrind/callgrindtool.cpp')
-rw-r--r--src/plugins/valgrind/callgrindtool.cpp41
1 files changed, 12 insertions, 29 deletions
diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp
index 2dc03c7785..27771bafc5 100644
--- a/src/plugins/valgrind/callgrindtool.cpp
+++ b/src/plugins/valgrind/callgrindtool.cpp
@@ -150,7 +150,6 @@ public slots:
void updateCostFormat();
void handleFilterProjectCosts();
- void handleShowCostsAction();
void handleShowCostsOfFunction();
void slotGoToOverview();
@@ -558,16 +557,18 @@ AnalyzerRunControl *CallgrindToolPrivate::createRunControl(const AnalyzerStartPa
return rc;
}
-void CallgrindTool::startTool(StartMode mode)
+void CallgrindTool::startLocalTool()
{
- if (mode == StartLocal && checkForLocalStart(ReleaseMode)) {
- Project *pro = SessionManager::startupProject();
- ProjectExplorerPlugin::instance()->runProject(pro, CallgrindRunMode);
+ if (checkForLocalStart(ReleaseMode)) {
+ ProjectExplorerPlugin::runStartupProject(CallgrindRunMode);
d->setBusyCursor(true);
}
+}
+void CallgrindTool::startRemoteTool()
+{
AnalyzerStartParameters sp;
- if (mode == StartRemote && checkForRemoteStart(&sp)) {
+ if (checkForRemoteStart(&sp)) {
AnalyzerRunControl *rc = createRunControl(sp, 0);
ProjectExplorerPlugin::startRunControl(rc, CallgrindRunMode);
d->setBusyCursor(true);
@@ -882,33 +883,15 @@ void CallgrindToolPrivate::editorOpened(IEditor *editor)
void CallgrindToolPrivate::requestContextMenu(TextEditorWidget *widget, int line, QMenu *menu)
{
- // find callgrind text mark that corresponds to this editor's file and line number
- const Function *func = 0;
+ // Find callgrind text mark that corresponds to this editor's file and line number
foreach (CallgrindTextMark *textMark, m_textMarks) {
if (textMark->fileName() == widget->textDocument()->filePath().toString() && textMark->lineNumber() == line) {
- func = textMark->function();
+ const Function *func = textMark->function();
+ QAction *action = menu->addAction(tr("Select this Function in the Analyzer Output"));
+ connect(action, &QAction::triggered, this, [this, func] { selectFunction(func); });
break;
}
}
- if (!func)
- return; // no callgrind text mark under cursor, return
-
- // add our action to the context menu
- QAction *action = new QAction(tr("Select this Function in the Analyzer Output"), menu);
- connect(action, &QAction::triggered, this, &CallgrindToolPrivate::handleShowCostsAction);
- action->setData(QVariant::fromValue<const Function *>(func));
- menu->addAction(action);
-}
-
-void CallgrindToolPrivate::handleShowCostsAction()
-{
- const QAction *action = qobject_cast<QAction *>(sender());
- QTC_ASSERT(action, return);
-
- const Function *func = action->data().value<const Function *>();
- QTC_ASSERT(func, return);
-
- selectFunction(func);
}
void CallgrindToolPrivate::handleShowCostsOfFunction()
@@ -925,7 +908,7 @@ void CallgrindToolPrivate::handleShowCostsOfFunction()
m_toggleCollectFunction = qualifiedFunctionName + QLatin1String("()");
- AnalyzerManager::selectTool(CallgrindToolId, StartLocal);
+ AnalyzerManager::selectTool(CallgrindLocalActionId);
AnalyzerManager::startTool();
}