diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2017-02-09 14:42:04 +0100 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2017-02-14 15:40:16 +0000 |
commit | b697fd0db4bfc492ba21b0b99903ff8eb04616a9 (patch) | |
tree | 712eb4935df49583a5520f72303ac9f2705df1de /src/plugins | |
parent | 086733a2c965433ca3b1e590eb06bcb7b2da0baf (diff) | |
download | qt-creator-b697fd0db4bfc492ba21b0b99903ff8eb04616a9.tar.gz |
qmake: Use Variable enum consistently
Change-Id: I89588f12600f0698de764c05c1930b13b53a2588
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'src/plugins')
11 files changed, 93 insertions, 129 deletions
diff --git a/src/plugins/qmakeandroidsupport/androidextralibrarylistmodel.cpp b/src/plugins/qmakeandroidsupport/androidextralibrarylistmodel.cpp index 2caf5860cb..a96f601a6e 100644 --- a/src/plugins/qmakeandroidsupport/androidextralibrarylistmodel.cpp +++ b/src/plugins/qmakeandroidsupport/androidextralibrarylistmodel.cpp @@ -93,13 +93,13 @@ void AndroidExtraLibraryListModel::activeRunConfigurationChanged() } m_scope = QLatin1String("contains(ANDROID_TARGET_ARCH,") - + node->singleVariableValue(QmakeProjectManager::AndroidArchVar) + + node->singleVariableValue(QmakeProjectManager::Variable::AndroidArch) + QLatin1Char(')'); bool enabled; beginResetModel(); if (node->validParse() && node->projectType() == QmakeProjectManager::ProjectType::ApplicationTemplate) { - m_entries = node->variableValue(QmakeProjectManager::AndroidExtraLibs); + m_entries = node->variableValue(QmakeProjectManager::Variable::AndroidExtraLibs); enabled = true; } else { // parsing error or not a application template diff --git a/src/plugins/qmakeandroidsupport/createandroidmanifestwizard.cpp b/src/plugins/qmakeandroidsupport/createandroidmanifestwizard.cpp index 0325b7bae3..2191422681 100644 --- a/src/plugins/qmakeandroidsupport/createandroidmanifestwizard.cpp +++ b/src/plugins/qmakeandroidsupport/createandroidmanifestwizard.cpp @@ -172,7 +172,7 @@ bool ChooseDirectoryPage::isComplete() const void ChooseDirectoryPage::initializePage() { - QString androidPackageDir = m_wizard->node()->singleVariableValue(QmakeProjectManager::AndroidPackageSourceDir); + QString androidPackageDir = m_wizard->node()->singleVariableValue(QmakeProjectManager::Variable::AndroidPackageSourceDir); if (androidPackageDir.isEmpty()) { m_label->setText(tr("Select the Android package source directory.\n\n" "The files in the Android package source directory are copied to the build directory's " @@ -336,7 +336,7 @@ void CreateAndroidManifestWizard::createAndroidTemplateFiles() } m_node->addFiles(addedFiles); - if (m_node->singleVariableValue(QmakeProjectManager::AndroidPackageSourceDir).isEmpty()) { + if (m_node->singleVariableValue(QmakeProjectManager::Variable::AndroidPackageSourceDir).isEmpty()) { // and now time for some magic QString value = QLatin1String("$$PWD/") + m_node->filePath().toFileInfo().absoluteDir().relativeFilePath(m_directory); diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkstep.cpp b/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkstep.cpp index ea90d04037..41b45a285b 100644 --- a/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkstep.cpp +++ b/src/plugins/qmakeandroidsupport/qmakeandroidbuildapkstep.cpp @@ -112,7 +112,7 @@ Utils::FileName QmakeAndroidBuildApkStep::androidPackageSourceDir() const if (!node) return Utils::FileName(); - QFileInfo sourceDirInfo(node->singleVariableValue(QmakeProjectManager::AndroidPackageSourceDir)); + QFileInfo sourceDirInfo(node->singleVariableValue(QmakeProjectManager::Variable::AndroidPackageSourceDir)); return Utils::FileName::fromString(sourceDirInfo.canonicalFilePath()); } @@ -152,7 +152,7 @@ bool QmakeAndroidBuildApkStep::init(QList<const BuildStep *> &earlierSteps) if (m_skipBuilding) return true; - QString inputFile = node->singleVariableValue(QmakeProjectManager::AndroidDeploySettingsFile); + QString inputFile = node->singleVariableValue(QmakeProjectManager::Variable::AndroidDeploySettingsFile); if (inputFile.isEmpty()) { m_skipBuilding = true; return true; diff --git a/src/plugins/qmakeandroidsupport/qmakeandroidsupport.cpp b/src/plugins/qmakeandroidsupport/qmakeandroidsupport.cpp index f18432e776..2fb0fe4e49 100644 --- a/src/plugins/qmakeandroidsupport/qmakeandroidsupport.cpp +++ b/src/plugins/qmakeandroidsupport/qmakeandroidsupport.cpp @@ -75,7 +75,7 @@ QStringList QmakeAndroidSupport::androidExtraLibs(const ProjectExplorer::Target return QStringList(); auto project = static_cast<QmakeProject *>(target->project()); QmakeProFileNode *node = project->rootProjectNode()->findProFileFor(qarc->proFilePath()); - return node->variableValue(QmakeProjectManager::AndroidExtraLibs); + return node->variableValue(QmakeProjectManager::Variable::AndroidExtraLibs); } QStringList QmakeAndroidSupport::projectTargetApplications(const ProjectExplorer::Target *target) const @@ -124,7 +124,7 @@ Utils::FileName QmakeAndroidSupport::androiddeployJsonPath(ProjectExplorer::Targ if (!node) // should never happen return Utils::FileName(); - QString inputFile = node->singleVariableValue(AndroidDeploySettingsFile); + QString inputFile = node->singleVariableValue(Variable::AndroidDeploySettingsFile); if (inputFile.isEmpty()) // should never happen return Utils::FileName(); @@ -146,7 +146,7 @@ Utils::FileName QmakeAndroidSupport::manifestSourcePath(const ProjectExplorer::T const auto project = static_cast<QmakeProjectManager::QmakeProject *>(target->project()); const QmakeProFileNode *node = project->rootProjectNode()->findProFileFor(proFilePath); if (node) { - QString packageSource = node->singleVariableValue(AndroidPackageSourceDir); + QString packageSource = node->singleVariableValue(Variable::AndroidPackageSourceDir); if (!packageSource.isEmpty()) { Utils::FileName manifest = Utils::FileName::fromUserInput(packageSource + QLatin1String("/AndroidManifest.xml")); if (manifest.exists()) diff --git a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp index af9c7e9601..bb0d169fd9 100644 --- a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp +++ b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp @@ -385,10 +385,10 @@ QString DesktopQmakeRunConfiguration::baseWorkingDirectory() const bool DesktopQmakeRunConfiguration::isConsoleApplication() const { if (QmakeProFileNode *node = projectNode()) { - const QStringList config = node->variableValue(ConfigVar); + const QStringList config = node->variableValue(Variable::Config); if (!config.contains("console") || config.contains("testcase")) return false; - const QStringList qt = node->variableValue(QtVar); + const QStringList qt = node->variableValue(Variable::Qt); return !qt.contains("testlib") && !qt.contains("qmltest"); } return false; @@ -404,7 +404,7 @@ void DesktopQmakeRunConfiguration::addToBaseEnvironment(Environment &env) const // dirs to the library search path const QmakeProFileNode *node = projectNode(); if (m_isUsingLibrarySearchPath && node) { - const QStringList libDirectories = node->variableValue(LibDirectoriesVar); + const QStringList libDirectories = node->variableValue(Variable::LibDirectories); if (!libDirectories.isEmpty()) { const QString proDirectory = node->buildDir(); foreach (QString dir, libDirectories) { @@ -472,7 +472,7 @@ QPair<QString, QString> DesktopQmakeRunConfiguration::extractWorkingDirAndExecut if (!ti.valid) return qMakePair(QString(), QString()); - const QStringList &config = node->variableValue(ConfigVar); + const QStringList &config = node->variableValue(Variable::Config); QString destDir = ti.destDir; QString workingDir; diff --git a/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp b/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp index 029f910df9..157bbb6f7d 100644 --- a/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp +++ b/src/plugins/qmakeprojectmanager/librarydetailscontroller.cpp @@ -853,7 +853,7 @@ bool PackageLibraryDetailsController::isLinkPackageGenerated() const if (!currentProject) return false; - const QStringList configVar = currentProject->variableValue(ConfigVar); + const QStringList configVar = currentProject->variableValue(Variable::Config); if (configVar.contains(QLatin1String("link_pkgconfig"))) return true; @@ -943,7 +943,7 @@ AddLibraryWizard::LinkageType InternalLibraryDetailsController::suggestedLinkage AddLibraryWizard::LinkageType type = AddLibraryWizard::NoLinkage; if (currentIndex >= 0) { QmakeProFileNode *proFileNode = m_proFileNodes.at(currentIndex); - const QStringList configVar = proFileNode->variableValue(ConfigVar); + const QStringList configVar = proFileNode->variableValue(Variable::Config); if (configVar.contains(QLatin1String("staticlib")) || configVar.contains(QLatin1String("static"))) type = AddLibraryWizard::StaticLinkage; @@ -959,7 +959,7 @@ AddLibraryWizard::MacLibraryType InternalLibraryDetailsController::suggestedMacL AddLibraryWizard::MacLibraryType type = AddLibraryWizard::NoLibraryType; if (currentIndex >= 0) { QmakeProFileNode *proFileNode = m_proFileNodes.at(currentIndex); - const QStringList configVar = proFileNode->variableValue(ConfigVar); + const QStringList configVar = proFileNode->variableValue(Variable::Config); if (configVar.contains(QLatin1String("lib_bundle"))) type = AddLibraryWizard::FrameworkType; else @@ -1007,7 +1007,7 @@ void InternalLibraryDetailsController::updateProFile() const QString proFilePath = proFileNode->filePath().toString(); QmakeProjectManager::ProjectType type = proFileNode->projectType(); if (type == ProjectType::SharedLibraryTemplate || type == ProjectType::StaticLibraryTemplate) { - const QStringList configVar = proFileNode->variableValue(ConfigVar); + const QStringList configVar = proFileNode->variableValue(Variable::Config); if (!configVar.contains(QLatin1String("plugin"))) { const QString relProFilePath = rootDir.relativeFilePath(proFilePath); TargetInformation targetInfo = proFileNode->targetInformation(); @@ -1032,7 +1032,7 @@ void InternalLibraryDetailsController::slotCurrentLibraryChanged() libraryDetailsWidget()->libraryComboBox->itemData( currentIndex, Qt::ToolTipRole).toString()); QmakeProFileNode *proFileNode = m_proFileNodes.at(currentIndex); - const QStringList configVar = proFileNode->variableValue(ConfigVar); + const QStringList configVar = proFileNode->variableValue(Variable::Config); if (Utils::HostOsInfo::isWindowsHost()) { bool useSubfolders = false; if (configVar.contains(QLatin1String("debug_and_release")) diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.cpp b/src/plugins/qmakeprojectmanager/qmakenodes.cpp index d9813187fc..22a079177d 100644 --- a/src/plugins/qmakeprojectmanager/qmakenodes.cpp +++ b/src/plugins/qmakeprojectmanager/qmakenodes.cpp @@ -24,6 +24,7 @@ ****************************************************************************/ #include "qmakenodes.h" +#include "qmakeparsernodes.h" #include "qmakeproject.h" #include "qmakeprojectmanager.h" #include "qmakeprojectmanagerconstants.h" @@ -225,7 +226,7 @@ public: IncludedPriFile includedFiles; TargetInformation targetInformation; InstallsList installsList; - QHash<QmakeVariable, QStringList> newVarValues; + QHash<Variable, QStringList> newVarValues; QStringList errors; }; @@ -1426,25 +1427,25 @@ QmakeProFileNode *QmakeProFileNode::findProFileFor(const FileName &fileName) con QString QmakeProFileNode::makefile() const { - return singleVariableValue(Makefile); + return singleVariableValue(Variable::Makefile); } QString QmakeProFileNode::objectExtension() const { - if (m_varValues[ObjectExt].isEmpty()) + if (m_varValues[Variable::ObjectExt].isEmpty()) return HostOsInfo::isWindowsHost() ? QLatin1String(".obj") : QLatin1String(".o"); - return m_varValues[ObjectExt].first(); + return m_varValues[Variable::ObjectExt].first(); } QString QmakeProFileNode::objectsDirectory() const { - return singleVariableValue(ObjectsDir); + return singleVariableValue(Variable::ObjectsDir); } QByteArray QmakeProFileNode::cxxDefines() const { QByteArray result; - foreach (const QString &def, variableValue(DefinesVar)) { + foreach (const QString &def, variableValue(Variable::Defines)) { // 'def' is shell input, so interpret it. QtcProcess::SplitError error = QtcProcess::SplitOk; const QStringList args = QtcProcess::splitArgs(def, HostOsInfo::hostOs(), false, &error); @@ -1523,13 +1524,13 @@ bool QmakeProFileNode::showInSimpleTree(ProjectType projectType) const bool QmakeProFileNode::isDebugAndRelease() const { - const QStringList configValues = m_varValues.value(ConfigVar); + const QStringList configValues = m_varValues.value(Variable::Config); return configValues.contains(QLatin1String("debug_and_release")); } bool QmakeProFileNode::isQtcRunnable() const { - const QStringList configValues = m_varValues.value(ConfigVar); + const QStringList configValues = m_varValues.value(Variable::Config); return configValues.contains(QLatin1String("qtc_runnable")); } @@ -1538,12 +1539,12 @@ ProjectType QmakeProFileNode::projectType() const return m_projectType; } -QStringList QmakeProFileNode::variableValue(const QmakeVariable var) const +QStringList QmakeProFileNode::variableValue(const Variable var) const { return m_varValues.value(var); } -QString QmakeProFileNode::singleVariableValue(const QmakeVariable var) const +QString QmakeProFileNode::singleVariableValue(const Variable var) const { const QStringList &values = variableValue(var); return values.isEmpty() ? QString() : values.first(); @@ -1815,50 +1816,50 @@ EvalResult *QmakeProFileNode::evaluate(const EvalInput &input) input.buildDirectory, input.projectFilePath.toString()); // update other variables - result->newVarValues[DefinesVar] = exactReader->values(QLatin1String("DEFINES")); - result->newVarValues[IncludePathVar] = includePaths(exactReader, input.sysroot, + result->newVarValues[Variable::Defines] = exactReader->values(QLatin1String("DEFINES")); + result->newVarValues[Variable::IncludePath] = includePaths(exactReader, input.sysroot, input.buildDirectory, input.projectDir); - result->newVarValues[CppFlagsVar] = exactReader->values(QLatin1String("QMAKE_CXXFLAGS")); - result->newVarValues[SourceVar] = + result->newVarValues[Variable::CppFlags] = exactReader->values(QLatin1String("QMAKE_CXXFLAGS")); + result->newVarValues[Variable::Source] = fileListForVar(exactSourceFiles, QLatin1String("SOURCES")) + fileListForVar(cumulativeSourceFiles, QLatin1String("SOURCES")) + fileListForVar(exactSourceFiles, QLatin1String("HEADERS")) + fileListForVar(cumulativeSourceFiles, QLatin1String("HEADERS")) + fileListForVar(exactSourceFiles, QLatin1String("OBJECTIVE_HEADERS")) + fileListForVar(cumulativeSourceFiles, QLatin1String("OBJECTIVE_HEADERS")); - result->newVarValues[UiDirVar] = QStringList() << uiDirPath(exactReader, input.buildDirectory); - result->newVarValues[HeaderExtensionVar] = QStringList() << exactReader->value(QLatin1String("QMAKE_EXT_H")); - result->newVarValues[CppExtensionVar] = QStringList() << exactReader->value(QLatin1String("QMAKE_EXT_CPP")); - result->newVarValues[MocDirVar] = QStringList() << mocDirPath(exactReader, input.buildDirectory); - result->newVarValues[ExactResourceVar] = fileListForVar(exactSourceFiles, QLatin1String("RESOURCES")); - result->newVarValues[CumulativeResourceVar] = fileListForVar(cumulativeSourceFiles, QLatin1String("RESOURCES")); - result->newVarValues[PkgConfigVar] = exactReader->values(QLatin1String("PKGCONFIG")); - result->newVarValues[PrecompiledHeaderVar] = ProFileEvaluator::sourcesToFiles(exactReader->fixifiedValues( + result->newVarValues[Variable::UiDir] = QStringList() << uiDirPath(exactReader, input.buildDirectory); + result->newVarValues[Variable::HeaderExtension] = QStringList() << exactReader->value(QLatin1String("QMAKE_EXT_H")); + result->newVarValues[Variable::CppExtension] = QStringList() << exactReader->value(QLatin1String("QMAKE_EXT_CPP")); + result->newVarValues[Variable::MocDir] = QStringList() << mocDirPath(exactReader, input.buildDirectory); + result->newVarValues[Variable::ExactResource] = fileListForVar(exactSourceFiles, QLatin1String("RESOURCES")); + result->newVarValues[Variable::CumulativeResource] = fileListForVar(cumulativeSourceFiles, QLatin1String("RESOURCES")); + result->newVarValues[Variable::PkgConfig] = exactReader->values(QLatin1String("PKGCONFIG")); + result->newVarValues[Variable::PrecompiledHeader] = ProFileEvaluator::sourcesToFiles(exactReader->fixifiedValues( QLatin1String("PRECOMPILED_HEADER"), input.projectDir, input.buildDirectory)); - result->newVarValues[LibDirectoriesVar] = libDirectories(exactReader); - result->newVarValues[ConfigVar] = exactReader->values(QLatin1String("CONFIG")); - result->newVarValues[QmlImportPathVar] = exactReader->absolutePathValues( + result->newVarValues[Variable::LibDirectories] = libDirectories(exactReader); + result->newVarValues[Variable::Config] = exactReader->values(QLatin1String("CONFIG")); + result->newVarValues[Variable::QmlImportPath] = exactReader->absolutePathValues( QLatin1String("QML_IMPORT_PATH"), input.projectDir); - result->newVarValues[QmlDesignerImportPathVar] = exactReader->absolutePathValues( + result->newVarValues[Variable::QmlDesignerImportPath] = exactReader->absolutePathValues( QLatin1String("QML_DESIGNER_IMPORT_PATH"), input.projectDir); - result->newVarValues[Makefile] = exactReader->values(QLatin1String("MAKEFILE")); - result->newVarValues[QtVar] = exactReader->values(QLatin1String("QT")); - result->newVarValues[ObjectExt] = exactReader->values(QLatin1String("QMAKE_EXT_OBJ")); - result->newVarValues[ObjectsDir] = exactReader->values(QLatin1String("OBJECTS_DIR")); - result->newVarValues[VersionVar] = exactReader->values(QLatin1String("VERSION")); - result->newVarValues[TargetExtVar] = exactReader->values(QLatin1String("TARGET_EXT")); - result->newVarValues[TargetVersionExtVar] + result->newVarValues[Variable::Makefile] = exactReader->values(QLatin1String("MAKEFILE")); + result->newVarValues[Variable::Qt] = exactReader->values(QLatin1String("QT")); + result->newVarValues[Variable::ObjectExt] = exactReader->values(QLatin1String("QMAKE_EXT_OBJ")); + result->newVarValues[Variable::ObjectsDir] = exactReader->values(QLatin1String("OBJECTS_DIR")); + result->newVarValues[Variable::Version] = exactReader->values(QLatin1String("VERSION")); + result->newVarValues[Variable::TargetExt] = exactReader->values(QLatin1String("TARGET_EXT")); + result->newVarValues[Variable::TargetVersionExt] = exactReader->values(QLatin1String("TARGET_VERSION_EXT")); - result->newVarValues[StaticLibExtensionVar] = exactReader->values(QLatin1String("QMAKE_EXTENSION_STATICLIB")); - result->newVarValues[ShLibExtensionVar] = exactReader->values(QLatin1String("QMAKE_EXTENSION_SHLIB")); - result->newVarValues[AndroidArchVar] = exactReader->values(QLatin1String("ANDROID_TARGET_ARCH")); - result->newVarValues[AndroidDeploySettingsFile] = exactReader->values(QLatin1String("ANDROID_DEPLOYMENT_SETTINGS_FILE")); - result->newVarValues[AndroidPackageSourceDir] = exactReader->values(QLatin1String("ANDROID_PACKAGE_SOURCE_DIR")); - result->newVarValues[AndroidExtraLibs] = exactReader->values(QLatin1String("ANDROID_EXTRA_LIBS")); - result->newVarValues[IsoIconsVar] = exactReader->values(QLatin1String("ISO_ICONS")); - result->newVarValues[QmakeProjectName] = exactReader->values(QLatin1String("QMAKE_PROJECT_NAME")); - result->newVarValues[QmakeCc] = exactReader->values("QMAKE_CC"); - result->newVarValues[QmakeCxx] = exactReader->values("QMAKE_CXX"); + result->newVarValues[Variable::StaticLibExtension] = exactReader->values(QLatin1String("QMAKE_EXTENSION_STATICLIB")); + result->newVarValues[Variable::ShLibExtension] = exactReader->values(QLatin1String("QMAKE_EXTENSION_SHLIB")); + result->newVarValues[Variable::AndroidArch] = exactReader->values(QLatin1String("ANDROID_TARGET_ARCH")); + result->newVarValues[Variable::AndroidDeploySettingsFile] = exactReader->values(QLatin1String("ANDROID_DEPLOYMENT_SETTINGS_FILE")); + result->newVarValues[Variable::AndroidPackageSourceDir] = exactReader->values(QLatin1String("ANDROID_PACKAGE_SOURCE_DIR")); + result->newVarValues[Variable::AndroidExtraLibs] = exactReader->values(QLatin1String("ANDROID_EXTRA_LIBS")); + result->newVarValues[Variable::IsoIcons] = exactReader->values(QLatin1String("ISO_ICONS")); + result->newVarValues[Variable::QmakeProjectName] = exactReader->values(QLatin1String("QMAKE_PROJECT_NAME")); + result->newVarValues[Variable::QmakeCc] = exactReader->values("QMAKE_CC"); + result->newVarValues[Variable::QmakeCxx] = exactReader->values("QMAKE_CXX"); } if (result->state == EvalResult::EvalOk || result->state == EvalResult::EvalPartial) { @@ -2010,7 +2011,7 @@ void QmakeProFileNode::applyEvaluate(EvalResult *evalResult) if (m_varValues != result->newVarValues) m_varValues = result->newVarValues; - const QString projectName = singleVariableValue(QmakeProjectName); + const QString projectName = singleVariableValue(Variable::QmakeProjectName); if (projectName.isEmpty()) setDisplayName(m_projectFilePath.toFileInfo().completeBaseName()); else @@ -2268,7 +2269,7 @@ QStringList QmakeProFileNode::generatedFiles(const QString &buildDir, switch (sourceFile->fileType()) { case FileType::Form: { FileName location; - auto it = m_varValues.constFind(UiDirVar); + auto it = m_varValues.constFind(Variable::UiDir); if (it != m_varValues.constEnd() && !it.value().isEmpty()) location = FileName::fromString(it.value().front()); else @@ -2277,7 +2278,7 @@ QStringList QmakeProFileNode::generatedFiles(const QString &buildDir, return QStringList(); location.appendPath(QLatin1String("ui_") + sourceFile->filePath().toFileInfo().completeBaseName() - + singleVariableValue(HeaderExtensionVar)); + + singleVariableValue(Variable::HeaderExtension)); return QStringList(QDir::cleanPath(location.toString())); } case FileType::StateChart: { @@ -2285,8 +2286,8 @@ QStringList QmakeProFileNode::generatedFiles(const QString &buildDir, return QStringList(); QString location = QDir::cleanPath(FileName::fromString(buildDir).appendPath( sourceFile->filePath().toFileInfo().completeBaseName()).toString()); - return QStringList({location + singleVariableValue(HeaderExtensionVar), - location + singleVariableValue(CppExtensionVar)}); + return QStringList({location + singleVariableValue(Variable::HeaderExtension), + location + singleVariableValue(Variable::CppExtension)}); } default: // TODO: Other types will be added when adapters for their compilers become available. diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.h b/src/plugins/qmakeprojectmanager/qmakenodes.h index 80208b5f4f..c47a147e42 100644 --- a/src/plugins/qmakeprojectmanager/qmakenodes.h +++ b/src/plugins/qmakeprojectmanager/qmakenodes.h @@ -50,43 +50,6 @@ class QmakeBuildConfiguration; class QmakeProFileNode; class QmakeProject; -// Other variables of interest -enum QmakeVariable { - DefinesVar = 1, - IncludePathVar, - CppFlagsVar, - SourceVar, - ExactResourceVar, - CumulativeResourceVar, - UiDirVar, - HeaderExtensionVar, - CppExtensionVar, - MocDirVar, - PkgConfigVar, - PrecompiledHeaderVar, - LibDirectoriesVar, - ConfigVar, - QtVar, - QmlImportPathVar, - QmlDesignerImportPathVar, - Makefile, - ObjectExt, - ObjectsDir, - VersionVar, - TargetExtVar, - TargetVersionExtVar, - StaticLibExtensionVar, - ShLibExtensionVar, - AndroidArchVar, - AndroidDeploySettingsFile, - AndroidPackageSourceDir, - AndroidExtraLibs, - IsoIconsVar, - QmakeProjectName, - QmakeCc, - QmakeCxx -}; - namespace Internal { class QmakePriFile; struct InternalNode; @@ -265,8 +228,8 @@ public: QmakeProjectManager::ProjectType projectType() const; - QStringList variableValue(const QmakeVariable var) const; - QString singleVariableValue(const QmakeVariable var) const; + QStringList variableValue(const Variable var) const; + QString singleVariableValue(const Variable var) const; bool isSubProjectDeployable(const QString &filePath) const { return !m_subProjectsNotToDeploy.contains(filePath); @@ -318,7 +281,7 @@ private: void asyncEvaluate(QFutureInterface<Internal::EvalResult *> &fi, Internal::EvalInput input); void cleanupProFileReaders(); - typedef QHash<QmakeVariable, QStringList> QmakeVariablesHash; + using VariablesHash = QHash<Variable, QStringList>; void updateGeneratedFiles(const QString &buildDir); @@ -336,7 +299,7 @@ private: bool m_parseInProgress = false; ProjectType m_projectType = ProjectType::Invalid; - QmakeVariablesHash m_varValues; + VariablesHash m_varValues; QList<ProjectExplorer::ExtraCompiler *> m_extraCompilers; TargetInformation m_qmakeTargetInformation; diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp index 0b1c911b1b..00550b4126 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp @@ -373,13 +373,13 @@ void QmakeProject::updateCppCodeModel() ppBuilder.setDisplayName(pro->displayName()); ppBuilder.setProjectFile(pro->filePath().toString()); - ppBuilder.setCxxFlags(pro->variableValue(CppFlagsVar)); // TODO: Handle QMAKE_CFLAGS + ppBuilder.setCxxFlags(pro->variableValue(Variable::CppFlags)); // TODO: Handle QMAKE_CFLAGS ppBuilder.setDefines(pro->cxxDefines()); - ppBuilder.setPreCompiledHeaders(pro->variableValue(PrecompiledHeaderVar)); + ppBuilder.setPreCompiledHeaders(pro->variableValue(Variable::PrecompiledHeader)); ppBuilder.setSelectedForBuilding(pro->includedInExactParse()); // Qt Version - if (pro->variableValue(ConfigVar).contains(QLatin1String("qt"))) + if (pro->variableValue(Variable::Config).contains(QLatin1String("qt"))) ppBuilder.setQtVersion(qtVersionForPart); else ppBuilder.setQtVersion(ProjectPart::NoQt); @@ -387,7 +387,7 @@ void QmakeProject::updateCppCodeModel() // Header paths CppTools::ProjectPartHeaderPaths headerPaths; using CppToolsHeaderPath = CppTools::ProjectPartHeaderPath; - foreach (const QString &inc, pro->variableValue(IncludePathVar)) { + foreach (const QString &inc, pro->variableValue(Variable::IncludePath)) { const auto headerPath = CppToolsHeaderPath(inc, CppToolsHeaderPath::IncludePath); if (!headerPaths.contains(headerPath)) headerPaths += headerPath; @@ -400,7 +400,7 @@ void QmakeProject::updateCppCodeModel() ppBuilder.setHeaderPaths(headerPaths); // Files and generators - QStringList fileList = pro->variableValue(SourceVar); + QStringList fileList = pro->variableValue(Variable::Source); QList<ProjectExplorer::ExtraCompiler *> proGenerators = pro->extraCompilers(); foreach (ProjectExplorer::ExtraCompiler *ec, proGenerators) { ec->forEachTarget([&](const Utils::FileName &generatedFile) { @@ -434,11 +434,11 @@ void QmakeProject::updateQmlJSCodeModel() bool hasQmlLib = false; foreach (QmakeProFileNode *node, proFiles) { - foreach (const QString &path, node->variableValue(QmlImportPathVar)) + foreach (const QString &path, node->variableValue(Variable::QmlImportPath)) projectInfo.importPaths.maybeInsert(FileName::fromString(path), QmlJS::Dialect::Qml); - const QStringList &exactResources = node->variableValue(ExactResourceVar); - const QStringList &cumulativeResources = node->variableValue(CumulativeResourceVar); + const QStringList &exactResources = node->variableValue(Variable::ExactResource); + const QStringList &cumulativeResources = node->variableValue(Variable::CumulativeResource); projectInfo.activeResourceFiles.append(exactResources); projectInfo.allResourceFiles.append(exactResources); projectInfo.allResourceFiles.append(cumulativeResources); @@ -453,7 +453,7 @@ void QmakeProject::updateQmlJSCodeModel() projectInfo.resourceFileContents[rc] = contents; } if (!hasQmlLib) { - QStringList qtLibs = node->variableValue(QtVar); + QStringList qtLibs = node->variableValue(Variable::Qt); hasQmlLib = qtLibs.contains(QLatin1String("declarative")) || qtLibs.contains(QLatin1String("qml")) || qtLibs.contains(QLatin1String("quick")); @@ -1285,14 +1285,14 @@ void QmakeProject::collectLibraryData(const QmakeProFileNode *node, DeploymentDa TargetInformation ti = node->targetInformation(); QString targetFileName = ti.target; - const QStringList config = node->variableValue(ConfigVar); + const QStringList config = node->variableValue(Variable::Config); const bool isStatic = config.contains(QLatin1String("static")); const bool isPlugin = config.contains(QLatin1String("plugin")); switch (toolchain->targetAbi().os()) { case Abi::WindowsOS: { - QString targetVersionExt = node->singleVariableValue(TargetVersionExtVar); + QString targetVersionExt = node->singleVariableValue(Variable::TargetVersionExt); if (targetVersionExt.isEmpty()) { - const QString version = node->singleVariableValue(VersionVar); + const QString version = node->singleVariableValue(Variable::Version); if (!version.isEmpty()) { targetVersionExt = version.left(version.indexOf(QLatin1Char('.'))); if (targetVersionExt == QLatin1String("0")) @@ -1315,7 +1315,7 @@ void QmakeProject::collectLibraryData(const QmakeProFileNode *node, DeploymentDa if (!isPlugin) { targetFileName += QLatin1Char('.'); - const QString version = node->singleVariableValue(VersionVar); + const QString version = node->singleVariableValue(Variable::Version); QString majorVersion = version.left(version.indexOf(QLatin1Char('.'))); if (majorVersion.isEmpty()) majorVersion = QLatin1String("1"); @@ -1323,7 +1323,7 @@ void QmakeProject::collectLibraryData(const QmakeProFileNode *node, DeploymentDa } targetFileName += QLatin1Char('.'); targetFileName += node->singleVariableValue(isStatic - ? StaticLibExtensionVar : ShLibExtensionVar); + ? Variable::StaticLibExtension : Variable::ShLibExtension); } deploymentData.addFile(destDir + QLatin1Char('/') + targetFileName, targetPath); break; @@ -1341,7 +1341,7 @@ void QmakeProject::collectLibraryData(const QmakeProFileNode *node, DeploymentDa targetFileName += QLatin1String("so"); deploymentData.addFile(destDirFor(ti) + QLatin1Char('/') + targetFileName, targetPath); if (!isPlugin) { - QString version = node->singleVariableValue(VersionVar); + QString version = node->singleVariableValue(Variable::Version); if (version.isEmpty()) version = QLatin1String("1.0.0"); targetFileName += QLatin1Char('.'); @@ -1371,7 +1371,7 @@ bool QmakeProject::matchesKit(const Kit *kit) }); } -static Utils::FileName getFullPathOf(const QmakeProFileNode *pro, QmakeVariable variable, +static Utils::FileName getFullPathOf(const QmakeProFileNode *pro, Variable variable, const BuildConfiguration *bc) { // Take last non-flag value, to cover e.g. '@echo $< && $$QMAKE_CC' or 'ccache gcc' @@ -1417,9 +1417,9 @@ void QmakeProject::warnOnToolChainMismatch(const QmakeProFileNode *pro) const return; testToolChain(ToolChainKitInformation::toolChain(t->kit(), ProjectExplorer::Constants::C_LANGUAGE_ID), - getFullPathOf(pro, QmakeCc, bc)); + getFullPathOf(pro, Variable::QmakeCc, bc)); testToolChain(ToolChainKitInformation::toolChain(t->kit(), ProjectExplorer::Constants::CXX_LANGUAGE_ID), - getFullPathOf(pro, QmakeCxx, bc)); + getFullPathOf(pro, Variable::QmakeCxx, bc)); } QString QmakeProject::executableFor(const QmakeProFileNode *node) @@ -1434,13 +1434,13 @@ QString QmakeProject::executableFor(const QmakeProFileNode *node) switch (toolchain->targetAbi().os()) { case Abi::DarwinOS: - if (node->variableValue(ConfigVar).contains(QLatin1String("app_bundle"))) { + if (node->variableValue(Variable::Config).contains(QLatin1String("app_bundle"))) { target = ti.target + QLatin1String(".app/Contents/MacOS/") + ti.target; break; } // else fall through default: { - QString extension = node->singleVariableValue(TargetExtVar); + QString extension = node->singleVariableValue(Variable::TargetExt); target = ti.target + extension; break; } diff --git a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp index 9e2735766a..9fcab2e899 100644 --- a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp +++ b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp @@ -439,7 +439,7 @@ QProcessEnvironment PuppetCreator::processEnvironment() const if (m_currentProject) { QmakeProjectManager::QmakeProject *qmakeProject = qobject_cast<QmakeProjectManager::QmakeProject *>(m_currentProject); if (qmakeProject) { - QStringList designerImports = qmakeProject->rootProjectNode()->variableValue(QmakeProjectManager::QmlDesignerImportPathVar); + QStringList designerImports = qmakeProject->rootProjectNode()->variableValue(QmakeProjectManager::Variable::QmlDesignerImportPath); importPaths.append(designerImports); } } diff --git a/src/plugins/qmldesigner/documentmanager.cpp b/src/plugins/qmldesigner/documentmanager.cpp index 12226f68ed..de2b6cc7a9 100644 --- a/src/plugins/qmldesigner/documentmanager.cpp +++ b/src/plugins/qmldesigner/documentmanager.cpp @@ -345,7 +345,7 @@ QStringList DocumentManager::isoIconsQmakeVariableValue(const QString &proPath) return QStringList(); } - return proNode->variableValue(QmakeProjectManager::IsoIconsVar); + return proNode->variableValue(QmakeProjectManager::Variable::IsoIcons); } bool DocumentManager::setIsoIconsQmakeVariableValue(const QString &proPath, const QStringList &value) |