diff options
author | Tobias Hunger <tobias.hunger@theqtcompany.com> | 2015-11-27 11:31:35 +0100 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@theqtcompany.com> | 2015-12-02 14:49:17 +0000 |
commit | 4b0a8648e4e1a2001367442525b4d57f92b61bd8 (patch) | |
tree | f9ddd96378b8077daa2be1e3c3d5beeba943a33b /src/plugins | |
parent | 19ee414446aae4dc65022e2c7c364a37c98c4f80 (diff) | |
download | qt-creator-4b0a8648e4e1a2001367442525b4d57f92b61bd8.tar.gz |
FeatureProvider: Remove Feature and FeatureSet
Use Core::Id for Feature and QSet<Core::Id> for FeatureSet.
Change-Id: I12341036bd9eaa82589d92bd3f7d21f2e6b737bd
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
Diffstat (limited to 'src/plugins')
44 files changed, 141 insertions, 340 deletions
diff --git a/src/plugins/android/androidqtversion.cpp b/src/plugins/android/androidqtversion.cpp index c23f2e8d64..9a7e3ced83 100644 --- a/src/plugins/android/androidqtversion.cpp +++ b/src/plugins/android/androidqtversion.cpp @@ -134,12 +134,12 @@ void AndroidQtVersion::parseMkSpec(ProFileEvaluator *evaluator) const BaseQtVersion::parseMkSpec(evaluator); } -Core::FeatureSet AndroidQtVersion::availableFeatures() const +QSet<Core::Id> AndroidQtVersion::availableFeatures() const { - Core::FeatureSet features = QtSupport::BaseQtVersion::availableFeatures(); - features |= Core::FeatureSet(QtSupport::Constants::FEATURE_MOBILE); - features.remove(Core::Feature(QtSupport::Constants::FEATURE_QT_CONSOLE)); - features.remove(Core::Feature(QtSupport::Constants::FEATURE_QT_WEBKIT)); + QSet<Core::Id> features = QtSupport::BaseQtVersion::availableFeatures(); + features.insert(QtSupport::Constants::FEATURE_MOBILE); + features.remove(QtSupport::Constants::FEATURE_QT_CONSOLE); + features.remove(QtSupport::Constants::FEATURE_QT_WEBKIT); return features; } diff --git a/src/plugins/android/androidqtversion.h b/src/plugins/android/androidqtversion.h index f407dae42a..a5b1ab0acb 100644 --- a/src/plugins/android/androidqtversion.h +++ b/src/plugins/android/androidqtversion.h @@ -56,7 +56,7 @@ public: void addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const; Utils::Environment qmakeRunEnvironment() const; - Core::FeatureSet availableFeatures() const; + QSet<Core::Id> availableFeatures() const; QString platformName() const; QString platformDisplayName() const; diff --git a/src/plugins/coreplugin/basefilewizardfactory.h b/src/plugins/coreplugin/basefilewizardfactory.h index ed6ce69b12..cdc020f3a8 100644 --- a/src/plugins/coreplugin/basefilewizardfactory.h +++ b/src/plugins/coreplugin/basefilewizardfactory.h @@ -63,7 +63,7 @@ public: Q_DECLARE_FLAGS(DialogParameterFlags, DialogParameterEnum) explicit WizardDialogParameters(const QString &defaultPath, const QString &platform, - const FeatureSet &requiredFeatures, DialogParameterFlags flags, + const QSet<Id> &requiredFeatures, DialogParameterFlags flags, QVariantMap extraValues) : m_defaultPath(defaultPath), m_selectedPlatform(platform), @@ -78,7 +78,7 @@ public: QString selectedPlatform() const { return m_selectedPlatform; } - FeatureSet requiredFeatures() const + QSet<Id> requiredFeatures() const { return m_requiredFeatures; } DialogParameterFlags flags() const @@ -90,7 +90,7 @@ public: private: QString m_defaultPath; QString m_selectedPlatform; - FeatureSet m_requiredFeatures; + QSet<Id> m_requiredFeatures; DialogParameterFlags m_parameterFlags; QVariantMap m_extraValues; }; diff --git a/src/plugins/coreplugin/featureprovider.cpp b/src/plugins/coreplugin/featureprovider.cpp index 4e4bc061b8..46553a28dc 100644 --- a/src/plugins/coreplugin/featureprovider.cpp +++ b/src/plugins/coreplugin/featureprovider.cpp @@ -52,92 +52,7 @@ \sa QtSupport::QtVersionManager */ - -/*! - \fn IFeatureProvider::IFeatureProvider() - \internal -*/ - /*! \fn IFeatureProvider::~IFeatureProvider() \internal */ - -/*! - \fn FetureSet IFeatureProvider::availableFeatures(const QString &platform) const - Returns available features provided by this manager. - \sa FeatureProvider::Features -*/ - -/*! - \class Core::Feature - - \brief The Feature class describes a single feature to be used in - Core::FeatureProvider::Features. - - \sa Core::FeaturesSet - \sa Core::IWizard - \sa QtSupport::QtVersionManager -*/ - -/*! - \class Core::FeatureSet - - \brief The FeatureSet class is a set of available or required feature sets. - - This class behaves similarly to QFlags. However, instead of enums, Features - relies on string ids and is therefore extendable. - - \sa Core::Feature - \sa Core::IWizard - \sa QtSupport::QtVersionManager -*/ - - -/*! - \fn bool FeatureSet::contains(const Feature &feature) const - - Returns true if \a feature is available. -*/ - -/*! - \fn bool FeatureSet::contains(const FeatureSet &features) const - - Returns true if all \a features are available. -*/ - -Core::Feature Core::Feature::versionedFeature(const QByteArray &prefix, int major, int minor) -{ - if (major < 0) - return Feature::fromName(prefix); - - QByteArray result = prefix + '.'; - result += QString::number(major).toLatin1(); - - if (minor < 0) - return Feature::fromName(result); - return Feature::fromName(result + '.' + QString::number(minor).toLatin1()); -} - -Core::FeatureSet Core::FeatureSet::versionedFeatures(const QByteArray &prefix, int major, int minor) -{ - FeatureSet result; - result |= Feature::fromName(prefix); - - if (major < 0) - return result; - - const QByteArray majorStr = QString::number(major).toLatin1(); - const QByteArray featureMajor = prefix + majorStr; - const QByteArray featureDotMajor = prefix + '.' + majorStr; - - result |= Feature::fromName(featureMajor) | Feature::fromName(featureDotMajor); - - for (int i = 0; i <= minor; ++i) { - const QByteArray minorStr = QString::number(i).toLatin1(); - result |= Feature::fromName(featureMajor + '.' + minorStr) - | Feature::fromName(featureDotMajor + '.' + minorStr); - } - - return result; -} diff --git a/src/plugins/coreplugin/featureprovider.h b/src/plugins/coreplugin/featureprovider.h index fc16ac6bdc..e0e0d886c4 100644 --- a/src/plugins/coreplugin/featureprovider.h +++ b/src/plugins/coreplugin/featureprovider.h @@ -45,125 +45,13 @@ class CORE_EXPORT FeatureSet; class CORE_EXPORT IFeatureProvider { public: - IFeatureProvider() {} - virtual ~IFeatureProvider() {} - virtual FeatureSet availableFeatures(const QString &platform) const = 0; + virtual ~IFeatureProvider() = default; + + virtual QSet<Id> availableFeatures(const QString &platform) const = 0; virtual QStringList availablePlatforms() const = 0; virtual QString displayNameForPlatform(const QString &string) const = 0; }; -class CORE_EXPORT Feature : public Id -{ -public: - Feature() = default; - template <int N> Feature(const char(&ch)[N]) : Id(ch) { } - - static Feature fromString(const QString &str) { return Feature(Id::fromString(str)); } - static Feature fromName(const QByteArray &ba) { return Feature(Id::fromName(ba)); } - - static Feature versionedFeature(const QByteArray &prefix, int major = -1, int minor = -1); - -private: - explicit Feature(const Id id) : Id(id) { } -}; - -class CORE_EXPORT FeatureSet : private QSet<Feature> -{ -public: - explicit FeatureSet(Feature id) - { - if (id.isValid()) - insert(id); - } - - FeatureSet() = default; - FeatureSet(const FeatureSet &other) = default; - FeatureSet &operator=(const FeatureSet &other) = default; - - static FeatureSet versionedFeatures(const QByteArray &prefix, int major, int minor = -1); - - using QSet<Feature>::isEmpty; - - bool contains(const Feature &feature) const - { - return QSet<Feature>::contains(feature); - } - - bool contains(const FeatureSet &features) const - { - return QSet<Feature>::contains(features); - } - - void remove(const Feature &feature) - { - QSet<Feature>::remove(feature); - } - - void remove(const FeatureSet &features) - { - QSet<Feature>::subtract(features); - } - - FeatureSet operator|(const Feature &feature) const - { - FeatureSet copy = *this; - if (feature.isValid()) - copy.insert(feature); - return copy; - } - - FeatureSet operator|(const FeatureSet &features) const - { - FeatureSet copy = *this; - if (!features.isEmpty()) - copy.unite(features); - return copy; - } - - FeatureSet &operator|=(const Feature &feature) - { - if (feature.isValid()) - insert(feature); - return *this; - } - - FeatureSet &operator|=(const FeatureSet &features) - { - if (!features.isEmpty()) - unite(features); - return *this; - } - - QStringList toStringList() const - { - QStringList stringList; - foreach (const Feature &feature, QSet<Feature>(*this)) - stringList.append(feature.toString()); - return stringList; - } - - static FeatureSet fromStringList(const QStringList &list) - { - FeatureSet features; - foreach (const QString &i, list) - features |= Feature::fromString(i); - return features; - } -}; - } // namespace Core -/* -The following operators have to be defined in the global namespace! -Otherwise "using namespace Core" would hide other | operators -defined in the global namespace (e. g. QFlags). -*/ - -inline Core::FeatureSet operator |(Core::Feature feature1, Core::Feature feature2) -{ return Core::FeatureSet(feature1) | feature2; } - -inline Core::FeatureSet operator|(Core::Feature feature1, Core::FeatureSet feature2) -{ return feature2 | feature1; } - - #endif // FEATUREPROVIDER_H diff --git a/src/plugins/coreplugin/id.cpp b/src/plugins/coreplugin/id.cpp index 5d0262803d..e3c329b505 100644 --- a/src/plugins/coreplugin/id.cpp +++ b/src/plugins/coreplugin/id.cpp @@ -266,7 +266,9 @@ QSet<Id> Id::fromStringList(const QStringList &list) QStringList Id::toStringList(const QSet<Id> &ids) { - return Utils::transform(ids.toList(), [](Id i) { return i.toString(); }); + QList<Id> idList = ids.toList(); + Utils::sort(idList); + return Utils::transform(idList, [](Id i) { return i.toString(); }); } /*! diff --git a/src/plugins/coreplugin/id.h b/src/plugins/coreplugin/id.h index 2a4bdd3782..3f42c5fbab 100644 --- a/src/plugins/coreplugin/id.h +++ b/src/plugins/coreplugin/id.h @@ -74,8 +74,7 @@ public: static Id fromName(const QByteArray &ba); // FIXME: avoid. static Id fromSetting(const QVariant &variant); // Good to use. - static Id versionedId(const QByteArray &prefix, int major, int minor); - static QSet<Id> versionedIds(const QByteArray &prefix, int major, int minor); + static Id versionedId(const QByteArray &prefix, int major = -1, int minor = -1); static QSet<Id> fromStringList(const QStringList &list); static QStringList toStringList(const QSet<Id> &ids); diff --git a/src/plugins/coreplugin/iwizardfactory.cpp b/src/plugins/coreplugin/iwizardfactory.cpp index 51fb4d6121..bcfe43c612 100644 --- a/src/plugins/coreplugin/iwizardfactory.cpp +++ b/src/plugins/coreplugin/iwizardfactory.cpp @@ -407,27 +407,25 @@ void IWizardFactory::clearWizardFactories() s_areFactoriesLoaded = false; } -FeatureSet IWizardFactory::pluginFeatures() const +QSet<Id> IWizardFactory::pluginFeatures() const { - static FeatureSet plugins; + static QSet<Id> plugins; if (plugins.isEmpty()) { - QStringList list; // Implicitly create a feature for each plugin loaded: foreach (ExtensionSystem::PluginSpec *s, ExtensionSystem::PluginManager::plugins()) { if (s->state() == ExtensionSystem::PluginSpec::Running) - list.append(s->name()); + plugins.insert(Id::fromString(s->name())); } - plugins = FeatureSet::fromStringList(list); } return plugins; } -FeatureSet IWizardFactory::availableFeatures(const QString &platformName) const +QSet<Id> IWizardFactory::availableFeatures(const QString &platformName) const { - FeatureSet availableFeatures; + QSet<Id> availableFeatures; foreach (const IFeatureProvider *featureManager, s_providerList) - availableFeatures |= featureManager->availableFeatures(platformName); + availableFeatures.unite(featureManager->availableFeatures(platformName)); return availableFeatures; } diff --git a/src/plugins/coreplugin/iwizardfactory.h b/src/plugins/coreplugin/iwizardfactory.h index eef809cd53..d0c3f4293b 100644 --- a/src/plugins/coreplugin/iwizardfactory.h +++ b/src/plugins/coreplugin/iwizardfactory.h @@ -71,7 +71,7 @@ public: QString category() const { return m_category; } QString displayCategory() const { return m_displayCategory; } QString descriptionImage() const { return m_descriptionImage; } - FeatureSet requiredFeatures() const { return m_requiredFeatures; } + QSet<Id> requiredFeatures() const { return m_requiredFeatures; } WizardFlags flags() const { return m_flags; } void setId(const Id id) { m_id = id; } @@ -82,8 +82,8 @@ public: void setCategory(const QString &category) { m_category = category; } void setDisplayCategory(const QString &displayCategory) { m_displayCategory = displayCategory; } void setDescriptionImage(const QString &descriptionImage) { m_descriptionImage = descriptionImage; } - void setRequiredFeatures(const FeatureSet &featureSet) { m_requiredFeatures = featureSet; } - void addRequiredFeature(const Feature &feature) { m_requiredFeatures |= feature; } + void setRequiredFeatures(const QSet<Id> &featureSet) { m_requiredFeatures = featureSet; } + void addRequiredFeature(const Id &feature) { m_requiredFeatures |= feature; } void setFlags(WizardFlags flags) { m_flags = flags; } QString runPath(const QString &defaultPath); @@ -115,8 +115,8 @@ public: const QVariantMap &extraVariables); protected: - FeatureSet pluginFeatures() const; - FeatureSet availableFeatures(const QString &platformName) const; + QSet<Id> pluginFeatures() const; + QSet<Id> availableFeatures(const QString &platformName) const; virtual Utils::Wizard *runWizardImpl(const QString &path, QWidget *parent, const QString &platform, const QVariantMap &variables) = 0; @@ -135,7 +135,7 @@ private: QString m_displayCategory; QString m_descriptionImage; Id m_id; - FeatureSet m_requiredFeatures; + QSet<Id> m_requiredFeatures; WizardKind m_kind = FileWizard; WizardFlags m_flags = 0; diff --git a/src/plugins/designer/cpp/formclasswizard.cpp b/src/plugins/designer/cpp/formclasswizard.cpp index 558d92d6d1..d6f5cc9266 100644 --- a/src/plugins/designer/cpp/formclasswizard.cpp +++ b/src/plugins/designer/cpp/formclasswizard.cpp @@ -43,7 +43,7 @@ namespace Internal { FormClassWizard::FormClassWizard() { - setRequiredFeatures(Core::FeatureSet(QtSupport::Constants::FEATURE_QWIDGETS)); + setRequiredFeatures({ QtSupport::Constants::FEATURE_QWIDGETS }); } QString FormClassWizard::headerSuffix() const diff --git a/src/plugins/ios/iosqtversion.cpp b/src/plugins/ios/iosqtversion.cpp index faff6ebeb9..bf064630d9 100644 --- a/src/plugins/ios/iosqtversion.cpp +++ b/src/plugins/ios/iosqtversion.cpp @@ -110,12 +110,12 @@ QString IosQtVersion::description() const return tr("iOS"); } -Core::FeatureSet IosQtVersion::availableFeatures() const +QSet<Core::Id> IosQtVersion::availableFeatures() const { - Core::FeatureSet features = QtSupport::BaseQtVersion::availableFeatures(); - features |= Core::FeatureSet(QtSupport::Constants::FEATURE_MOBILE); - features.remove(Core::Feature(QtSupport::Constants::FEATURE_QT_CONSOLE)); - features.remove(Core::Feature(QtSupport::Constants::FEATURE_QT_WEBKIT)); + QSet<Core::Id> features = QtSupport::BaseQtVersion::availableFeatures(); + features.insert(QtSupport::Constants::FEATURE_MOBILE); + features.remove(QtSupport::Constants::FEATURE_QT_CONSOLE); + features.remove(QtSupport::Constants::FEATURE_QT_WEBKIT); return features; } diff --git a/src/plugins/ios/iosqtversion.h b/src/plugins/ios/iosqtversion.h index e6a25d8d4a..a8d98e2bfb 100644 --- a/src/plugins/ios/iosqtversion.h +++ b/src/plugins/ios/iosqtversion.h @@ -55,7 +55,7 @@ public: void addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const override; - Core::FeatureSet availableFeatures() const override; + QSet<Core::Id> availableFeatures() const override; QString platformName() const override; QString platformDisplayName() const override; diff --git a/src/plugins/projectexplorer/baseprojectwizarddialog.cpp b/src/plugins/projectexplorer/baseprojectwizarddialog.cpp index 69f8c51685..ee07a78ccf 100644 --- a/src/plugins/projectexplorer/baseprojectwizarddialog.cpp +++ b/src/plugins/projectexplorer/baseprojectwizarddialog.cpp @@ -54,7 +54,7 @@ struct BaseProjectWizardDialogPrivate { Utils::ProjectIntroPage *introPage; int introPageId; QString selectedPlatform; - Core::FeatureSet requiredFeatureSet; + QSet<Core::Id> requiredFeatureSet; }; BaseProjectWizardDialogPrivate::BaseProjectWizardDialogPrivate(Utils::ProjectIntroPage *page, int id) : @@ -199,12 +199,12 @@ void BaseProjectWizardDialog::setSelectedPlatform(const QString &platform) d->selectedPlatform = platform; } -Core::FeatureSet BaseProjectWizardDialog::requiredFeatures() const +QSet<Core::Id> BaseProjectWizardDialog::requiredFeatures() const { return d->requiredFeatureSet; } -void BaseProjectWizardDialog::setRequiredFeatures(const Core::FeatureSet &featureSet) +void BaseProjectWizardDialog::setRequiredFeatures(const QSet<Core::Id> &featureSet) { d->requiredFeatureSet = featureSet; } diff --git a/src/plugins/projectexplorer/baseprojectwizarddialog.h b/src/plugins/projectexplorer/baseprojectwizarddialog.h index 300b15d8ba..c1dade2de9 100644 --- a/src/plugins/projectexplorer/baseprojectwizarddialog.h +++ b/src/plugins/projectexplorer/baseprojectwizarddialog.h @@ -80,8 +80,8 @@ protected: QString selectedPlatform() const; void setSelectedPlatform(const QString &platform); - Core::FeatureSet requiredFeatures() const; - void setRequiredFeatures(const Core::FeatureSet &featureSet); + QSet<Core::Id> requiredFeatures() const; + void setRequiredFeatures(const QSet<Core::Id> &featureSet); private: void init(); diff --git a/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp b/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp index 19a161c0a6..56e81e8246 100644 --- a/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp +++ b/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp @@ -457,13 +457,13 @@ static inline IWizardFactory::WizardKind kindAttribute(const QXmlStreamReader &r return IWizardFactory::ProjectWizard; } -static inline FeatureSet readRequiredFeatures(const QXmlStreamReader &reader) +static inline QSet<Id> readRequiredFeatures(const QXmlStreamReader &reader) { QString value = reader.attributes().value(QLatin1String(featuresRequiredC)).toString(); QStringList stringList = value.split(QLatin1Char(','), QString::SkipEmptyParts); - FeatureSet features; + QSet<Id> features; foreach (const QString &string, stringList) - features |= Feature::fromString(string); + features |= Id::fromString(string); return features; } diff --git a/src/plugins/projectexplorer/customwizard/customwizardparameters.h b/src/plugins/projectexplorer/customwizard/customwizardparameters.h index 329b038cd9..bb66b2da1f 100644 --- a/src/plugins/projectexplorer/customwizard/customwizardparameters.h +++ b/src/plugins/projectexplorer/customwizard/customwizardparameters.h @@ -134,7 +134,7 @@ public: QString displayName; QString category; QString displayCategory; - Core::FeatureSet requiredFeatures; + QSet<Core::Id> requiredFeatures; Core::IWizardFactory::WizardFlags flags; }; diff --git a/src/plugins/projectexplorer/jsonwizard/jsonkitspage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonkitspage.cpp index 8f4b49b4f8..8514dc6b22 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonkitspage.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonkitspage.cpp @@ -63,9 +63,9 @@ void JsonKitsPage::initializePage() connect(wiz, &JsonWizard::filesPolished, this, &JsonKitsPage::setupProjectFiles); const QString platform = wiz->stringValue(QLatin1String("Platform")); - const FeatureSet preferred + const QSet<Id> preferred = evaluate(m_preferredFeatures, wiz->value(QLatin1String("PreferredFeatures")), wiz); - const FeatureSet required + const QSet<Id> required = evaluate(m_requiredFeatures, wiz->value(QLatin1String("RequiredFeatures")), wiz); setRequiredKitMatcher(KitMatcher([required](const Kit *k) { return k->hasFeatures(required); })); @@ -133,16 +133,16 @@ void JsonKitsPage::setupProjectFiles(const JsonWizard::GeneratorFiles &files) } } -FeatureSet JsonKitsPage::evaluate(const QVector<JsonKitsPage::ConditionalFeature> &list, - const QVariant &defaultSet, JsonWizard *wiz) +QSet<Id> JsonKitsPage::evaluate(const QVector<JsonKitsPage::ConditionalFeature> &list, + const QVariant &defaultSet, JsonWizard *wiz) { if (list.isEmpty()) - return FeatureSet::fromStringList(defaultSet.toStringList()); + return Id::fromStringList(defaultSet.toStringList()); - FeatureSet features; + QSet<Id> features; foreach (const ConditionalFeature &f, list) { if (JsonWizard::boolFromVariant(f.condition, wiz->expander())) - features |= Feature::fromString(wiz->expander()->expand(f.feature)); + features.insert(Id::fromString(wiz->expander()->expand(f.feature))); } return features; } diff --git a/src/plugins/projectexplorer/jsonwizard/jsonkitspage.h b/src/plugins/projectexplorer/jsonwizard/jsonkitspage.h index ac9dd50a22..c4158be587 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonkitspage.h +++ b/src/plugins/projectexplorer/jsonwizard/jsonkitspage.h @@ -76,7 +76,7 @@ private: QVector<ConditionalFeature> m_requiredFeatures; QVector<ConditionalFeature> m_preferredFeatures; - Core::FeatureSet evaluate(const QVector<ConditionalFeature> &list, const QVariant &defaultSet, + QSet<Core::Id> evaluate(const QVector<ConditionalFeature> &list, const QVariant &defaultSet, JsonWizard *wiz); }; diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp index 36d0b425b8..23cc89fafb 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp @@ -365,15 +365,15 @@ Utils::Wizard *JsonWizardFactory::runWizardImpl(const QString &path, QWidget *pa wizard->setWindowTitle(displayName()); wizard->setValue(QStringLiteral("WizardDir"), m_wizardDir); - Core::FeatureSet tmp = requiredFeatures(); - tmp.remove(pluginFeatures()); - wizard->setValue(QStringLiteral("RequiredFeatures"), tmp.toStringList()); + QSet<Core::Id> tmp = requiredFeatures(); + tmp.subtract(pluginFeatures()); + wizard->setValue(QStringLiteral("RequiredFeatures"), Core::Id::toStringList(tmp)); tmp = m_preferredFeatures; - tmp.remove(pluginFeatures()); - wizard->setValue(QStringLiteral("PreferredFeatures"), tmp.toStringList()); + tmp.subtract(pluginFeatures()); + wizard->setValue(QStringLiteral("PreferredFeatures"), Core::Id::toStringList(tmp)); - wizard->setValue(QStringLiteral("Features"), availableFeatures(platform).toStringList()); - wizard->setValue(QStringLiteral("Plugins"), pluginFeatures().toStringList()); + wizard->setValue(QStringLiteral("Features"), Core::Id::toStringList(availableFeatures(platform))); + wizard->setValue(QStringLiteral("Plugins"), Core::Id::toStringList(pluginFeatures())); // Add data to wizard: for (auto i = variables.constBegin(); i != variables.constEnd(); ++i) @@ -493,9 +493,9 @@ bool JsonWizardFactory::isAvailable(const QString &platformName) const expander.registerVariable("Platform", tr("The platform selected for the wizard."), [platformName]() { return platformName; }); expander.registerVariable("Features", tr("The features available to this wizard."), - [this, e, platformName]() { return JsonWizard::stringListToArrayString(availableFeatures(platformName).toStringList(), e); }); + [this, e, platformName]() { return JsonWizard::stringListToArrayString(Core::Id::toStringList(availableFeatures(platformName)), e); }); expander.registerVariable("Plugins", tr("The plugins loaded."), - [this, e]() { return JsonWizard::stringListToArrayString(pluginFeatures().toStringList(), e); }); + [this, e]() { return JsonWizard::stringListToArrayString(Core::Id::toStringList(pluginFeatures()), e); }); return JsonWizard::boolFromVariant(m_enabledExpression, &expander); } @@ -564,9 +564,9 @@ bool JsonWizardFactory::initialize(const QVariantMap &data, const QDir &baseDir, setDescriptionImage(strVal); } - setRequiredFeatures(Core::FeatureSet::fromStringList(data.value(QLatin1String(REQUIRED_FEATURES_KEY)).toStringList())); - m_preferredFeatures = Core::FeatureSet::fromStringList(data.value(QLatin1String(SUGGESTED_FEATURES_KEY)).toStringList()); - m_preferredFeatures |= requiredFeatures(); + setRequiredFeatures(Core::Id::fromStringList(data.value(QLatin1String(REQUIRED_FEATURES_KEY)).toStringList())); + m_preferredFeatures = Core::Id::fromStringList(data.value(QLatin1String(SUGGESTED_FEATURES_KEY)).toStringList()); + m_preferredFeatures.unite(requiredFeatures()); strVal = localizedString(data.value(QLatin1String(DISPLAY_NAME_KEY))); if (strVal.isEmpty()) { diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.h b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.h index d5750dae91..280af740be 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.h +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.h @@ -117,7 +117,7 @@ private: QList<Page> m_pages; QMap<QString, QString> m_options; - Core::FeatureSet m_preferredFeatures; + QSet<Core::Id> m_preferredFeatures; static int m_verbose; diff --git a/src/plugins/projectexplorer/kit.cpp b/src/plugins/projectexplorer/kit.cpp index 408c7941ab..6415436694 100644 --- a/src/plugins/projectexplorer/kit.cpp +++ b/src/plugins/projectexplorer/kit.cpp @@ -639,15 +639,15 @@ QString Kit::displayNameForPlatform(const QString &platform) const } -FeatureSet Kit::availableFeatures() const +QSet<Id> Kit::availableFeatures() const { - FeatureSet features; + QSet<Id> features; foreach (const KitInformation *ki, KitManager::kitInformation()) features |= ki->availableFeatures(this); return features; } -bool Kit::hasFeatures(const FeatureSet &features) const +bool Kit::hasFeatures(const QSet<Id> &features) const { return availableFeatures().contains(features); } diff --git a/src/plugins/projectexplorer/kit.h b/src/plugins/projectexplorer/kit.h index 64a300eee6..8101ea4a65 100644 --- a/src/plugins/projectexplorer/kit.h +++ b/src/plugins/projectexplorer/kit.h @@ -124,8 +124,8 @@ public: QSet<QString> availablePlatforms() const; bool hasPlatform(const QString &platform) const; QString displayNameForPlatform(const QString &platform) const; - Core::FeatureSet availableFeatures() const; - bool hasFeatures(const Core::FeatureSet &features) const; + QSet<Core::Id> availableFeatures() const; + bool hasFeatures(const QSet<Core::Id> &features) const; Utils::MacroExpander *macroExpander() const; private: diff --git a/src/plugins/projectexplorer/kitfeatureprovider.h b/src/plugins/projectexplorer/kitfeatureprovider.h index 8ee2c1436a..1bb2b55d31 100644 --- a/src/plugins/projectexplorer/kitfeatureprovider.h +++ b/src/plugins/projectexplorer/kitfeatureprovider.h @@ -40,7 +40,7 @@ namespace Internal { class KitFeatureProvider : public Core::IFeatureProvider { public: - Core::FeatureSet availableFeatures(const QString &platform) const; + QSet<Core::Id> availableFeatures(const QString &platform) const; QStringList availablePlatforms() const; QString displayNameForPlatform(const QString &string) const; }; diff --git a/src/plugins/projectexplorer/kitinformation.cpp b/src/plugins/projectexplorer/kitinformation.cpp index 65ef02d67c..4326f1fbfb 100644 --- a/src/plugins/projectexplorer/kitinformation.cpp +++ b/src/plugins/projectexplorer/kitinformation.cpp @@ -341,12 +341,12 @@ KitMatcher DeviceTypeKitInformation::deviceTypeMatcher(Core::Id type) }); } -Core::FeatureSet DeviceTypeKitInformation::availableFeatures(const Kit *k) const +QSet<Core::Id> DeviceTypeKitInformation::availableFeatures(const Kit *k) const { Core::Id id = DeviceTypeKitInformation::deviceTypeId(k); - Core::FeatureSet result; + QSet<Core::Id> result; if (id.isValid()) - result |= Core::Feature::fromString(QString::fromLatin1("DeviceType.") + id.toString()); + result |= Core::Id::fromString(QString::fromLatin1("DeviceType.") + id.toString()); return result; } diff --git a/src/plugins/projectexplorer/kitinformation.h b/src/plugins/projectexplorer/kitinformation.h index 1f14cc7d99..6a87492b36 100644 --- a/src/plugins/projectexplorer/kitinformation.h +++ b/src/plugins/projectexplorer/kitinformation.h @@ -133,7 +133,7 @@ public: static KitMatcher deviceTypeMatcher(Core::Id type); - Core::FeatureSet availableFeatures(const Kit *k) const; + QSet<Core::Id> availableFeatures(const Kit *k) const; }; // -------------------------------------------------------------------------- diff --git a/src/plugins/projectexplorer/kitmanager.cpp b/src/plugins/projectexplorer/kitmanager.cpp index 05f75c3df5..3101ca09a6 100644 --- a/src/plugins/projectexplorer/kitmanager.cpp +++ b/src/plugins/projectexplorer/kitmanager.cpp @@ -320,9 +320,9 @@ QString KitManager::displayNameForPlatform(const QString &platform) return QString(); } -FeatureSet KitManager::availableFeatures(const QString &platform) +QSet<Id> KitManager::availableFeatures(const QString &platform) { - FeatureSet features; + QSet<Id> features; foreach (const Kit *k, kits()) { QSet<QString> kitPlatforms = k->availablePlatforms(); if (kitPlatforms.isEmpty() || kitPlatforms.contains(platform) || platform.isEmpty()) @@ -566,10 +566,10 @@ QString KitInformation::displayNameForPlatform(const Kit *k, const QString &plat return QString(); } -FeatureSet KitInformation::availableFeatures(const Kit *k) const +QSet<Id> KitInformation::availableFeatures(const Kit *k) const { Q_UNUSED(k); - return FeatureSet(); + return QSet<Id>(); } void KitInformation::addToMacroExpander(Kit *k, MacroExpander *expander) const @@ -588,7 +588,7 @@ void KitInformation::notifyAboutUpdate(Kit *k) // KitFeatureProvider: // -------------------------------------------------------------------- -FeatureSet KitFeatureProvider::availableFeatures(const QString &platform) const +QSet<Id> KitFeatureProvider::availableFeatures(const QString &platform) const { return KitManager::availableFeatures(platform); } diff --git a/src/plugins/projectexplorer/kitmanager.h b/src/plugins/projectexplorer/kitmanager.h index 6f53f39574..2168cd6d12 100644 --- a/src/plugins/projectexplorer/kitmanager.h +++ b/src/plugins/projectexplorer/kitmanager.h @@ -97,7 +97,7 @@ public: virtual QSet<QString> availablePlatforms(const Kit *k) const; virtual QString displayNameForPlatform(const Kit *k, const QString &platform) const; - virtual Core::FeatureSet availableFeatures(const Kit *k) const; + virtual QSet<Core::Id> availableFeatures(const Kit *k) const; virtual void addToMacroExpander(ProjectExplorer::Kit *kit, Utils::MacroExpander *expander) const; @@ -154,7 +154,7 @@ public: static QSet<QString> availablePlatforms(); static QString displayNameForPlatform(const QString &platform); - static Core::FeatureSet availableFeatures(const QString &platform); + static QSet<Core::Id> availableFeatures(const QString &platform); static QList<Kit *> sortKits(const QList<Kit *> kits); // Avoid sorting whenever possible! diff --git a/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwizard.cpp b/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwizard.cpp index 480d585e54..a1801ffbd4 100644 --- a/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwizard.cpp +++ b/src/plugins/qmakeprojectmanager/customwidgetwizard/customwidgetwizard.cpp @@ -52,7 +52,7 @@ CustomWidgetWizard::CustomWidgetWizard() setDisplayName(tr("Qt Custom Designer Widget")); setDescription(tr("Creates a Qt Custom Designer Widget or a Custom Widget Collection.")); setIcon(QIcon(QLatin1String(":/wizards/images/gui.png"))); - setRequiredFeatures(Core::FeatureSet(QtSupport::Constants::FEATURE_QWIDGETS)); + setRequiredFeatures({ QtSupport::Constants::FEATURE_QWIDGETS }); } Core::BaseFileWizard *CustomWidgetWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const diff --git a/src/plugins/qmakeprojectmanager/wizards/guiappwizard.cpp b/src/plugins/qmakeprojectmanager/wizards/guiappwizard.cpp index b0921cc9e1..6272586eab 100644 --- a/src/plugins/qmakeprojectmanager/wizards/guiappwizard.cpp +++ b/src/plugins/qmakeprojectmanager/wizards/guiappwizard.cpp @@ -83,7 +83,7 @@ GuiAppWizard::GuiAppWizard() "Includes a Qt Designer-based main window.\n\n" "Preselects a desktop Qt for building the application if available.")); setIcon(QIcon(QLatin1String(":/wizards/images/gui.png"))); - setRequiredFeatures(Core::FeatureSet(QtSupport::Constants::FEATURE_QWIDGETS)); + setRequiredFeatures({ QtSupport::Constants::FEATURE_QWIDGETS }); } Core::BaseFileWizard *GuiAppWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const diff --git a/src/plugins/qmakeprojectmanager/wizards/librarywizard.cpp b/src/plugins/qmakeprojectmanager/wizards/librarywizard.cpp index f509bdd877..e0a32bb0c1 100644 --- a/src/plugins/qmakeprojectmanager/wizards/librarywizard.cpp +++ b/src/plugins/qmakeprojectmanager/wizards/librarywizard.cpp @@ -56,7 +56,7 @@ LibraryWizard::LibraryWizard() "<li>a shared C++ library for use with <tt>QPluginLoader</tt> and runtime (Plugins)</li>" "<li>a shared or static C++ library for use with another project at linktime</li></ul>")); setIcon(QIcon(QLatin1String(":/wizards/images/lib.png"))); - setRequiredFeatures(Core::FeatureSet(Core::Feature::versionedFeature(QtSupport::Constants::FEATURE_QT_PREFIX))); + setRequiredFeatures({ QtSupport::Constants::FEATURE_QT_PREFIX }); } Core::BaseFileWizard *LibraryWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const diff --git a/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp b/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp index 5835ec3bf8..ac73757151 100644 --- a/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp +++ b/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp @@ -204,7 +204,7 @@ int BaseQmakeProjectWizardDialog::addTargetSetupPage(int id) { m_targetSetupPage = new ProjectExplorer::TargetSetupPage; const QString platform = selectedPlatform(); - Core::FeatureSet features = Core::FeatureSet(QtSupport::Constants::FEATURE_DESKTOP); + QSet<Core::Id> features = { QtSupport::Constants::FEATURE_DESKTOP }; if (platform.isEmpty()) m_targetSetupPage->setPreferredKitMatcher(QtKitInformation::qtVersionMatcher(features)); else diff --git a/src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizard.cpp b/src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizard.cpp index ef736b9351..ae4335f68e 100644 --- a/src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizard.cpp +++ b/src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizard.cpp @@ -51,7 +51,7 @@ SubdirsProjectWizard::SubdirsProjectWizard() setDescription(tr("Creates a qmake-based subdirs project. This allows you to group " "your projects in a tree structure.")); setIcon(QIcon(QLatin1String(":/wizards/images/gui.png"))); - setRequiredFeatures(Core::FeatureSet(Core::Feature::versionedFeature(QtSupport::Constants::FEATURE_QT_PREFIX))); + setRequiredFeatures({ QtSupport::Constants::FEATURE_QT_PREFIX }); } Core::BaseFileWizard *SubdirsProjectWizard::create(QWidget *parent, diff --git a/src/plugins/qmakeprojectmanager/wizards/testwizard.cpp b/src/plugins/qmakeprojectmanager/wizards/testwizard.cpp index 7aa03dc262..92de2a55ca 100644 --- a/src/plugins/qmakeprojectmanager/wizards/testwizard.cpp +++ b/src/plugins/qmakeprojectmanager/wizards/testwizard.cpp @@ -56,8 +56,7 @@ TestWizard::TestWizard() "Unit tests allow you to verify that the code is fit for use " "and that there are no regressions.")); setIcon(QIcon(QLatin1String(":/wizards/images/console.png"))); - setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QT_CONSOLE) | - Core::Feature::versionedFeature(QtSupport::Constants::FEATURE_QT_PREFIX)); + setRequiredFeatures({ QtSupport::Constants::FEATURE_QT_CONSOLE, QtSupport::Constants::FEATURE_QT_PREFIX }); } Core::BaseFileWizard *TestWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const diff --git a/src/plugins/qmljstools/qmljsbundleprovider.cpp b/src/plugins/qmljstools/qmljsbundleprovider.cpp index 78a7f78aef..68ce51acad 100644 --- a/src/plugins/qmljstools/qmljsbundleprovider.cpp +++ b/src/plugins/qmljstools/qmljsbundleprovider.cpp @@ -130,8 +130,8 @@ void BasicBundleProvider::mergeBundlesForKit(ProjectExplorer::Kit *kit QString qtImportsPath = qtVersion->qmakeProperty("QT_INSTALL_IMPORTS"); QString qtQmlPath = qtVersion->qmakeProperty("QT_INSTALL_QML"); - Core::FeatureSet features = qtVersion->availableFeatures(); - if (features.contains(Core::Feature::versionedFeature(QtSupport::Constants::FEATURE_QT_QUICK_PREFIX))) { + QSet<Core::Id> features = qtVersion->availableFeatures(); + if (features.contains(QtSupport::Constants::FEATURE_QT_QUICK_PREFIX)) { myReplacements.insert(QLatin1String("$(CURRENT_DIRECTORY)"), qtImportsPath); QDir qtQuick1Bundles(qtImportsPath); qtQuick1Bundles.setNameFilters(QStringList(QLatin1String("*-bundle.json"))); @@ -156,7 +156,7 @@ void BasicBundleProvider::mergeBundlesForKit(ProjectExplorer::Kit *kit bundles.mergeBundleForLanguage(Dialect::Qml, qtQuick1Bundle); bundles.mergeBundleForLanguage(Dialect::QmlQtQuick1, qtQuick1Bundle); } - if (features.contains(Core::Feature::versionedFeature(QtSupport::Constants::FEATURE_QT_QUICK_PREFIX, 2))) { + if (features.contains(Core::Id::versionedId(QtSupport::Constants::FEATURE_QT_QUICK_PREFIX, 2))) { myReplacements.insert(QLatin1String("$(CURRENT_DIRECTORY)"), qtQmlPath); QDir qtQuick2Bundles(qtQmlPath); qtQuick2Bundles.setNameFilters(QStringList(QLatin1String("*-bundle.json"))); diff --git a/src/plugins/qnx/qnxqtversion.cpp b/src/plugins/qnx/qnxqtversion.cpp index 95fa5f871f..733251945b 100644 --- a/src/plugins/qnx/qnxqtversion.cpp +++ b/src/plugins/qnx/qnxqtversion.cpp @@ -76,12 +76,12 @@ QString QnxQtVersion::description() const return QCoreApplication::translate("Qnx::Internal::QnxQtVersion", "QNX %1").arg(archString()); } -Core::FeatureSet QnxQtVersion::availableFeatures() const +QSet<Core::Id> QnxQtVersion::availableFeatures() const { - Core::FeatureSet features = QtSupport::BaseQtVersion::availableFeatures(); - features |= Core::FeatureSet(Constants::QNX_QNX_FEATURE); - features.remove(Core::Feature(QtSupport::Constants::FEATURE_QT_CONSOLE)); - features.remove(Core::Feature(QtSupport::Constants::FEATURE_QT_WEBKIT)); + QSet<Core::Id> features = QtSupport::BaseQtVersion::availableFeatures(); + features.insert(Constants::QNX_QNX_FEATURE); + features.remove(QtSupport::Constants::FEATURE_QT_CONSOLE); + features.remove(QtSupport::Constants::FEATURE_QT_WEBKIT); return features; } diff --git a/src/plugins/qnx/qnxqtversion.h b/src/plugins/qnx/qnxqtversion.h index 737853c291..d654d240f4 100644 --- a/src/plugins/qnx/qnxqtversion.h +++ b/src/plugins/qnx/qnxqtversion.h @@ -56,7 +56,7 @@ public: QString description() const override; - Core::FeatureSet availableFeatures() const override; + QSet<Core::Id> availableFeatures() const override; QString platformName() const override; QString platformDisplayName() const override; diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 42e9aa46f3..09522e3c57 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -76,7 +76,7 @@ static const char QTVERSIONQMAKEPATH[] = "QMakePath"; static const char MKSPEC_VALUE_LIBINFIX[] = "QT_LIBINFIX"; static const char MKSPEC_VALUE_NAMESPACE[] = "QT_NAMESPACE"; -QSet<Id> static versionedIds(const QByteArray &prefix, int major, int minor) +static QSet<Id> versionedIds(const QByteArray &prefix, int major, int minor) { QSet<Id> result; result.insert(Id::fromName(prefix)); @@ -120,9 +120,9 @@ QtVersionNumber::QtVersionNumber() majorVersion = minorVersion = patchVersion = -1; } -FeatureSet QtVersionNumber::features() const +QSet<Id> QtVersionNumber::features() const { - return FeatureSet::versionedFeatures(Constants::FEATURE_QT_PREFIX, majorVersion, minorVersion); + return versionedIds(Constants::FEATURE_QT_PREFIX, majorVersion, minorVersion); } bool QtVersionNumber::matches(int major, int minor, int patch) const @@ -392,63 +392,63 @@ QString BaseQtVersion::defaultUnexpandedDisplayName(const FileName &qmakePath, b QCoreApplication::translate("QtVersion", "Qt %{Qt:Version} (%2)").arg(location); } -FeatureSet BaseQtVersion::availableFeatures() const +QSet<Id> BaseQtVersion::availableFeatures() const { - FeatureSet features = qtVersion().features(); // Qt Version features + QSet<Id> features = qtVersion().features(); // Qt Version features - features |= (Feature(Constants::FEATURE_QWIDGETS) - | Feature(Constants::FEATURE_QT_WEBKIT) - | Feature(Constants::FEATURE_QT_CONSOLE)); + features.insert(Constants::FEATURE_QWIDGETS); + features.insert(Constants::FEATURE_QT_WEBKIT); + features.insert(Constants::FEATURE_QT_CONSOLE); if (qtVersion() < QtVersionNumber(4, 7, 0)) return features; - features |= FeatureSet::versionedFeatures(Constants::FEATURE_QT_QUICK_PREFIX, 1, 0); + features.unite(versionedIds(Constants::FEATURE_QT_QUICK_PREFIX, 1, 0)); if (qtVersion().matches(4, 7, 0)) return features; - features |= FeatureSet::versionedFeatures(Constants::FEATURE_QT_QUICK_PREFIX, 1, 1); + features.unite(versionedIds(Constants::FEATURE_QT_QUICK_PREFIX, 1, 1)); if (qtVersion().matches(4)) return features; - features |= FeatureSet::versionedFeatures(Constants::FEATURE_QT_QUICK_PREFIX, 2, 0); + features.unite(versionedIds(Constants::FEATURE_QT_QUICK_PREFIX, 2, 0)); if (qtVersion().matches(5, 0)) return features; - features |= FeatureSet::versionedFeatures(Constants::FEATURE_QT_QUICK_PREFIX, 2, 1); - features |= FeatureSet::versionedFeatures(Constants::FEATURE_QT_QUICK_CONTROLS_PREFIX, 1, 0); + features.unite(versionedIds(Constants::FEATURE_QT_QUICK_PREFIX, 2, 1)); + features.unite(versionedIds(Constants::FEATURE_QT_QUICK_CONTROLS_PREFIX, 1, 0)); if (qtVersion().matches(5, 1)) return features; - features |= FeatureSet::versionedFeatures(Constants::FEATURE_QT_QUICK_PREFIX, 2, 2); - features |= FeatureSet::versionedFeatures(Constants::FEATURE_QT_QUICK_CONTROLS_PREFIX, 1, 1); + features.unite(versionedIds(Constants::FEATURE_QT_QUICK_PREFIX, 2, 2)); + features.unite(versionedIds(Constants::FEATURE_QT_QUICK_CONTROLS_PREFIX, 1, 1)); if (qtVersion().matches(5, 2)) return features; - features |= FeatureSet::versionedFeatures(Constants::FEATURE_QT_QUICK_PREFIX, 2, 3); - features |= FeatureSet::versionedFeatures(Constants::FEATURE_QT_QUICK_CONTROLS_PREFIX, 1, 2); + features.unite(versionedIds(Constants::FEATURE_QT_QUICK_PREFIX, 2, 3)); + features.unite(versionedIds(Constants::FEATURE_QT_QUICK_CONTROLS_PREFIX, 1, 2)); if (qtVersion().matches(5, 3)) return features; - features |= Feature(Constants::FEATURE_QT_QUICK_UI_FILES); + features.insert(Constants::FEATURE_QT_QUICK_UI_FILES); - features |= FeatureSet::versionedFeatures(Constants::FEATURE_QT_QUICK_PREFIX, 2, 4); - features |= FeatureSet::versionedFeatures(Constants::FEATURE_QT_QUICK_CONTROLS_PREFIX, 1, 3); + features.unite(versionedIds(Constants::FEATURE_QT_QUICK_PREFIX, 2, 4)); + features.unite(versionedIds(Constants::FEATURE_QT_QUICK_CONTROLS_PREFIX, 1, 3)); if (qtVersion().matches(5, 4)) return features; - features |= Feature(Constants::FEATURE_QT_3D); - features |= Feature(Constants::FEATURE_QT_CANVAS3D); + features.insert(Constants::FEATURE_QT_3D); + features.insert(Constants::FEATURE_QT_CANVAS3D); - features |= FeatureSet::versionedFeatures(Constants::FEATURE_QT_QUICK_PREFIX, 2, 5); - features |= FeatureSet::versionedFeatures(Constants::FEATURE_QT_QUICK_CONTROLS_PREFIX, 1, 4); + features.unite(versionedIds(Constants::FEATURE_QT_QUICK_PREFIX, 2, 5)); + features.unite(versionedIds(Constants::FEATURE_QT_QUICK_CONTROLS_PREFIX, 1, 4)); if (qtVersion().matches(5, 5)) return features; diff --git a/src/plugins/qtsupport/baseqtversion.h b/src/plugins/qtsupport/baseqtversion.h index f9ea7b473e..e56d86b4ff 100644 --- a/src/plugins/qtsupport/baseqtversion.h +++ b/src/plugins/qtsupport/baseqtversion.h @@ -42,7 +42,7 @@ #include <QVariantMap> namespace Utils { class Environment; } -namespace Core { class FeatureSet; } +namespace Core { class Id; } namespace ProjectExplorer { class IOutputParser; @@ -68,7 +68,7 @@ public: QtVersionNumber(const QString &versionString); QtVersionNumber(); - Core::FeatureSet features() const; + QSet<Core::Id> features() const; int majorVersion; int minorVersion; @@ -205,7 +205,7 @@ public: static QString defaultUnexpandedDisplayName(const Utils::FileName &qmakePath, bool fromPath = false); - virtual Core::FeatureSet availableFeatures() const; + virtual QSet<Core::Id> availableFeatures() const; virtual QString platformName() const; virtual QString platformDisplayName() const; virtual bool supportsPlatform(const QString &platformName) const; diff --git a/src/plugins/qtsupport/desktopqtversion.cpp b/src/plugins/qtsupport/desktopqtversion.cpp index 01658dd1bd..b71bb709b8 100644 --- a/src/plugins/qtsupport/desktopqtversion.cpp +++ b/src/plugins/qtsupport/desktopqtversion.cpp @@ -82,11 +82,11 @@ QString DesktopQtVersion::description() const return QCoreApplication::translate("QtVersion", "Desktop", "Qt Version is meant for the desktop"); } -Core::FeatureSet DesktopQtVersion::availableFeatures() const +QSet<Core::Id> DesktopQtVersion::availableFeatures() const { - Core::FeatureSet features = BaseQtVersion::availableFeatures(); - features |= Core::FeatureSet(Constants::FEATURE_DESKTOP); - features |= Core::Feature(Constants::FEATURE_QMLPROJECT); + QSet<Core::Id> features = BaseQtVersion::availableFeatures(); + features.insert(Constants::FEATURE_DESKTOP); + features.insert(Constants::FEATURE_QMLPROJECT); return features; } diff --git a/src/plugins/qtsupport/desktopqtversion.h b/src/plugins/qtsupport/desktopqtversion.h index 4e8a1c8462..ff1a5c59f4 100644 --- a/src/plugins/qtsupport/desktopqtversion.h +++ b/src/plugins/qtsupport/desktopqtversion.h @@ -51,7 +51,7 @@ public: QString description() const; - Core::FeatureSet availableFeatures() const; + QSet<Core::Id> availableFeatures() const; QString platformName() const; QString platformDisplayName() const; }; diff --git a/src/plugins/qtsupport/qtkitinformation.cpp b/src/plugins/qtsupport/qtkitinformation.cpp index 68e529fd6e..9aa10f7dcd 100644 --- a/src/plugins/qtsupport/qtkitinformation.cpp +++ b/src/plugins/qtsupport/qtkitinformation.cpp @@ -228,7 +228,7 @@ KitMatcher QtKitInformation::platformMatcher(const QString &platform) }); } -KitMatcher QtKitInformation::qtVersionMatcher(const Core::FeatureSet &required, +KitMatcher QtKitInformation::qtVersionMatcher(const QSet<Core::Id> &required, const QtVersionNumber &min, const QtVersionNumber &max) { return std::function<bool(const Kit *)>([required, min, max](const Kit *kit) -> bool { @@ -264,10 +264,10 @@ QString QtKitInformation::displayNameForPlatform(const Kit *k, const QString &pl return QString(); } -Core::FeatureSet QtKitInformation::availableFeatures(const Kit *k) const +QSet<Core::Id> QtKitInformation::availableFeatures(const Kit *k) const { BaseQtVersion *version = QtKitInformation::qtVersion(k); - return version ? version->availableFeatures() : Core::FeatureSet(); + return version ? version->availableFeatures() : QSet<Core::Id>(); } } // namespace QtSupport diff --git a/src/plugins/qtsupport/qtkitinformation.h b/src/plugins/qtsupport/qtkitinformation.h index 8c5f314c6b..9478082429 100644 --- a/src/plugins/qtsupport/qtkitinformation.h +++ b/src/plugins/qtsupport/qtkitinformation.h @@ -70,13 +70,13 @@ public: static void setQtVersion(ProjectExplorer::Kit *k, const BaseQtVersion *v); static ProjectExplorer::KitMatcher platformMatcher(const QString &availablePlatforms); - static ProjectExplorer::KitMatcher qtVersionMatcher(const Core::FeatureSet &required = Core::FeatureSet(), + static ProjectExplorer::KitMatcher qtVersionMatcher(const QSet<Core::Id> &required = QSet<Core::Id>(), const QtVersionNumber &min = QtVersionNumber(0, 0, 0), const QtVersionNumber &max = QtVersionNumber(INT_MAX, INT_MAX, INT_MAX)); QSet<QString> availablePlatforms(const ProjectExplorer::Kit *k) const; QString displayNameForPlatform(const ProjectExplorer::Kit *k, const QString &platform) const; - Core::FeatureSet availableFeatures(const ProjectExplorer::Kit *k) const; + QSet<Core::Id> availableFeatures(const ProjectExplorer::Kit *k) const; private slots: void qtVersionsChanged(const QList<int> &addedIds, diff --git a/src/plugins/winrt/winrtqtversion.cpp b/src/plugins/winrt/winrtqtversion.cpp index 07728e6845..d899da3bff 100644 --- a/src/plugins/winrt/winrtqtversion.cpp +++ b/src/plugins/winrt/winrtqtversion.cpp @@ -64,13 +64,13 @@ QString WinRtQtVersion::description() const return tr("Windows Runtime"); } -Core::FeatureSet WinRtQtVersion::availableFeatures() const +QSet<Core::Id> WinRtQtVersion::availableFeatures() const { - Core::FeatureSet features = QtSupport::BaseQtVersion::availableFeatures(); - features |= Core::FeatureSet(QtSupport::Constants::FEATURE_MOBILE); - features.remove(Core::Feature(QtSupport::Constants::FEATURE_QT_CONSOLE)); - features.remove(Core::Feature::versionedFeature(QtSupport::Constants::FEATURE_QT_QUICK_CONTROLS_PREFIX, 1)); - features.remove(Core::Feature(QtSupport::Constants::FEATURE_QT_WEBKIT)); + QSet<Core::Id> features = QtSupport::BaseQtVersion::availableFeatures(); + features.insert(QtSupport::Constants::FEATURE_MOBILE); + features.remove(QtSupport::Constants::FEATURE_QT_CONSOLE); + features.remove(Core::Id::versionedId(QtSupport::Constants::FEATURE_QT_QUICK_CONTROLS_PREFIX, 1)); + features.remove(QtSupport::Constants::FEATURE_QT_WEBKIT); return features; } diff --git a/src/plugins/winrt/winrtqtversion.h b/src/plugins/winrt/winrtqtversion.h index 4e5d8b6d64..6036d16e0f 100644 --- a/src/plugins/winrt/winrtqtversion.h +++ b/src/plugins/winrt/winrtqtversion.h @@ -47,7 +47,7 @@ public: BaseQtVersion *clone() const; QString type() const; QString description() const; - Core::FeatureSet availableFeatures() const; + QSet<Core::Id> availableFeatures() const; QString platformName() const; QString platformDisplayName() const; QList<ProjectExplorer::Abi> detectQtAbis() const; |