diff --git a/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp b/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp index 8cd331ded3b..615ae3fd7c6 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp @@ -56,8 +56,8 @@ QmlProjectApplicationWizardDialog::QmlProjectApplicationWizardDialog(QWidget *pa setIntroDescription(tr("This wizard generates a Qt Quick UI project.")); } -QmlProjectApplicationWizard::QmlProjectApplicationWizard() - : Core::BaseFileWizard(parameters()) +QmlProjectApplicationWizard::QmlProjectApplicationWizard(ProjectType projectType) + : Core::BaseFileWizard(parameters(projectType)), m_projectType(projectType) { } QmlProjectApplicationWizard::~QmlProjectApplicationWizard() @@ -65,21 +65,45 @@ QmlProjectApplicationWizard::~QmlProjectApplicationWizard() Core::FeatureSet QmlProjectApplicationWizard::requiredFeatures() const { - return Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_2) | Core::Feature(QtSupport::Constants::FEATURE_QMLPROJECT); + switch (m_projectType) { + case QtQuick2Project: + return Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_2) + | Core::Feature(QtSupport::Constants::FEATURE_QMLPROJECT); + case QtQuick1Project: + default: + return Core::Feature(QtSupport::Constants::FEATURE_QMLPROJECT) + | Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_1_1); + } } -Core::BaseFileWizardParameters QmlProjectApplicationWizard::parameters() +Core::BaseFileWizardParameters QmlProjectApplicationWizard::parameters(ProjectType projectType) { Core::BaseFileWizardParameters parameters(ProjectWizard); parameters.setIcon(QIcon(QLatin1String(QtSupport::Constants::QML_WIZARD_ICON))); - parameters.setDisplayName(tr("Qt Quick UI")); - parameters.setId(QLatin1String("QB.QML Application")); + switch (projectType) { + case QtQuick2Project: + parameters.setDisplayName(tr("Qt Quick 2 UI")); + parameters.setId(QLatin1String("QB.QML Application for Qt Quick 2.0")); + + parameters.setDescription(tr("Creates a Qt Quick UI 2 project with a single " + "QML file that contains the main view.\n\n" + "You can review Qt Quick UI 2 projects in the QML Scene and you need not build them. " + "You do not need to have the development environment installed " + "on your computer to create and run this type of projects.\n\nRequires Qt 5.0 or newer.")); + break; + case QtQuick1Project: + default: + parameters.setDisplayName(tr("Qt Quick 1 UI")); + parameters.setId(QLatin1String("QB.QML Application for Qt Quick 1.1")); + + parameters.setDescription(tr("Creates a Qt Quick UI 1 project with a single " + "QML file that contains the main view.\n\n" + "You can review Qt Quick UI 1 projects in the QML Viewer and you need not build them. " + "You do not need to have the development environment installed " + "on your computer to create and run this type of projects.\n\nRequires Qt 4.8 or newer.")); + + } - parameters.setDescription(tr("Creates a Qt Quick UI project with a single " - "QML file that contains the main view.\n\n" - "You can review Qt Quick UI projects in the QML Viewer and you need not build them. " - "You do not need to have the development environment installed " - "on your computer to create and run this type of projects.\n\nRequires Qt 5.0 or newer.")); parameters.setCategory(QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY)); parameters.setDisplayCategory(QT_TRANSLATE_NOOP("ProjectExplorer", "Qt Application")); return parameters; @@ -118,8 +142,16 @@ Core::GeneratedFiles QmlProjectApplicationWizard::generateFiles(const QWizard *w { QTextStream out(&contents); + switch (m_projectType) { + case QtQuick2Project: + out << "import QtQuick 2.0" << endl; + break; + case QtQuick1Project: + default: + out << "import QtQuick 1.1" << endl; + } + out - << "import QtQuick 2.0" << endl << endl << "Rectangle {" << endl << " width: 360" << endl diff --git a/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.h b/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.h index ee5924e9f7c..76b9c84abde 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.h +++ b/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.h @@ -49,11 +49,16 @@ class QmlProjectApplicationWizard : public Core::BaseFileWizard Q_OBJECT public: - QmlProjectApplicationWizard(); + enum ProjectType { + QtQuick2Project, + QtQuick1Project + }; + + QmlProjectApplicationWizard(ProjectType projectType); virtual ~QmlProjectApplicationWizard(); virtual Core::FeatureSet requiredFeatures() const; - static Core::BaseFileWizardParameters parameters(); + static Core::BaseFileWizardParameters parameters(ProjectType projectType); protected: virtual QWizard *createWizardDialog(QWidget *parent, @@ -63,6 +68,9 @@ protected: QString *errorMessage) const; virtual bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage); + +private: + const ProjectType m_projectType; }; } // namespace Internal diff --git a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp index dd097068c82..5f2698acb86 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp @@ -80,7 +80,11 @@ bool QmlProjectPlugin::initialize(const QStringList &, QString *errorMessage) addAutoReleasedObject(manager); addAutoReleasedObject(new Internal::QmlProjectRunConfigurationFactory); addAutoReleasedObject(new Internal::QmlProjectRunControlFactory); - addAutoReleasedObject(new Internal::QmlProjectApplicationWizard); + + addAutoReleasedObject(new Internal::QmlProjectApplicationWizard( + Internal::QmlProjectApplicationWizard::QtQuick1Project)); + addAutoReleasedObject(new Internal::QmlProjectApplicationWizard( + Internal::QmlProjectApplicationWizard::QtQuick2Project)); QmlProjectFileFormat::registerDeclarativeTypes();