diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 6b0a35aff679f3171e363a267c46539c569b31af..601f6e004fb9c7079b9f8ad627ceacb863cec5ef 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -1962,7 +1962,7 @@ void DebuggerPluginPrivate::onCurrentProjectChanged(Project *project) m_continueAction->setEnabled(false); m_exitAction->setEnabled(false); QString whyNot; - const bool canRun = ProjectExplorerPlugin::canRun(project, ProjectExplorer::Constants::DEBUG_RUN_MODE, &whyNot); + const bool canRun = ProjectExplorerPlugin::canRunStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE, &whyNot); m_startAction->setEnabled(canRun); m_startAction->setToolTip(whyNot); m_debugWithoutDeployAction->setEnabled(canRun); @@ -2609,8 +2609,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine) m_localsAndExpressionsWindow->setShowLocals(false); activateDebugMode(); } else if (state == DebuggerFinished) { - Project *project = SessionManager::startupProject(); - const bool canRun = ProjectExplorerPlugin::canRun(project, ProjectExplorer::Constants::DEBUG_RUN_MODE); + const bool canRun = ProjectExplorerPlugin::canRunStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE); // We don't want to do anything anymore. m_interruptAction->setEnabled(false); m_continueAction->setEnabled(false); @@ -2711,9 +2710,8 @@ void DebuggerPluginPrivate::updateDebugActions() if (m_currentEngine->state() != DebuggerNotReady) return; - Project *project = SessionManager::startupProject(); QString whyNot; - const bool canRun = ProjectExplorerPlugin::canRun(project, ProjectExplorer::Constants::DEBUG_RUN_MODE, &whyNot); + const bool canRun = ProjectExplorerPlugin::canRunStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE, &whyNot); m_startAction->setEnabled(canRun); m_startAction->setToolTip(whyNot); m_debugWithoutDeployAction->setEnabled(canRun); @@ -2722,11 +2720,12 @@ void DebuggerPluginPrivate::updateDebugActions() if (m_snapshotHandler->currentIndex() < 0) { QString toolTip; const bool canRunAndBreakMain - = ProjectExplorerPlugin::canRun(project, ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN, &toolTip); + = ProjectExplorerPlugin::canRunStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN, &toolTip); m_stepAction->setEnabled(canRunAndBreakMain); m_nextAction->setEnabled(canRunAndBreakMain); if (canRunAndBreakMain) { - QTC_ASSERT(project, return ; ); + Project *project = SessionManager::startupProject(); + QTC_ASSERT(project, return); toolTip = tr("Start \"%1\" and break at function \"main()\"") .arg(project->displayName()); } @@ -3403,7 +3402,7 @@ bool ActionDescription::isRunnable(QString *reason) const if (m_customToolStarter) // Something special. Pretend we can always run it. return true; - return ProjectExplorerPlugin::canRun(SessionManager::startupProject(), m_runMode, reason); + return ProjectExplorerPlugin::canRunStartupProject(m_runMode, reason); } static bool buildTypeAccepted(QFlags<ToolMode> toolMode, BuildConfiguration::BuildType buildType) diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 4e103cc528f78c6ebf1853ee3a052924bc4f6320..fec7d9938cefc42b9b94e0c1d9c7f4442cb11531 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -2733,8 +2733,9 @@ void ProjectExplorerPluginPrivate::updateDeployActions() emit m_instance->updateRunActions(); } -bool ProjectExplorerPlugin::canRun(Project *project, Core::Id runMode, QString *whyNot) +bool ProjectExplorerPlugin::canRunStartupProject(Core::Id runMode, QString *whyNot) { + Project *project = SessionManager::startupProject(); if (!project) { if (whyNot) *whyNot = tr("No active project."); @@ -2798,9 +2799,8 @@ bool ProjectExplorerPlugin::canRun(Project *project, Core::Id runMode, QString * void ProjectExplorerPluginPrivate::slotUpdateRunActions() { - Project *project = SessionManager::startupProject(); QString whyNot; - const bool state = ProjectExplorerPlugin::canRun(project, Constants::NORMAL_RUN_MODE, &whyNot); + const bool state = ProjectExplorerPlugin::canRunStartupProject(Constants::NORMAL_RUN_MODE, &whyNot); m_runAction->setEnabled(state); m_runAction->setToolTip(whyNot); m_runWithoutDeployAction->setEnabled(state); diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h index 1ca80bfacfa152b4e93dc2590c283257bfe8f538..aee6d28f738f0afe4968034ea2a4fa561cf9a754 100644 --- a/src/plugins/projectexplorer/projectexplorer.h +++ b/src/plugins/projectexplorer/projectexplorer.h @@ -134,7 +134,7 @@ public: static QStringList projectFilePatterns(); static QList<QPair<QString, QString> > recentProjects(); - static bool canRun(Project *pro, Core::Id runMode, QString *whyNot = 0); + static bool canRunStartupProject(Core::Id runMode, QString *whyNot = 0); static void runProject(Project *pro, Core::Id, const bool forceSkipDeploy = false); static void runStartupProject(Core::Id runMode, bool forceSkipDeploy = false); static void runRunConfiguration(RunConfiguration *rc, Core::Id runMode,