Commit 61097386 authored by Christian Kandeler's avatar Christian Kandeler
Browse files

QML/Mobile wizards: Add target selection.

Reviewed-by: Tobias Hunger
parent 7482a3a6
......@@ -85,6 +85,8 @@ void MaemoDeployables::createModels()
void MaemoDeployables::createModels(const Qt4ProFileNode *proFileNode)
{
if (!proFileNode) // Happens on project creation by wizard.
return;
const Qt4ProjectType type = proFileNode->projectType() ;
switch (type) {
case ApplicationTemplate:
......
......@@ -31,6 +31,11 @@
#include "abstractmobileapp.h"
#include "mobileappwizardpages.h"
#include "targetsetuppage.h"
#include <extensionsystem/pluginmanager.h>
#include <qt4projectmanager/qt4project.h>
#include <qt4projectmanager/qt4projectmanager.h>
#include <QtGui/QIcon>
......@@ -40,11 +45,16 @@ namespace Internal {
AbstractMobileAppWizardDialog::AbstractMobileAppWizardDialog(QWidget *parent)
: ProjectExplorer::BaseProjectWizardDialog(parent)
{
m_targetsPage = new TargetSetupPage;
m_targetsPage->setImportDirectoryBrowsingEnabled(false);
int pageId = addPage(m_targetsPage);
wizardProgress()->item(pageId)->setTitle(tr("Qt versions"));
m_optionsPage = new MobileAppWizardOptionsPage;
const int pageId = addPage(m_optionsPage);
pageId = addPage(m_optionsPage);
wizardProgress()->item(pageId)->setTitle(tr("Application options"));
}
AbstractMobileAppWizard::AbstractMobileAppWizard(const Core::BaseFileWizardParameters &params,
QObject *parent) : Core::BaseFileWizard(params, parent)
{
......@@ -74,8 +84,6 @@ Core::GeneratedFiles AbstractMobileAppWizard::generateFiles(const QWizard *wizar
prepareGenerateFiles(wizard, errorMessage);
const AbstractMobileAppWizardDialog *wdlg
= qobject_cast<const AbstractMobileAppWizardDialog*>(wizard);
app()->setProjectName(wdlg->projectName());
app()->setProjectPath(wdlg->path());
app()->setSymbianTargetUid(wdlg->m_optionsPage->symbianUid());
app()->setSymbianSvgIcon(wdlg->m_optionsPage->symbianSvgIcon());
app()->setOrientation(wdlg->m_optionsPage->orientation());
......@@ -83,10 +91,29 @@ Core::GeneratedFiles AbstractMobileAppWizard::generateFiles(const QWizard *wizar
return app()->generateFiles(errorMessage);
}
bool AbstractMobileAppWizard::postGenerateFiles(const QWizard *w,
const Core::GeneratedFiles &l, QString *errorMessage)
{
Q_UNUSED(w);
Qt4Manager * const manager
= ExtensionSystem::PluginManager::instance()->getObject<Qt4Manager>();
Q_ASSERT(manager);
Qt4Project project(manager, app()->path(AbstractMobileApp::AppPro));
bool success = wizardDialog()->m_targetsPage->setupProject(&project);
if (success) {
project.saveSettings();
success = postGenerateFilesInternal(l, errorMessage);
}
return success;
}
void AbstractMobileAppWizard::useProjectPath(const QString &projectName,
const QString &projectPath)
{
wizardDialog()->m_optionsPage->setSymbianUid(app()->symbianUidForPath(projectPath + projectName));
app()->setProjectName(projectName);
app()->setProjectPath(projectPath);
wizardDialog()->m_targetsPage->setProFilePath(app()->path(AbstractMobileApp::AppPro));
}
} // end of namespace Internal
......
......@@ -41,13 +41,12 @@ class AbstractMobileApp;
class AbstractMobileAppWizardDialog : public ProjectExplorer::BaseProjectWizardDialog
{
Q_OBJECT
friend class AbstractMobileAppWizard;
protected:
explicit AbstractMobileAppWizardDialog(QWidget *parent = 0);
private:
public:
class MobileAppWizardOptionsPage *m_optionsPage;
class TargetSetupPage *m_targetsPage;
};
class AbstractMobileAppWizard : public Core::BaseFileWizard
......@@ -65,12 +64,16 @@ private:
const QString &defaultPath, const WizardPageList &extensionPages) const;
virtual Core::GeneratedFiles generateFiles(const QWizard *wizard,
QString *errorMessage) const;
virtual bool postGenerateFiles(const QWizard *w,
const Core::GeneratedFiles &l, QString *errorMessage);
virtual AbstractMobileApp *app() const=0;
virtual AbstractMobileAppWizardDialog *wizardDialog() const=0;
virtual AbstractMobileAppWizardDialog *createWizardDialogInternal(QWidget *parent) const=0;
virtual void prepareGenerateFiles(const QWizard *wizard,
QString *errorMessage) const=0;
virtual bool postGenerateFilesInternal(const Core::GeneratedFiles &l,
QString *errorMessage)=0;
};
} // end of namespace Internal
......
......@@ -28,8 +28,10 @@
**************************************************************************/
#include "mobileappwizard.h"
#include "mobileappwizardpages.h"
#include "mobileapp.h"
#include "targetsetuppage.h"
#include "qt4projectmanagerconstants.h"
......@@ -101,6 +103,8 @@ Core::BaseFileWizardParameters MobileAppWizard::parameters()
AbstractMobileAppWizardDialog *MobileAppWizard::createWizardDialogInternal(QWidget *parent) const
{
m_d->wizardDialog = new MobileAppWizardDialog(parent);
m_d->wizardDialog->m_targetsPage->setImportInfos(TargetSetupPage::importInfosForKnownQtVersions());
m_d->wizardDialog->m_targetsPage->setPreferMobile(true);
return m_d->wizardDialog;
}
......@@ -111,9 +115,9 @@ void MobileAppWizard::prepareGenerateFiles(const QWizard *w,
Q_UNUSED(errorMessage)
}
bool MobileAppWizard::postGenerateFiles(const QWizard *wizard, const Core::GeneratedFiles &l, QString *errorMessage)
bool MobileAppWizard::postGenerateFilesInternal(const Core::GeneratedFiles &l,
QString *errorMessage)
{
Q_UNUSED(wizard)
return ProjectExplorer::CustomProjectWizard::postGenerateOpen(l, errorMessage);
}
......
......@@ -46,14 +46,13 @@ public:
private:
static Core::BaseFileWizardParameters parameters();
bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l,
QString *errorMessage);
virtual AbstractMobileApp *app() const;
virtual AbstractMobileAppWizardDialog *wizardDialog() const;
virtual AbstractMobileAppWizardDialog *createWizardDialogInternal(QWidget *parent) const;
virtual void prepareGenerateFiles(const QWizard *wizard,
QString *errorMessage) const;
virtual bool postGenerateFilesInternal(const Core::GeneratedFiles &l,
QString *errorMessage);
class MobileAppWizardPrivate *m_d;
};
......
......@@ -28,9 +28,11 @@
**************************************************************************/
#include "mobileappwizardpages.h"
#include "qmlstandaloneapp.h"
#include "qmlstandaloneappwizard.h"
#include "qmlstandaloneappwizardpages.h"
#include "targetsetuppage.h"
#include "qt4projectmanagerconstants.h"
......@@ -127,6 +129,23 @@ AbstractMobileAppWizardDialog *QmlStandaloneAppWizard::createWizardDialogInterna
m_d->wizardDialog = new QmlStandaloneAppWizardDialog(m_d->type, parent);
connect(m_d->wizardDialog->m_qmlSourcesPage,
SIGNAL(externalModulesChanged(QStringList, QStringList)), SLOT(handleModulesChange(QStringList, QStringList)));
const QList<TargetSetupPage::ImportInfo> &qtVersions
= TargetSetupPage::importInfosForKnownQtVersions();
QList<TargetSetupPage::ImportInfo> qmlQtVersions;
foreach (const TargetSetupPage::ImportInfo &qtVersion, qtVersions) {
const QString versionString = qtVersion.version->qtVersionString();
bool isNumber;
const int majorVersion = versionString.mid(0, 1).toInt(&isNumber);
if (!isNumber || majorVersion < 4)
continue;
const int minorVersion = versionString.mid(2, 1).toInt(&isNumber);
if (!isNumber || minorVersion < 7)
continue;
qmlQtVersions << qtVersion;
}
m_d->wizardDialog->m_targetsPage->setImportInfos(qmlQtVersions);
return m_d->wizardDialog;
}
......@@ -141,9 +160,9 @@ void QmlStandaloneAppWizard::prepareGenerateFiles(const QWizard *w,
wizard->m_qmlSourcesPage->moduleUris(), wizard->m_qmlSourcesPage->moduleImportPaths());
}
bool QmlStandaloneAppWizard::postGenerateFiles(const QWizard *wizard, const Core::GeneratedFiles &l, QString *errorMessage)
bool QmlStandaloneAppWizard::postGenerateFilesInternal(const Core::GeneratedFiles &l,
QString *errorMessage)
{
Q_UNUSED(wizard)
const bool success = ProjectExplorer::CustomProjectWizard::postGenerateOpen(l, errorMessage);
if (success && m_d->type == QmlStandaloneAppWizard::ImportQmlFile) {
ProjectExplorer::ProjectExplorerPlugin::instance()->setCurrentFile(0, m_d->standaloneApp->mainQmlFile());
......
......@@ -59,8 +59,8 @@ private:
virtual AbstractMobileAppWizardDialog *createWizardDialogInternal(QWidget *parent) const;
virtual void prepareGenerateFiles(const QWizard *wizard,
QString *errorMessage) const;
virtual bool postGenerateFiles(const QWizard *w,
const Core::GeneratedFiles &l, QString *errorMessage);
virtual bool postGenerateFilesInternal(const Core::GeneratedFiles &l,
QString *errorMessage);
class QmlStandaloneAppWizardPrivate *m_d;
};
......
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