1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
33 #include "mobileappwizardpages.h"
35 #include "qtquickapp.h"
36 #include "qtquickappwizard.h"
37 #include "qtquickappwizardpages.h"
38 #include "targetsetuppage.h"
40 #include "qt4projectmanagerconstants.h"
42 #include <QtCore/QCoreApplication>
43 #include <QtGui/QIcon>
45 namespace Qt4ProjectManager {
48 class QtQuickAppWizardDialog : public AbstractMobileAppWizardDialog
53 explicit QtQuickAppWizardDialog(QWidget *parent = 0);
56 class QtQuickAppWizardSourcesPage *m_qmlSourcesPage;
57 friend class QtQuickAppWizard;
60 QtQuickAppWizardDialog::QtQuickAppWizardDialog(QWidget *parent)
61 : AbstractMobileAppWizardDialog(parent, QtVersionNumber(4, 7, 0))
64 setWindowTitle(tr("New Qt Quick Application"));
65 setIntroDescription(tr("This wizard generates a Qt Quick application project."));
67 m_qmlSourcesPage = new QtQuickAppWizardSourcesPage;
68 addPageWithTitle(m_qmlSourcesPage, tr("QML Sources"));
72 class QtQuickAppWizardPrivate
74 class QtQuickApp *app;
75 class QtQuickAppWizardDialog *wizardDialog;
76 friend class QtQuickAppWizard;
79 QtQuickAppWizard::QtQuickAppWizard()
80 : AbstractMobileAppWizard(parameters())
81 , m_d(new QtQuickAppWizardPrivate)
83 m_d->app = new QtQuickApp;
84 m_d->wizardDialog = 0;
87 QtQuickAppWizard::~QtQuickAppWizard()
93 Core::BaseFileWizardParameters QtQuickAppWizard::parameters()
95 Core::BaseFileWizardParameters parameters(ProjectWizard);
96 parameters.setIcon(QIcon(QLatin1String(Constants::ICON_QTQUICK_APP)));
97 parameters.setDisplayName(tr("Qt Quick Application"));
98 parameters.setId(QLatin1String("QA.QMLA Application"));
99 parameters.setDescription(tr("Creates a Qt Quick application project that can contain "
100 "both QML and C++ code and includes a QDeclarativeView.\n\n"
101 "You can build the application and deploy it on desktop and "
102 "mobile target platforms. For example, you can create signed "
103 "Symbian Installation System (SIS) packages for this type of "
105 parameters.setCategory(QLatin1String(Constants::QML_WIZARD_CATEGORY));
106 parameters.setDisplayCategory(QCoreApplication::translate(Constants::QML_WIZARD_TR_SCOPE,
107 Constants::QML_WIZARD_TR_CATEGORY));
111 AbstractMobileAppWizardDialog *QtQuickAppWizard::createWizardDialogInternal(QWidget *parent) const
113 m_d->wizardDialog = new QtQuickAppWizardDialog(parent);
114 return m_d->wizardDialog;
117 void QtQuickAppWizard::projectPathChanged(const QString &path) const
119 m_d->wizardDialog->targetsPage()->setProFilePath(path);
122 void QtQuickAppWizard::prepareGenerateFiles(const QWizard *w,
123 QString *errorMessage) const
125 Q_UNUSED(errorMessage)
126 const QtQuickAppWizardDialog *wizard = qobject_cast<const QtQuickAppWizardDialog*>(w);
127 if (wizard->m_qmlSourcesPage->mainQmlMode() == QtQuickApp::ModeGenerate) {
128 m_d->app->setMainQml(QtQuickApp::ModeGenerate);
130 const QString mainQmlFile = wizard->m_qmlSourcesPage->mainQmlFile();
131 m_d->app->setMainQml(QtQuickApp::ModeImport, mainQmlFile);
135 QString QtQuickAppWizard::fileToOpenPostGeneration() const
137 return m_d->app->path(QtQuickApp::MainQml);
140 AbstractMobileApp *QtQuickAppWizard::app() const
145 AbstractMobileAppWizardDialog *QtQuickAppWizard::wizardDialog() const
147 return m_d->wizardDialog;
150 } // namespace Internal
151 } // namespace Qt4ProjectManager
153 #include "qtquickappwizard.moc"