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 <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2018-10-25 15:24:39 +02:00
committed by hjk
parent 06162c1aa5
commit 183cfb0772

View File

@@ -394,6 +394,8 @@ namespace PE = ProjectExplorer::Constants;
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
const char DEBUGGER_START[] = "Debugger.Start";
void addCdbOptionPages(QList<IOptionsPage*> *opts); void addCdbOptionPages(QList<IOptionsPage*> *opts);
void addGdbOptionPages(QList<IOptionsPage*> *opts); void addGdbOptionPages(QList<IOptionsPage*> *opts);
@@ -1115,17 +1117,19 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
// G_START_QML // G_START_QML
ActionContainer *mstart = ActionManager::actionContainer(PE::M_DEBUG_STARTDEBUGGING); 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 = ActionManager::registerAction(&m_visibleStartAction, Constants::DEBUG);
cmd->setDescription(tr("Start Debugging or Continue")); 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_UpdateText);
cmd->setAttribute(Command::CA_UpdateIcon); cmd->setAttribute(Command::CA_UpdateIcon);
//mstart->addAction(cmd, CC::G_DEFAULT_ONE); //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->setDescription(tr("Start Debugging"));
cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateText);
cmd->setDefaultKeySequence(startShortcut);
mstart->addAction(cmd, CC::G_DEFAULT_ONE); mstart->addAction(cmd, CC::G_DEFAULT_ONE);
m_visibleStartAction.initialize(&m_startAction); m_visibleStartAction.initialize(&m_startAction);
@@ -1191,12 +1195,14 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
cmd = ActionManager::registerAction(act, Constants::INTERRUPT); cmd = ActionManager::registerAction(act, Constants::INTERRUPT);
cmd->setDescription(tr("Interrupt Debugger")); cmd->setDescription(tr("Interrupt Debugger"));
cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateText);
cmd->setDefaultKeySequence(startShortcut);
debugMenu->addAction(cmd, CC::G_DEFAULT_ONE); debugMenu->addAction(cmd, CC::G_DEFAULT_ONE);
act = new QAction(continueIcon(false), tr("Continue"), this); act = new QAction(continueIcon(false), tr("Continue"), this);
act->setEnabled(false); act->setEnabled(false);
cmd = ActionManager::registerAction(act, Constants::CONTINUE); cmd = ActionManager::registerAction(act, Constants::CONTINUE);
cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateText);
cmd->setDefaultKeySequence(startShortcut);
debugMenu->addAction(cmd, CC::G_DEFAULT_ONE); debugMenu->addAction(cmd, CC::G_DEFAULT_ONE);
act = new QAction(Icons::DEBUG_EXIT_SMALL.icon(), tr("Stop Debugger"), this); 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.setToolTip(startToolTip);
m_startAction.setText(canRun ? startToolTip : tr("Start Debugging")); 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 // No engine running -- or -- we have a running engine but it does not
// correspond to the current start up project. // correspond to the current start up project.
m_startAction.setEnabled(canRun); m_startAction.setEnabled(canRun);
@@ -1502,7 +1508,7 @@ void DebuggerPluginPrivate::updatePresetState()
// We don't want to do anything anymore. // We don't want to do anything anymore.
m_startAction.setEnabled(canRun); m_startAction.setEnabled(canRun);
m_debugWithoutDeployAction.setEnabled(canRun); m_debugWithoutDeployAction.setEnabled(canRun);
m_visibleStartAction.setAction(&m_startAction); m_visibleStartAction.setAction(ActionManager::command(DEBUGGER_START)->action());
m_hiddenStopAction.setAction(&m_undisturbableAction); m_hiddenStopAction.setAction(&m_undisturbableAction);
} else if (state == InferiorUnrunnable) { } else if (state == InferiorUnrunnable) {
// We don't want to do anything anymore. // We don't want to do anything anymore.