ProjectLoadWizard::ProjectLoadWizard(Qt4Project *project, QWidget *parent, Qt::WindowFlags flags) : QWizard(parent, flags), m_project(project), m_importVersion(0), m_temporaryVersion(false) { QtVersionManager * vm = project->qt4ProjectManager()->versionManager(); QString directory = QFileInfo(project->file()->fileName()).absolutePath(); QString importVersion = vm->findQtVersionFromMakefile(directory); if (!importVersion.isNull()) { // This also means we have a build in there // First get the qt version m_importVersion = vm->qtVersionForDirectory(importVersion); // Okay does not yet exist, create if (!m_importVersion) { m_importVersion = new QtVersion(QFileInfo(importVersion).baseName(), importVersion); m_temporaryVersion = true; } m_importBuildConfig = m_importVersion->defaultBuildConfig(); m_importBuildConfig= vm->scanMakefileForQmakeConfig(directory, m_importBuildConfig); } // So now we have the version and the configuration for that version // If buildAll we create debug and release configurations, // if not then just either debug or release // The default buildConfiguration depends on QmakeBuildConfig::DebugBuild // Also if the qt version is not yet in the Tools Options dialog we offer to add it there if (m_importVersion) setupImportPage(m_importVersion, m_importBuildConfig); setOptions(options() | QWizard::NoCancelButton | QWizard::NoBackButtonOnLastPage); }
void Qt4BuildConfigWidget::importLabelClicked() { if (m_ui->shadowBuildCheckBox->isChecked()) { QString directory = m_ui->shadowBuildDirEdit->path(); if (!directory.isEmpty()) { QtVersionManager *vm = m_pro->qt4ProjectManager()->versionManager(); QString qtPath = vm->findQtVersionFromMakefile(directory); if (!qtPath.isEmpty()) { QtVersion *version = vm->qtVersionForDirectory(qtPath); if (!version) { version = new QtVersion(QFileInfo(qtPath).baseName(), qtPath); vm->addVersion(version); } QtVersion::QmakeBuildConfig qmakeBuildConfig = version->defaultBuildConfig(); qmakeBuildConfig = vm->scanMakefileForQmakeConfig(directory, qmakeBuildConfig); // So we got all the information now apply it... m_pro->setQtVersion(m_buildConfiguration, version->uniqueId()); // Combo box will be updated at the end // Find qmakestep... QMakeStep *qmakeStep = m_pro->qmakeStep(); MakeStep *makeStep = m_pro->makeStep(); qmakeStep->setValue(m_buildConfiguration, "buildConfiguration", int(qmakeBuildConfig)); // Adjust command line arguments, this is ugly as hell // If we are switching to BuildAll we want "release" in there and no "debug" // or "debug" in there and no "release" // If we are switching to not BuildAl we want neither "release" nor "debug" in there QStringList makeCmdArguments = makeStep->value(m_buildConfiguration, "makeargs").toStringList(); bool debug = qmakeBuildConfig & QtVersion::DebugBuild; if (qmakeBuildConfig & QtVersion::BuildAll) { makeCmdArguments.removeAll(debug ? "release" : "debug"); if (!makeCmdArguments.contains(debug ? "debug" : "release")) makeCmdArguments.append(debug ? "debug" : "release"); } else { makeCmdArguments.removeAll("debug"); makeCmdArguments.removeAll("remove"); } makeStep->setValue(m_buildConfiguration, "makeargs", makeCmdArguments); } } } setupQtVersionsComboBox(); }