From 183cfb0772a9738fbd0ae2483e47d444674ad5c4 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 25 Oct 2018 15:24:39 +0200 Subject: [PATCH] Make the currently visible debugger UI define the behavior of F5 That fixes the behavior of F5 for the debuggers which were not started directly with a run configuration (attach, debug external application). It has the disadvantage that it is only possible to start another application in the debugger after switching to the "Debugger Preset", even after you switch the startup project. Fixes: QTCREATORBUG-21261 Change-Id: Id4d4c81920939af2b34b462d87c815719bed6aff Reviewed-by: Christian Stenger Reviewed-by: hjk --- src/plugins/debugger/debuggerplugin.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 949edd2a799..cf16a810a6f 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -394,6 +394,8 @@ namespace PE = ProjectExplorer::Constants; namespace Debugger { namespace Internal { +const char DEBUGGER_START[] = "Debugger.Start"; + void addCdbOptionPages(QList *opts); void addGdbOptionPages(QList *opts); @@ -1115,17 +1117,19 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, // G_START_QML ActionContainer *mstart = ActionManager::actionContainer(PE::M_DEBUG_STARTDEBUGGING); + const QKeySequence startShortcut(useMacShortcuts ? tr("Ctrl+Y") : tr("F5")); + cmd = ActionManager::registerAction(&m_visibleStartAction, Constants::DEBUG); cmd->setDescription(tr("Start Debugging or Continue")); - cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Ctrl+Y") : tr("F5"))); cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateIcon); //mstart->addAction(cmd, CC::G_DEFAULT_ONE); - cmd = ActionManager::registerAction(&m_startAction, "Debugger.Start"); + cmd = ActionManager::registerAction(&m_startAction, DEBUGGER_START); cmd->setDescription(tr("Start Debugging")); cmd->setAttribute(Command::CA_UpdateText); + cmd->setDefaultKeySequence(startShortcut); mstart->addAction(cmd, CC::G_DEFAULT_ONE); m_visibleStartAction.initialize(&m_startAction); @@ -1191,12 +1195,14 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, cmd = ActionManager::registerAction(act, Constants::INTERRUPT); cmd->setDescription(tr("Interrupt Debugger")); cmd->setAttribute(Command::CA_UpdateText); + cmd->setDefaultKeySequence(startShortcut); debugMenu->addAction(cmd, CC::G_DEFAULT_ONE); act = new QAction(continueIcon(false), tr("Continue"), this); act->setEnabled(false); cmd = ActionManager::registerAction(act, Constants::CONTINUE); cmd->setAttribute(Command::CA_UpdateText); + cmd->setDefaultKeySequence(startShortcut); debugMenu->addAction(cmd, CC::G_DEFAULT_ONE); act = new QAction(Icons::DEBUG_EXIT_SMALL.icon(), tr("Stop Debugger"), this); @@ -1461,7 +1467,7 @@ void DebuggerPluginPrivate::updatePresetState() m_startAction.setToolTip(startToolTip); m_startAction.setText(canRun ? startToolTip : tr("Start Debugging")); - if (!currentEngine || !currentEngine->isStartupRunConfiguration()) { + if (!currentEngine) { // No engine running -- or -- we have a running engine but it does not // correspond to the current start up project. m_startAction.setEnabled(canRun); @@ -1502,7 +1508,7 @@ void DebuggerPluginPrivate::updatePresetState() // We don't want to do anything anymore. m_startAction.setEnabled(canRun); m_debugWithoutDeployAction.setEnabled(canRun); - m_visibleStartAction.setAction(&m_startAction); + m_visibleStartAction.setAction(ActionManager::command(DEBUGGER_START)->action()); m_hiddenStopAction.setAction(&m_undisturbableAction); } else if (state == InferiorUnrunnable) { // We don't want to do anything anymore.