From acb4ebeafade3479602f67d661c95b1798f42990 Mon Sep 17 00:00:00 2001 From: Daniel Teske <daniel.teske@nokia.com> Date: Wed, 28 Mar 2012 14:17:24 +0200 Subject: [PATCH] Qt4Project: Fix ordering of buildconfigurations for new/open Task-number: QTCREATORBUG-7152 Change-Id: I4c7c0d2f89cdde2ed8dc13adc4187adf91b10f29 Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com> --- src/plugins/qt4projectmanager/qt4target.cpp | 33 +++++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/plugins/qt4projectmanager/qt4target.cpp b/src/plugins/qt4projectmanager/qt4target.cpp index 754b886f960..dc5f5ed7ecb 100644 --- a/src/plugins/qt4projectmanager/qt4target.cpp +++ b/src/plugins/qt4projectmanager/qt4target.cpp @@ -970,10 +970,33 @@ bool less(const BuildConfigurationInfo &a, const BuildConfigurationInfo &b) return true; if (a.qtVersionId > b.qtVersionId) return false; - if (a.buildConfig < b.buildConfig) - return true; - if (a.buildConfig > b.buildConfig) - return false; + + if (a.buildConfig != b.buildConfig) { + QtSupport::BaseQtVersion *version = a.version(); + QtSupport::BaseQtVersion::QmakeBuildConfigs defaultBuildConfigs = QtSupport::BaseQtVersion::DebugBuild; + if (version) + defaultBuildConfigs = version->defaultBuildConfig(); + + bool adebug = a.buildConfig & QtSupport::BaseQtVersion::DebugBuild; + bool bdebug = b.buildConfig & QtSupport::BaseQtVersion::DebugBuild; + bool defaultdebug = defaultBuildConfigs & QtSupport::BaseQtVersion::DebugBuild; + + if (adebug != bdebug) + return (adebug == defaultdebug); + + bool abuildall = a.buildConfig & QtSupport::BaseQtVersion::BuildAll; + bool bbuildall = b.buildConfig & QtSupport::BaseQtVersion::BuildAll; + bool defaultbuildall = defaultBuildConfigs & QtSupport::BaseQtVersion::BuildAll; + + if (abuildall != bbuildall) + return (abuildall == defaultbuildall); + + // Those cases can't happen + if (a.buildConfig < b.buildConfig) + return true; + if (a.buildConfig > b.buildConfig) + return false; + } if (a.additionalArguments < b.additionalArguments) return true; if (a.additionalArguments > b.additionalArguments) @@ -986,8 +1009,6 @@ bool less(const BuildConfigurationInfo &a, const BuildConfigurationInfo &b) void Qt4DefaultTargetSetupWidget::setBuildConfigurationInfos(QList<BuildConfigurationInfo> infos, bool resetDirectories) { - // This is somewhat ugly in that we used to sort the buildconfigurations in the order - // that the default for that qt version is first qSort(infos.begin(), infos.end(), less); // Existing builds, to figure out which newly added -- GitLab