2010-07-15 11:58:37 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2011-01-11 16:28:15 +01:00
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
2010-07-15 11:58:37 +02:00
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
2010-07-15 11:58:37 +02:00
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** 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.
|
2010-07-15 11:58:37 +02:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** 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.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-05-06 15:05:37 +02:00
|
|
|
** Nokia at info@qt.nokia.com.
|
2010-07-15 11:58:37 +02:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
2010-09-16 16:53:59 +02:00
|
|
|
#include "mobileappwizardpages.h"
|
2010-09-21 08:51:52 +02:00
|
|
|
|
2011-02-06 16:23:02 +01:00
|
|
|
#include "qtquickapp.h"
|
|
|
|
|
#include "qtquickappwizard.h"
|
|
|
|
|
#include "qtquickappwizardpages.h"
|
2010-09-21 08:51:52 +02:00
|
|
|
#include "targetsetuppage.h"
|
2010-07-15 11:58:37 +02:00
|
|
|
|
2010-08-25 14:25:18 +02:00
|
|
|
#include "qt4projectmanagerconstants.h"
|
2010-07-15 11:58:37 +02:00
|
|
|
|
|
|
|
|
#include <QtCore/QCoreApplication>
|
2010-09-17 12:58:19 +02:00
|
|
|
#include <QtGui/QIcon>
|
2010-07-15 11:58:37 +02:00
|
|
|
|
2010-08-25 14:25:18 +02:00
|
|
|
namespace Qt4ProjectManager {
|
2010-07-15 11:58:37 +02:00
|
|
|
namespace Internal {
|
|
|
|
|
|
2011-02-07 12:47:07 +01:00
|
|
|
class QtQuickAppWizardDialog : public AbstractMobileAppWizardDialog
|
2010-07-15 11:58:37 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2011-02-07 12:47:07 +01:00
|
|
|
explicit QtQuickAppWizardDialog(QWidget *parent = 0);
|
2010-07-15 11:58:37 +02:00
|
|
|
|
|
|
|
|
private:
|
2011-02-06 16:23:02 +01:00
|
|
|
class QtQuickAppWizardSourcesPage *m_qmlSourcesPage;
|
|
|
|
|
friend class QtQuickAppWizard;
|
2010-07-15 11:58:37 +02:00
|
|
|
};
|
|
|
|
|
|
2011-02-07 12:47:07 +01:00
|
|
|
QtQuickAppWizardDialog::QtQuickAppWizardDialog(QWidget *parent)
|
2011-04-13 10:12:52 +02:00
|
|
|
: AbstractMobileAppWizardDialog(parent, QtVersionNumber(4, 7, 0))
|
2010-09-22 14:22:57 +02:00
|
|
|
, m_qmlSourcesPage(0)
|
2010-07-15 11:58:37 +02:00
|
|
|
{
|
2010-10-02 17:51:36 +02:00
|
|
|
setWindowTitle(tr("New Qt Quick Application"));
|
|
|
|
|
setIntroDescription(tr("This wizard generates a Qt Quick application project."));
|
|
|
|
|
|
2011-02-06 16:23:02 +01:00
|
|
|
m_qmlSourcesPage = new QtQuickAppWizardSourcesPage;
|
2010-12-01 16:55:42 +01:00
|
|
|
addPageWithTitle(m_qmlSourcesPage, tr("QML Sources"));
|
2010-07-15 11:58:37 +02:00
|
|
|
}
|
|
|
|
|
|
2010-12-01 16:55:42 +01:00
|
|
|
|
2011-02-06 16:23:02 +01:00
|
|
|
class QtQuickAppWizardPrivate
|
2010-07-20 17:21:18 +02:00
|
|
|
{
|
2011-02-06 16:23:02 +01:00
|
|
|
class QtQuickApp *app;
|
2011-02-07 12:47:07 +01:00
|
|
|
class QtQuickAppWizardDialog *wizardDialog;
|
2011-02-06 16:23:02 +01:00
|
|
|
friend class QtQuickAppWizard;
|
2010-07-20 17:21:18 +02:00
|
|
|
};
|
|
|
|
|
|
2011-02-06 16:23:02 +01:00
|
|
|
QtQuickAppWizard::QtQuickAppWizard()
|
2010-10-02 17:51:36 +02:00
|
|
|
: AbstractMobileAppWizard(parameters())
|
2011-02-06 16:23:02 +01:00
|
|
|
, m_d(new QtQuickAppWizardPrivate)
|
2010-07-15 11:58:37 +02:00
|
|
|
{
|
2011-02-06 16:23:02 +01:00
|
|
|
m_d->app = new QtQuickApp;
|
2010-07-20 17:21:18 +02:00
|
|
|
m_d->wizardDialog = 0;
|
2010-07-15 11:58:37 +02:00
|
|
|
}
|
|
|
|
|
|
2011-02-06 16:23:02 +01:00
|
|
|
QtQuickAppWizard::~QtQuickAppWizard()
|
2010-07-15 11:58:37 +02:00
|
|
|
{
|
2011-02-06 16:23:02 +01:00
|
|
|
delete m_d->app;
|
2010-09-17 12:58:19 +02:00
|
|
|
delete m_d;
|
2010-07-15 11:58:37 +02:00
|
|
|
}
|
|
|
|
|
|
2011-02-06 16:23:02 +01:00
|
|
|
Core::BaseFileWizardParameters QtQuickAppWizard::parameters()
|
2010-07-15 11:58:37 +02:00
|
|
|
{
|
|
|
|
|
Core::BaseFileWizardParameters parameters(ProjectWizard);
|
2011-02-06 16:23:02 +01:00
|
|
|
parameters.setIcon(QIcon(QLatin1String(Constants::ICON_QTQUICK_APP)));
|
2010-10-02 17:51:36 +02:00
|
|
|
parameters.setDisplayName(tr("Qt Quick Application"));
|
|
|
|
|
parameters.setId(QLatin1String("QA.QMLA Application"));
|
2010-10-07 17:02:20 +02:00
|
|
|
parameters.setDescription(tr("Creates a Qt Quick application project that can contain "
|
|
|
|
|
"both QML and C++ code and includes a QDeclarativeView.\n\n"
|
|
|
|
|
"You can build the application and deploy it on desktop and "
|
|
|
|
|
"mobile target platforms. For example, you can create signed "
|
|
|
|
|
"Symbian Installation System (SIS) packages for this type of "
|
|
|
|
|
"projects."));
|
2010-10-04 14:50:58 +02:00
|
|
|
parameters.setCategory(QLatin1String(Constants::QML_WIZARD_CATEGORY));
|
|
|
|
|
parameters.setDisplayCategory(QCoreApplication::translate(Constants::QML_WIZARD_TR_SCOPE,
|
|
|
|
|
Constants::QML_WIZARD_TR_CATEGORY));
|
2010-07-15 11:58:37 +02:00
|
|
|
return parameters;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-06 16:23:02 +01:00
|
|
|
AbstractMobileAppWizardDialog *QtQuickAppWizard::createWizardDialogInternal(QWidget *parent) const
|
2010-07-15 11:58:37 +02:00
|
|
|
{
|
2011-02-07 12:47:07 +01:00
|
|
|
m_d->wizardDialog = new QtQuickAppWizardDialog(parent);
|
2010-12-10 19:02:19 +01:00
|
|
|
return m_d->wizardDialog;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-06 16:23:02 +01:00
|
|
|
void QtQuickAppWizard::projectPathChanged(const QString &path) const
|
2010-12-10 19:02:19 +01:00
|
|
|
{
|
2011-03-15 13:34:44 +01:00
|
|
|
m_d->wizardDialog->targetsPage()->setProFilePath(path);
|
2010-07-15 11:58:37 +02:00
|
|
|
}
|
|
|
|
|
|
2011-02-06 16:23:02 +01:00
|
|
|
void QtQuickAppWizard::prepareGenerateFiles(const QWizard *w,
|
2010-09-17 12:58:19 +02:00
|
|
|
QString *errorMessage) const
|
2010-07-15 11:58:37 +02:00
|
|
|
{
|
|
|
|
|
Q_UNUSED(errorMessage)
|
2011-02-07 12:47:07 +01:00
|
|
|
const QtQuickAppWizardDialog *wizard = qobject_cast<const QtQuickAppWizardDialog*>(w);
|
2011-02-09 21:39:46 +01:00
|
|
|
if (wizard->m_qmlSourcesPage->mainQmlMode() == QtQuickApp::ModeGenerate) {
|
|
|
|
|
m_d->app->setMainQml(QtQuickApp::ModeGenerate);
|
|
|
|
|
} else {
|
|
|
|
|
const QString mainQmlFile = wizard->m_qmlSourcesPage->mainQmlFile();
|
|
|
|
|
m_d->app->setMainQml(QtQuickApp::ModeImport, mainQmlFile);
|
|
|
|
|
}
|
2010-07-15 11:58:37 +02:00
|
|
|
}
|
|
|
|
|
|
2011-02-10 22:44:01 +01:00
|
|
|
QString QtQuickAppWizard::fileToOpenPostGeneration() const
|
2010-07-15 11:58:37 +02:00
|
|
|
{
|
2011-02-10 22:44:01 +01:00
|
|
|
return m_d->app->path(QtQuickApp::MainQml);
|
2010-07-15 11:58:37 +02:00
|
|
|
}
|
|
|
|
|
|
2011-02-06 16:23:02 +01:00
|
|
|
AbstractMobileApp *QtQuickAppWizard::app() const
|
2010-09-17 12:58:19 +02:00
|
|
|
{
|
2011-02-06 16:23:02 +01:00
|
|
|
return m_d->app;
|
2010-09-17 12:58:19 +02:00
|
|
|
}
|
|
|
|
|
|
2011-02-06 16:23:02 +01:00
|
|
|
AbstractMobileAppWizardDialog *QtQuickAppWizard::wizardDialog() const
|
2010-09-17 12:58:19 +02:00
|
|
|
{
|
|
|
|
|
return m_d->wizardDialog;
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-15 11:58:37 +02:00
|
|
|
} // namespace Internal
|
2010-08-25 14:25:18 +02:00
|
|
|
} // namespace Qt4ProjectManager
|
2010-07-15 11:58:37 +02:00
|
|
|
|
2011-02-06 16:23:02 +01:00
|
|
|
#include "qtquickappwizard.moc"
|