ProjectExplorerPlugin: Use expected_str for canRunStartupProject()

Change-Id: Iddc9abcb1b9ef02c6a8188d2eb82cc30a0ba4c22
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Jarek Kobus
2023-07-06 18:16:59 +02:00
parent 714b5963f7
commit 9f1b56e91a
7 changed files with 58 additions and 80 deletions

View File

@@ -1393,9 +1393,8 @@ void DebuggerPluginPrivate::updatePresetState()
RunConfiguration *startupRunConfig = ProjectManager::startupRunConfiguration();
DebuggerEngine *currentEngine = EngineManager::currentEngine();
QString whyNot;
const bool canRun =
ProjectExplorerPlugin::canRunStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE, &whyNot);
const auto canRun = ProjectExplorerPlugin::canRunStartupProject(
ProjectExplorer::Constants::DEBUG_RUN_MODE);
QString startupRunConfigName;
if (startupRunConfig)
@@ -1404,8 +1403,8 @@ void DebuggerPluginPrivate::updatePresetState()
startupRunConfigName = startupProject->displayName();
// Restrict width, otherwise Creator gets too wide, see QTCREATORBUG-21885
const QString startToolTip =
canRun ? Tr::tr("Start debugging of startup project") : whyNot;
const QString startToolTip = canRun ? Tr::tr("Start debugging of startup project")
: canRun.error();
m_startAction.setToolTip(startToolTip);
m_startAction.setText(Tr::tr("Start Debugging of Startup Project"));
@@ -1413,11 +1412,11 @@ void DebuggerPluginPrivate::updatePresetState()
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);
m_startAction.setEnabled(bool(canRun));
m_startAction.setIcon(startIcon(true));
m_startAction.setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
m_startAction.setVisible(true);
m_debugWithoutDeployAction.setEnabled(canRun);
m_debugWithoutDeployAction.setEnabled(bool(canRun));
m_visibleStartAction.setAction(&m_startAction);
m_hiddenStopAction.setAction(&m_undisturbableAction);
return;
@@ -1431,7 +1430,7 @@ void DebuggerPluginPrivate::updatePresetState()
m_startAction.setEnabled(false);
m_startAction.setVisible(false);
m_debugWithoutDeployAction.setEnabled(canRun);
m_debugWithoutDeployAction.setEnabled(bool(canRun));
const DebuggerState state = currentEngine->state();
@@ -1449,8 +1448,8 @@ void DebuggerPluginPrivate::updatePresetState()
m_hiddenStopAction.setAction(ActionManager::command(Constants::INTERRUPT)->action());
} else if (state == DebuggerFinished) {
// We don't want to do anything anymore.
m_startAction.setEnabled(canRun);
m_debugWithoutDeployAction.setEnabled(canRun);
m_startAction.setEnabled(bool(canRun));
m_debugWithoutDeployAction.setEnabled(bool(canRun));
m_visibleStartAction.setAction(ActionManager::command(DEBUGGER_START)->action());
m_hiddenStopAction.setAction(&m_undisturbableAction);
} else if (state == InferiorUnrunnable) {