Debugger: Show something in start action text again

... even if the action is disabled.

Change-Id: I7f5bb0abd73d25650fab4c9dafbe70c772d2cb0e
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
hjk
2018-10-04 17:25:11 +02:00
parent a743e25d27
commit 4d2a6db1a8

View File

@@ -1449,28 +1449,31 @@ void DebuggerPluginPrivate::updatePresetState()
DebuggerEngine *currentEngine = EngineManager::currentEngine(); DebuggerEngine *currentEngine = EngineManager::currentEngine();
QString whyNot; QString whyNot;
const bool canRun = startupProject const bool canRun =
&& ProjectExplorerPlugin::canRunStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE, &whyNot); ProjectExplorerPlugin::canRunStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE, &whyNot);
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; QString startupRunConfigName;
if (startupRunConfig) if (startupRunConfig)
startupRunConfigName = startupRunConfig->displayName(); startupRunConfigName = startupRunConfig->displayName();
if (startupRunConfigName.isEmpty() && startupProject) if (startupRunConfigName.isEmpty() && startupProject)
startupRunConfigName = startupProject->displayName(); startupRunConfigName = startupProject->displayName();
QString startToolTip = canRun ? tr("Start debugging of \"%1\"").arg(startupRunConfigName) : whyNot; const QString startToolTip =
QString stepToolTip = canRun ? tr("Start \"%1\" and break at function \"main\"").arg(startupRunConfigName) : whyNot; canRun ? tr("Start debugging of \"%1\"").arg(startupRunConfigName) : whyNot;
// Step into/next: Start and break at 'main' unless a debugger is running.
m_stepAction.setEnabled(canRun);
m_stepAction.setToolTip(stepToolTip);
m_nextAction.setEnabled(canRun);
m_nextAction.setToolTip(stepToolTip);
m_startAction.setEnabled(canRun);
m_startAction.setToolTip(startToolTip); m_startAction.setToolTip(startToolTip);
m_startAction.setText(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.
// Step into/next: Start and break at 'main' unless a debugger is running.
QString stepToolTip = canRun ? tr("Start \"%1\" and break at function \"main\"").arg(startupRunConfigName) : whyNot;
m_stepAction.setToolTip(stepToolTip);
m_nextAction.setToolTip(stepToolTip);
m_stepAction.setEnabled(canRun);
m_nextAction.setEnabled(canRun);
m_startAction.setEnabled(canRun);
m_startAction.setIcon(startIcon(false)); m_startAction.setIcon(startIcon(false));
m_startAction.setToolButtonStyle(Qt::ToolButtonTextBesideIcon); m_startAction.setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
m_startAction.setVisible(true); m_startAction.setVisible(true);
@@ -1493,8 +1496,6 @@ void DebuggerPluginPrivate::updatePresetState()
m_nextAction.setToolTip(QString()); m_nextAction.setToolTip(QString());
// The 'state' bits only affect the fat debug button, not the preset start button. // 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.setIcon(startIcon(false));
m_startAction.setEnabled(false); m_startAction.setEnabled(false);
m_startAction.setVisible(false); m_startAction.setVisible(false);