aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/valgrind
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2018-08-21 12:30:00 +0200
committerhjk <hjk@qt.io>2018-08-21 15:38:22 +0000
commit32d2a4c985061098700cff53054e0fe0aea30e69 (patch)
treec1f089ee860288ca80e445979022190f03dd7ff9 /src/plugins/valgrind
parentdf4bfed60b5258c975d8be9f7e3e13925699c9ef (diff)
Shift perspective ownership to plugins
Change-Id: Id146ca771b4dc92f35cf156efbabae154f2d940f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/plugins/valgrind')
-rw-r--r--src/plugins/valgrind/callgrindtool.cpp44
-rw-r--r--src/plugins/valgrind/memchecktool.cpp17
2 files changed, 30 insertions, 31 deletions
diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp
index a0dfbd96b67..0d87510ec2b 100644
--- a/src/plugins/valgrind/callgrindtool.cpp
+++ b/src/plugins/valgrind/callgrindtool.cpp
@@ -215,6 +215,8 @@ public:
QString m_toggleCollectFunction;
bool m_toolBusy = false;
+
+ Perspective m_perspective{CallgrindPerspectiveId, tr("Callgrind")};
};
CallgrindTool::CallgrindTool()
@@ -419,18 +421,17 @@ CallgrindTool::CallgrindTool()
this, &CallgrindTool::setCostEvent);
updateEventCombo();
- auto perspective = new Perspective(CallgrindPerspectiveId, tr("Callgrind"));
- perspective->addToolBarAction(m_startAction);
- perspective->addToolBarAction(m_stopAction);
- perspective->addToolBarAction(m_loadExternalLogFile);
- perspective->addToolBarAction(m_dumpAction);
- perspective->addToolBarAction(m_resetAction);
- perspective->addToolBarAction(m_pauseAction);
- perspective->addToolBarAction(m_discardAction);
- perspective->addToolBarAction(m_goBack);
- perspective->addToolBarAction(m_goNext);
- perspective->addToolbarSeparator();
- perspective->addToolBarWidget(m_eventCombo);
+ m_perspective.addToolBarAction(m_startAction);
+ m_perspective.addToolBarAction(m_stopAction);
+ m_perspective.addToolBarAction(m_loadExternalLogFile);
+ m_perspective.addToolBarAction(m_dumpAction);
+ m_perspective.addToolBarAction(m_resetAction);
+ m_perspective.addToolBarAction(m_pauseAction);
+ m_perspective.addToolBarAction(m_discardAction);
+ m_perspective.addToolBarAction(m_goBack);
+ m_perspective.addToolBarAction(m_goNext);
+ m_perspective.addToolbarSeparator();
+ m_perspective.addToolBarWidget(m_eventCombo);
// Cost formatting
{
@@ -463,7 +464,7 @@ CallgrindTool::CallgrindTool()
button->setPopupMode(QToolButton::InstantPopup);
button->setText(QLatin1String("$"));
button->setToolTip(tr("Cost Format"));
- perspective->addToolBarWidget(button);
+ m_perspective.addToolBarWidget(button);
}
ValgrindGlobalSettings *settings = ValgrindPlugin::globalSettings();
@@ -500,17 +501,16 @@ CallgrindTool::CallgrindTool()
setCostFormat(settings->costFormat());
enableCycleDetection(settings->detectCycles());
- perspective->addToolBarAction(m_cycleDetection);
- perspective->addToolBarAction(m_shortenTemplates);
- perspective->addToolBarAction(m_filterProjectCosts);
- perspective->addToolBarWidget(m_searchFilter);
+ m_perspective.addToolBarAction(m_cycleDetection);
+ m_perspective.addToolBarAction(m_shortenTemplates);
+ m_perspective.addToolBarAction(m_filterProjectCosts);
+ m_perspective.addToolBarWidget(m_searchFilter);
- perspective->addWindow(m_flatView, Perspective::SplitVertical, nullptr);
- perspective->addWindow(m_calleesView, Perspective::SplitVertical, nullptr);
- perspective->addWindow(m_callersView, Perspective::SplitHorizontal, m_calleesView);
- perspective->addWindow(m_visualization, Perspective::SplitVertical, nullptr,
+ m_perspective.addWindow(m_flatView, Perspective::SplitVertical, nullptr);
+ m_perspective.addWindow(m_calleesView, Perspective::SplitVertical, nullptr);
+ m_perspective.addWindow(m_callersView, Perspective::SplitHorizontal, m_calleesView);
+ m_perspective.addWindow(m_visualization, Perspective::SplitVertical, nullptr,
false, Qt::RightDockWidgetArea);
- Debugger::registerPerspective(perspective);
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::updateRunActions,
this, &CallgrindTool::updateRunActions);
diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp
index b42090f3efb..19cb8ff72aa 100644
--- a/src/plugins/valgrind/memchecktool.cpp
+++ b/src/plugins/valgrind/memchecktool.cpp
@@ -440,6 +440,7 @@ private:
bool m_toolBusy = false;
QString m_exitMsg;
+ Perspective m_perspective{MemcheckPerspectiveId, tr("Memcheck")};
};
#ifdef Q_OS_WIN
@@ -556,8 +557,7 @@ MemcheckTool::MemcheckTool()
m_errorView->setObjectName(QLatin1String("Valgrind.MemcheckTool.ErrorView"));
m_errorView->setWindowTitle(tr("Memory Issues"));
- auto perspective = new Perspective(MemcheckPerspectiveId, tr("Memcheck"));
- perspective->addWindow(m_errorView, Perspective::SplitVertical, nullptr);
+ m_perspective.addWindow(m_errorView, Perspective::SplitVertical, nullptr);
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::updateRunActions,
this, &MemcheckTool::maybeActiveRunConfigurationChanged);
@@ -683,14 +683,13 @@ MemcheckTool::MemcheckTool()
ProjectExplorerPlugin::startRunControl(rc);
});
- perspective->addToolBarAction(m_startAction);
+ m_perspective.addToolBarAction(m_startAction);
//toolbar.addAction(m_startWithGdbAction);
- perspective->addToolBarAction(m_stopAction);
- perspective->addToolBarAction(m_loadExternalLogFile);
- perspective->addToolBarAction(m_goBack);
- perspective->addToolBarAction(m_goNext);
- perspective->addToolBarWidget(filterButton);
- Debugger::registerPerspective(perspective);
+ m_perspective.addToolBarAction(m_stopAction);
+ m_perspective.addToolBarAction(m_loadExternalLogFile);
+ m_perspective.addToolBarAction(m_goBack);
+ m_perspective.addToolBarAction(m_goNext);
+ m_perspective.addToolBarWidget(filterButton);
updateFromSettings();
maybeActiveRunConfigurationChanged();