diff --git a/src/plugins/qt4projectmanager/projectloadwizard.cpp b/src/plugins/qt4projectmanager/projectloadwizard.cpp index f559806cec3731ea670af414beab57ddba0517ec..29e518edc52b19e16921495adcbfd79975ba583b 100644 --- a/src/plugins/qt4projectmanager/projectloadwizard.cpp +++ b/src/plugins/qt4projectmanager/projectloadwizard.cpp @@ -112,33 +112,6 @@ ProjectLoadWizard::~ProjectLoadWizard() } -void ProjectLoadWizard::addBuildConfiguration(QString buildConfigurationName, QtVersion *qtversion, QtVersion::QmakeBuildConfig qmakeBuildConfiguration, QStringList additionalArguments) -{ - QMakeStep *qmakeStep = m_project->qmakeStep(); - MakeStep *makeStep = m_project->makeStep(); - - bool debug = qmakeBuildConfiguration & QtVersion::DebugBuild; - - // Add the buildconfiguration - ProjectExplorer::BuildConfiguration *bc = new ProjectExplorer::BuildConfiguration(buildConfigurationName); - m_project->addBuildConfiguration(bc); - const QString &finalBuildConfigurationName = bc->name(); - qmakeStep->setValue(finalBuildConfigurationName, "qmakeArgs", additionalArguments); - - // set some options for qmake and make - if (qmakeBuildConfiguration & QtVersion::BuildAll) // debug_and_release => explicit targets - makeStep->setValue(finalBuildConfigurationName, "makeargs", QStringList() << (debug ? "debug" : "release")); - - bc->setValue("buildConfiguration", int(qmakeBuildConfiguration)); - - // Finally set the qt version - bool defaultQtVersion = (qtversion == 0); - if (defaultQtVersion) - m_project->setQtVersion(bc, 0); - else - m_project->setQtVersion(bc, qtversion->uniqueId()); -} - void ProjectLoadWizard::done(int result) { QtVersionManager *vm = QtVersionManager::instance(); @@ -154,7 +127,7 @@ void ProjectLoadWizard::done(int result) // qDebug()<<"Creating m_buildconfiguration entry from imported stuff"; // qDebug()<<((m_importBuildConfig& QtVersion::BuildAll)? "debug_and_release" : "")<<((m_importBuildConfig & QtVersion::DebugBuild)? "debug" : "release"); bool debug = m_importBuildConfig & QtVersion::DebugBuild; - addBuildConfiguration(debug ? "Debug" : "Release", m_importVersion, m_importBuildConfig, m_additionalArguments); + m_project->addQt4BuildConfiguration(debug ? "Debug" : "Release", m_importVersion, m_importBuildConfig, m_additionalArguments); if (m_importBuildConfig & QtVersion::BuildAll) { // Also create the other configuration @@ -164,7 +137,7 @@ void ProjectLoadWizard::done(int result) else otherBuildConfiguration = QtVersion::QmakeBuildConfig(otherBuildConfiguration | QtVersion::DebugBuild); - addBuildConfiguration(debug ? "Release" : "Debug", m_importVersion, otherBuildConfiguration, m_additionalArguments); + m_project->addQt4BuildConfiguration(debug ? "Release" : "Debug", m_importVersion, otherBuildConfiguration, m_additionalArguments); } } else { // Not importing @@ -176,11 +149,11 @@ void ProjectLoadWizard::done(int result) if (defaultVersion && defaultVersion->isValid() && (defaultVersion->defaultBuildConfig() & QtVersion::BuildAll)) buildAll = true; if (buildAll) { - addBuildConfiguration("Debug", 0, QtVersion::QmakeBuildConfig(QtVersion::BuildAll | QtVersion::DebugBuild), m_additionalArguments); - addBuildConfiguration("Release", 0, QtVersion::BuildAll, m_additionalArguments); + m_project->addQt4BuildConfiguration("Debug", 0, QtVersion::QmakeBuildConfig(QtVersion::BuildAll | QtVersion::DebugBuild), m_additionalArguments); + m_project->addQt4BuildConfiguration("Release", 0, QtVersion::BuildAll, m_additionalArguments); } else { - addBuildConfiguration("Debug", 0, QtVersion::DebugBuild, m_additionalArguments); - addBuildConfiguration("Release", 0, QtVersion::QmakeBuildConfig(0), m_additionalArguments); + m_project->addQt4BuildConfiguration("Debug", 0, QtVersion::DebugBuild, m_additionalArguments); + m_project->addQt4BuildConfiguration("Release", 0, QtVersion::QmakeBuildConfig(0), m_additionalArguments); } } diff --git a/src/plugins/qt4projectmanager/projectloadwizard.h b/src/plugins/qt4projectmanager/projectloadwizard.h index f6505ae92f6b5bdd5450f5526269768f633817bc..ef92cfb516eab913034b0e65b70091639290e016 100644 --- a/src/plugins/qt4projectmanager/projectloadwizard.h +++ b/src/plugins/qt4projectmanager/projectloadwizard.h @@ -57,7 +57,6 @@ public: void execDialog(); private: - void addBuildConfiguration(QString name, QtVersion *qtversion, QtVersion::QmakeBuildConfig buildConfiguration, QStringList additionalArguments); void setupImportPage(QtVersion *version, QtVersion::QmakeBuildConfig buildConfig, QStringList addtionalArguments); Qt4Project *m_project; diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index afddbe174e3f926e99eb2b97c098176c9e765ddb..c58793bed76aa80c44783fc2684f7649871149fc 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -283,9 +283,15 @@ bool Qt4BuildConfigurationFactory::create(const QString &type) const &ok); if (!ok || buildConfigurationName.isEmpty()) return false; - BuildConfiguration *bc = new BuildConfiguration(buildConfigurationName); - bc->setValue(KEY_QT_VERSION_ID, info.versionId); - m_project->addBuildConfiguration(bc); + + QtVersion *version = QtVersionManager::instance()->version(info.versionId); + + m_project->addQt4BuildConfiguration(tr("%1 Debug").arg(buildConfigurationName), + version, + (QtVersion::QmakeBuildConfig)(version->defaultBuildConfig() | QtVersion::DebugBuild)); + m_project->addQt4BuildConfiguration(tr("%1 Release").arg(buildConfigurationName), + version, + (QtVersion::QmakeBuildConfig)(version->defaultBuildConfig() & ~QtVersion::DebugBuild)); return true; } @@ -431,6 +437,36 @@ ProjectExplorer::IBuildConfigurationFactory *Qt4Project::buildConfigurationFacto return m_buildConfigurationFactory; } +void Qt4Project::addQt4BuildConfiguration(QString buildConfigurationName, QtVersion *qtversion, + QtVersion::QmakeBuildConfig qmakeBuildConfiguration, + QStringList additionalArguments) +{ + QMakeStep *qmake = qmakeStep(); + MakeStep *make = makeStep(); + + bool debug = qmakeBuildConfiguration & QtVersion::DebugBuild; + + // Add the buildconfiguration + ProjectExplorer::BuildConfiguration *bc = new ProjectExplorer::BuildConfiguration(buildConfigurationName); + addBuildConfiguration(bc); + const QString &finalBuildConfigurationName = bc->name(); + if (!additionalArguments.isEmpty()) + qmake->setValue(finalBuildConfigurationName, "qmakeArgs", additionalArguments); + + // set some options for qmake and make + if (qmakeBuildConfiguration & QtVersion::BuildAll) // debug_and_release => explicit targets + make->setValue(finalBuildConfigurationName, "makeargs", QStringList() << (debug ? "debug" : "release")); + + bc->setValue("buildConfiguration", int(qmakeBuildConfiguration)); + + // Finally set the qt version + bool defaultQtVersion = (qtversion == 0); + if (defaultQtVersion) + setQtVersion(bc, 0); + else + setQtVersion(bc, qtversion->uniqueId()); +} + namespace { class FindQt4ProFiles: protected ProjectExplorer::NodesVisitor { QList<Qt4ProFileNode *> m_proFiles; diff --git a/src/plugins/qt4projectmanager/qt4project.h b/src/plugins/qt4projectmanager/qt4project.h index 7c553d87f57ed854bbcb03e2a30bf7b73660190e..597a426247c6bd52bcf2b888914f4fd8d96c10de 100644 --- a/src/plugins/qt4projectmanager/qt4project.h +++ b/src/plugins/qt4projectmanager/qt4project.h @@ -160,6 +160,11 @@ public: Qt4Manager *qt4ProjectManager() const; ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const; + void addQt4BuildConfiguration(QString buildConfigurationName, + QtVersion *qtversion, + QtVersion::QmakeBuildConfig qmakeBuildConfiguration, + QStringList additionalArguments = QStringList()); + QList<Core::IFile *> dependencies(); //NBS remove QList<ProjectExplorer::Project *>dependsOn();