Commit 57d65274 authored by Tobias Hunger's avatar Tobias Hunger

Qt: Update features for Qt 5.5

* Add QtVersionNumber::matches to match against a Qt version to
  make the code setting the features easier to follow.
* Use versionedFeatures instead of adding new string constants for
  the latest and greatest Qt Quick and Qt Quick Controls.
* Fix Qt-version-to-features mapping as discussed in
  QTCREATORBUG-14575
* Simplify code in qmljsbundleprovider.cpp: It should do the same
  thing as the old one.

Change-Id: Iba24e9d299a2a2e5d6e4de7cd1e95707a574678e
Reviewed-by: default avatarDaniel Teske <daniel.teske@theqtcompany.com>
parent 705ac153
......@@ -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(QtSupport::Constants::FEATURE_QT));
setRequiredFeatures(Core::FeatureSet(Core::Feature::versionedFeature(QtSupport::Constants::FEATURE_QT_PREFIX)));
}
Core::BaseFileWizard *LibraryWizard::create(QWidget *parent, const Core::WizardDialogParameters &parameters) const
......
......@@ -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(QtSupport::Constants::FEATURE_QT));
setRequiredFeatures(Core::FeatureSet(Core::Feature::versionedFeature(QtSupport::Constants::FEATURE_QT_PREFIX)));
}
Core::BaseFileWizard *SubdirsProjectWizard::create(QWidget *parent,
......
......@@ -57,7 +57,7 @@ TestWizard::TestWizard()
"and that there are no regressions."));
setIcon(QIcon(QLatin1String(":/wizards/images/console.png")));
setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QT_CONSOLE) |
Core::Feature(QtSupport::Constants::FEATURE_QT));
Core::Feature::versionedFeature(QtSupport::Constants::FEATURE_QT_PREFIX));
}
Core::BaseFileWizard *TestWizard::create(QWidget *parent, const Core::WizardDialogParameters &parameters) const
......
......@@ -131,9 +131,7 @@ void BasicBundleProvider::mergeBundlesForKit(ProjectExplorer::Kit *kit
QString qtQmlPath = qtVersion->qmakeProperty("QT_INSTALL_QML");
Core::FeatureSet features = qtVersion->availableFeatures();
if (features.contains(Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK))
|| features.contains(Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_1))
|| features.contains(Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_1_1))) {
if (features.contains(Core::Feature::versionedFeature(QtSupport::Constants::FEATURE_QT_QUICK_PREFIX))) {
myReplacements.insert(QLatin1String("$(CURRENT_DIRECTORY)"), qtImportsPath);
QDir qtQuick1Bundles(qtImportsPath);
qtQuick1Bundles.setNameFilters(QStringList(QLatin1String("*-bundle.json")));
......@@ -158,7 +156,7 @@ void BasicBundleProvider::mergeBundlesForKit(ProjectExplorer::Kit *kit
bundles.mergeBundleForLanguage(Dialect::Qml, qtQuick1Bundle);
bundles.mergeBundleForLanguage(Dialect::QmlQtQuick1, qtQuick1Bundle);
}
if (features.contains(Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_2))) {
if (features.contains(Core::Feature::versionedFeature(QtSupport::Constants::FEATURE_QT_QUICK_PREFIX, 2))) {
myReplacements.insert(QLatin1String("$(CURRENT_DIRECTORY)"), qtQmlPath);
QDir qtQuick2Bundles(qtQmlPath);
qtQuick2Bundles.setNameFilters(QStringList(QLatin1String("*-bundle.json")));
......
......@@ -98,7 +98,24 @@ QtVersionNumber::QtVersionNumber()
FeatureSet QtVersionNumber::features() const
{
return FeatureSet::versionedFeatures(Constants::FEATURE_QT, majorVersion, minorVersion);
return FeatureSet::versionedFeatures(Constants::FEATURE_QT_PREFIX, majorVersion, minorVersion);
}
bool QtVersionNumber::matches(int major, int minor, int patch) const
{
if (major < 0)
return true;
if (major != majorVersion)
return false;
if (minor < 0)
return true;
if (minor != minorVersion)
return false;
if (patch < 0)
return true;
return (patch == patchVersion);
}
bool QtVersionNumber::operator <(const QtVersionNumber &b) const
......@@ -355,59 +372,62 @@ FeatureSet BaseQtVersion::availableFeatures() const
{
FeatureSet features = qtVersion().features(); // Qt Version features
features |= (FeatureSet(Constants::FEATURE_QWIDGETS)
| FeatureSet(Constants::FEATURE_QT_WEBKIT)
| FeatureSet(Constants::FEATURE_QT_CONSOLE));
features |= (Feature(Constants::FEATURE_QWIDGETS)
| Feature(Constants::FEATURE_QT_WEBKIT)
| Feature(Constants::FEATURE_QT_CONSOLE));
if (qtVersion() < QtVersionNumber(4, 7, 0))
return features;
features |= FeatureSet(Constants::FEATURE_QT_QUICK);
features |= FeatureSet(Constants::FEATURE_QT_QUICK_1);
features |= FeatureSet::versionedFeatures(Constants::FEATURE_QT_QUICK_PREFIX, 1, 0);
if (qtVersion() < QtVersionNumber(4, 7, 1))
if (qtVersion().matches(4, 7, 0))
return features;
features |= FeatureSet(Constants::FEATURE_QT_QUICK_1_1);
features |= FeatureSet::versionedFeatures(Constants::FEATURE_QT_QUICK_PREFIX, 1, 1);
if (qtVersion() < QtVersionNumber(5, 0, 0))
if (qtVersion().matches(4))
return features;
features |= FeatureSet(Constants::FEATURE_QT_QUICK_2);
features |= FeatureSet(Constants::FEATURE_QT_QUICK_2_0);
features |= FeatureSet::versionedFeatures(Constants::FEATURE_QT_QUICK_PREFIX, 2, 0);
if (qtVersion() < QtVersionNumber(5, 1, 0))
if (qtVersion().matches(5, 0))
return features;
features |= FeatureSet(Constants::FEATURE_QT_QUICK_2_1);
features |= FeatureSet(Constants::FEATURE_QT_QUICK_CONTROLS);
features |= FeatureSet(Constants::FEATURE_QT_QUICK_CONTROLS_1);
features |= FeatureSet(Constants::FEATURE_QT_QUICK_CONTROLS_1_0);
features |= FeatureSet::versionedFeatures(Constants::FEATURE_QT_QUICK_PREFIX, 2, 1);
features |= FeatureSet::versionedFeatures(Constants::FEATURE_QT_QUICK_CONTROLS_PREFIX, 1, 0);
if (qtVersion() < QtVersionNumber(5, 2, 0))
if (qtVersion().matches(5, 1))
return features;
features |= FeatureSet(Constants::FEATURE_QT_QUICK_2_2);
features |= FeatureSet(Constants::FEATURE_QT_QUICK_CONTROLS_1_1);
features |= FeatureSet::versionedFeatures(Constants::FEATURE_QT_QUICK_PREFIX, 2, 2);
features |= FeatureSet::versionedFeatures(Constants::FEATURE_QT_QUICK_CONTROLS_PREFIX, 1, 1);
if (qtVersion() < QtVersionNumber(5, 3, 0))
if (qtVersion().matches(5, 2))
return features;
features |= FeatureSet(Constants::FEATURE_QT_QUICK_2_3);
features |= FeatureSet(Constants::FEATURE_QT_QUICK_CONTROLS_1_2);
features |= FeatureSet::versionedFeatures(Constants::FEATURE_QT_QUICK_PREFIX, 2, 3);
features |= FeatureSet::versionedFeatures(Constants::FEATURE_QT_QUICK_CONTROLS_PREFIX, 1, 2);
if (qtVersion() < QtVersionNumber(5, 4, 0))
if (qtVersion().matches(5, 3))
return features;
features |= FeatureSet(Constants::FEATURE_QT_QUICK_2_4);
features |= FeatureSet(Constants::FEATURE_QT_QUICK_CONTROLS_1_3);
features |= FeatureSet(Constants::FEATURE_QT_QUICK_UI_FILES);
features |= Feature(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);
if (qtVersion() < QtVersionNumber(5, 5, 0))
if (qtVersion().matches(5, 4))
return features;
features |= FeatureSet(Constants::FEATURE_QT_3D);
features |= FeatureSet(Constants::FEATURE_QT_CANVAS3D);
features |= Feature(Constants::FEATURE_QT_3D);
features |= Feature(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);
if (qtVersion().matches(5, 5))
return features;
return features;
}
......
......@@ -73,6 +73,9 @@ public:
int majorVersion;
int minorVersion;
int patchVersion;
bool matches(int major = -1, int minor = -1, int patch = -1) const;
bool operator <(const QtVersionNumber &b) const;
bool operator <=(const QtVersionNumber &b) const;
bool operator >(const QtVersionNumber &b) const;
......
......@@ -50,24 +50,11 @@ static const char QTVERSIONID[] = "Id";
static const char QTVERSIONNAME[] = "Name";
//Qt Features
const char FEATURE_QT[] = "QtSupport.Wizards.FeatureQt";
const char FEATURE_QT_PREFIX[] = "QtSupport.Wizards.FeatureQt";
const char FEATURE_QWIDGETS[] = "QtSupport.Wizards.FeatureQWidgets";
const char FEATURE_QT_QUICK[] = "QtSupport.Wizards.FeatureQtQuick";
const char FEATURE_QT_QUICK_PREFIX[] = "QtSupport.Wizards.FeatureQtQuick";
const char FEATURE_QMLPROJECT[] = "QtSupport.Wizards.FeatureQtQuickProject";
const char FEATURE_QT_QUICK_1[] = "QtSupport.Wizards.FeatureQtQuick.1";
const char FEATURE_QT_QUICK_1_1[] = "QtSupport.Wizards.FeatureQtQuick.1.1";
const char FEATURE_QT_QUICK_2[] = "QtSupport.Wizards.FeatureQtQuick.2";
const char FEATURE_QT_QUICK_2_0[] = "QtSupport.Wizards.FeatureQtQuick.2.0";
const char FEATURE_QT_QUICK_2_1[] = "QtSupport.Wizards.FeatureQtQuick.2.1";
const char FEATURE_QT_QUICK_2_2[] = "QtSupport.Wizards.FeatureQtQuick.2.2";
const char FEATURE_QT_QUICK_2_3[] = "QtSupport.Wizards.FeatureQtQuick.2.3";
const char FEATURE_QT_QUICK_2_4[] = "QtSupport.Wizards.FeatureQtQuick.2.4";
const char FEATURE_QT_QUICK_CONTROLS[] = "QtSupport.Wizards.FeatureQtQuick.Controls";
const char FEATURE_QT_QUICK_CONTROLS_1[] = "QtSupport.Wizards.FeatureQtQuick.Controls.1";
const char FEATURE_QT_QUICK_CONTROLS_1_0[] = "QtSupport.Wizards.FeatureQtQuick.Controls.1.0";
const char FEATURE_QT_QUICK_CONTROLS_1_1[] = "QtSupport.Wizards.FeatureQtQuick.Controls.1.1";
const char FEATURE_QT_QUICK_CONTROLS_1_2[] = "QtSupport.Wizards.FeatureQtQuick.Controls.1.2";
const char FEATURE_QT_QUICK_CONTROLS_1_3[] = "QtSupport.Wizards.FeatureQtQuick.Controls.1.3";
const char FEATURE_QT_QUICK_CONTROLS_PREFIX[] = "QtSupport.Wizards.FeatureQtQuick.Controls";
const char FEATURE_QT_QUICK_UI_FILES[] = "QtSupport.Wizards.FeatureQtQuick.UiFiles";
const char FEATURE_QT_WEBKIT[] = "QtSupport.Wizards.FeatureQtWebkit";
const char FEATURE_QT_3D[] = "QtSupport.Wizards.FeatureQt3d";
......
......@@ -69,7 +69,7 @@ Core::FeatureSet 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(QtSupport::Constants::FEATURE_QT_QUICK_1));
features.remove(Core::Feature::versionedFeature(QtSupport::Constants::FEATURE_QT_QUICK_CONTROLS_PREFIX, 1));
features.remove(Core::Feature(QtSupport::Constants::FEATURE_QT_WEBKIT));
return features;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment