Commit 9749d38f authored by dt's avatar dt
Browse files

Enable the build project action if the project has buildable dependencies

Task-Nr: QTCREATORBUG-1016
parent 61e5ce37
...@@ -260,6 +260,8 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er ...@@ -260,6 +260,8 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
this, SLOT(updatePreferredWizardKinds())); this, SLOT(updatePreferredWizardKinds()));
connect(d->m_session, SIGNAL(projectRemoved(ProjectExplorer::Project*)), connect(d->m_session, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
this, SLOT(updatePreferredWizardKinds())); this, SLOT(updatePreferredWizardKinds()));
connect(d->m_session, SIGNAL(dependencyChanged(ProjectExplorer::Project*,ProjectExplorer::Project*)),
this, SLOT(updateActions()));
d->m_proWindow = new ProjectWindow; d->m_proWindow = new ProjectWindow;
...@@ -1358,11 +1360,11 @@ void ProjectExplorerPlugin::updateActions() ...@@ -1358,11 +1360,11 @@ void ProjectExplorerPlugin::updateActions()
Project *startupProject = session()->startupProject(); Project *startupProject = session()->startupProject();
bool enableBuildActions = startupProject bool enableBuildActions = startupProject
&& ! (d->m_buildManager->isBuilding(startupProject)) && ! (d->m_buildManager->isBuilding(startupProject))
&& startupProject->hasActiveBuildSettings(); && hasBuildSettings(startupProject);
bool enableBuildActionsContextMenu = d->m_currentProject bool enableBuildActionsContextMenu = d->m_currentProject
&& ! (d->m_buildManager->isBuilding(d->m_currentProject)) && ! (d->m_buildManager->isBuilding(d->m_currentProject))
&& d->m_currentProject->hasActiveBuildSettings(); && hasBuildSettings(d->m_currentProject);
bool hasProjects = !d->m_session->projects().isEmpty(); bool hasProjects = !d->m_session->projects().isEmpty();
...@@ -1632,12 +1634,21 @@ void ProjectExplorerPlugin::runProjectContextMenu() ...@@ -1632,12 +1634,21 @@ void ProjectExplorerPlugin::runProjectContextMenu()
runProjectImpl(d->m_currentProject, ProjectExplorer::Constants::RUNMODE); runProjectImpl(d->m_currentProject, ProjectExplorer::Constants::RUNMODE);
} }
bool ProjectExplorerPlugin::hasBuildSettings(Project *pro)
{
const QList<Project *> & projects = d->m_session->projectOrder(pro);
foreach(Project *pro, projects)
if (pro->activeTarget()->activeBuildConfiguration())
return true;
return false;
}
void ProjectExplorerPlugin::runProjectImpl(Project *pro, QString mode) void ProjectExplorerPlugin::runProjectImpl(Project *pro, QString mode)
{ {
if (!pro) if (!pro)
return; return;
if (d->m_projectExplorerSettings.buildBeforeRun && pro->hasActiveBuildSettings()) { if (d->m_projectExplorerSettings.buildBeforeRun && hasBuildSettings(pro)) {
if (!pro->activeTarget()->activeRunConfiguration()->isEnabled()) { if (!pro->activeTarget()->activeRunConfiguration()->isEnabled()) {
if (!showBuildConfigDialog()) if (!showBuildConfigDialog())
return; return;
......
...@@ -207,6 +207,7 @@ private: ...@@ -207,6 +207,7 @@ private:
bool parseArguments(const QStringList &arguments, QString *error); bool parseArguments(const QStringList &arguments, QString *error);
void runProjectImpl(Project *pro, QString mode); void runProjectImpl(Project *pro, QString mode);
void executeRunConfiguration(RunConfiguration *, const QString &mode); void executeRunConfiguration(RunConfiguration *, const QString &mode);
bool hasBuildSettings(Project *pro);
bool showBuildConfigDialog(); bool showBuildConfigDialog();
void setCurrent(Project *project, QString filePath, Node *node); void setCurrent(Project *project, QString filePath, Node *node);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment