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 @@
<file>images/qmlproject.png</file>
<file>images/qml_wizard.png</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/symbianicon.svg</file>
<file>wizards/templates/cpp/main.cpp</file>
......
......@@ -23,7 +23,7 @@ HEADERS += qmlproject.h \
qmlprojectmanagerconstants.h \
qmlprojecttarget.h \
wizards/qmlstandaloneappwizard.h \
wizards/qmlstandaloneappwizardoptionspage.h \
wizards/qmlstandaloneappwizardpages.h \
wizards/qmlstandaloneapp.h
SOURCES += qmlproject.cpp \
......@@ -38,7 +38,7 @@ SOURCES += qmlproject.cpp \
qmlprojectapplicationwizard.cpp \
qmlprojecttarget.cpp \
wizards/qmlstandaloneappwizard.cpp \
wizards/qmlstandaloneappwizardoptionspage.cpp \
wizards/qmlstandaloneappwizardpages.cpp \
wizards/qmlstandaloneapp.cpp
RESOURCES += qmlproject.qrc
......@@ -48,7 +48,8 @@ INCLUDEPATH += \
wizards
FORMS += \
wizards/qmlstandaloneappwizardoptionspage.ui
wizards/qmlstandaloneappwizardoptionspage.ui \
wizards/qmlstandaloneappwizardsourcespage.ui
OTHER_FILES += QmlProjectManager.pluginspec \
QmlProject.mimetypes.xml
......@@ -77,7 +77,8 @@ bool QmlProjectPlugin::initialize(const QStringList &, QString *errorMessage)
addAutoReleasedObject(manager);
addAutoReleasedObject(new Internal::QmlProjectRunConfigurationFactory);
addAutoReleasedObject(new Internal::QmlRunControlFactory);
addAutoReleasedObject(new QmlNewStandaloneAppWizard);
addAutoReleasedObject(new QmlStandaloneAppWizard(QmlStandaloneAppWizard::NewQmlFile));
addAutoReleasedObject(new QmlStandaloneAppWizard(QmlStandaloneAppWizard::ImportQmlFile));
addAutoReleasedObject(new QmlProjectApplicationWizard);
addAutoReleasedObject(new QmlProjectImportWizard);
......
......@@ -55,6 +55,16 @@ QString QmlStandaloneApp::symbianUidForPath(const QString &path)
+ 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)
{
m_orientation = orientation;
......@@ -77,10 +87,7 @@ QString QmlStandaloneApp::projectName() const
void QmlStandaloneApp::setProjectPath(const QString &path)
{
m_projectPath = path;
if (!(m_projectPath.endsWith(QLatin1Char('\\'))
|| m_projectPath.endsWith(QLatin1Char('/'))))
m_projectPath.append(QDir::separator());
m_projectPath.setFile(path);
}
void QmlStandaloneApp::setSymbianSvgIcon(const QString &icon)
......@@ -101,7 +108,7 @@ void QmlStandaloneApp::setSymbianTargetUid(const QString &uid)
QString QmlStandaloneApp::symbianTargetUid() const
{
return !m_symbianTargetUid.isEmpty() ? m_symbianTargetUid
: symbianUidForPath(m_projectPath + m_projectName);
: symbianUidForPath(path(AppProfile, Target));
}
void QmlStandaloneApp::setLoadDummyData(bool loadIt)
......@@ -126,11 +133,12 @@ bool QmlStandaloneApp::networkEnabled() 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 cppSourceSubDir = QLatin1String("cpp/");
const QString qmlSourceSubDir = QLatin1String("qml/");
const QString cppTargetSubDir = cppSourceSubDir;
const QString qmlTargetSubDir = qmlSourceSubDir;
const QString qmlExtension = QLatin1String(".qml");
const QString mainCpp = QLatin1String("main.cpp");
const QString appViewCpp = QLatin1String("qmlapplicationview.cpp");
......@@ -141,42 +149,50 @@ QString QmlStandaloneApp::path(Path path, Location location) const
switch (location) {
case Source: {
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 MainCpp: return sourceRoot + cppSourceSubDir + mainCpp;
case AppViewerCpp: return sourceRoot + cppSourceSubDir + appViewCpp;
case AppViewerH: return sourceRoot + cppSourceSubDir + appViewH;
case SymbianSvgIcon: return !m_symbianSvgIcon.isEmpty() ? m_symbianSvgIcon
:sourceRoot + cppSourceSubDir + symbianIcon;
: sourceRoot + cppSourceSubDir + symbianIcon;
default: qFatal(errorMessage);
}
}
case Target: {
const QString pathBase = m_projectPath + m_projectName + QDir::separator();
const QString pathBase = m_projectPath.absoluteFilePath() + QLatin1Char('/')
+ m_projectName + QLatin1Char('/');
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 AppProfilePath: return pathBase;
case MainCpp: return pathBase + cppTargetSubDir + mainCpp;
case AppViewerCpp: return pathBase + cppTargetSubDir + appViewCpp;
case AppViewerH: return pathBase + cppTargetSubDir + appViewH;
case SymbianSvgIcon: return pathBase + cppTargetSubDir + symbianIcon;
case QmlDir: return pathBase + qmlRootFolder;
default: qFatal(errorMessage);
}
}
case AppProfileRelative: {
const QDir appProFilePath(this->path(AppProfilePath, Target));
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 AppViewerCpp: return cppTargetSubDir + appViewCpp;
case AppViewerH: return cppTargetSubDir + appViewH;
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: { /* case MainCppRelative: */
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);
}
}
......@@ -310,6 +326,7 @@ Core::GeneratedFiles QmlStandaloneApp::generateFiles(QString *errorMessage) cons
generatedProFile.setAttributes(Core::GeneratedFile::OpenProjectAttribute);
files.append(generatedProFile);
if (!useExistingMainQml())
files.append(generateFileCopy(path(MainQml, Source), path(MainQml, Target), true));
Core::GeneratedFile generatedMainCppFile(path(MainCpp, Target));
......@@ -324,5 +341,10 @@ Core::GeneratedFiles QmlStandaloneApp::generateFiles(QString *errorMessage) cons
}
#endif // CREATORLESSTEST
bool QmlStandaloneApp::useExistingMainQml() const
{
return !m_mainQmlFile.filePath().isEmpty();
}
} // namespace Internal
} // namespace QmlProjectManager
......@@ -31,6 +31,8 @@
#define QMLSTANDALONEAPP_H
#include <QtCore/QString>
#include <QtCore/QFileInfo>
#ifndef CREATORLESSTEST
#include <coreplugin/basefilewizard.h>
#endif // CREATORLESSTEST
......@@ -51,6 +53,7 @@ public:
MainQml,
MainCpp,
AppProfile,
AppProfilePath,
AppViewerCpp,
AppViewerH,
SymbianSvgIcon,
......@@ -66,6 +69,8 @@ public:
QmlStandaloneApp();
void setMainQmlFile(const QString &qmlFile);
QString mainQmlFile() const;
void setOrientation(Orientation orientation);
Orientation orientation() const;
void setProjectName(const QString &name);
......@@ -86,19 +91,21 @@ public:
#else
bool generateFiles(QString *errorMessage) const;
#endif // CREATORLESSTEST
QString path(Path path, Location location) const;
bool useExistingMainQml() const;
private:
QString path(Path path, Location location) const;
QByteArray generateMainCpp(const QString *errorMessage) const;
QByteArray generateProFile(const QString *errorMessage) const;
QString m_projectName;
QString m_projectPath;
QFileInfo m_projectPath;
QString m_symbianSvgIcon;
QString m_symbianTargetUid;
bool m_loadDummyData;
Orientation m_orientation;
bool m_networkEnabled;
QFileInfo m_mainQmlFile;
};
} // end of namespace Internal
......
......@@ -28,12 +28,15 @@
**************************************************************************/
#include "qmlstandaloneappwizard.h"
#include "qmlstandaloneappwizardoptionspage.h"
#include "qmlstandaloneappwizardpages.h"
#include "qmlstandaloneapp.h"
#include "qmlprojectconstants.h"
#include <projectexplorer/baseprojectwizarddialog.h>
#include <projectexplorer/customwizard/customwizard.h>
#include <projectexplorer/projectexplorer.h>
#include <coreplugin/editormanager/editormanager.h>
#include <QtGui/QIcon>
......@@ -48,103 +51,142 @@
namespace QmlProjectManager {
namespace Internal {
class QmlNewStandaloneAppWizardDialog : public ProjectExplorer::BaseProjectWizardDialog
class QmlStandaloneAppWizardDialog : public ProjectExplorer::BaseProjectWizardDialog
{
Q_OBJECT
public:
explicit QmlNewStandaloneAppWizardDialog(QWidget *parent = 0);
explicit QmlStandaloneAppWizardDialog(QmlStandaloneAppWizard::WizardType type, QWidget *parent = 0);
private:
class QmlStandaloneAppWizardOptionPage *m_qmlOptionsPage;
friend class QmlNewStandaloneAppWizard;
QmlStandaloneAppWizard::WizardType m_type;
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)
, m_type(type)
{
setWindowTitle(tr("New Standalone QML Project"));
setIntroDescription(tr("This wizard generates a Standalone QML application project."));
m_qmlOptionsPage = new QmlStandaloneAppWizardOptionPage;
setWindowTitle(m_type == QmlStandaloneAppWizard::NewQmlFile
? tr("New Standalone QML Project")
: tr("Standalone QML Project from existing QML Project"));
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);
wizardProgress()->item(qmlOptionsPagePageId)->setTitle(tr("Qml App options"));
}
QmlNewStandaloneAppWizard::QmlNewStandaloneAppWizard()
: Core::BaseFileWizard(parameters())
, m_standaloneApp(new QmlStandaloneApp)
, m_wizardDialog(0)
class QmlStandaloneAppWizardPrivate
{
QmlStandaloneAppWizard::WizardType type;
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);
parameters.setIcon(QIcon(QLatin1String(Constants::QML_WIZARD_ICON)));
parameters.setDisplayName(tr("Qt QML Standalone Application"));
parameters.setId(QLatin1String("QA.QML Standalone Application"));
parameters.setDescription(tr("Creates a standalone, mobile-deployable Qt QML application "
parameters.setDisplayName(type == QmlStandaloneAppWizard::NewQmlFile
? tr("Qt QML New Standalone Application")
: tr("Qt QML Imported Standalone Application"));
parameters.setId(QLatin1String(type == QmlStandaloneAppWizard::NewQmlFile
? "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."));
"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.setDisplayCategory(QCoreApplication::translate(Constants::QML_WIZARD_TR_SCOPE,
Constants::QML_WIZARD_TR_CATEGORY));
return parameters;
}
QWizard *QmlNewStandaloneAppWizard::createWizardDialog(QWidget *parent,
QWizard *QmlStandaloneAppWizard::createWizardDialog(QWidget *parent,
const QString &defaultPath,
const WizardPageList &extensionPages) const
{
m_wizardDialog = new QmlNewStandaloneAppWizardDialog(parent);
m_d->wizardDialog = new QmlStandaloneAppWizardDialog(m_d->type, parent);
m_wizardDialog->setPath(defaultPath);
m_wizardDialog->setProjectName(QmlNewStandaloneAppWizardDialog::uniqueProjectName(defaultPath));
m_wizardDialog->m_qmlOptionsPage->setSymbianSvgIcon(m_standaloneApp->symbianSvgIcon());
m_wizardDialog->m_qmlOptionsPage->setOrientation(m_standaloneApp->orientation());
m_wizardDialog->m_qmlOptionsPage->setNetworkEnabled(m_standaloneApp->networkEnabled());
m_wizardDialog->m_qmlOptionsPage->setLoadDummyData(m_standaloneApp->loadDummyData());
connect(m_wizardDialog, SIGNAL(introPageLeft(QString, QString)), SLOT(useProjectPath(QString, QString)));
m_d->wizardDialog->setPath(defaultPath);
m_d->wizardDialog->setProjectName(QmlStandaloneAppWizardDialog::uniqueProjectName(defaultPath));
m_d->wizardDialog->m_qmlOptionsPage->setSymbianSvgIcon(m_d->standaloneApp->symbianSvgIcon());
m_d->wizardDialog->m_qmlOptionsPage->setOrientation(m_d->standaloneApp->orientation());
m_d->wizardDialog->m_qmlOptionsPage->setNetworkEnabled(m_d->standaloneApp->networkEnabled());
m_d->wizardDialog->m_qmlOptionsPage->setLoadDummyData(m_d->standaloneApp->loadDummyData());
connect(m_d->wizardDialog, SIGNAL(introPageLeft(QString, QString)), SLOT(useProjectPath(QString, QString)));
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
{
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_standaloneApp->setProjectPath(wizard->path());
m_standaloneApp->setSymbianTargetUid(wizard->m_qmlOptionsPage->symbianUid());
m_standaloneApp->setSymbianSvgIcon(wizard->m_qmlOptionsPage->symbianSvgIcon());
m_standaloneApp->setOrientation(wizard->m_qmlOptionsPage->orientation());
m_standaloneApp->setNetworkEnabled(wizard->m_qmlOptionsPage->networkEnabled());
m_d->standaloneApp->setProjectName(wizard->projectName());
m_d->standaloneApp->setProjectPath(wizard->path());
m_d->standaloneApp->setSymbianTargetUid(wizard->m_qmlOptionsPage->symbianUid());
m_d->standaloneApp->setSymbianSvgIcon(wizard->m_qmlOptionsPage->symbianSvgIcon());
m_d->standaloneApp->setOrientation(wizard->m_qmlOptionsPage->orientation());
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)
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;
}
void QmlNewStandaloneAppWizard::useProjectPath(const QString &projectName, const QString &projectPath)
void QmlStandaloneAppWizard::useProjectPath(const QString &projectName, const QString &projectPath)
{
m_wizardDialog->m_qmlOptionsPage->setSymbianUid(QmlStandaloneApp::symbianUidForPath(projectPath + projectName));
m_d->wizardDialog->m_qmlOptionsPage->setSymbianUid(QmlStandaloneApp::symbianUidForPath(projectPath + projectName));
}
} // namespace Internal
......
......@@ -31,19 +31,23 @@
#define QMLSTANDALONEAPPWIZARD_H
#include <coreplugin/basefilewizard.h>
#include <projectexplorer/baseprojectwizarddialog.h>
namespace QmlProjectManager {
namespace Internal {
class QmlNewStandaloneAppWizard : public Core::BaseFileWizard
class QmlStandaloneAppWizard : public Core::BaseFileWizard
{
Q_OBJECT
public:
QmlNewStandaloneAppWizard();
virtual ~QmlNewStandaloneAppWizard();
static Core::BaseFileWizardParameters parameters();
enum WizardType {
NewQmlFile,
ImportQmlFile
};
QmlStandaloneAppWizard(WizardType type);
virtual ~QmlStandaloneAppWizard();
static Core::BaseFileWizardParameters parameters(WizardType type);
protected:
QWizard *createWizardDialog(QWidget *parent, const QString &defaultPath,
......@@ -57,8 +61,7 @@ protected slots:
void useProjectPath(const QString &projectName, const QString &projectPath);
private:
class QmlStandaloneApp *m_standaloneApp;
mutable class QmlNewStandaloneAppWizardDialog *m_wizardDialog;
class QmlStandaloneAppWizardPrivate *m_d;
};
} // end of namespace Internal
......
......@@ -27,7 +27,8 @@
**
**************************************************************************/
#include "qmlstandaloneappwizardoptionspage.h"
#include "qmlstandaloneappwizardpages.h"
#include "ui_qmlstandaloneappwizardsourcespage.h"
#include "ui_qmlstandaloneappwizardoptionspage.h"
#include <QtGui/QDesktopServices>
......@@ -36,44 +37,77 @@
namespace QmlProjectManager {
namespace Internal {
class QmlStandaloneAppWizardOptionPagePrivate
class QmlStandaloneAppWizardSourcesPagePrivate
{
Ui::QmlStandaloneAppWizardOptionPage m_ui;
Ui::QmlStandaloneAppWizardSourcesPage ui;
friend class QmlStandaloneAppWizardSourcesPage;
};
QmlStandaloneAppWizardSourcesPage::QmlStandaloneAppWizardSourcesPage(QWidget *parent)
: QWizardPage(parent)
, m_d(new QmlStandaloneAppWizardSourcesPagePrivate)
{
m_d->ui.setupUi(this);
m_d->ui.mainQmlFileLineEdit->setExpectedKind(Utils::PathChooser::File);
m_d->ui.mainQmlFileLineEdit->setPromptDialogFilter(QLatin1String("*.qml"));
m_d->ui.mainQmlFileLineEdit->setPromptDialogTitle(tr("Select the main QML file of the application."));
m_d->ui.qmlModulesGroupBox->setEnabled(false); // TODO: implement modules selection
connect(m_d->ui.mainQmlFileLineEdit, SIGNAL(changed(QString)), SIGNAL(completeChanged()));
}
QmlStandaloneAppWizardSourcesPage::~QmlStandaloneAppWizardSourcesPage()
{
delete m_d;
}
QString QmlStandaloneAppWizardSourcesPage::mainQmlFile() const
{
return m_d->ui.mainQmlFileLineEdit->path();
}
bool QmlStandaloneAppWizardSourcesPage::isComplete() const
{
return m_d->ui.mainQmlFileLineEdit->isValid();
}
void QmlStandaloneAppWizardSourcesPage::setMainQmlFileChooserVisible(bool visible)
{
m_d->ui.mainQmlFileLineEdit->setVisible(visible);
}
class QmlStandaloneAppWizardOptionsPagePrivate
{
Ui::QmlStandaloneAppWizardOptionPage ui;
QString symbianSvgIcon;
friend class QmlStandaloneAppWizardOptionPage;
friend class QmlStandaloneAppWizardOptionsPage;
};
QmlStandaloneAppWizardOptionPage::QmlStandaloneAppWizardOptionPage(QWidget *parent) :
QWizardPage(parent),
m_d(new QmlStandaloneAppWizardOptionPagePrivate)
QmlStandaloneAppWizardOptionsPage::QmlStandaloneAppWizardOptionsPage(QWidget *parent)
: QWizardPage(parent)
, m_d(new QmlStandaloneAppWizardOptionsPagePrivate)
{
m_d->m_ui.setupUi(this);
m_d->ui.setupUi(this);
const QIcon open = QApplication::style()->standardIcon(QStyle::SP_DirOpenIcon);
m_d->m_ui.symbianAppIconLoadToolButton->setIcon(open);
connect(m_d->m_ui.symbianAppIconLoadToolButton, SIGNAL(clicked()), SLOT(openSymbianSvgIcon()));
m_d->ui.symbianAppIconLoadToolButton->setIcon(open);
connect(m_d->ui.symbianAppIconLoadToolButton, SIGNAL(clicked()), SLOT(openSymbianSvgIcon()));
m_d->m_ui.orientationBehaviorComboBox->addItem(tr("Auto rotate orientation"),
m_d->ui.orientationBehaviorComboBox->addItem(tr("Auto rotate orientation"),
QmlStandaloneApp::Auto);
m_d->m_ui.orientationBehaviorComboBox->addItem(tr("Lock to landscape orientation"),
m_d->ui.orientationBehaviorComboBox->addItem(tr("Lock to landscape orientation"),
QmlStandaloneApp::LockLandscape);
m_d->m_ui.orientationBehaviorComboBox->addItem(tr("Lock to portrait orientation"),
m_d->ui.orientationBehaviorComboBox->addItem(tr("Lock to portrait orientation"),
QmlStandaloneApp::LockPortrait);
}
QmlStandaloneAppWizardOptionPage::~QmlStandaloneAppWizardOptionPage()
QmlStandaloneAppWizardOptionsPage::~QmlStandaloneAppWizardOptionsPage()
{
delete m_d;
}
bool QmlStandaloneAppWizardOptionPage::isComplete() const
{
return true;
}
void QmlStandaloneAppWizardOptionPage::setOrientation(QmlStandaloneApp::Orientation orientation)
void QmlStandaloneAppWizardOptionsPage::setOrientation(QmlStandaloneApp::Orientation orientation)
{
QComboBox *const comboBox = m_d->m_ui.orientationBehaviorComboBox;
QComboBox *const comboBox = m_d->ui.orientationBehaviorComboBox;
for (int i = 0; i < comboBox->count(); ++i)
if (comboBox->itemData(i).toInt() == static_cast<int>(orientation)) {