diff options
author | Thomas Hartmann <Thomas.Hartmann@nokia.com> | 2012-01-18 13:50:14 +0100 |
---|---|---|
committer | Thomas Hartmann <Thomas.Hartmann@nokia.com> | 2012-01-18 15:13:52 +0100 |
commit | 17a7bd17d08489453d6a679aab711a946e023ff3 (patch) | |
tree | 8191d6931163d2630408d6f9087a2261836e0478 /src | |
parent | 31d5ec9cab213fb65b970bfa7c8cb16128d282c8 (diff) | |
download | qt-creator-17a7bd17d08489453d6a679aab711a946e023ff3.tar.gz |
Wizards: allows filtering of wizards based on Qt version
Every wizard now implements requiredFeatures() to define a feature set.
If the feature set is not satisfied by the available Qt Versions,
the wizard is not shown in the create file/project dialog.
Every Qt version can define the provided feature set in availableFeatures()
defined in BaseQtVersion.
Change-Id: Ie9e2c210d19187b2296451948c36d274f2096623
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Reviewed-by: Alessandro Portale <alessandro.portale@nokia.com>
Diffstat (limited to 'src')
68 files changed, 632 insertions, 50 deletions
diff --git a/src/plugins/coreplugin/basefilewizard.cpp b/src/plugins/coreplugin/basefilewizard.cpp index 8f91bc9c84..9f35f5c09f 100644 --- a/src/plugins/coreplugin/basefilewizard.cpp +++ b/src/plugins/coreplugin/basefilewizard.cpp @@ -86,6 +86,7 @@ public: QString id; QString category; QString displayCategory; + Core::FeatureSet requiredFeatures; }; BaseFileWizardParameterData::BaseFileWizardParameterData(IWizard::WizardKind k) : @@ -145,7 +146,8 @@ CORE_EXPORT QDebug operator<<(QDebug d, const BaseFileWizardParameters &p) << " Category: " << p.category() << " DisplayName: " << p.displayName() << " Description: " << p.description() - << " DisplayCategory: " << p.displayCategory(); + << " DisplayCategory: " << p.displayCategory() + << " Required Features: " << p.requiredFeatures().toStringList(); return d; } @@ -214,6 +216,17 @@ QString BaseFileWizardParameters::displayCategory() const return m_d->displayCategory; } +Core::FeatureSet BaseFileWizardParameters::requiredFeatures() const +{ + return m_d->requiredFeatures; +} + +void BaseFileWizardParameters::setRequiredFeatures(Core::FeatureSet features) +{ + + m_d->requiredFeatures = features; +} + void BaseFileWizardParameters::setDisplayCategory(const QString &v) { m_d->displayCategory = v; @@ -349,6 +362,11 @@ BaseFileWizard::BaseFileWizard(const BaseFileWizardParameters ¶meters, { } +BaseFileWizardParameters BaseFileWizard::baseFileWizardParameters() const +{ + return d->m_parameters; +} + BaseFileWizard::~BaseFileWizard() { delete d; @@ -497,6 +515,12 @@ void BaseFileWizard::runWizard(const QString &path, QWidget *parent) QMessageBox::critical(0, tr("File Generation Failure"), errorMessage); } + +Core::FeatureSet BaseFileWizard::requiredFeatures() const +{ + return d->m_parameters.requiredFeatures(); +} + /*! \fn virtual QWizard *Core::BaseFileWizard::createWizardDialog(QWidget *parent, const QString &defaultPath, diff --git a/src/plugins/coreplugin/basefilewizard.h b/src/plugins/coreplugin/basefilewizard.h index 1539a90e1e..80e353b161 100644 --- a/src/plugins/coreplugin/basefilewizard.h +++ b/src/plugins/coreplugin/basefilewizard.h @@ -91,6 +91,9 @@ public: QString displayCategory() const; void setDisplayCategory(const QString &trCategory); + Core::FeatureSet requiredFeatures() const; + void setRequiredFeatures(Core::FeatureSet features); + private: QSharedDataPointer<BaseFileWizardParameterData> m_d; }; @@ -115,6 +118,7 @@ public: virtual QString displayCategory() const; virtual void runWizard(const QString &path, QWidget *parent); + virtual Core::FeatureSet requiredFeatures() const; static QString buildFileName(const QString &path, const QString &baseName, const QString &extension); static void setupWizard(QWizard *); @@ -125,6 +129,8 @@ protected: explicit BaseFileWizard(const BaseFileWizardParameters ¶meters, QObject *parent = 0); + BaseFileWizardParameters baseFileWizardParameters() const; + virtual QWizard *createWizardDialog(QWidget *parent, const QString &defaultPath, const WizardPageList &extensionPages) const = 0; diff --git a/src/plugins/coreplugin/coreplugin.pro b/src/plugins/coreplugin/coreplugin.pro index c65054df86..d2cc2b02b3 100644 --- a/src/plugins/coreplugin/coreplugin.pro +++ b/src/plugins/coreplugin/coreplugin.pro @@ -95,7 +95,8 @@ SOURCES += mainwindow.cpp \ mimetypesettings.cpp \ dialogs/promptoverwritedialog.cpp \ fileutils.cpp \ - textfile.cpp + textfile.cpp \ + featureprovider.cpp HEADERS += mainwindow.h \ editmode.h \ @@ -192,7 +193,8 @@ HEADERS += mainwindow.h \ fileutils.h \ externaltoolmanager.h \ textfile.h \ - generatedfile.h + generatedfile.h \ + featureprovider.h FORMS += dialogs/newdialog.ui \ actionmanager/commandmappings.ui \ diff --git a/src/plugins/coreplugin/dialogs/iwizard.cpp b/src/plugins/coreplugin/dialogs/iwizard.cpp index ec8c203d8f..3dec333a5b 100644 --- a/src/plugins/coreplugin/dialogs/iwizard.cpp +++ b/src/plugins/coreplugin/dialogs/iwizard.cpp @@ -35,6 +35,8 @@ #include <extensionsystem/pluginmanager.h> +#include <QtCore/QStringList> + /*! \class Core::IWizard \mainclass @@ -178,3 +180,14 @@ QList<IWizard*> IWizard::wizardsOfKind(WizardKind kind) return findWizards(WizardKindPredicate(kind)); } +bool IWizard::isAvailable() const +{ + FeatureSet availableFeatures; + + const QList<Core::IFeatureProvider*> featureManagers = ExtensionSystem::PluginManager::instance()->getObjects<Core::IFeatureProvider>(); + + foreach (const Core::IFeatureProvider *featureManager, featureManagers) + availableFeatures |= featureManager->availableFeatures(); + + return availableFeatures.contains(requiredFeatures()); +} diff --git a/src/plugins/coreplugin/dialogs/iwizard.h b/src/plugins/coreplugin/dialogs/iwizard.h index 1996642747..991df2b820 100644 --- a/src/plugins/coreplugin/dialogs/iwizard.h +++ b/src/plugins/coreplugin/dialogs/iwizard.h @@ -34,6 +34,8 @@ #define IWIZARD_H #include <coreplugin/core_global.h> +#include <coreplugin/featureprovider.h> + #include <QtCore/QObject> QT_BEGIN_NAMESPACE @@ -66,8 +68,12 @@ public: virtual QString category() const = 0; virtual QString displayCategory() const = 0; + virtual FeatureSet requiredFeatures() const = 0; + virtual void runWizard(const QString &path, QWidget *parent) = 0; + bool isAvailable() const; + // Utility to find all registered wizards static QList<IWizard*> allWizards(); // Utility to find all registered wizards of a certain kind diff --git a/src/plugins/coreplugin/dialogs/newdialog.cpp b/src/plugins/coreplugin/dialogs/newdialog.cpp index e07a20be64..fc6cd2fe32 100644 --- a/src/plugins/coreplugin/dialogs/newdialog.cpp +++ b/src/plugins/coreplugin/dialogs/newdialog.cpp @@ -37,7 +37,7 @@ #include <utils/stylehelper.h> #include <coreplugin/coreconstants.h> -#include <coreplugin/dialogs/iwizard.h> +#include <coreplugin/featureprovider.h> #include <QtGui/QAbstractProxyModel> #include <QtGui/QItemSelectionModel> @@ -249,19 +249,21 @@ void NewDialog::setWizards(QList<IWizard*> wizards) cit = categories.insert(categoryName, categoryItem); } // add item - QStandardItem *wizardItem = new QStandardItem(wizard->displayName()); - QIcon wizardIcon; - - // spacing hack. Add proper icons instead - if (wizard->icon().isNull()) { - wizardIcon = m_dummyIcon; - } else { - wizardIcon = wizard->icon(); + if (wizard->isAvailable()) { + QStandardItem *wizardItem = new QStandardItem(wizard->displayName()); + QIcon wizardIcon; + + // spacing hack. Add proper icons instead + if (wizard->icon().isNull()) { + wizardIcon = m_dummyIcon; + } else { + wizardIcon = wizard->icon(); + } + wizardItem->setIcon(wizardIcon); + wizardItem->setData(QVariant::fromValue(wizard), Qt::UserRole); + wizardItem->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable); + cit.value()->appendRow(wizardItem); } - wizardItem->setIcon(wizardIcon); - wizardItem->setData(QVariant::fromValue(wizard), Qt::UserRole); - wizardItem->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable); - cit.value()->appendRow(wizardItem); } diff --git a/src/plugins/coreplugin/featureprovider.cpp b/src/plugins/coreplugin/featureprovider.cpp new file mode 100644 index 0000000000..520b2e4821 --- /dev/null +++ b/src/plugins/coreplugin/featureprovider.cpp @@ -0,0 +1,111 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#include "featureprovider.h" + +/*! + \class Core::IFeatureProvider + \mainclass + + \brief The class IFeatureProvider defines an interface to manage features for wizards + + The features provided by an object in the object pool implementing IFeatureProvider + will be respected by wizards implementing IWizard. + + This feature set, provided by all instances of IFeatureProvider in the object pool, is checked against IWizard::requiredFeatures() + and only if all required features are available the wizard is displayed when creating a new file or project. + + Qt4VersionManager creates an instance of IFeatureProvider and provides Qt specific features for the available + versions of Qt. + + \sa Core::IWizard + \sa QtSupport::QtVersionManager +*/ + + +/*! + \fn IFeatureProvider::IFeatureProvider() + \internal +*/ + +/*! + \fn IFeatureProvider::~IFeatureProvider() + \internal +*/ + +/*! + \fn FeatureProvider::Features availableFeatures() const; + Returns available features provided by this manager. + \sa FeatureProvider::Features +*/ + +/*! + \class Core::FeatureProvider::Feature + + \brief This class describes a single Feature + + This class describes a single Feature to be used + in Core::FeatureProvider::Features. + + \sa Core::FeatureProvider::Features + \sa Core::IWizard + \sa QtSupport::QtVersionManager +*/ + +/*! + \class Core::FeatureProvider::Features + + \brief This class is a set of features + + Features is used to describe available or + required feature sets and behaves similar to QFlags. + + But instead of enums Features relies on string ids + and is therefore extendable. + + \sa Core::FeatureProvider::Feature + \sa Core::IWizard + \sa QtSupport::QtVersionManager +*/ + + +/*! + \fn bool Features::~contains(const Feature &feature)() + + \returns true if the \param features is available. +*/ + +/*! + \fn bool Features::~contains(const Features &features)() + + \returns true if all \param features are available. +*/ diff --git a/src/plugins/coreplugin/featureprovider.h b/src/plugins/coreplugin/featureprovider.h new file mode 100644 index 0000000000..fcb4815654 --- /dev/null +++ b/src/plugins/coreplugin/featureprovider.h @@ -0,0 +1,161 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#ifndef FEATUREMANAGER_H +#define FEATUREMANAGER_H + +#include "core_global.h" + +#include <coreplugin/id.h> + +#include <QtCore/QObject> +#include <QtCore/QSet> +#include <QtCore/QStringList> + + +namespace Utils { +class AbstractMacroExpander; +} + +namespace Core { + +class CORE_EXPORT FeatureSet; + +class CORE_EXPORT IFeatureProvider : public QObject +{ + Q_OBJECT + +public: + IFeatureProvider() {} + virtual ~IFeatureProvider() {} + virtual FeatureSet availableFeatures() const = 0; +}; + +class CORE_EXPORT Feature : public Id +{ +friend class FeatureSet; +public: + Feature(const char *name) : Id(name) {} + explicit Feature(const QString &name) : Id(name) {} +}; + +class CORE_EXPORT FeatureSet : private QSet<Feature> +{ +public: + FeatureSet() {} + + FeatureSet(const Feature &feature) + { + if (feature.toString().isEmpty()) + return; + + insert(feature); + } + + FeatureSet(const FeatureSet &other) : QSet<Feature>(other) {} + + FeatureSet &operator=(const FeatureSet &other) + { + QSet<Feature>::operator=(other); + return *this; + } + + 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); + } + + 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; + } +}; + +} // 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 // FEATUREANAGER_H diff --git a/src/plugins/cppeditor/cppclasswizard.cpp b/src/plugins/cppeditor/cppclasswizard.cpp index 4563376fe3..3bdc3a1f6a 100644 --- a/src/plugins/cppeditor/cppclasswizard.cpp +++ b/src/plugins/cppeditor/cppclasswizard.cpp @@ -155,6 +155,11 @@ CppClassWizard::CppClassWizard(const Core::BaseFileWizardParameters ¶meters, { } +Core::FeatureSet CppClassWizard::requiredFeatures() const +{ + return Core::FeatureSet(); +} + QString CppClassWizard::sourceSuffix() const { return preferredSuffix(QLatin1String(Constants::CPP_SOURCE_MIMETYPE)); diff --git a/src/plugins/cppeditor/cppclasswizard.h b/src/plugins/cppeditor/cppclasswizard.h index 4531c10dce..9d6f1efa4c 100644 --- a/src/plugins/cppeditor/cppclasswizard.h +++ b/src/plugins/cppeditor/cppclasswizard.h @@ -102,6 +102,8 @@ public: explicit CppClassWizard(const Core::BaseFileWizardParameters ¶meters, QObject *parent = 0); + virtual Core::FeatureSet requiredFeatures() const; + protected: virtual QWizard *createWizardDialog(QWidget *parent, const QString &defaultPath, diff --git a/src/plugins/designer/cpp/formclasswizard.cpp b/src/plugins/designer/cpp/formclasswizard.cpp index d8bd28f99a..f3a69e83ae 100644 --- a/src/plugins/designer/cpp/formclasswizard.cpp +++ b/src/plugins/designer/cpp/formclasswizard.cpp @@ -35,6 +35,7 @@ #include "designerconstants.h" #include "formwindoweditor.h" #include "qtdesignerformclasscodegenerator.h" +#include <qtsupport/qtsupportconstants.h> #include <coreplugin/icore.h> #include <cppeditor/cppeditorconstants.h> @@ -65,6 +66,11 @@ QString FormClassWizard::formSuffix() const return preferredSuffix(QLatin1String(Constants::FORM_MIMETYPE)); } +Core::FeatureSet FormClassWizard::requiredFeatures() const +{ + return Core::Feature(QtSupport::Constants::FEATURE_QWIDGETS); +} + QWizard *FormClassWizard::createWizardDialog(QWidget *parent, const QString &defaultPath, const WizardPageList &extensionPages) const diff --git a/src/plugins/designer/cpp/formclasswizard.h b/src/plugins/designer/cpp/formclasswizard.h index 2b9202ffc9..e6c8047dc1 100644 --- a/src/plugins/designer/cpp/formclasswizard.h +++ b/src/plugins/designer/cpp/formclasswizard.h @@ -55,6 +55,8 @@ public: QString sourceSuffix() const; QString formSuffix() const; + virtual Core::FeatureSet requiredFeatures() const; + protected: virtual QWizard *createWizardDialog(QWidget *parent, const QString &defaultPath, diff --git a/src/plugins/designer/formwizard.cpp b/src/plugins/designer/formwizard.cpp index 3f8c190e71..9b44526ec4 100644 --- a/src/plugins/designer/formwizard.cpp +++ b/src/plugins/designer/formwizard.cpp @@ -34,6 +34,7 @@ #include "formwizarddialog.h" #include "formwindoweditor.h" #include "designerconstants.h" +#include <qtsupport/qtsupportconstants.h> #include <QtCore/QDebug> @@ -45,6 +46,11 @@ FormWizard::FormWizard(const BaseFileWizardParameters ¶meters, QObject *pare { } +Core::FeatureSet FormWizard::requiredFeatures() const +{ + return Core::Feature(QtSupport::Constants::FEATURE_QWIDGETS); +} + QWizard *FormWizard::createWizardDialog(QWidget *parent, const QString &defaultPath, const WizardPageList &extensionPages) const diff --git a/src/plugins/designer/formwizard.h b/src/plugins/designer/formwizard.h index 6ea6f76ed9..ff14971fbf 100644 --- a/src/plugins/designer/formwizard.h +++ b/src/plugins/designer/formwizard.h @@ -47,6 +47,8 @@ public: FormWizard(const BaseFileWizardParameters ¶meters, QObject *parent); + virtual Core::FeatureSet requiredFeatures() const; + protected: virtual QWizard *createWizardDialog(QWidget *parent, const QString &defaultPath, diff --git a/src/plugins/genericprojectmanager/genericprojectwizard.cpp b/src/plugins/genericprojectmanager/genericprojectwizard.cpp index 1749122bc6..e1afafb78a 100644 --- a/src/plugins/genericprojectmanager/genericprojectwizard.cpp +++ b/src/plugins/genericprojectmanager/genericprojectwizard.cpp @@ -116,6 +116,11 @@ GenericProjectWizard::GenericProjectWizard() GenericProjectWizard::~GenericProjectWizard() { } +Core::FeatureSet GenericProjectWizard::requiredFeatures() const +{ + return Core::FeatureSet(); +} + Core::BaseFileWizardParameters GenericProjectWizard::parameters() { Core::BaseFileWizardParameters parameters(ProjectWizard); diff --git a/src/plugins/genericprojectmanager/genericprojectwizard.h b/src/plugins/genericprojectmanager/genericprojectwizard.h index 1b2ec40d0a..1cbc8cd391 100644 --- a/src/plugins/genericprojectmanager/genericprojectwizard.h +++ b/src/plugins/genericprojectmanager/genericprojectwizard.h @@ -78,6 +78,7 @@ class GenericProjectWizard : public Core::BaseFileWizard public: GenericProjectWizard(); virtual ~GenericProjectWizard(); + virtual Core::FeatureSet requiredFeatures() const; static Core::BaseFileWizardParameters parameters(); diff --git a/src/plugins/glsleditor/glslfilewizard.cpp b/src/plugins/glsleditor/glslfilewizard.cpp index eb5786a1e5..12fb4cdc0e 100644 --- a/src/plugins/glsleditor/glslfilewizard.cpp +++ b/src/plugins/glsleditor/glslfilewizard.cpp @@ -63,6 +63,11 @@ GLSLFileWizard::GLSLFileWizard(const BaseFileWizardParameters ¶meters, { } +Core::FeatureSet GLSLFileWizard::requiredFeatures() const +{ + return Core::FeatureSet(); +} + Core::GeneratedFiles GLSLFileWizard::generateFiles(const QWizard *w, QString * /*errorMessage*/) const { diff --git a/src/plugins/glsleditor/glslfilewizard.h b/src/plugins/glsleditor/glslfilewizard.h index 26c4ff6f30..fc02ba9559 100644 --- a/src/plugins/glsleditor/glslfilewizard.h +++ b/src/plugins/glsleditor/glslfilewizard.h @@ -55,6 +55,8 @@ public: explicit GLSLFileWizard(const BaseFileWizardParameters ¶meters, ShaderType shaderType, QObject *parent = 0); + virtual Core::FeatureSet requiredFeatures() const; + protected: QString fileContents(const QString &baseName, ShaderType shaderType) const; diff --git a/src/plugins/madde/maemoqtversion.cpp b/src/plugins/madde/maemoqtversion.cpp index 4ab595d11e..d33eb35b32 100644 --- a/src/plugins/madde/maemoqtversion.cpp +++ b/src/plugins/madde/maemoqtversion.cpp @@ -176,6 +176,15 @@ QString MaemoQtVersion::osType() const return m_osType; } +Core::FeatureSet MaemoQtVersion::availableFeatures() const +{ + Core::FeatureSet features = QtSupport::BaseQtVersion::availableFeatures(); + if (qtVersion() >= QtSupport::QtVersionNumber(4, 7, 4)) //no reliable test for components, yet. + features |= Core::FeatureSet(QtSupport::Constants::FEATURE_QTQUICK_COMPONENTS_MEEGO); + return features; +} + + void MaemoQtVersion::addToEnvironment(Utils::Environment &env) const { const QString maddeRoot = MaemoGlobal::maddeRoot(qmakeCommand().toString()); diff --git a/src/plugins/madde/maemoqtversion.h b/src/plugins/madde/maemoqtversion.h index b5b0620608..5f2f7ad30a 100644 --- a/src/plugins/madde/maemoqtversion.h +++ b/src/plugins/madde/maemoqtversion.h @@ -60,6 +60,8 @@ public: bool supportsShadowBuilds() const; QString osType() const; + Core::FeatureSet availableFeatures() const; + private: mutable QString m_systemRoot; mutable QString m_osType; diff --git a/src/plugins/madde/qt4maemotargetfactory.cpp b/src/plugins/madde/qt4maemotargetfactory.cpp index 4851677891..e2eb6b1d68 100644 --- a/src/plugins/madde/qt4maemotargetfactory.cpp +++ b/src/plugins/madde/qt4maemotargetfactory.cpp @@ -165,8 +165,6 @@ QSet<QString> Qt4MaemoTargetFactory::targetFeatures(const QString & /*id*/) cons #ifndef Q_OS_WIN features << Qt4ProjectManager::Constants::SHADOWBUILD_TARGETFEATURE_ID; #endif - // how to check check whether the component set is really installed? - features << Qt4ProjectManager::Constants::QTQUICKCOMPONENTS_MEEGO_TARGETFEATURE_ID; return features; } diff --git a/src/plugins/projectexplorer/customwizard/customwizard.cpp b/src/plugins/projectexplorer/customwizard/customwizard.cpp index d93a7c986f..5183cc7d33 100644 --- a/src/plugins/projectexplorer/customwizard/customwizard.cpp +++ b/src/plugins/projectexplorer/customwizard/customwizard.cpp @@ -252,6 +252,10 @@ Core::GeneratedFiles CustomWizard::generateFiles(const QWizard *dialog, QString return generateWizardFiles(errorMessage); } +Core::FeatureSet CustomWizard::requiredFeatures() const +{ + return baseFileWizardParameters().requiredFeatures(); +} bool CustomWizard::writeFiles(const Core::GeneratedFiles &files, QString *errorMessage) { diff --git a/src/plugins/projectexplorer/customwizard/customwizard.h b/src/plugins/projectexplorer/customwizard/customwizard.h index 932dd7ed94..3462143ad8 100644 --- a/src/plugins/projectexplorer/customwizard/customwizard.h +++ b/src/plugins/projectexplorer/customwizard/customwizard.h @@ -94,6 +94,8 @@ public: virtual Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const; + virtual Core::FeatureSet requiredFeatures() const; + // Register a factory for a derived custom widget static void registerFactory(const QString &name, const ICustomWizardFactoryPtr &f); diff --git a/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp b/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp index 951815a711..265c38c084 100644 --- a/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp +++ b/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp @@ -67,6 +67,7 @@ static const char firstPageAttributeC[] = "firstpage"; static const char langAttributeC[] = "xml:lang"; static const char categoryAttributeC[] = "category"; static const char displayCategoryElementC[] = "displaycategory"; +static const char featuresRequiredC[] = "featuresRequired"; static const char fieldPageTitleElementC[] = "fieldpagetitle"; static const char fieldsElementC[] = "fields"; static const char fieldElementC[] = "field"; @@ -486,6 +487,19 @@ static inline Core::IWizard::WizardKind kindAttribute(const QXmlStreamReader &r) return Core::IWizard::ProjectWizard; } +static inline Core::FeatureSet requiredFeatures(const QXmlStreamReader &reader) +{ + Core::FeatureSet r; + QString value = reader.attributes().value(QLatin1String(featuresRequiredC)).toString(); + QStringList stringList = value.split(QLatin1Char(','), QString::SkipEmptyParts); + Core::FeatureSet features; + foreach (const QString &string, stringList) { + Core::Feature feature(string); + features |= feature; + } + return features; +} + static inline QString msgError(const QXmlStreamReader &reader, const QString &fileName, const QString &what) @@ -591,6 +605,7 @@ CustomWizardParameters::ParseResult bp->setId(attributeValue(reader, idAttributeC)); bp->setCategory(attributeValue(reader, categoryAttributeC)); bp->setKind(kindAttribute(reader)); + bp->setRequiredFeatures(requiredFeatures(reader)); klass = attributeValue(reader, klassAttributeC); firstPageId = integerAttributeValue(reader, firstPageAttributeC, -1); break; diff --git a/src/plugins/qmljseditor/jsfilewizard.cpp b/src/plugins/qmljseditor/jsfilewizard.cpp index c6f56caf40..03db41910e 100644 --- a/src/plugins/qmljseditor/jsfilewizard.cpp +++ b/src/plugins/qmljseditor/jsfilewizard.cpp @@ -98,6 +98,11 @@ JsFileWizard::JsFileWizard(const BaseFileWizardParameters ¶meters, { } +Core::FeatureSet JsFileWizard::requiredFeatures() const +{ + return Core::FeatureSet(); +} + Core::GeneratedFiles JsFileWizard::generateFiles(const QWizard *w, QString * /*errorMessage*/) const { diff --git a/src/plugins/qmljseditor/jsfilewizard.h b/src/plugins/qmljseditor/jsfilewizard.h index 44c69a912e..6deca081ad 100644 --- a/src/plugins/qmljseditor/jsfilewizard.h +++ b/src/plugins/qmljseditor/jsfilewizard.h @@ -47,6 +47,8 @@ public: explicit JsFileWizard(const BaseFileWizardParameters ¶meters, QObject *parent = 0); + virtual Core::FeatureSet requiredFeatures() const; + protected: QString fileContents(const QString &baseName, bool statelessLibrary) const; diff --git a/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp b/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp index 7ca639f2fb..da222d03f3 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp @@ -64,6 +64,11 @@ QmlProjectApplicationWizard::QmlProjectApplicationWizard() QmlProjectApplicationWizard::~QmlProjectApplicationWizard() { } +Core::FeatureSet QmlProjectApplicationWizard::requiredFeatures() const +{ + return Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK); +} + Core::BaseFileWizardParameters QmlProjectApplicationWizard::parameters() { Core::BaseFileWizardParameters parameters(ProjectWizard); diff --git a/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.h b/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.h index c50532226e..ea54209457 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.h +++ b/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.h @@ -53,6 +53,7 @@ class QmlProjectApplicationWizard : public Core::BaseFileWizard public: QmlProjectApplicationWizard(); virtual ~QmlProjectApplicationWizard(); + virtual Core::FeatureSet requiredFeatures() const; static Core::BaseFileWizardParameters parameters(); diff --git a/src/plugins/qt4projectmanager/buildconfigurationinfo.h b/src/plugins/qt4projectmanager/buildconfigurationinfo.h index 6cf166c98b..5ad180bb9c 100644 --- a/src/plugins/qt4projectmanager/buildconfigurationinfo.h +++ b/src/plugins/qt4projectmanager/buildconfigurationinfo.h @@ -34,6 +34,7 @@ #define BUILDCONFIGURATIONINFO_H #include "qt4projectmanager_global.h" +#include <coreplugin/featureprovider.h> #include <qtsupport/baseqtversion.h> namespace Qt4ProjectManager { @@ -72,6 +73,7 @@ struct QT4PROJECTMANAGER_EXPORT BuildConfigurationInfo { static QList<BuildConfigurationInfo> importBuildConfigurations(const QString &proFilePath); static QList<BuildConfigurationInfo> checkForBuild(const QString &directory, const QString &proFilePath); static QList<BuildConfigurationInfo> filterBuildConfigurationInfos(const QList<BuildConfigurationInfo> &infos, const QString &id); + static QList<BuildConfigurationInfo> filterBuildConfigurationInfos(const QList<BuildConfigurationInfo> &infos, Core::FeatureSet features); }; } // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizard.cpp b/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizard.cpp index e3c88e2769..1239ed144c 100644 --- a/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizard.cpp +++ b/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizard.cpp @@ -38,6 +38,8 @@ #include <projectexplorer/projectexplorerconstants.h> +#include <qtsupport/qtsupportconstants.h> + #include <QtGui/QIcon> namespace Qt4ProjectManager { @@ -53,6 +55,11 @@ CustomWidgetWizard::CustomWidgetWizard() : { } +Core::FeatureSet CustomWidgetWizard::requiredFeatures() const +{ + return Core::Feature(QtSupport::Constants::FEATURE_QWIDGETS); +} + QWizard *CustomWidgetWizard::createWizardDialog(QWidget *parent, const QString &defaultPath, const WizardPageList &extensionPages) const diff --git a/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizard.h b/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizard.h index a6e49c60e8..e056e7f56e 100644 --- a/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizard.h +++ b/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizard.h @@ -44,6 +44,7 @@ class CustomWidgetWizard : public QtWizard public: CustomWidgetWizard(); + virtual Core::FeatureSet requiredFeatures() const; protected: virtual QWizard *createWizardDialog(QWidget *parent, diff --git a/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.cpp b/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.cpp index 4fe993ef18..56bd7584c0 100644 --- a/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.cpp +++ b/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.cpp @@ -99,3 +99,12 @@ QString DesktopQtVersion::description() const { return QCoreApplication::translate("QtVersion", "Desktop", "Qt Version is meant for the desktop"); } + +Core::FeatureSet DesktopQtVersion::availableFeatures() const +{ + Core::FeatureSet features = QtSupport::BaseQtVersion::availableFeatures(); + if (qtVersion() >= QtSupport::QtVersionNumber(4, 7, 4)) //no reliable test for components, yet. + features |= Core::FeatureSet(QtSupport::Constants::FEATURE_QTQUICK_COMPONENTS_MEEGO) + | Core::FeatureSet(QtSupport::Constants::FEATURE_QTQUICK_COMPONENTS_SYMBIAN); + return features; +} diff --git a/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.h b/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.h index 3031f286a4..edde9d93f2 100644 --- a/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.h +++ b/src/plugins/qt4projectmanager/qt-desktop/desktopqtversion.h @@ -57,6 +57,8 @@ public: QSet<QString> supportedTargetIds() const; QString description() const; + + Core::FeatureSet availableFeatures() const; }; } diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.cpp b/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.cpp index 1b06c58e66..952d32b7e2 100644 --- a/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.cpp +++ b/src/plugins/qt4projectmanager/qt-desktop/qt4desktoptargetfactory.cpp @@ -164,11 +164,9 @@ ProjectExplorer::Target *Qt4DesktopTargetFactory::create(ProjectExplorer::Projec QSet<QString> Qt4DesktopTargetFactory::targetFeatures(const QString & /*id*/) const { QSet<QString> features; - features << QLatin1String(Constants::DESKTOP_TARGETFEATURE_ID) - << QLatin1String(Constants::SHADOWBUILD_TARGETFEATURE_ID) - // how to check check whether they component set is really installed? - << QLatin1String(Constants::QTQUICKCOMPONENTS_SYMBIAN_TARGETFEATURE_ID) - << QLatin1String(Constants::QTQUICKCOMPONENTS_MEEGO_TARGETFEATURE_ID); + features << QLatin1String(Constants::DESKTOP_TARGETFEATURE_ID); + features << QLatin1String(Constants::SHADOWBUILD_TARGETFEATURE_ID); + return features; } diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortargetfactory.cpp b/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortargetfactory.cpp index 77e16c1f05..aaa2b8cb8e 100644 --- a/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortargetfactory.cpp +++ b/src/plugins/qt4projectmanager/qt-desktop/qt4simulatortargetfactory.cpp @@ -129,10 +129,8 @@ QSet<QString> Qt4SimulatorTargetFactory::targetFeatures(const QString & /*id*/) QSet<QString> features; features << QLatin1String(Constants::MOBILE_TARGETFEATURE_ID) - << QLatin1String(Constants::SHADOWBUILD_TARGETFEATURE_ID) - // how to check check whether the component set is really installed? - << QLatin1String(Constants::QTQUICKCOMPONENTS_SYMBIAN_TARGETFEATURE_ID) - << QLatin1String(Constants::QTQUICKCOMPONENTS_MEEGO_TARGETFEATURE_ID); + << QLatin1String(Constants::SHADOWBUILD_TARGETFEATURE_ID); + return features; } diff --git a/src/plugins/qt4projectmanager/qt-s60/qt4symbiantargetfactory.cpp b/src/plugins/qt4projectmanager/qt-s60/qt4symbiantargetfactory.cpp index 6a2e88d10b..1d63cec578 100644 --- a/src/plugins/qt4projectmanager/qt-s60/qt4symbiantargetfactory.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/qt4symbiantargetfactory.cpp @@ -190,9 +190,8 @@ bool Qt4SymbianTargetFactory::selectByDefault(const QString &id) const QSet<QString> Qt4SymbianTargetFactory::targetFeatures(const QString & /*id*/) const { QSet<QString> features; - features << QLatin1String(Constants::MOBILE_TARGETFEATURE_ID) - // ideally we should check whether they're really installed - << QLatin1String(Constants::QTQUICKCOMPONENTS_SYMBIAN_TARGETFEATURE_ID); + features << QLatin1String(Constants::MOBILE_TARGETFEATURE_ID); + return features; } diff --git a/src/plugins/qt4projectmanager/qt-s60/symbianqtversion.cpp b/src/plugins/qt4projectmanager/qt-s60/symbianqtversion.cpp index c90aadfd73..0a3b0e8d36 100644 --- a/src/plugins/qt4projectmanager/qt-s60/symbianqtversion.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/symbianqtversion.cpp @@ -364,6 +364,16 @@ void SymbianQtVersion::setSystemRoot(const QString &root) } } +Core::FeatureSet SymbianQtVersion::availableFeatures() const +{ + Core::FeatureSet features = QtSupport::BaseQtVersion::availableFeatures(); + if (qtVersion() >= QtSupport::QtVersionNumber(4, 7, 4)) //no reliable test for components, yet. + features |= Core::FeatureSet(QtSupport::Constants::FEATURE_QTQUICK_COMPONENTS_SYMBIAN); + features.remove(Core::Feature(QtSupport::Constants::FEATURE_QT_CONSOLE)); + + return features; +} + QString SymbianQtVersion::systemRoot() const { return m_systemRoot; diff --git a/src/plugins/qt4projectmanager/qt-s60/symbianqtversion.h b/src/plugins/qt4projectmanager/qt-s60/symbianqtversion.h index c405d3845d..fafecd9ed3 100644 --- a/src/plugins/qt4projectmanager/qt-s60/symbianqtversion.h +++ b/src/plugins/qt4projectmanager/qt-s60/symbianqtversion.h @@ -83,6 +83,8 @@ public: QtSupport::QtConfigWidget *createConfigurationWidget() const; + Core::FeatureSet availableFeatures() const; + protected: QList<ProjectExplorer::Task> reportIssuesImpl(const QString &proFile, const QString &buildDir); void parseMkSpec(ProFileEvaluator *) const; diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerconstants.h b/src/plugins/qt4projectmanager/qt4projectmanagerconstants.h index d1cccf292a..1b114fc233 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanagerconstants.h +++ b/src/plugins/qt4projectmanager/qt4projectmanagerconstants.h @@ -85,11 +85,6 @@ const char QT_SIMULATOR_TARGET_ID[] = "Qt4ProjectManager.Target.QtSimulatorTarge const char MOBILE_TARGETFEATURE_ID[] = "Qt4ProjectManager.TargetFeature.Mobile"; const char DESKTOP_TARGETFEATURE_ID[] = "Qt4ProjectManager.TargetFeature.Desktop"; const char SHADOWBUILD_TARGETFEATURE_ID[] = "Qt4ProjectManager.TargetFeature.ShadowBuild"; -const char QTQUICKCOMPONENTS_SYMBIAN_TARGETFEATURE_ID[] - = "Qt4ProjectManager.TargetFeature.QtQuickComponentsSymbian"; -const char QTQUICKCOMPONENTS_MEEGO_TARGETFEATURE_ID[] - = "Qt4ProjectManager.TargetFeature.QtQuickComponentsMeego"; - // Tool chains: const char GCCE_TOOLCHAIN_ID[] = "Qt4ProjectManager.ToolChain.GCCE"; diff --git a/src/plugins/qt4projectmanager/qt4target.cpp b/src/plugins/qt4projectmanager/qt4target.cpp index 79f38644b0..a206254ccc 100644 --- a/src/plugins/qt4projectmanager/qt4target.cpp +++ b/src/plugins/qt4projectmanager/qt4target.cpp @@ -1176,6 +1176,15 @@ QList<BuildConfigurationInfo> BuildConfigurationInfo::filterBuildConfigurationIn return result; } +QList<BuildConfigurationInfo> BuildConfigurationInfo::filterBuildConfigurationInfos(const QList<BuildConfigurationInfo> &infos, Core::FeatureSet features) +{ + QList<BuildConfigurationInfo> result; + foreach (const BuildConfigurationInfo &info, infos) + if (info.version->availableFeatures().contains(features)) + result.append(info); + return result; +} + QList<BuildConfigurationInfo> BuildConfigurationInfo::importBuildConfigurations(const QString &proFilePath) { QList<BuildConfigurationInfo> result; diff --git a/src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp b/src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp index bd0a4da7fe..7fca16190d 100644 --- a/src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp @@ -37,6 +37,7 @@ #include <projectexplorer/projectexplorerconstants.h> #include <cpptools/abstracteditorsupport.h> +#include <qtsupport/qtsupportconstants.h> #include <QtGui/QIcon> #include <QtCore/QFileInfo> @@ -107,5 +108,10 @@ Core::GeneratedFiles return Core::GeneratedFiles() << source << profile; } +Core::FeatureSet ConsoleAppWizard::requiredFeatures() const +{ + return Core::Feature(QtSupport::Constants::FEATURE_GENERIC_CPP_ENTRY_POINT); +} + } // namespace Internal } // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/wizards/consoleappwizard.h b/src/plugins/qt4projectmanager/wizards/consoleappwizard.h index 64674e7856..91199489f2 100644 --- a/src/plugins/qt4projectmanager/wizards/consoleappwizard.h +++ b/src/plugins/qt4projectmanager/wizards/consoleappwizard.h @@ -54,6 +54,8 @@ protected: virtual Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const; + + virtual Core::FeatureSet requiredFeatures() const; }; } // namespace Internal diff --git a/src/plugins/qt4projectmanager/wizards/emptyprojectwizard.cpp b/src/plugins/qt4projectmanager/wizards/emptyprojectwizard.cpp index d30c6aeac6..d6be96c9d4 100644 --- a/src/plugins/qt4projectmanager/wizards/emptyprojectwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/emptyprojectwizard.cpp @@ -52,6 +52,11 @@ EmptyProjectWizard::EmptyProjectWizard() { } +Core::FeatureSet EmptyProjectWizard::requiredFeatures() const +{ + return Core::FeatureSet(); +} + QWizard *EmptyProjectWizard::createWizardDialog(QWidget *parent, const QString &defaultPath, const WizardPageList &extensionPages) const diff --git a/src/plugins/qt4projectmanager/wizards/emptyprojectwizard.h b/src/plugins/qt4projectmanager/wizards/emptyprojectwizard.h index 37f04d47bb..0adc2c253e 100644 --- a/src/plugins/qt4projectmanager/wizards/emptyprojectwizard.h +++ b/src/plugins/qt4projectmanager/wizards/emptyprojectwizard.h @@ -44,6 +44,7 @@ class EmptyProjectWizard : public QtWizard public: EmptyProjectWizard(); + virtual Core::FeatureSet requiredFeatures() const; protected: virtual QWizard *createWizardDialog(QWidget *parent, diff --git a/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp b/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp index f05fb63696..0e89c521b0 100644 --- a/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp @@ -40,6 +40,7 @@ #include <coreplugin/icore.h> #include <extensionsystem/pluginmanager.h> #include <extensionsystem/invoker.h> +#include <qtsupport/qtsupportconstants.h> #include <utils/fileutils.h> @@ -95,6 +96,11 @@ GuiAppWizard::GuiAppWizard() { } +Core::FeatureSet GuiAppWizard::requiredFeatures() const +{ + return Core::Feature(QtSupport::Constants::FEATURE_QWIDGETS); +} + GuiAppWizard::GuiAppWizard(const QString &id, const QString &category, const QString &displayCategory, diff --git a/src/plugins/qt4projectmanager/wizards/guiappwizard.h b/src/plugins/qt4projectmanager/wizards/guiappwizard.h index 8cd7a27b03..893df770fd 100644 --- a/src/plugins/qt4projectmanager/wizards/guiappwizard.h +++ b/src/plugins/qt4projectmanager/wizards/guiappwizard.h @@ -46,6 +46,7 @@ class GuiAppWizard : public QtWizard public: GuiAppWizard(); + virtual Core::FeatureSet requiredFeatures() const; protected: GuiAppWizard(const QString &id, diff --git a/src/plugins/qt4projectmanager/wizards/html5appwizard.cpp b/src/plugins/qt4projectmanager/wizards/html5appwizard.cpp index 7e03147194..4c218c6929 100644 --- a/src/plugins/qt4projectmanager/wizards/html5appwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/html5appwizard.cpp @@ -39,6 +39,7 @@ #include "qt4projectmanagerconstants.h" #include <projectexplorer/projectexplorerconstants.h> +#include <qtsupport/qtsupportconstants.h> #include <limits> #include <QtCore/QCoreApplication> @@ -93,6 +94,11 @@ Html5AppWizard::~Html5AppWizard() delete d; } +Core::FeatureSet Html5AppWizard::requiredFeatures() const +{ + return Core::Feature(QtSupport::Constants::FEATURE_GENERIC_CPP_ENTRY_POINT); +} + Core::BaseFileWizardParameters Html5AppWizard::parameters() { Core::BaseFileWizardParameters parameters(ProjectWizard); diff --git a/src/plugins/qt4projectmanager/wizards/html5appwizard.h b/src/plugins/qt4projectmanager/wizards/html5appwizard.h index 39168644c2..577b2c14fb 100644 --- a/src/plugins/qt4projectmanager/wizards/html5appwizard.h +++ b/src/plugins/qt4projectmanager/wizards/html5appwizard.h @@ -45,6 +45,7 @@ class Html5AppWizard : public AbstractMobileAppWizard public: Html5AppWizard(); virtual ~Html5AppWizard(); + virtual Core::FeatureSet requiredFeatures() const; protected: QString fileToOpenPostGeneration() const; diff --git a/src/plugins/qt4projectmanager/wizards/librarywizard.cpp b/src/plugins/qt4projectmanager/wizards/librarywizard.cpp index 95dcf4dfa9..6852f6677c 100644 --- a/src/plugins/qt4projectmanager/wizards/librarywizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/librarywizard.cpp @@ -143,5 +143,10 @@ Core::GeneratedFiles LibraryWizard::generateFiles(const QWizard *w, return rc; } +Core::FeatureSet LibraryWizard::requiredFeatures() const +{ + return Core::FeatureSet(); +} + } // namespace Internal } // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/wizards/librarywizard.h b/src/plugins/qt4projectmanager/wizards/librarywizard.h index 1c180befcd..a1183f092d 100644 --- a/src/plugins/qt4projectmanager/wizards/librarywizard.h +++ b/src/plugins/qt4projectmanager/wizards/librarywizard.h @@ -56,6 +56,7 @@ protected: virtual Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const; + virtual Core::FeatureSet requiredFeatures() const; }; } // namespace Internal diff --git a/src/plugins/qt4projectmanager/wizards/mobileappwizard.cpp b/src/plugins/qt4projectmanager/wizards/mobileappwizard.cpp index 97d2aad148..5702cfc4fd 100644 --- a/src/plugins/qt4projectmanager/wizards/mobileappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/mobileappwizard.cpp @@ -40,6 +40,8 @@ #include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/task.h> +#include <qtsupport/qtsupportconstants.h> + #include <QtCore/QCoreApplication> #include <QtGui/QIcon> @@ -89,6 +91,12 @@ MobileAppWizard::~MobileAppWizard() delete d; } +Core::FeatureSet MobileAppWizard::requiredFeatures() const +{ + return Core::Feature(QtSupport::Constants::FEATURE_GENERIC_CPP_ENTRY_POINT) + | Core::Feature(QtSupport::Constants::FEATURE_QWIDGETS); +} + Core::BaseFileWizardParameters MobileAppWizard::parameters() { Core::BaseFileWizardParameters parameters(ProjectWizard); diff --git a/src/plugins/qt4projectmanager/wizards/mobileappwizard.h b/src/plugins/qt4projectmanager/wizards/mobileappwizard.h index bbe56ddb83..cbe4e7aecd 100644 --- a/src/plugins/qt4projectmanager/wizards/mobileappwizard.h +++ b/src/plugins/qt4projectmanager/wizards/mobileappwizard.h @@ -45,6 +45,7 @@ class MobileAppWizard : public AbstractMobileAppWizard public: MobileAppWizard(); virtual ~MobileAppWizard(); + virtual Core::FeatureSet requiredFeatures() const; protected: QString fileToOpenPostGeneration() const; diff --git a/src/plugins/qt4projectmanager/wizards/qtquickappwizard.cpp b/src/plugins/qt4projectmanager/wizards/qtquickappwizard.cpp index 8cf8bca90a..f2648a96ab 100644 --- a/src/plugins/qt4projectmanager/wizards/qtquickappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/qtquickappwizard.cpp @@ -39,6 +39,7 @@ #include "qt4projectmanagerconstants.h" #include <qtsupport/qtsupportconstants.h> +#include <coreplugin/dialogs/iwizard.h> #include <QtCore/QCoreApplication> #include <QtGui/QIcon> @@ -87,19 +88,12 @@ bool QtQuickAppWizardDialog::validateCurrentPage() setIgnoreGenericOptionsPage(false); if (m_componentOptionsPage->componentSet() == QtQuickApp::Symbian11Components) { setIgnoreGenericOptionsPage(true); - targetsPage()->setMinimumQtVersion(QtSupport::QtVersionNumber(4, 7, 4)); - QSet<QString> requiredFeatures; - requiredFeatures << QLatin1String(Constants::QTQUICKCOMPONENTS_SYMBIAN_TARGETFEATURE_ID); - targetsPage()->setRequiredFeatures(requiredFeatures); + targetsPage()->setRequiredQtFeatures(Core::FeatureSet(QtSupport::Constants::FEATURE_QTQUICK_COMPONENTS_MEEGO)); } else if (m_componentOptionsPage->componentSet() == QtQuickApp::Meego10Components) { - targetsPage()->setMinimumQtVersion(QtSupport::QtVersionNumber(4, 7, 4)); - QSet<QString> requiredFeatures; - requiredFeatures << QLatin1String(Constants::QTQUICKCOMPONENTS_MEEGO_TARGETFEATURE_ID); - targetsPage()->setRequiredFeatures(requiredFeatures); + targetsPage()->setRequiredQtFeatures(Core::FeatureSet(QtSupport::Constants::FEATURE_QTQUICK_COMPONENTS_MEEGO)); } else { targetsPage()->setMinimumQtVersion(QtSupport::QtVersionNumber(4, 7, 0)); - QSet<QString> requiredFeatures; - targetsPage()->setRequiredFeatures(requiredFeatures); + targetsPage()->setRequiredQtFeatures(Core::FeatureSet()); } } return AbstractMobileAppWizardDialog::validateCurrentPage(); @@ -126,6 +120,13 @@ QtQuickAppWizard::~QtQuickAppWizard() delete d; } +Core::FeatureSet QtQuickAppWizard::requiredFeatures() const +{ + return Core::Feature(QtSupport::Constants::FEATURE_GENERIC_CPP_ENTRY_POINT) | + Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK); + +} + Core::BaseFileWizardParameters QtQuickAppWizard::parameters() { Core::BaseFileWizardParameters parameters(ProjectWizard); diff --git a/src/plugins/qt4projectmanager/wizards/qtquickappwizard.h b/src/plugins/qt4projectmanager/wizards/qtquickappwizard.h index e35ae7b4f9..60e7c595a9 100644 --- a/src/plugins/qt4projectmanager/wizards/qtquickappwizard.h +++ b/src/plugins/qt4projectmanager/wizards/qtquickappwizard.h @@ -45,6 +45,7 @@ class QtQuickAppWizard : public AbstractMobileAppWizard public: QtQuickAppWizard(); virtual ~QtQuickAppWizard(); + virtual Core::FeatureSet requiredFeatures() const; protected: QString fileToOpenPostGeneration() const; diff --git a/src/plugins/qt4projectmanager/wizards/subdirsprojectwizard.cpp b/src/plugins/qt4projectmanager/wizards/subdirsprojectwizard.cpp index bdd887c792..c9da43c717 100644 --- a/src/plugins/qt4projectmanager/wizards/subdirsprojectwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/subdirsprojectwizard.cpp @@ -93,5 +93,10 @@ bool SubdirsProjectWizard::postGenerateFiles(const QWizard *w, const Core::Gener return true; } +Core::FeatureSet SubdirsProjectWizard::requiredFeatures() const +{ + return Core::FeatureSet(); +} + } // namespace Internal } // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/wizards/subdirsprojectwizard.h b/src/plugins/qt4projectmanager/wizards/subdirsprojectwizard.h index ec8667ac8b..42695f2905 100644 --- a/src/plugins/qt4projectmanager/wizards/subdirsprojectwizard.h +++ b/src/plugins/qt4projectmanager/wizards/subdirsprojectwizard.h @@ -53,6 +53,7 @@ protected: virtual Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const; virtual bool postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l, QString *errorMessage); + virtual Core::FeatureSet requiredFeatures() const; }; } // namespace Internal diff --git a/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp b/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp index 27a4c227f7..ba96396dfe 100644 --- a/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp +++ b/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp @@ -103,9 +103,14 @@ void TargetSetupPage::setPreferredFeatures(const QSet<QString> &featureIds) m_preferredFeatures = featureIds; } -void TargetSetupPage::setRequiredFeatures(const QSet<QString> &featureIds) +void TargetSetupPage::setRequiredTargetFeatures(const QSet<QString> &featureIds) { - m_requiredFeatures = featureIds; + m_requiredTargetFeatures = featureIds; +} + +void TargetSetupPage::setRequiredQtFeatures(const Core::FeatureSet &features) +{ + m_requiredQtFeatures = features; } void TargetSetupPage::setMinimumQtVersion(const QtSupport::QtVersionNumber &number) @@ -130,10 +135,12 @@ void TargetSetupPage::setupWidgets() foreach (Qt4BaseTargetFactory *factory, factories) { QStringList ids = factory->supportedTargetIds(0); foreach (const QString &id, ids) { - if (!factory->targetFeatures(id).contains(m_requiredFeatures)) + if (!factory->targetFeatures(id).contains(m_requiredTargetFeatures)) continue; QList<BuildConfigurationInfo> infos = BuildConfigurationInfo::filterBuildConfigurationInfos(m_importInfos, id); + infos = BuildConfigurationInfo::filterBuildConfigurationInfos(infos, m_requiredQtFeatures); + Qt4TargetSetupWidget *widget = factory->createTargetSetupWidget(id, m_proFilePath, m_minimumQtVersionNumber, m_maximumQtVersionNumber, diff --git a/src/plugins/qt4projectmanager/wizards/targetsetuppage.h b/src/plugins/qt4projectmanager/wizards/targetsetuppage.h index 357e29249d..1ab03441bb 100644 --- a/src/plugins/qt4projectmanager/wizards/targetsetuppage.h +++ b/src/plugins/qt4projectmanager/wizards/targetsetuppage.h @@ -36,6 +36,7 @@ #include "../qt4target.h" #include "../qt4projectmanager_global.h" #include <qtsupport/qtversionmanager.h> +#include <coreplugin/featureprovider.h> #include <QtCore/QString> #include <QtGui/QWizard> @@ -77,7 +78,10 @@ public: void setPreferredFeatures(const QSet<QString> &featureIds); /// Sets the features a target must support /// call this before \sa initializePage() - void setRequiredFeatures(const QSet<QString> &featureIds); + void setRequiredTargetFeatures(const QSet<QString> &featureIds); + /// Sets the features a qt version must support + /// call this before \sa initializePage() + void setRequiredQtFeatures(const Core::FeatureSet &features); /// Sets the minimum qt version /// calls this before \sa initializePage() void setMinimumQtVersion(const QtSupport::QtVersionNumber &number); @@ -102,7 +106,8 @@ private: void deleteWidgets(); QSet<QString> m_preferredFeatures; - QSet<QString> m_requiredFeatures; + QSet<QString> m_requiredTargetFeatures; + Core::FeatureSet m_requiredQtFeatures; bool m_importSearch; QtSupport::QtVersionNumber m_minimumQtVersionNumber; QtSupport::QtVersionNumber m_maximumQtVersionNumber; diff --git a/src/plugins/qt4projectmanager/wizards/testwizard.cpp b/src/plugins/qt4projectmanager/wizards/testwizard.cpp index 0f63048772..7c0383f18e 100644 --- a/src/plugins/qt4projectmanager/wizards/testwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/testwizard.cpp @@ -35,6 +35,7 @@ #include <cpptools/abstracteditorsupport.h> #include <projectexplorer/projectexplorerconstants.h> +#include <qtsupport/qtsupportconstants.h> #include <utils/qtcassert.h> @@ -186,5 +187,11 @@ Core::GeneratedFiles TestWizard::generateFiles(const QWizard *w, QString *errorM return Core::GeneratedFiles() << source << profile; } +Core::FeatureSet TestWizard::requiredFeatures() const +{ + return Core::Feature(QtSupport::Constants::FEATURE_GENERIC_CPP_ENTRY_POINT) | + Core::Feature(QtSupport::Constants::FEATURE_QT); +} + } // namespace Internal } // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/wizards/testwizard.h b/src/plugins/qt4projectmanager/wizards/testwizard.h index 46a6d9c28e..f48aa43f28 100644 --- a/src/plugins/qt4projectmanager/wizards/testwizard.h +++ b/src/plugins/qt4projectmanager/wizards/testwizard.h @@ -44,6 +44,7 @@ class TestWizard : public QtWizard public: TestWizard(); + virtual Core::FeatureSet requiredFeatures() const; protected: virtual QWizard *createWizardDialog(QWidget *parent, diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 679316be96..2ab646da99 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -44,6 +44,7 @@ #include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/toolchainmanager.h> +#include <qtsupport/qtsupportconstants.h> #include <utils/persistentsettings.h> #include <utils/environment.h> @@ -252,6 +253,20 @@ QString BaseQtVersion::defaultDisplayName(const QString &versionString, const Ut QCoreApplication::translate("QtVersion", "Qt %1 (%2)").arg(versionString, location); } +Core::FeatureSet BaseQtVersion::availableFeatures() const +{ + Core::FeatureSet features = Core::FeatureSet(QtSupport::Constants::FEATURE_GENERIC_CPP_ENTRY_POINT) | + Core::FeatureSet(QtSupport::Constants::FEATURE_QWIDGETS) + | Core::FeatureSet(QtSupport::Constants::FEATURE_QT) + | Core::FeatureSet(QtSupport::Constants::FEATURE_QT_WEBKIT) + | Core::FeatureSet(QtSupport::Constants::FEATURE_QT_CONSOLE); + + if (qtVersion() >= QtSupport::QtVersionNumber(4, 7, 0)) + features |= Core::FeatureSet(QtSupport::Constants::FEATURE_QT_QUICK); + + return features; +} + void BaseQtVersion::setId(int id) { m_id = id; diff --git a/src/plugins/qtsupport/baseqtversion.h b/src/plugins/qtsupport/baseqtversion.h index 91bc7b24a7..2cd871bb32 100644 --- a/src/plugins/qtsupport/baseqtversion.h +++ b/src/plugins/qtsupport/baseqtversion.h @@ -40,6 +40,7 @@ #include <projectexplorer/abi.h> #include <projectexplorer/headerpath.h> #include <projectexplorer/task.h> +#include <coreplugin/featureprovider.h> #include <QtCore/QVariantMap> #include <QtGui/QWidget> @@ -214,6 +215,8 @@ public: const Utils::FileName &qmakePath, bool fromPath = false); + virtual Core::FeatureSet availableFeatures() const; + protected: BaseQtVersion(); BaseQtVersion(const Utils::FileName &path, bool isAutodetected = false, const QString &autodetectionSource = QString()); diff --git a/src/plugins/qtsupport/qtsupportconstants.h b/src/plugins/qtsupport/qtsupportconstants.h index ed6b0bd5a9..696ef55f30 100644 --- a/src/plugins/qtsupport/qtsupportconstants.h +++ b/src/plugins/qtsupport/qtsupportconstants.h @@ -47,6 +47,17 @@ const char DESKTOPQT[] = "Qt4ProjectManager.QtVersion.Desktop"; const char SIMULATORQT[] = "Qt4ProjectManager.QtVersion.Simulator"; const char WINCEQT[] = "Qt4ProjectManager.QtVersion.WinCE"; +//Qt Features +const char FEATURE_QT[] = "QtSupport.Wizards.FeatureQt"; +const char FEATURE_QWIDGETS[] = "QtSupport.Wizards.FeatureQWidgets"; +const char FEATURE_QT_QUICK[] = "QtSupport.Wizards.FeatureQtQuick"; +const char FEATURE_QT_WEBKIT[] = "QtSupport.Wizards.FeatureQtWebkit"; +const char FEATURE_QT_CONSOLE[] = "QtSupport.Wizards.FeatureQtConsole"; +const char FEATURE_GENERIC_CPP_ENTRY_POINT[] ="QtSupport.Wizards.FeatureGenericCppEntryPoint"; +const char FEATURE_QTQUICK_COMPONENTS_SYMBIAN[] = "QtSupport.Wizards.FeatureQtQuickComponentsSymbian"; +const char FEATURE_QTQUICK_COMPONENTS_MEEGO[] = "QtSupport.Wizards.FeatureQtQuickComponentsMeego"; + + // QML wizard categories // both the qt4projectmanager and the qmlprojectmanager do have qt quick wizards // so we define the category here diff --git a/src/plugins/qtsupport/qtsupportplugin.cpp b/src/plugins/qtsupport/qtsupportplugin.cpp index fe634b47d0..5ebf76147b 100644 --- a/src/plugins/qtsupport/qtsupportplugin.cpp +++ b/src/plugins/qtsupport/qtsupportplugin.cpp @@ -57,6 +57,10 @@ bool QtSupportPlugin::initialize(const QStringList &arguments, QString *errorMes QtVersionManager *mgr = new QtVersionManager; addAutoReleasedObject(mgr); + + QtFeatureProvider *featureMgr = new QtFeatureProvider; + addAutoReleasedObject(featureMgr); + addAutoReleasedObject(new QtOptionsPage); ExamplesWelcomePage *welcomePage; diff --git a/src/plugins/qtsupport/qtversionmanager.cpp b/src/plugins/qtsupport/qtversionmanager.cpp index 31516ad013..8e9e4bface 100644 --- a/src/plugins/qtsupport/qtversionmanager.cpp +++ b/src/plugins/qtsupport/qtversionmanager.cpp @@ -34,6 +34,8 @@ #include "qtversionfactory.h" +#include "qtsupportconstants.h" + #include <projectexplorer/debugginghelper.h> // only for legay restore #include <projectexplorer/projectexplorerconstants.h> @@ -600,6 +602,18 @@ QString QtVersionManager::popPendingGcceUpdate() return m_pendingGcceUpdates.takeFirst(); } +Core::FeatureSet QtVersionManager::availableFeatures() const +{ + Core::FeatureSet features; + foreach (BaseQtVersion *const qtVersion, validVersions()) { + if (qtVersion->isValid()) + features |= qtVersion->availableFeatures(); + } + if (validVersions().empty()) + features |= Constants::FEATURE_GENERIC_CPP_ENTRY_POINT; + return features; +} + BaseQtVersion *QtVersionManager::version(int id) const { QMap<int, BaseQtVersion *>::const_iterator it = m_versions.find(id); @@ -919,3 +933,8 @@ BaseQtVersion::QmakeBuildConfigs QtVersionManager::qmakeBuildConfigFromCmdArgs(Q } return result; } + +Core::FeatureSet QtFeatureProvider::availableFeatures() const +{ + return QtVersionManager::instance()->availableFeatures(); +} diff --git a/src/plugins/qtsupport/qtversionmanager.h b/src/plugins/qtsupport/qtversionmanager.h index fb46fcf31c..8b0071d911 100644 --- a/src/plugins/qtsupport/qtversionmanager.h +++ b/src/plugins/qtsupport/qtversionmanager.h @@ -111,6 +111,9 @@ public: // Compatibility with pre-2.2: QString popPendingMwcUpdate(); QString popPendingGcceUpdate(); + + Core::FeatureSet availableFeatures() const; + signals: // content of BaseQtVersion objects with qmake path might have changed void dumpUpdatedFor(const Utils::FileName &qmakeCommand); @@ -159,6 +162,19 @@ private: QStringList m_pendingGcceUpdates; }; +namespace Internal { + +class QTSUPPORT_EXPORT QtFeatureProvider : public Core::IFeatureProvider +{ + Q_OBJECT + +public: + QtFeatureProvider() {} + virtual Core::FeatureSet availableFeatures() const; +}; + +} + } // namespace Qt4ProjectManager #endif // QTVERSIONMANAGER_H diff --git a/src/plugins/vcsbase/basecheckoutwizard.cpp b/src/plugins/vcsbase/basecheckoutwizard.cpp index 3514613a17..e8f96224e2 100644 --- a/src/plugins/vcsbase/basecheckoutwizard.cpp +++ b/src/plugins/vcsbase/basecheckoutwizard.cpp @@ -147,6 +147,11 @@ void BaseCheckoutWizard::runWizard(const QString &path, QWidget *parent) } } +Core::FeatureSet BaseCheckoutWizard::requiredFeatures() const +{ + return Core::FeatureSet(); +} + static inline QString msgNoProjectFiles(const QDir &dir, const QStringList &patterns) { return BaseCheckoutWizard::tr("Could not find any project files matching (%1) in the directory '%2'.").arg(patterns.join(QLatin1String(", ")), QDir::toNativeSeparators(dir.absolutePath())); diff --git a/src/plugins/vcsbase/basecheckoutwizard.h b/src/plugins/vcsbase/basecheckoutwizard.h index 57a0388781..08e68a808f 100644 --- a/src/plugins/vcsbase/basecheckoutwizard.h +++ b/src/plugins/vcsbase/basecheckoutwizard.h @@ -66,6 +66,8 @@ public: virtual void runWizard(const QString &path, QWidget *parent); + virtual Core::FeatureSet requiredFeatures() const; + static QString openProject(const QString &path, QString *errorMessage); protected: |