Commit e73a349a authored by Thomas Hartmann's avatar Thomas Hartmann Committed by Kai Koehne
Browse files

Splitting QmlProjectApplicationWizard for Qt Quick 1.1 and Qt Quick 2



QmlProjectApplicationWizard now has a version for Qt Quick 1.1
and one for Qt Quick 2.

Change-Id: Icdcf2b58ad9f252e47a838717a6234eb840a03b7
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
parent affd4b9c
......@@ -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"));
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 <b>Qt 5.0</b> or newer."));
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 <b>Qt 5.0</b> 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 <b>Qt 4.8</b> 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
......
......@@ -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
......
......@@ -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();
......
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