From 4d2a6db1a8ed2936355b98ea743b750d0f072ec3 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 4 Oct 2018 17:25:11 +0200 Subject: [PATCH] Debugger: Show something in start action text again ... even if the action is disabled. Change-Id: I7f5bb0abd73d25650fab4c9dafbe70c772d2cb0e Reviewed-by: hjk Reviewed-by: Orgad Shaneh --- src/plugins/debugger/debuggerplugin.cpp | 33 +++++++++++++------------ 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index dcf62cbd1e7..64a085cd9e0 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -1449,28 +1449,31 @@ void DebuggerPluginPrivate::updatePresetState() DebuggerEngine *currentEngine = EngineManager::currentEngine(); QString whyNot; - const bool canRun = startupProject - && ProjectExplorerPlugin::canRunStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE, &whyNot); + const bool canRun = + ProjectExplorerPlugin::canRunStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE, &whyNot); + + QString startupRunConfigName; + if (startupRunConfig) + startupRunConfigName = startupRunConfig->displayName(); + if (startupRunConfigName.isEmpty() && startupProject) + startupRunConfigName = startupProject->displayName(); + + const QString startToolTip = + canRun ? tr("Start debugging of \"%1\"").arg(startupRunConfigName) : whyNot; + + m_startAction.setToolTip(startToolTip); + m_startAction.setText(canRun ? startToolTip : tr("Start Debugging")); if (!currentEngine || !currentEngine->isStartupRunConfiguration()) { // No engine running -- or -- we have a running engine but it does not // correspond to the current start up project. - QString startupRunConfigName; - if (startupRunConfig) - startupRunConfigName = startupRunConfig->displayName(); - if (startupRunConfigName.isEmpty() && startupProject) - startupRunConfigName = startupProject->displayName(); - - QString startToolTip = canRun ? tr("Start debugging of \"%1\"").arg(startupRunConfigName) : whyNot; - QString stepToolTip = canRun ? tr("Start \"%1\" and break at function \"main\"").arg(startupRunConfigName) : whyNot; // Step into/next: Start and break at 'main' unless a debugger is running. - m_stepAction.setEnabled(canRun); + QString stepToolTip = canRun ? tr("Start \"%1\" and break at function \"main\"").arg(startupRunConfigName) : whyNot; m_stepAction.setToolTip(stepToolTip); - m_nextAction.setEnabled(canRun); m_nextAction.setToolTip(stepToolTip); + m_stepAction.setEnabled(canRun); + m_nextAction.setEnabled(canRun); m_startAction.setEnabled(canRun); - m_startAction.setToolTip(startToolTip); - m_startAction.setText(startToolTip); m_startAction.setIcon(startIcon(false)); m_startAction.setToolButtonStyle(Qt::ToolButtonTextBesideIcon); m_startAction.setVisible(true); @@ -1493,8 +1496,6 @@ void DebuggerPluginPrivate::updatePresetState() m_nextAction.setToolTip(QString()); // The 'state' bits only affect the fat debug button, not the preset start button. - m_startAction.setText(QString()); - m_startAction.setToolTip(whyNot); m_startAction.setIcon(startIcon(false)); m_startAction.setEnabled(false); m_startAction.setVisible(false);