diff options
author | hjk <hjk@qt.io> | 2018-08-22 10:53:34 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2018-08-23 08:57:10 +0000 |
commit | e6e38df436aab431d7682b22183790898e599350 (patch) | |
tree | dd2b3dd7318b72944b82d20aedd9cab703b209c7 /src/plugins/valgrind | |
parent | aca14a36e9231d37c00379e13ebf6bcbdd248ddb (diff) |
Debugger: Shift some perspective related API to the perspective class
Also, use QString uniformly for the (now rarely used) perspective ids.
Change-Id: I682062e7d179d0fcfd309e7714713bd1218bd8bb
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/plugins/valgrind')
-rw-r--r-- | src/plugins/valgrind/callgrindtool.cpp | 11 | ||||
-rw-r--r-- | src/plugins/valgrind/memchecktool.cpp | 19 |
2 files changed, 13 insertions, 17 deletions
diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index 0d87510ec2b..a64e5d4f27b 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -102,7 +102,6 @@ using namespace Utils; namespace Valgrind { namespace Internal { -const char CallgrindPerspectiveId[] = "Callgrind.Perspective"; const char CallgrindLocalActionId[] = "Callgrind.Local.Action"; const char CallgrindRemoteActionId[] = "Callgrind.Remote.Action"; const char CALLGRIND_RUN_MODE[] = "CallgrindTool.CallgrindRunMode"; @@ -216,7 +215,7 @@ public: QString m_toggleCollectFunction; bool m_toolBusy = false; - Perspective m_perspective{CallgrindPerspectiveId, tr("Callgrind")}; + Perspective m_perspective{"Callgrind.Perspective", tr("Callgrind")}; }; CallgrindTool::CallgrindTool() @@ -252,10 +251,10 @@ CallgrindTool::CallgrindTool() action->setToolTip(toolTip); menu->addAction(ActionManager::registerAction(action, CallgrindLocalActionId), Debugger::Constants::G_ANALYZER_TOOLS); - QObject::connect(action, &QAction::triggered, this, [action] { + QObject::connect(action, &QAction::triggered, this, [this, action] { if (!Debugger::wantRunTool(OptimizedMode, action->text())) return; - Debugger::selectPerspective(CallgrindPerspectiveId); + m_perspective.select(); ProjectExplorerPlugin::runStartupProject(CALLGRIND_RUN_MODE); }); QObject::connect(m_startAction, &QAction::triggered, action, &QAction::triggered); @@ -268,7 +267,7 @@ CallgrindTool::CallgrindTool() action->setToolTip(toolTip); menu->addAction(ActionManager::registerAction(action, CallgrindRemoteActionId), Debugger::Constants::G_ANALYZER_REMOTE_TOOLS); - QObject::connect(action, &QAction::triggered, this, [action] { + QObject::connect(action, &QAction::triggered, this, [this, action] { auto runConfig = RunConfiguration::startupRunConfiguration(); if (!runConfig) { showCannotStartDialog(action->text()); @@ -277,7 +276,7 @@ CallgrindTool::CallgrindTool() StartRemoteDialog dlg; if (dlg.exec() != QDialog::Accepted) return; - Debugger::selectPerspective(CallgrindPerspectiveId); + m_perspective.select(); auto runControl = new RunControl(runConfig, CALLGRIND_RUN_MODE); if (auto creator = RunControl::producer(runConfig, CALLGRIND_RUN_MODE)) creator(runControl); diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp index 19cb8ff72aa..e6586720222 100644 --- a/src/plugins/valgrind/memchecktool.cpp +++ b/src/plugins/valgrind/memchecktool.cpp @@ -117,9 +117,6 @@ namespace Internal { const char MEMCHECK_RUN_MODE[] = "MemcheckTool.MemcheckRunMode"; const char MEMCHECK_WITH_GDB_RUN_MODE[] = "MemcheckTool.MemcheckWithGdbRunMode"; -const char MemcheckPerspectiveId[] = "Memcheck.Perspective"; - - class MemcheckToolRunner : public ValgrindToolRunner { Q_OBJECT @@ -440,7 +437,7 @@ private: bool m_toolBusy = false; QString m_exitMsg; - Perspective m_perspective{MemcheckPerspectiveId, tr("Memcheck")}; + Perspective m_perspective{"Memcheck.Perspective", tr("Memcheck")}; }; #ifdef Q_OS_WIN @@ -617,11 +614,11 @@ MemcheckTool::MemcheckTool() action->setToolTip(toolTip); menu->addAction(ActionManager::registerAction(action, "Memcheck.Local"), Debugger::Constants::G_ANALYZER_TOOLS); - QObject::connect(action, &QAction::triggered, this, [action] { + QObject::connect(action, &QAction::triggered, this, [this, action] { if (!Debugger::wantRunTool(DebugMode, action->text())) return; TaskHub::clearTasks(Debugger::Constants::ANALYZERTASK_ID); - Debugger::selectPerspective(MemcheckPerspectiveId); + m_perspective.select(); ProjectExplorerPlugin::runStartupProject(MEMCHECK_RUN_MODE); }); QObject::connect(m_startAction, &QAction::triggered, action, &QAction::triggered); @@ -636,11 +633,11 @@ MemcheckTool::MemcheckTool() "the application is interrupted and can be debugged.")); menu->addAction(ActionManager::registerAction(action, "MemcheckWithGdb.Local"), Debugger::Constants::G_ANALYZER_TOOLS); - QObject::connect(action, &QAction::triggered, this, [action] { + QObject::connect(action, &QAction::triggered, this, [this, action] { if (!Debugger::wantRunTool(DebugMode, action->text())) return; TaskHub::clearTasks(Debugger::Constants::ANALYZERTASK_ID); - Debugger::selectPerspective(MemcheckPerspectiveId); + m_perspective.select(); ProjectExplorerPlugin::runStartupProject(MEMCHECK_WITH_GDB_RUN_MODE); }); QObject::connect(m_startWithGdbAction, &QAction::triggered, action, &QAction::triggered); @@ -663,7 +660,7 @@ MemcheckTool::MemcheckTool() action->setToolTip(toolTip); menu->addAction(ActionManager::registerAction(action, "Memcheck.Remote"), Debugger::Constants::G_ANALYZER_REMOTE_TOOLS); - QObject::connect(action, &QAction::triggered, this, [action] { + QObject::connect(action, &QAction::triggered, this, [this, action] { auto runConfig = RunConfiguration::startupRunConfiguration(); if (!runConfig) { showCannotStartDialog(action->text()); @@ -673,7 +670,7 @@ MemcheckTool::MemcheckTool() if (dlg.exec() != QDialog::Accepted) return; TaskHub::clearTasks(Debugger::Constants::ANALYZERTASK_ID); - Debugger::selectPerspective(MemcheckPerspectiveId); + m_perspective.select(); RunControl *rc = new RunControl(runConfig, MEMCHECK_RUN_MODE); if (auto creator = RunControl::producer(runConfig, MEMCHECK_RUN_MODE)) creator(rc); @@ -980,7 +977,7 @@ void MemcheckTool::loadShowXmlLogFile(const QString &filePath, const QString &ex clearErrorView(); m_settings->setFilterExternalIssues(false); m_filterProjectAction->setChecked(true); - Debugger::selectPerspective(MemcheckPerspectiveId); + m_perspective.select(); Core::ModeManager::activateMode(Debugger::Constants::MODE_DEBUG); m_exitMsg = exitMsg; |