Commit 38e2ba8c authored by Alessandro Portale's avatar Alessandro Portale
Browse files

Support existing Qml project for "standalone" Qml apps

Now, the user can select an existing qml application that can
be turned into a standalone Qml app. The qml source files will not
be copied around but rather stay in their original location. The
new .pro file that gets generated by this wizard will reference
the qml source files via relative path and deploy them from there.

Task-number: QTCREATORBUG-1814
parent ae4993f8
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<file>images/qmlproject.png</file> <file>images/qmlproject.png</file>
<file>images/qml_wizard.png</file> <file>images/qml_wizard.png</file>
<file>wizards/templates/app.pro</file> <file>wizards/templates/app.pro</file>
<file>wizards/templates/qml/app.qml</file> <file>wizards/templates/qml/app/app.qml</file>
<file>wizards/templates/cpp/qmlapplicationview.h</file> <file>wizards/templates/cpp/qmlapplicationview.h</file>
<file>wizards/templates/cpp/symbianicon.svg</file> <file>wizards/templates/cpp/symbianicon.svg</file>
<file>wizards/templates/cpp/main.cpp</file> <file>wizards/templates/cpp/main.cpp</file>
......
...@@ -23,7 +23,7 @@ HEADERS += qmlproject.h \ ...@@ -23,7 +23,7 @@ HEADERS += qmlproject.h \
qmlprojectmanagerconstants.h \ qmlprojectmanagerconstants.h \
qmlprojecttarget.h \ qmlprojecttarget.h \
wizards/qmlstandaloneappwizard.h \ wizards/qmlstandaloneappwizard.h \
wizards/qmlstandaloneappwizardoptionspage.h \ wizards/qmlstandaloneappwizardpages.h \
wizards/qmlstandaloneapp.h wizards/qmlstandaloneapp.h
SOURCES += qmlproject.cpp \ SOURCES += qmlproject.cpp \
...@@ -38,7 +38,7 @@ SOURCES += qmlproject.cpp \ ...@@ -38,7 +38,7 @@ SOURCES += qmlproject.cpp \
qmlprojectapplicationwizard.cpp \ qmlprojectapplicationwizard.cpp \
qmlprojecttarget.cpp \ qmlprojecttarget.cpp \
wizards/qmlstandaloneappwizard.cpp \ wizards/qmlstandaloneappwizard.cpp \
wizards/qmlstandaloneappwizardoptionspage.cpp \ wizards/qmlstandaloneappwizardpages.cpp \
wizards/qmlstandaloneapp.cpp wizards/qmlstandaloneapp.cpp
RESOURCES += qmlproject.qrc RESOURCES += qmlproject.qrc
...@@ -48,7 +48,8 @@ INCLUDEPATH += \ ...@@ -48,7 +48,8 @@ INCLUDEPATH += \
wizards wizards
FORMS += \ FORMS += \
wizards/qmlstandaloneappwizardoptionspage.ui wizards/qmlstandaloneappwizardoptionspage.ui \
wizards/qmlstandaloneappwizardsourcespage.ui
OTHER_FILES += QmlProjectManager.pluginspec \ OTHER_FILES += QmlProjectManager.pluginspec \
QmlProject.mimetypes.xml QmlProject.mimetypes.xml
...@@ -77,7 +77,8 @@ bool QmlProjectPlugin::initialize(const QStringList &, QString *errorMessage) ...@@ -77,7 +77,8 @@ bool QmlProjectPlugin::initialize(const QStringList &, QString *errorMessage)
addAutoReleasedObject(manager); addAutoReleasedObject(manager);
addAutoReleasedObject(new Internal::QmlProjectRunConfigurationFactory); addAutoReleasedObject(new Internal::QmlProjectRunConfigurationFactory);
addAutoReleasedObject(new Internal::QmlRunControlFactory); addAutoReleasedObject(new Internal::QmlRunControlFactory);
addAutoReleasedObject(new QmlNewStandaloneAppWizard); addAutoReleasedObject(new QmlStandaloneAppWizard(QmlStandaloneAppWizard::NewQmlFile));
addAutoReleasedObject(new QmlStandaloneAppWizard(QmlStandaloneAppWizard::ImportQmlFile));
addAutoReleasedObject(new QmlProjectApplicationWizard); addAutoReleasedObject(new QmlProjectApplicationWizard);
addAutoReleasedObject(new QmlProjectImportWizard); addAutoReleasedObject(new QmlProjectImportWizard);
......
...@@ -55,6 +55,16 @@ QString QmlStandaloneApp::symbianUidForPath(const QString &path) ...@@ -55,6 +55,16 @@ QString QmlStandaloneApp::symbianUidForPath(const QString &path)
+ QString::fromLatin1("%1").arg(hash, 7, 16, QLatin1Char('0')).right(7); + QString::fromLatin1("%1").arg(hash, 7, 16, QLatin1Char('0')).right(7);
} }
void QmlStandaloneApp::setMainQmlFile(const QString &qmlFile)
{
m_mainQmlFile.setFile(qmlFile);
}
QString QmlStandaloneApp::mainQmlFile() const
{
return path(MainQml, Target);
}
void QmlStandaloneApp::setOrientation(Orientation orientation) void QmlStandaloneApp::setOrientation(Orientation orientation)
{ {
m_orientation = orientation; m_orientation = orientation;
...@@ -77,10 +87,7 @@ QString QmlStandaloneApp::projectName() const ...@@ -77,10 +87,7 @@ QString QmlStandaloneApp::projectName() const
void QmlStandaloneApp::setProjectPath(const QString &path) void QmlStandaloneApp::setProjectPath(const QString &path)
{ {
m_projectPath = path; m_projectPath.setFile(path);
if (!(m_projectPath.endsWith(QLatin1Char('\\'))
|| m_projectPath.endsWith(QLatin1Char('/'))))
m_projectPath.append(QDir::separator());
} }
void QmlStandaloneApp::setSymbianSvgIcon(const QString &icon) void QmlStandaloneApp::setSymbianSvgIcon(const QString &icon)
...@@ -101,7 +108,7 @@ void QmlStandaloneApp::setSymbianTargetUid(const QString &uid) ...@@ -101,7 +108,7 @@ void QmlStandaloneApp::setSymbianTargetUid(const QString &uid)
QString QmlStandaloneApp::symbianTargetUid() const QString QmlStandaloneApp::symbianTargetUid() const
{ {
return !m_symbianTargetUid.isEmpty() ? m_symbianTargetUid return !m_symbianTargetUid.isEmpty() ? m_symbianTargetUid
: symbianUidForPath(m_projectPath + m_projectName); : symbianUidForPath(path(AppProfile, Target));
} }
void QmlStandaloneApp::setLoadDummyData(bool loadIt) void QmlStandaloneApp::setLoadDummyData(bool loadIt)
...@@ -126,11 +133,12 @@ bool QmlStandaloneApp::networkEnabled() const ...@@ -126,11 +133,12 @@ bool QmlStandaloneApp::networkEnabled() const
QString QmlStandaloneApp::path(Path path, Location location) const QString QmlStandaloneApp::path(Path path, Location location) const
{ {
const QString qmlRootFolder = QLatin1String("qml/")
+ (useExistingMainQml() ? m_mainQmlFile.dir().dirName() : m_projectName)
+ QLatin1Char('/');
const QString sourceRoot = QLatin1String(":/qmlproject/wizards/templates/"); const QString sourceRoot = QLatin1String(":/qmlproject/wizards/templates/");
const QString cppSourceSubDir = QLatin1String("cpp/"); const QString cppSourceSubDir = QLatin1String("cpp/");
const QString qmlSourceSubDir = QLatin1String("qml/");
const QString cppTargetSubDir = cppSourceSubDir; const QString cppTargetSubDir = cppSourceSubDir;
const QString qmlTargetSubDir = qmlSourceSubDir;
const QString qmlExtension = QLatin1String(".qml"); const QString qmlExtension = QLatin1String(".qml");
const QString mainCpp = QLatin1String("main.cpp"); const QString mainCpp = QLatin1String("main.cpp");
const QString appViewCpp = QLatin1String("qmlapplicationview.cpp"); const QString appViewCpp = QLatin1String("qmlapplicationview.cpp");
...@@ -141,42 +149,50 @@ QString QmlStandaloneApp::path(Path path, Location location) const ...@@ -141,42 +149,50 @@ QString QmlStandaloneApp::path(Path path, Location location) const
switch (location) { switch (location) {
case Source: { case Source: {
switch (path) { switch (path) {
case MainQml: return sourceRoot + qmlSourceSubDir + QLatin1String("app.qml"); case MainQml: return sourceRoot + QLatin1String("qml/app/app.qml");
case AppProfile: return sourceRoot + QLatin1String("app.pro"); case AppProfile: return sourceRoot + QLatin1String("app.pro");
case MainCpp: return sourceRoot + cppSourceSubDir + mainCpp; case MainCpp: return sourceRoot + cppSourceSubDir + mainCpp;
case AppViewerCpp: return sourceRoot + cppSourceSubDir + appViewCpp; case AppViewerCpp: return sourceRoot + cppSourceSubDir + appViewCpp;
case AppViewerH: return sourceRoot + cppSourceSubDir + appViewH; case AppViewerH: return sourceRoot + cppSourceSubDir + appViewH;
case SymbianSvgIcon: return !m_symbianSvgIcon.isEmpty() ? m_symbianSvgIcon case SymbianSvgIcon: return !m_symbianSvgIcon.isEmpty() ? m_symbianSvgIcon
:sourceRoot + cppSourceSubDir + symbianIcon; : sourceRoot + cppSourceSubDir + symbianIcon;
default: qFatal(errorMessage); default: qFatal(errorMessage);
} }
} }
case Target: { case Target: {
const QString pathBase = m_projectPath + m_projectName + QDir::separator(); const QString pathBase = m_projectPath.absoluteFilePath() + QLatin1Char('/')
+ m_projectName + QLatin1Char('/');
switch (path) { switch (path) {
case MainQml: return pathBase + qmlTargetSubDir + m_projectName + qmlExtension; case MainQml: return useExistingMainQml() ? m_mainQmlFile.canonicalFilePath()
: pathBase + qmlRootFolder + m_projectName + qmlExtension;
case AppProfile: return pathBase + m_projectName + QLatin1String(".pro"); case AppProfile: return pathBase + m_projectName + QLatin1String(".pro");
case AppProfilePath: return pathBase;
case MainCpp: return pathBase + cppTargetSubDir + mainCpp; case MainCpp: return pathBase + cppTargetSubDir + mainCpp;
case AppViewerCpp: return pathBase + cppTargetSubDir + appViewCpp; case AppViewerCpp: return pathBase + cppTargetSubDir + appViewCpp;
case AppViewerH: return pathBase + cppTargetSubDir + appViewH; case AppViewerH: return pathBase + cppTargetSubDir + appViewH;
case SymbianSvgIcon: return pathBase + cppTargetSubDir + symbianIcon; case SymbianSvgIcon: return pathBase + cppTargetSubDir + symbianIcon;
case QmlDir: return pathBase + qmlRootFolder;
default: qFatal(errorMessage); default: qFatal(errorMessage);
} }
} }
case AppProfileRelative: { case AppProfileRelative: {
const QDir appProFilePath(this->path(AppProfilePath, Target));
switch (path) { switch (path) {
case MainQml: return qmlTargetSubDir + m_projectName + qmlExtension; case MainQml: return useExistingMainQml() ? appProFilePath.relativeFilePath(m_mainQmlFile.canonicalFilePath())
: qmlRootFolder + m_projectName + qmlExtension;
case MainCpp: return cppTargetSubDir + mainCpp; case MainCpp: return cppTargetSubDir + mainCpp;
case AppViewerCpp: return cppTargetSubDir + appViewCpp; case AppViewerCpp: return cppTargetSubDir + appViewCpp;
case AppViewerH: return cppTargetSubDir + appViewH; case AppViewerH: return cppTargetSubDir + appViewH;
case SymbianSvgIcon: return cppTargetSubDir + symbianIcon; case SymbianSvgIcon: return cppTargetSubDir + symbianIcon;
case QmlDir: return QString(qmlTargetSubDir).remove(qmlTargetSubDir.length() - 1, 1); case QmlDir: return useExistingMainQml() ? appProFilePath.relativeFilePath(m_mainQmlFile.canonicalPath())
: QString(qmlRootFolder).remove(qmlRootFolder.length() - 1, 1);
default: qFatal(errorMessage); default: qFatal(errorMessage);
} }
} }
default: { /* case MainCppRelative: */ default: { /* case MainCppRelative: */
switch (path) { switch (path) {
case MainQml: return qmlTargetSubDir + m_projectName + qmlExtension; case MainQml: return useExistingMainQml() ? qmlRootFolder + m_mainQmlFile.fileName()
: QString(qmlRootFolder + m_projectName + qmlExtension);
default: qFatal(errorMessage); default: qFatal(errorMessage);
} }
} }
...@@ -310,7 +326,8 @@ Core::GeneratedFiles QmlStandaloneApp::generateFiles(QString *errorMessage) cons ...@@ -310,7 +326,8 @@ Core::GeneratedFiles QmlStandaloneApp::generateFiles(QString *errorMessage) cons
generatedProFile.setAttributes(Core::GeneratedFile::OpenProjectAttribute); generatedProFile.setAttributes(Core::GeneratedFile::OpenProjectAttribute);
files.append(generatedProFile); files.append(generatedProFile);
files.append(generateFileCopy(path(MainQml, Source), path(MainQml, Target), true)); if (!useExistingMainQml())
files.append(generateFileCopy(path(MainQml, Source), path(MainQml, Target), true));
Core::GeneratedFile generatedMainCppFile(path(MainCpp, Target)); Core::GeneratedFile generatedMainCppFile(path(MainCpp, Target));
generatedMainCppFile.setContents(generateMainCpp(errorMessage)); generatedMainCppFile.setContents(generateMainCpp(errorMessage));
...@@ -324,5 +341,10 @@ Core::GeneratedFiles QmlStandaloneApp::generateFiles(QString *errorMessage) cons ...@@ -324,5 +341,10 @@ Core::GeneratedFiles QmlStandaloneApp::generateFiles(QString *errorMessage) cons
} }
#endif // CREATORLESSTEST #endif // CREATORLESSTEST
bool QmlStandaloneApp::useExistingMainQml() const
{
return !m_mainQmlFile.filePath().isEmpty();
}
} // namespace Internal } // namespace Internal
} // namespace QmlProjectManager } // namespace QmlProjectManager
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#define QMLSTANDALONEAPP_H #define QMLSTANDALONEAPP_H
#include <QtCore/QString> #include <QtCore/QString>
#include <QtCore/QFileInfo>
#ifndef CREATORLESSTEST #ifndef CREATORLESSTEST
#include <coreplugin/basefilewizard.h> #include <coreplugin/basefilewizard.h>
#endif // CREATORLESSTEST #endif // CREATORLESSTEST
...@@ -51,6 +53,7 @@ public: ...@@ -51,6 +53,7 @@ public:
MainQml, MainQml,
MainCpp, MainCpp,
AppProfile, AppProfile,
AppProfilePath,
AppViewerCpp, AppViewerCpp,
AppViewerH, AppViewerH,
SymbianSvgIcon, SymbianSvgIcon,
...@@ -66,6 +69,8 @@ public: ...@@ -66,6 +69,8 @@ public:
QmlStandaloneApp(); QmlStandaloneApp();
void setMainQmlFile(const QString &qmlFile);
QString mainQmlFile() const;
void setOrientation(Orientation orientation); void setOrientation(Orientation orientation);
Orientation orientation() const; Orientation orientation() const;
void setProjectName(const QString &name); void setProjectName(const QString &name);
...@@ -86,19 +91,21 @@ public: ...@@ -86,19 +91,21 @@ public:
#else #else
bool generateFiles(QString *errorMessage) const; bool generateFiles(QString *errorMessage) const;
#endif // CREATORLESSTEST #endif // CREATORLESSTEST
QString path(Path path, Location location) const;
bool useExistingMainQml() const;
private: private:
QString path(Path path, Location location) const;
QByteArray generateMainCpp(const QString *errorMessage) const; QByteArray generateMainCpp(const QString *errorMessage) const;
QByteArray generateProFile(const QString *errorMessage) const; QByteArray generateProFile(const QString *errorMessage) const;
QString m_projectName; QString m_projectName;
QString m_projectPath; QFileInfo m_projectPath;
QString m_symbianSvgIcon; QString m_symbianSvgIcon;
QString m_symbianTargetUid; QString m_symbianTargetUid;
bool m_loadDummyData; bool m_loadDummyData;
Orientation m_orientation; Orientation m_orientation;
bool m_networkEnabled; bool m_networkEnabled;
QFileInfo m_mainQmlFile;
}; };
} // end of namespace Internal } // end of namespace Internal
......
...@@ -28,12 +28,15 @@ ...@@ -28,12 +28,15 @@
**************************************************************************/ **************************************************************************/
#include "qmlstandaloneappwizard.h" #include "qmlstandaloneappwizard.h"
#include "qmlstandaloneappwizardoptionspage.h" #include "qmlstandaloneappwizardpages.h"
#include "qmlstandaloneapp.h" #include "qmlstandaloneapp.h"
#include "qmlprojectconstants.h" #include "qmlprojectconstants.h"
#include <projectexplorer/baseprojectwizarddialog.h>
#include <projectexplorer/customwizard/customwizard.h> #include <projectexplorer/customwizard/customwizard.h>
#include <projectexplorer/projectexplorer.h>
#include <coreplugin/editormanager/editormanager.h>
#include <QtGui/QIcon> #include <QtGui/QIcon>
...@@ -48,103 +51,142 @@ ...@@ -48,103 +51,142 @@
namespace QmlProjectManager { namespace QmlProjectManager {
namespace Internal { namespace Internal {
class QmlNewStandaloneAppWizardDialog : public ProjectExplorer::BaseProjectWizardDialog class QmlStandaloneAppWizardDialog : public ProjectExplorer::BaseProjectWizardDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit QmlNewStandaloneAppWizardDialog(QWidget *parent = 0); explicit QmlStandaloneAppWizardDialog(QmlStandaloneAppWizard::WizardType type, QWidget *parent = 0);
private: private:
class QmlStandaloneAppWizardOptionPage *m_qmlOptionsPage; QmlStandaloneAppWizard::WizardType m_type;
friend class QmlNewStandaloneAppWizard; class QmlStandaloneAppWizardSourcesPage *m_qmlSourcesPage;
class QmlStandaloneAppWizardOptionsPage *m_qmlOptionsPage;
friend class QmlStandaloneAppWizard;
}; };
QmlNewStandaloneAppWizardDialog::QmlNewStandaloneAppWizardDialog(QWidget *parent) QmlStandaloneAppWizardDialog::QmlStandaloneAppWizardDialog(QmlStandaloneAppWizard::WizardType type,
QWidget *parent)
: ProjectExplorer::BaseProjectWizardDialog(parent) : ProjectExplorer::BaseProjectWizardDialog(parent)
, m_type(type)
{ {
setWindowTitle(tr("New Standalone QML Project")); setWindowTitle(m_type == QmlStandaloneAppWizard::NewQmlFile
setIntroDescription(tr("This wizard generates a Standalone QML application project.")); ? tr("New Standalone QML Project")
: tr("Standalone QML Project from existing QML Project"));
m_qmlOptionsPage = new QmlStandaloneAppWizardOptionPage; setIntroDescription(m_type == QmlStandaloneAppWizard::NewQmlFile
? tr("This wizard generates a Standalone QML application project.")
: tr("This wizard imports an existing QML application and creates a standalone version of it."));
m_qmlSourcesPage = new QmlStandaloneAppWizardSourcesPage;
m_qmlSourcesPage->setMainQmlFileChooserVisible(m_type == QmlStandaloneAppWizard::ImportQmlFile);
if (m_type == QmlStandaloneAppWizard::ImportQmlFile) {
const int qmlSourcesPagePageId = addPage(m_qmlSourcesPage);
wizardProgress()->item(qmlSourcesPagePageId)->setTitle(tr("Qml Sources"));
}
m_qmlOptionsPage = new QmlStandaloneAppWizardOptionsPage;
const int qmlOptionsPagePageId = addPage(m_qmlOptionsPage); const int qmlOptionsPagePageId = addPage(m_qmlOptionsPage);
wizardProgress()->item(qmlOptionsPagePageId)->setTitle(tr("Qml App options")); wizardProgress()->item(qmlOptionsPagePageId)->setTitle(tr("Qml App options"));
} }
QmlNewStandaloneAppWizard::QmlNewStandaloneAppWizard() class QmlStandaloneAppWizardPrivate
: Core::BaseFileWizard(parameters()) {
, m_standaloneApp(new QmlStandaloneApp) QmlStandaloneAppWizard::WizardType type;
, m_wizardDialog(0) class QmlStandaloneApp *standaloneApp;
class QmlStandaloneAppWizardDialog *wizardDialog;
friend class QmlStandaloneAppWizard;
};
QmlStandaloneAppWizard::QmlStandaloneAppWizard(WizardType type)
: Core::BaseFileWizard(parameters(type))
, m_d(new QmlStandaloneAppWizardPrivate)
{ {
m_d->type = type;
m_d->standaloneApp = new QmlStandaloneApp;
m_d->wizardDialog = 0;
} }
QmlNewStandaloneAppWizard::~QmlNewStandaloneAppWizard() QmlStandaloneAppWizard::~QmlStandaloneAppWizard()
{ {
delete m_standaloneApp; delete m_d->standaloneApp;
} }
Core::BaseFileWizardParameters QmlNewStandaloneAppWizard::parameters() Core::BaseFileWizardParameters QmlStandaloneAppWizard::parameters(WizardType type)
{ {
Core::BaseFileWizardParameters parameters(ProjectWizard); Core::BaseFileWizardParameters parameters(ProjectWizard);
parameters.setIcon(QIcon(QLatin1String(Constants::QML_WIZARD_ICON))); parameters.setIcon(QIcon(QLatin1String(Constants::QML_WIZARD_ICON)));
parameters.setDisplayName(tr("Qt QML Standalone Application")); parameters.setDisplayName(type == QmlStandaloneAppWizard::NewQmlFile
parameters.setId(QLatin1String("QA.QML Standalone Application")); ? tr("Qt QML New Standalone Application")
parameters.setDescription(tr("Creates a standalone, mobile-deployable Qt QML application " : tr("Qt QML Imported Standalone Application"));
"project. A lightweight Qt/C++ application with a QDeclarativeView " parameters.setId(QLatin1String(type == QmlStandaloneAppWizard::NewQmlFile
"and a single QML file will be created.")); ? "QA.QML New Standalone Application"
: "QA.QML Imported Standalone Application"));
parameters.setDescription(type == QmlStandaloneAppWizard::NewQmlFile
? tr("Creates a standalone, mobile-deployable Qt QML application "
"project. A lightweight Qt/C++ application with a QDeclarativeView "
"and a single QML file will be created.")
: tr("Creates a standalone, mobile-deployable Qt QML application "
"project. An erxisting QML project will be imported and a lightweight "
"Qt/C++ application with a QDeclarativeView will be created for it."));
parameters.setCategory(QLatin1String(Constants::QML_WIZARD_CATEGORY)); parameters.setCategory(QLatin1String(Constants::QML_WIZARD_CATEGORY));
parameters.setDisplayCategory(QCoreApplication::translate(Constants::QML_WIZARD_TR_SCOPE, parameters.setDisplayCategory(QCoreApplication::translate(Constants::QML_WIZARD_TR_SCOPE,
Constants::QML_WIZARD_TR_CATEGORY)); Constants::QML_WIZARD_TR_CATEGORY));
return parameters; return parameters;
} }
QWizard *QmlNewStandaloneAppWizard::createWizardDialog(QWidget *parent, QWizard *QmlStandaloneAppWizard::createWizardDialog(QWidget *parent,
const QString &defaultPath, const QString &defaultPath,
const WizardPageList &extensionPages) const const WizardPageList &extensionPages) const
{ {
m_wizardDialog = new QmlNewStandaloneAppWizardDialog(parent); m_d->wizardDialog = new QmlStandaloneAppWizardDialog(m_d->type, parent);
m_wizardDialog->setPath(defaultPath); m_d->wizardDialog->setPath(defaultPath);
m_wizardDialog->setProjectName(QmlNewStandaloneAppWizardDialog::uniqueProjectName(defaultPath)); m_d->wizardDialog->setProjectName(QmlStandaloneAppWizardDialog::uniqueProjectName(defaultPath));
m_wizardDialog->m_qmlOptionsPage->setSymbianSvgIcon(m_standaloneApp->symbianSvgIcon()); m_d->wizardDialog->m_qmlOptionsPage->setSymbianSvgIcon(m_d->standaloneApp->symbianSvgIcon());
m_wizardDialog->m_qmlOptionsPage->setOrientation(m_standaloneApp->orientation()); m_d->wizardDialog->m_qmlOptionsPage->setOrientation(m_d->standaloneApp->orientation());
m_wizardDialog->m_qmlOptionsPage->setNetworkEnabled(m_standaloneApp->networkEnabled()); m_d->wizardDialog->m_qmlOptionsPage->setNetworkEnabled(m_d->standaloneApp->networkEnabled());
m_wizardDialog->m_qmlOptionsPage->setLoadDummyData(m_standaloneApp->loadDummyData()); m_d->wizardDialog->m_qmlOptionsPage->setLoadDummyData(m_d->standaloneApp->loadDummyData());
connect(m_wizardDialog, SIGNAL(introPageLeft(QString, QString)), SLOT(useProjectPath(QString, QString))); connect(m_d->wizardDialog, SIGNAL(introPageLeft(QString, QString)), SLOT(useProjectPath(QString, QString)));
foreach (QWizardPage *p, extensionPages) foreach (QWizardPage *p, extensionPages)
BaseFileWizard::applyExtensionPageShortTitle(m_wizardDialog, m_wizardDialog->addPage(p)); BaseFileWizard::applyExtensionPageShortTitle(m_d->wizardDialog, m_d->wizardDialog->addPage(p));
return m_wizardDialog; return m_d->wizardDialog;
} }
Core::GeneratedFiles QmlNewStandaloneAppWizard::generateFiles(const QWizard *w, Core::GeneratedFiles QmlStandaloneAppWizard::generateFiles(const QWizard *w,
QString *errorMessage) const QString *errorMessage) const
{ {
Q_UNUSED(errorMessage) Q_UNUSED(errorMessage)
const QmlNewStandaloneAppWizardDialog *wizard = qobject_cast<const QmlNewStandaloneAppWizardDialog*>(w); const QmlStandaloneAppWizardDialog *wizard = qobject_cast<const QmlStandaloneAppWizardDialog*>(w);
m_standaloneApp->setProjectName(wizard->projectName()); m_d->standaloneApp->setProjectName(wizard->projectName());
m_standaloneApp->setProjectPath(wizard->path()); m_d->standaloneApp->setProjectPath(wizard->path());
m_standaloneApp->setSymbianTargetUid(wizard->m_qmlOptionsPage->symbianUid()); m_d->standaloneApp->setSymbianTargetUid(wizard->m_qmlOptionsPage->symbianUid());
m_standaloneApp->setSymbianSvgIcon(wizard->m_qmlOptionsPage->symbianSvgIcon()); m_d->standaloneApp->setSymbianSvgIcon(wizard->m_qmlOptionsPage->symbianSvgIcon());
m_standaloneApp->setOrientation(wizard->m_qmlOptionsPage->orientation()); m_d->standaloneApp->setOrientation(wizard->m_qmlOptionsPage->orientation());
m_standaloneApp->setNetworkEnabled(wizard->m_qmlOptionsPage->networkEnabled()); m_d->standaloneApp->setNetworkEnabled(wizard->m_qmlOptionsPage->networkEnabled());
if (m_d->type == QmlStandaloneAppWizard::ImportQmlFile)
m_d->standaloneApp->setMainQmlFile(wizard->m_qmlSourcesPage->mainQmlFile());
return m_standaloneApp->generateFiles(errorMessage); return m_d->standaloneApp->generateFiles(errorMessage);
} }
bool QmlNewStandaloneAppWizard::postGenerateFiles(const QWizard *wizard, const Core::GeneratedFiles &l, QString *errorMessage) bool QmlStandaloneAppWizard::postGenerateFiles(const QWizard *wizard, const Core::GeneratedFiles &l, QString *errorMessage)
{ {
Q_UNUSED(wizard) Q_UNUSED(wizard)
return ProjectExplorer::CustomProjectWizard::postGenerateOpen(l, errorMessage); const bool success = ProjectExplorer::CustomProjectWizard::postGenerateOpen(l, errorMessage);
if (success && m_d->type == QmlStandaloneAppWizard::ImportQmlFile) {
ProjectExplorer::ProjectExplorerPlugin::instance()->setCurrentFile(0, m_d->standaloneApp->mainQmlFile());
Core::EditorManager::instance()->openEditor(m_d->standaloneApp->mainQmlFile());
}
return success;
} }