aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/debugger/debuggerplugin.cpp
diff options
context:
space:
mode:
authorArtem Sokolovskii <[email protected]>2023-09-29 14:50:58 +0200
committerArtem Sokolovskii <[email protected]>2023-10-04 12:36:00 +0000
commit9af8ecd935b8647d49574e1b66a522970025dcb8 (patch)
tree229e9971a03e5bd90977119a72f9cfb07854205b /src/plugins/debugger/debuggerplugin.cpp
parent6cd2e6de0cd7fe62ba62e1448b7d3d0654acf77f (diff)
DAP: Fix dap engine selection with the translated strings
Diffstat (limited to 'src/plugins/debugger/debuggerplugin.cpp')
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp44
1 files changed, 21 insertions, 23 deletions
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 88bcbd081c0..bb90a260cc9 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -1239,17 +1239,29 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(const QStringList &arguments)
void DebuggerPluginPrivate::createDapDebuggerPerspective(QWidget *globalLogWindow)
{
- EngineManager::registerDefaultPerspective(Tr::tr("CMake Preset"),
- "DAP",
- Constants::DAP_PERSPECTIVE_ID);
+ struct DapPerspective
+ {
+ QString name;
+ char const *runMode;
+ };
+
+ const QList<DapPerspective> perspectiveList = {
+ DapPerspective{Tr::tr("CMake Preset"), ProjectExplorer::Constants::DAP_CMAKE_DEBUG_RUN_MODE},
+ DapPerspective{Tr::tr("GDB Preset"), ProjectExplorer::Constants::DAP_GDB_DEBUG_RUN_MODE},
+ DapPerspective{Tr::tr("Python Preset"),
+ ProjectExplorer::Constants::DAP_PY_DEBUG_RUN_MODE},
+ };
- EngineManager::registerDefaultPerspective(Tr::tr("GDB Preset"),
- "DAP",
- Constants::DAP_PERSPECTIVE_ID);
+ for (const DapPerspective &dp : perspectiveList)
+ EngineManager::registerDefaultPerspective(dp.name, "DAP", Constants::DAP_PERSPECTIVE_ID);
- EngineManager::registerDefaultPerspective(Tr::tr("Python Preset"),
- "DAP",
- Constants::DAP_PERSPECTIVE_ID);
+ connect(&m_startDapAction, &QAction::triggered, this, [perspectiveList] {
+ QComboBox *combo = qobject_cast<QComboBox *>(EngineManager::dapEngineChooser());
+ if (perspectiveList.size() > combo->currentIndex())
+ ProjectExplorerPlugin::runStartupProject(perspectiveList.at(combo->currentIndex())
+ .runMode,
+ false);
+ });
auto breakpointManagerView = createBreakpointManagerView("DAPDebugger.BreakWindow");
auto breakpointManagerWindow
@@ -1265,20 +1277,6 @@ void DebuggerPluginPrivate::createDapDebuggerPerspective(QWidget *globalLogWindo
Tr::tr("DAP Debugger Perspectives"),
"DAPDebugger.Docks.Snapshots");
- connect(&m_startDapAction, &QAction::triggered, this, [] {
- QComboBox *combo = qobject_cast<QComboBox *>(EngineManager::dapEngineChooser());
- if (combo->currentText() == "CMake Preset") {
- ProjectExplorerPlugin::runStartupProject(
- ProjectExplorer::Constants::DAP_CMAKE_DEBUG_RUN_MODE, false);
- } else if (combo->currentText() == "GDB Preset") {
- ProjectExplorerPlugin::runStartupProject(
- ProjectExplorer::Constants::DAP_GDB_DEBUG_RUN_MODE, false);
- } else {
- ProjectExplorerPlugin::runStartupProject(
- ProjectExplorer::Constants::DAP_PY_DEBUG_RUN_MODE, false);
- }
- });
-
m_perspectiveDap.addToolBarAction(&m_startDapAction);
m_startDapAction.setToolTip(Tr::tr("Start DAP Debugging"));
m_startDapAction.setText(Tr::tr("Start DAP Debugging"));