forked from qt-creator/qt-creator
Combine multi qt quick app wizards into just one
Cleanup some stuff (mobile orientation page), drop import of qml from existing file Change-Id: I261f03b6f249129dfe732719fb683978cc90fb9e Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -22,7 +22,6 @@ HEADERS += \
|
||||
wizards/qtprojectparameters.h \
|
||||
wizards/guiappwizard.h \
|
||||
wizards/mobileapp.h \
|
||||
wizards/mobileappwizardpages.h \
|
||||
wizards/mobilelibrarywizardoptionpage.h \
|
||||
wizards/mobilelibraryparameters.h \
|
||||
wizards/consoleappwizard.h \
|
||||
@@ -81,7 +80,6 @@ SOURCES += \
|
||||
wizards/qtprojectparameters.cpp \
|
||||
wizards/guiappwizard.cpp \
|
||||
wizards/mobileapp.cpp \
|
||||
wizards/mobileappwizardpages.cpp \
|
||||
wizards/mobilelibrarywizardoptionpage.cpp \
|
||||
wizards/mobilelibraryparameters.cpp \
|
||||
wizards/consoleappwizard.cpp \
|
||||
@@ -128,7 +126,6 @@ FORMS += makestep.ui \
|
||||
wizards/testwizardpage.ui \
|
||||
wizards/html5appwizardsourcespage.ui \
|
||||
wizards/mobilelibrarywizardoptionpage.ui \
|
||||
wizards/mobileappwizardgenericoptionspage.ui \
|
||||
wizards/qtquickcomponentsetoptionspage.ui
|
||||
|
||||
RESOURCES += qmakeprojectmanager.qrc \
|
||||
|
@@ -104,8 +104,6 @@ QtcPlugin {
|
||||
"librarywizard.cpp", "librarywizard.h",
|
||||
"librarywizarddialog.cpp", "librarywizarddialog.h",
|
||||
"mobileapp.cpp", "mobileapp.h",
|
||||
"mobileappwizardgenericoptionspage.ui",
|
||||
"mobileappwizardpages.cpp", "mobileappwizardpages.h",
|
||||
"mobilelibraryparameters.cpp", "mobilelibraryparameters.h",
|
||||
"mobilelibrarywizardoptionpage.cpp", "mobilelibrarywizardoptionpage.h", "mobilelibrarywizardoptionpage.ui",
|
||||
"modulespage.cpp", "modulespage.h",
|
||||
|
@@ -126,7 +126,7 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString
|
||||
addAutoReleasedObject(new SubdirsProjectWizard);
|
||||
addAutoReleasedObject(new GuiAppWizard);
|
||||
addAutoReleasedObject(new ConsoleAppWizard);
|
||||
QtQuickAppWizard::createInstances(this); //creates several instances with different options
|
||||
addAutoReleasedObject(new QtQuickAppWizard);
|
||||
addAutoReleasedObject(new Html5AppWizard);
|
||||
addAutoReleasedObject(new LibraryWizard);
|
||||
addAutoReleasedObject(new TestWizard);
|
||||
|
@@ -60,22 +60,11 @@ const int AbstractMobileApp::StubVersion = 9;
|
||||
|
||||
AbstractMobileApp::AbstractMobileApp()
|
||||
: QObject()
|
||||
, m_orientation(ScreenOrientationAuto)
|
||||
{
|
||||
}
|
||||
|
||||
AbstractMobileApp::~AbstractMobileApp() { }
|
||||
|
||||
void AbstractMobileApp::setOrientation(ScreenOrientation orientation)
|
||||
{
|
||||
m_orientation = orientation;
|
||||
}
|
||||
|
||||
AbstractMobileApp::ScreenOrientation AbstractMobileApp::orientation() const
|
||||
{
|
||||
return m_orientation;
|
||||
}
|
||||
|
||||
void AbstractMobileApp::setProjectName(const QString &name)
|
||||
{
|
||||
m_projectName = name;
|
||||
@@ -167,25 +156,7 @@ QByteArray AbstractMobileApp::generateMainCpp(QString *errorMessage) const
|
||||
QString line;
|
||||
while (!(line = in.readLine()).isNull()) {
|
||||
bool adaptLine = true;
|
||||
if (line.contains(QLatin1String("// ORIENTATION"))) {
|
||||
const char *orientationString;
|
||||
switch (orientation()) {
|
||||
case ScreenOrientationLockLandscape:
|
||||
orientationString = "ScreenOrientationLockLandscape";
|
||||
break;
|
||||
case ScreenOrientationLockPortrait:
|
||||
orientationString = "ScreenOrientationLockPortrait";
|
||||
break;
|
||||
case ScreenOrientationAuto:
|
||||
orientationString = "ScreenOrientationAuto";
|
||||
break;
|
||||
case ScreenOrientationImplicit:
|
||||
default:
|
||||
continue; // omit line
|
||||
}
|
||||
insertParameter(line, mainWindowClassName() + QLatin1String("::")
|
||||
+ QLatin1String(orientationString));
|
||||
} else if (line.contains(QLatin1String("// DELETE_LINE"))) {
|
||||
if (line.contains(QLatin1String("// DELETE_LINE"))) {
|
||||
continue; // omit this line in the output
|
||||
} else {
|
||||
adaptLine = adaptCurrentMainCppTemplateLine(line);
|
||||
|
@@ -80,13 +80,6 @@ class
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum ScreenOrientation {
|
||||
ScreenOrientationLockLandscape,
|
||||
ScreenOrientationLockPortrait,
|
||||
ScreenOrientationAuto,
|
||||
ScreenOrientationImplicit // Don't set in application at all
|
||||
};
|
||||
|
||||
enum FileType {
|
||||
MainCpp,
|
||||
MainCppOrigin,
|
||||
@@ -105,8 +98,6 @@ public:
|
||||
|
||||
virtual ~AbstractMobileApp();
|
||||
|
||||
void setOrientation(ScreenOrientation orientation);
|
||||
ScreenOrientation orientation() const;
|
||||
void setProjectName(const QString &name);
|
||||
QString projectName() const;
|
||||
void setProjectPath(const QString &path);
|
||||
@@ -174,7 +165,6 @@ private:
|
||||
QFileInfo m_projectPath;
|
||||
QString m_pngIcon64;
|
||||
QString m_pngIcon80;
|
||||
ScreenOrientation m_orientation;
|
||||
};
|
||||
|
||||
} // namespace QmakeProjectManager
|
||||
|
@@ -28,8 +28,8 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "abstractmobileappwizard.h"
|
||||
#include "abstractmobileapp.h"
|
||||
|
||||
#include "mobileappwizardpages.h"
|
||||
#include "../qmakeprojectimporter.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
@@ -51,57 +51,35 @@ AbstractMobileAppWizardDialog::AbstractMobileAppWizardDialog(QWidget *parent,
|
||||
const QtSupport::QtVersionNumber &maximumQtVersionNumber,
|
||||
const Core::WizardDialogParameters ¶meters)
|
||||
: ProjectExplorer::BaseProjectWizardDialog(parent, parameters)
|
||||
, m_targetsPage(0)
|
||||
, m_genericOptionsPageId(-1)
|
||||
, m_targetsPageId(-1)
|
||||
, m_ignoreGeneralOptions(false)
|
||||
, m_targetItem(0)
|
||||
, m_genericItem(0)
|
||||
, m_kitIds(parameters.extraValues().value(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS))
|
||||
.value<QList<Core::Id> >())
|
||||
, m_kitsPage(0)
|
||||
{
|
||||
if (!parameters.extraValues().contains(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS))) {
|
||||
m_targetsPage = new ProjectExplorer::TargetSetupPage;
|
||||
m_targetsPage->setProjectImporter(new Internal::QmakeProjectImporter(path()));
|
||||
m_kitsPage = new ProjectExplorer::TargetSetupPage;
|
||||
m_kitsPage->setProjectImporter(new Internal::QmakeProjectImporter(path()));
|
||||
QString platform = selectedPlatform();
|
||||
if (platform.isEmpty()) {
|
||||
m_targetsPage->setPreferredKitMatcher(
|
||||
m_kitsPage->setPreferredKitMatcher(
|
||||
new QtSupport::QtVersionKitMatcher(
|
||||
Core::FeatureSet( QtSupport::Constants::FEATURE_MOBILE)));
|
||||
} else {
|
||||
m_targetsPage->setPreferredKitMatcher(new QtSupport::QtPlatformKitMatcher(platform));
|
||||
m_kitsPage->setPreferredKitMatcher(new QtSupport::QtPlatformKitMatcher(platform));
|
||||
}
|
||||
m_targetsPage->setRequiredKitMatcher(new QtSupport::QtVersionKitMatcher(requiredFeatures(),
|
||||
m_kitsPage->setRequiredKitMatcher(new QtSupport::QtVersionKitMatcher(requiredFeatures(),
|
||||
minimumQtVersionNumber,
|
||||
maximumQtVersionNumber));
|
||||
resize(900, 450);
|
||||
}
|
||||
|
||||
m_genericOptionsPage = new Internal::MobileAppWizardGenericOptionsPage;
|
||||
}
|
||||
|
||||
void AbstractMobileAppWizardDialog::addMobilePages()
|
||||
void AbstractMobileAppWizardDialog::addKitsPage()
|
||||
{
|
||||
if (m_targetsPage) {
|
||||
m_targetsPageId = addPageWithTitle(m_targetsPage, tr("Targets"));
|
||||
m_targetItem = wizardProgress()->item(m_targetsPageId);
|
||||
if (m_kitsPage)
|
||||
addPageWithTitle(m_kitsPage, tr("Kits"));
|
||||
}
|
||||
|
||||
const bool shouldAddGenericPage = m_targetsPage;
|
||||
|
||||
if (shouldAddGenericPage) {
|
||||
m_genericOptionsPageId = addPageWithTitle(m_genericOptionsPage,
|
||||
tr("Mobile Options"));
|
||||
m_genericItem = wizardProgress()->item(m_genericOptionsPageId);
|
||||
}
|
||||
|
||||
if (m_targetItem)
|
||||
m_targetItem->setNextShownItem(0);
|
||||
}
|
||||
|
||||
ProjectExplorer::TargetSetupPage *AbstractMobileAppWizardDialog::targetsPage() const
|
||||
ProjectExplorer::TargetSetupPage *AbstractMobileAppWizardDialog::kitsPage() const
|
||||
{
|
||||
return m_targetsPage;
|
||||
return m_kitsPage;
|
||||
}
|
||||
|
||||
int AbstractMobileAppWizardDialog::addPageWithTitle(QWizardPage *page, const QString &title)
|
||||
@@ -111,72 +89,6 @@ int AbstractMobileAppWizardDialog::addPageWithTitle(QWizardPage *page, const QSt
|
||||
return pageId;
|
||||
}
|
||||
|
||||
int AbstractMobileAppWizardDialog::nextId() const
|
||||
{
|
||||
if (m_targetsPage) {
|
||||
if (currentPage() == m_targetsPage)
|
||||
return idOfNextGenericPage();
|
||||
if (currentPage() == m_genericOptionsPage)
|
||||
return idOfNextGenericPage();
|
||||
}
|
||||
return BaseProjectWizardDialog::nextId();
|
||||
}
|
||||
|
||||
void AbstractMobileAppWizardDialog::initializePage(int id)
|
||||
{
|
||||
if (m_targetItem) {
|
||||
if (id == startId()) {
|
||||
m_targetItem->setNextItems(QList<Utils::WizardProgressItem *>()
|
||||
<< m_genericItem << itemOfNextGenericPage());
|
||||
} else if (id == m_genericOptionsPageId) {
|
||||
QList<Utils::WizardProgressItem *> order;
|
||||
order << m_genericItem << itemOfNextGenericPage();
|
||||
for (int i = 0; i < order.count() - 1; i++)
|
||||
order.at(i)->setNextShownItem(order.at(i + 1));
|
||||
}
|
||||
}
|
||||
BaseProjectWizardDialog::initializePage(id);
|
||||
}
|
||||
|
||||
void AbstractMobileAppWizardDialog::setIgnoreGenericOptionsPage(bool ignore)
|
||||
{
|
||||
m_ignoreGeneralOptions = ignore;
|
||||
}
|
||||
|
||||
Utils::WizardProgressItem *AbstractMobileAppWizardDialog::targetsPageItem() const
|
||||
{
|
||||
return m_targetItem;
|
||||
}
|
||||
|
||||
int AbstractMobileAppWizardDialog::idOfNextGenericPage() const
|
||||
{
|
||||
return pageIds().at(pageIds().indexOf(m_genericOptionsPageId) + 1);
|
||||
}
|
||||
|
||||
Utils::WizardProgressItem *AbstractMobileAppWizardDialog::itemOfNextGenericPage() const
|
||||
{
|
||||
return wizardProgress()->item(idOfNextGenericPage());
|
||||
}
|
||||
|
||||
bool AbstractMobileAppWizardDialog::isQtPlatformSelected(const QString &platform) const
|
||||
{
|
||||
QList<Core::Id> selectedKitsList = selectedKits();
|
||||
|
||||
foreach (Kit *k, KitManager::matchingKits(QtSupport::QtPlatformKitMatcher(platform)))
|
||||
if (selectedKitsList.contains(k->id()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
QList<Core::Id> AbstractMobileAppWizardDialog::selectedKits() const
|
||||
{
|
||||
if (m_targetsPage)
|
||||
return m_targetsPage->selectedKits();
|
||||
return m_kitIds;
|
||||
}
|
||||
|
||||
|
||||
|
||||
AbstractMobileAppWizard::AbstractMobileAppWizard(QObject *parent)
|
||||
: Core::BaseFileWizard(parent)
|
||||
@@ -188,7 +100,6 @@ QWizard *AbstractMobileAppWizard::createWizardDialog(QWidget *parent,
|
||||
AbstractMobileAppWizardDialog * const wdlg
|
||||
= createWizardDialogInternal(parent, wizardDialogParameters);
|
||||
wdlg->setProjectName(ProjectExplorer::BaseProjectWizardDialog::uniqueProjectName(wizardDialogParameters.defaultPath()));
|
||||
wdlg->m_genericOptionsPage->setOrientation(app()->orientation());
|
||||
connect(wdlg, SIGNAL(projectParametersChanged(QString,QString)),
|
||||
SLOT(useProjectPath(QString,QString)));
|
||||
wdlg->addExtensionPages(wizardDialogParameters.extensionPages());
|
||||
@@ -199,9 +110,6 @@ QWizard *AbstractMobileAppWizard::createWizardDialog(QWidget *parent,
|
||||
Core::GeneratedFiles AbstractMobileAppWizard::generateFiles(const QWizard *wizard,
|
||||
QString *errorMessage) const
|
||||
{
|
||||
const AbstractMobileAppWizardDialog *wdlg
|
||||
= qobject_cast<const AbstractMobileAppWizardDialog*>(wizard);
|
||||
app()->setOrientation(wdlg->m_genericOptionsPage->orientation());
|
||||
prepareGenerateFiles(wizard, errorMessage);
|
||||
return app()->generateFiles(errorMessage);
|
||||
}
|
||||
@@ -217,8 +125,8 @@ bool AbstractMobileAppWizard::postGenerateFiles(const QWizard *w,
|
||||
Q_ASSERT(manager);
|
||||
QmakeProject project(manager, app()->path(AbstractMobileApp::AppPro));
|
||||
bool success = true;
|
||||
if (wizardDialog()->m_targetsPage) {
|
||||
success = wizardDialog()->m_targetsPage->setupProject(&project);
|
||||
if (wizardDialog()->kitsPage()) {
|
||||
success = wizardDialog()->kitsPage()->setupProject(&project);
|
||||
if (success) {
|
||||
project.saveSettings();
|
||||
success = ProjectExplorer::CustomProjectWizard::postGenerateOpen(l, errorMessage);
|
||||
@@ -239,8 +147,8 @@ void AbstractMobileAppWizard::useProjectPath(const QString &projectName,
|
||||
{
|
||||
app()->setProjectName(projectName);
|
||||
app()->setProjectPath(projectPath);
|
||||
if (wizardDialog()->m_targetsPage)
|
||||
wizardDialog()->m_targetsPage->setProjectPath(app()->path(AbstractMobileApp::AppPro));
|
||||
if (wizardDialog()->kitsPage())
|
||||
wizardDialog()->kitsPage()->setProjectPath(app()->path(AbstractMobileApp::AppPro));
|
||||
projectPathChanged(app()->path(AbstractMobileApp::AppPro));
|
||||
}
|
||||
|
||||
|
@@ -44,8 +44,6 @@ namespace QmakeProjectManager {
|
||||
|
||||
class AbstractMobileApp;
|
||||
|
||||
namespace Internal { class MobileAppWizardGenericOptionsPage; }
|
||||
|
||||
/// \internal
|
||||
class QMAKEPROJECTMANAGER_EXPORT AbstractMobileAppWizardDialog : public ProjectExplorer::BaseProjectWizardDialog
|
||||
{
|
||||
@@ -55,36 +53,16 @@ protected:
|
||||
explicit AbstractMobileAppWizardDialog(QWidget *parent, const QtSupport::QtVersionNumber &minimumQtVersionNumber,
|
||||
const QtSupport::QtVersionNumber &maximumQtVersionNumber,
|
||||
const Core::WizardDialogParameters ¶meters);
|
||||
void addMobilePages();
|
||||
void addKitsPage();
|
||||
|
||||
public:
|
||||
ProjectExplorer::TargetSetupPage *targetsPage() const;
|
||||
ProjectExplorer::TargetSetupPage *kitsPage() const;
|
||||
|
||||
protected:
|
||||
int addPageWithTitle(QWizardPage *page, const QString &title);
|
||||
virtual void initializePage(int id);
|
||||
virtual void setIgnoreGenericOptionsPage(bool);
|
||||
virtual int nextId() const;
|
||||
|
||||
Utils::WizardProgressItem *targetsPageItem() const;
|
||||
|
||||
private:
|
||||
int idOfNextGenericPage() const;
|
||||
Utils::WizardProgressItem *itemOfNextGenericPage() const;
|
||||
bool isQtPlatformSelected(const QString &platform) const;
|
||||
QList<Core::Id> selectedKits() const;
|
||||
|
||||
Internal::MobileAppWizardGenericOptionsPage *m_genericOptionsPage;
|
||||
ProjectExplorer::TargetSetupPage *m_targetsPage;
|
||||
|
||||
int m_genericOptionsPageId;
|
||||
int m_targetsPageId;
|
||||
bool m_ignoreGeneralOptions; // If true, do not show generic mobile options page.
|
||||
Utils::WizardProgressItem *m_targetItem;
|
||||
Utils::WizardProgressItem *m_genericItem;
|
||||
QList<Core::Id> m_kitIds;
|
||||
|
||||
friend class AbstractMobileAppWizard;
|
||||
ProjectExplorer::TargetSetupPage *m_kitsPage;
|
||||
};
|
||||
|
||||
/// \internal
|
||||
|
@@ -67,7 +67,7 @@ Html5AppWizardDialog::Html5AppWizardDialog(QWidget *parent,
|
||||
|
||||
m_htmlOptionsPage = new Html5AppWizardOptionsPage;
|
||||
addPageWithTitle(m_htmlOptionsPage, tr("HTML Options"));
|
||||
addMobilePages();
|
||||
addKitsPage();
|
||||
}
|
||||
|
||||
|
||||
@@ -114,8 +114,8 @@ AbstractMobileAppWizardDialog *Html5AppWizard::createWizardDialogInternal(QWidge
|
||||
|
||||
void Html5AppWizard::projectPathChanged(const QString &path) const
|
||||
{
|
||||
if (d->wizardDialog->targetsPage())
|
||||
d->wizardDialog->targetsPage()->setProjectPath(path);
|
||||
if (d->wizardDialog->kitsPage())
|
||||
d->wizardDialog->kitsPage()->setProjectPath(path);
|
||||
}
|
||||
|
||||
void Html5AppWizard::prepareGenerateFiles(const QWizard *w,
|
||||
|
@@ -1,57 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QmakeProjectManager::Internal::MobileAppWizardGenericOptionsPage</class>
|
||||
<widget class="QWizardPage" name="QmakeProjectManager::Internal::MobileAppWizardGenericOptionsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>396</width>
|
||||
<height>115</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>WizardPage</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="orientationBehaviorLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Orientation behavior:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>orientationBehaviorComboBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="orientationBehaviorComboBox"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>66</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@@ -1,133 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, 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.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "mobileappwizardpages.h"
|
||||
#include "ui_mobileappwizardgenericoptionspage.h"
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <QTemporaryFile>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
namespace QmakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class MobileAppWizardGenericOptionsPagePrivate
|
||||
{
|
||||
Ui::MobileAppWizardGenericOptionsPage ui;
|
||||
friend class MobileAppWizardGenericOptionsPage;
|
||||
};
|
||||
|
||||
MobileAppWizardGenericOptionsPage::MobileAppWizardGenericOptionsPage(QWidget *parent)
|
||||
: QWizardPage(parent)
|
||||
, d(new MobileAppWizardGenericOptionsPagePrivate)
|
||||
{
|
||||
d->ui.setupUi(this);
|
||||
d->ui.orientationBehaviorComboBox->addItem(tr("Automatically Rotate Orientation"),
|
||||
AbstractMobileApp::ScreenOrientationAuto);
|
||||
d->ui.orientationBehaviorComboBox->addItem(tr("Lock to Landscape Orientation"),
|
||||
AbstractMobileApp::ScreenOrientationLockLandscape);
|
||||
d->ui.orientationBehaviorComboBox->addItem(tr("Lock to Portrait Orientation"),
|
||||
AbstractMobileApp::ScreenOrientationLockPortrait);
|
||||
}
|
||||
|
||||
MobileAppWizardGenericOptionsPage::~MobileAppWizardGenericOptionsPage()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void MobileAppWizardGenericOptionsPage::setOrientation(AbstractMobileApp::ScreenOrientation orientation)
|
||||
{
|
||||
QComboBox *const comboBox = d->ui.orientationBehaviorComboBox;
|
||||
for (int i = 0; i < comboBox->count(); ++i) {
|
||||
if (comboBox->itemData(i).toInt() == static_cast<int>(orientation)) {
|
||||
comboBox->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AbstractMobileApp::ScreenOrientation MobileAppWizardGenericOptionsPage::orientation() const
|
||||
{
|
||||
QComboBox *const comboBox = d->ui.orientationBehaviorComboBox;
|
||||
const int index = comboBox->currentIndex();
|
||||
return static_cast<AbstractMobileApp::ScreenOrientation>(comboBox->itemData(index).toInt());
|
||||
}
|
||||
|
||||
|
||||
class PngIconScaler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PngIconScaler(const QSize &expectedSize, const QString &iconPath)
|
||||
: m_expectedSize(expectedSize)
|
||||
, m_iconPath(iconPath)
|
||||
, m_pixmap(iconPath)
|
||||
{
|
||||
}
|
||||
|
||||
bool hasRightSize() const { return m_expectedSize == m_pixmap.size(); }
|
||||
QPixmap pixmap() const { return m_pixmap; }
|
||||
|
||||
bool scale(QString *newPath) {
|
||||
const QMessageBox::StandardButton button
|
||||
= QMessageBox::warning(QApplication::activeWindow(),
|
||||
tr("Wrong Icon Size"),
|
||||
tr("The icon needs to be %1x%2 pixels big, "
|
||||
"but is not. Do you want Qt Creator to scale it?")
|
||||
.arg(m_expectedSize.width()).arg(m_expectedSize.height()),
|
||||
QMessageBox::Ok | QMessageBox::Cancel);
|
||||
if (button != QMessageBox::Ok)
|
||||
return false;
|
||||
|
||||
m_pixmap = m_pixmap.scaled(m_expectedSize);
|
||||
Utils::TempFileSaver saver;
|
||||
saver.setAutoRemove(false);
|
||||
if (!saver.hasError())
|
||||
saver.setResult(m_pixmap.save(
|
||||
saver.file(), QFileInfo(m_iconPath).suffix().toLatin1().constData()));
|
||||
if (!saver.finalize()) {
|
||||
QMessageBox::critical(QApplication::activeWindow(),
|
||||
tr("File Error"),
|
||||
tr("Could not copy icon file: %1").arg(saver.errorString()));
|
||||
return false;
|
||||
}
|
||||
*newPath = saver.fileName();
|
||||
return true;
|
||||
}
|
||||
private:
|
||||
QSize m_expectedSize;
|
||||
QString m_iconPath;
|
||||
QPixmap m_pixmap;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmakeProjectManager
|
||||
|
||||
#include "mobileappwizardpages.moc"
|
@@ -1,58 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, 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.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef MOBILEAPPWIZARDPAGES_H
|
||||
#define MOBILEAPPWIZARDPAGES_H
|
||||
|
||||
#include "abstractmobileapp.h"
|
||||
|
||||
#include <QWizardPage>
|
||||
|
||||
namespace QmakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class MobileAppWizardGenericOptionsPage : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MobileAppWizardGenericOptionsPage(QWidget *parent = 0);
|
||||
virtual ~MobileAppWizardGenericOptionsPage();
|
||||
|
||||
void setOrientation(AbstractMobileApp::ScreenOrientation orientation);
|
||||
AbstractMobileApp::ScreenOrientation orientation() const;
|
||||
|
||||
private:
|
||||
class MobileAppWizardGenericOptionsPagePrivate *d;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmakeProjectManager
|
||||
|
||||
#endif // MOBILEAPPWIZARDPAGES_H
|
@@ -45,7 +45,6 @@ namespace Internal {
|
||||
|
||||
QtQuickApp::QtQuickApp()
|
||||
: AbstractMobileApp()
|
||||
, m_mainQmlMode(ModeGenerate)
|
||||
, m_componentSet(QtQuick10Components)
|
||||
{
|
||||
}
|
||||
@@ -60,24 +59,9 @@ QtQuickApp::ComponentSet QtQuickApp::componentSet() const
|
||||
return m_componentSet;
|
||||
}
|
||||
|
||||
void QtQuickApp::setMainQml(Mode mode, const QString &file)
|
||||
{
|
||||
Q_ASSERT(mode != ModeGenerate || file.isEmpty());
|
||||
m_mainQmlMode = mode;
|
||||
m_mainQmlFile.setFile(file);
|
||||
}
|
||||
|
||||
QtQuickApp::Mode QtQuickApp::mainQmlMode() const
|
||||
{
|
||||
return m_mainQmlMode;
|
||||
}
|
||||
|
||||
QString QtQuickApp::pathExtended(int fileType) const
|
||||
{
|
||||
const bool importQmlFile = m_mainQmlMode == ModeImport;
|
||||
const QString qmlSubDir = QLatin1String("qml/")
|
||||
+ (importQmlFile ? m_mainQmlFile.dir().dirName() : projectName())
|
||||
+ QLatin1Char('/');
|
||||
const QString qmlSubDir = QLatin1String("qml/") + projectName() + QLatin1Char('/');
|
||||
const QString appViewerTargetSubDir = appViewerOriginSubDir();
|
||||
|
||||
const QString mainQmlFile = QLatin1String("main.qml");
|
||||
@@ -87,13 +71,10 @@ QString QtQuickApp::pathExtended(int fileType) const
|
||||
+ componentSetDir(componentSet()) + QLatin1Char('/');
|
||||
|
||||
const QString pathBase = outputPathBase();
|
||||
const QDir appProFilePath(pathBase);
|
||||
|
||||
switch (fileType) {
|
||||
case MainQml:
|
||||
return importQmlFile ? m_mainQmlFile.canonicalFilePath() : pathBase + qmlSubDir + mainQmlFile;
|
||||
case MainQmlDeployed: return importQmlFile ? qmlSubDir + m_mainQmlFile.fileName()
|
||||
: QString(qmlSubDir + mainQmlFile);
|
||||
case MainQml: return pathBase + qmlSubDir + mainQmlFile;
|
||||
case MainQmlDeployed: return qmlSubDir + mainQmlFile;
|
||||
case MainQmlOrigin: return qmlOriginDir + mainQmlFile;
|
||||
case MainPageQml: return pathBase + qmlSubDir + mainPageQmlFile;
|
||||
case MainPageQmlOrigin: return qmlOriginDir + mainPageQmlFile;
|
||||
@@ -104,8 +85,7 @@ QString QtQuickApp::pathExtended(int fileType) const
|
||||
case AppViewerH: return pathBase + appViewerTargetSubDir + fileName(AppViewerH);
|
||||
case AppViewerHOrigin: return originsRoot() + appViewerOriginSubDir() + fileName(AppViewerH);
|
||||
case QmlDir: return pathBase + qmlSubDir;
|
||||
case QmlDirProFileRelative: return importQmlFile ? appProFilePath.relativeFilePath(m_mainQmlFile.canonicalPath())
|
||||
: QString(qmlSubDir).remove(qmlSubDir.length() - 1, 1);
|
||||
case QmlDirProFileRelative: return QString(qmlSubDir).remove(qmlSubDir.length() - 1, 1);
|
||||
default: qFatal("QtQuickApp::pathExtended() needs more work");
|
||||
}
|
||||
return QString();
|
||||
|
@@ -67,11 +67,6 @@ public:
|
||||
MainPageQmlOrigin
|
||||
};
|
||||
|
||||
enum Mode {
|
||||
ModeGenerate,
|
||||
ModeImport
|
||||
};
|
||||
|
||||
enum ComponentSet {
|
||||
QtQuick10Components,
|
||||
QtQuick20Components,
|
||||
@@ -83,9 +78,6 @@ public:
|
||||
void setComponentSet(ComponentSet componentSet);
|
||||
ComponentSet componentSet() const;
|
||||
|
||||
void setMainQml(Mode mode, const QString &file = QString());
|
||||
Mode mainQmlMode() const;
|
||||
|
||||
#ifndef CREATORLESSTEST
|
||||
virtual Core::GeneratedFiles generateFiles(QString *errorMessage) const;
|
||||
#else
|
||||
@@ -117,7 +109,6 @@ private:
|
||||
QString componentSetDir(ComponentSet componentSet) const;
|
||||
|
||||
QFileInfo m_mainQmlFile;
|
||||
Mode m_mainQmlMode;
|
||||
ComponentSet m_componentSet;
|
||||
};
|
||||
|
||||
|
@@ -49,24 +49,16 @@ class QtQuickAppWizardDialog : public AbstractMobileAppWizardDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QtQuickAppWizardDialog(QWidget *parent, const Core::WizardDialogParameters ¶meters,
|
||||
QtQuickAppWizard::Kind kind);
|
||||
explicit QtQuickAppWizardDialog(QWidget *parent, const Core::WizardDialogParameters ¶meters);
|
||||
QtQuickApp::ComponentSet componentSet() const { return m_componentSetPage->componentSet(); }
|
||||
|
||||
protected:
|
||||
bool validateCurrentPage();
|
||||
|
||||
private:
|
||||
QtQuickComponentSetOptionsPage *m_componentOptionsPage;
|
||||
int m_componentOptionsPageId;
|
||||
|
||||
Utils::WizardProgressItem *m_componentItem;
|
||||
|
||||
friend class QtQuickAppWizard;
|
||||
QtQuickComponentSetPage *m_componentSetPage;
|
||||
};
|
||||
|
||||
QtQuickAppWizardDialog::QtQuickAppWizardDialog(QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters,
|
||||
QtQuickAppWizard::Kind kind)
|
||||
const Core::WizardDialogParameters ¶meters)
|
||||
: AbstractMobileAppWizardDialog(parent,
|
||||
QtSupport::QtVersionNumber(4, 7, 0),
|
||||
QtSupport::QtVersionNumber(5, INT_MAX, INT_MAX), parameters)
|
||||
@@ -74,33 +66,16 @@ QtQuickAppWizardDialog::QtQuickAppWizardDialog(QWidget *parent,
|
||||
setWindowTitle(tr("New Qt Quick Application"));
|
||||
setIntroDescription(tr("This wizard generates a Qt Quick application project."));
|
||||
|
||||
if (kind == QtQuickAppWizard::ImportQml || kind == QtQuickAppWizard::ImportQml2) { //Choose existing qml file
|
||||
m_componentOptionsPage = new Internal::QtQuickComponentSetOptionsPage;
|
||||
m_componentOptionsPageId = addPageWithTitle(m_componentOptionsPage, tr("Select existing QML file"));
|
||||
m_componentItem = wizardProgress()->item(m_componentOptionsPageId);
|
||||
}
|
||||
m_componentSetPage = new Internal::QtQuickComponentSetPage;
|
||||
addPageWithTitle(m_componentSetPage, tr("Component Set"));
|
||||
|
||||
AbstractMobileAppWizardDialog::addMobilePages();
|
||||
|
||||
if (kind == QtQuickAppWizard::ImportQml || kind == QtQuickAppWizard::ImportQml2) {
|
||||
if (targetsPageItem())
|
||||
m_componentItem->setNextItems(QList<Utils::WizardProgressItem *>()
|
||||
<< targetsPageItem());
|
||||
}
|
||||
}
|
||||
|
||||
bool QtQuickAppWizardDialog::validateCurrentPage()
|
||||
{
|
||||
if (currentPage() == m_componentOptionsPage)
|
||||
setIgnoreGenericOptionsPage(false);
|
||||
return AbstractMobileAppWizardDialog::validateCurrentPage();
|
||||
addKitsPage();
|
||||
}
|
||||
|
||||
class QtQuickAppWizardPrivate
|
||||
{
|
||||
class QtQuickApp *app;
|
||||
class QtQuickAppWizardDialog *wizardDialog;
|
||||
QtQuickAppWizard::Kind kind;
|
||||
friend class QtQuickAppWizard;
|
||||
};
|
||||
|
||||
@@ -112,6 +87,9 @@ QtQuickAppWizard::QtQuickAppWizard()
|
||||
setId(QLatin1String("D.QMLA Application"));
|
||||
setCategory(QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY));
|
||||
setDisplayCategory(QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY_DISPLAY));
|
||||
setDisplayName(tr("Qt Quick Application"));
|
||||
setDescription(tr("Creates a Qt Quick application project that can contain both QML and C++ code."));
|
||||
setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK));
|
||||
|
||||
d->app = new QtQuickApp;
|
||||
d->wizardDialog = 0;
|
||||
@@ -123,111 +101,17 @@ QtQuickAppWizard::~QtQuickAppWizard()
|
||||
delete d;
|
||||
}
|
||||
|
||||
void QtQuickAppWizard::createInstances(ExtensionSystem::IPlugin *plugin)
|
||||
{
|
||||
const QString basicDescription = tr("Creates a Qt Quick 1 application project that can contain "
|
||||
"both QML and C++ code and includes a QDeclarativeView.\n\n");
|
||||
const QString basicDescription2 = tr("Creates a Qt Quick 2 application project that can contain "
|
||||
"both QML and C++ code and includes a QQuickView.\n\n");
|
||||
|
||||
Core::FeatureSet basicFeatures = Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_1);
|
||||
|
||||
QtQuickAppWizard *wizard = new QtQuickAppWizard;
|
||||
wizard->setQtQuickKind(QtQuick1_1);
|
||||
wizard->setDisplayName(tr("Qt Quick 1 Application (Built-in Types)"));
|
||||
wizard->setDescription(basicDescription + tr("The built-in QML types in the QtQuick 1 namespace allow "
|
||||
"you to write cross-platform applications with "
|
||||
"a custom look and feel.\n\nRequires <b>Qt 4.8.0</b> or newer."));
|
||||
wizard->setRequiredFeatures(basicFeatures);
|
||||
plugin->addAutoReleasedObject(wizard);
|
||||
|
||||
|
||||
wizard = new QtQuickAppWizard;
|
||||
wizard->setQtQuickKind(QtQuick2_0);
|
||||
wizard->setDisplayName(tr("Qt Quick 2 Application (Built-in Types)"));
|
||||
wizard->setDescription(basicDescription2 + tr("The built-in QML types in the QtQuick 2 namespace allow "
|
||||
"you to write cross-platform applications with "
|
||||
"a custom look and feel.\n\nRequires <b>Qt 5.0</b> or newer."));
|
||||
wizard->setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_2));
|
||||
plugin->addAutoReleasedObject(wizard);
|
||||
|
||||
|
||||
wizard = new QtQuickAppWizard;
|
||||
wizard->setQtQuickKind(ImportQml);
|
||||
wizard->setDisplayName(tr("Qt Quick 1 Application (from Existing QML File)"));
|
||||
wizard->setDescription(basicDescription + tr("Creates a deployable Qt Quick application from "
|
||||
"existing QML files. All files and directories that "
|
||||
"reside in the same directory as the main .qml file "
|
||||
"are deployed. You can modify the contents of the "
|
||||
"directory any time before deploying.\n\nRequires <b>Qt 4.8.0</b> or newer."));
|
||||
wizard->setRequiredFeatures(basicFeatures);
|
||||
plugin->addAutoReleasedObject(wizard);
|
||||
|
||||
|
||||
wizard = new QtQuickAppWizard;
|
||||
wizard->setQtQuickKind(ImportQml2);
|
||||
wizard->setDisplayName(tr("Qt Quick 2 Application (from Existing QML File)"));
|
||||
wizard->setDescription(basicDescription2 + tr("Creates a deployable Qt Quick application from "
|
||||
"existing QML files. All files and directories that "
|
||||
"reside in the same directory as the main .qml file "
|
||||
"are deployed. You can modify the contents of the "
|
||||
"directory any time before deploying.\n\nRequires <b>Qt 5.0</b> or newer."));
|
||||
|
||||
wizard->setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_2));
|
||||
plugin->addAutoReleasedObject(wizard);
|
||||
|
||||
wizard = new QtQuickAppWizard;
|
||||
wizard->setQtQuickKind(QtQuick_Controls_1_0);
|
||||
|
||||
wizard->setDisplayName(tr("Qt Quick 2 Application (Qt Quick Controls)"));
|
||||
wizard->setDescription(basicDescription + tr("Creates a deployable Qt Quick application using "
|
||||
"Qt Quick Controls. All files and directories that "
|
||||
"reside in the same directory as the main .qml file "
|
||||
"are deployed. You can modify the contents of the "
|
||||
"directory any time before deploying.\n\nRequires <b>Qt 5.1.0</b> or newer."));
|
||||
wizard->setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_2)
|
||||
| Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_CONTROLS));
|
||||
plugin->addAutoReleasedObject(wizard);
|
||||
}
|
||||
|
||||
AbstractMobileAppWizardDialog *QtQuickAppWizard::createWizardDialogInternal(QWidget *parent,
|
||||
const Core::WizardDialogParameters ¶meters) const
|
||||
{
|
||||
d->wizardDialog = new QtQuickAppWizardDialog(parent, parameters, qtQuickKind());
|
||||
|
||||
switch (qtQuickKind()) {
|
||||
case QtQuick1_1:
|
||||
d->app->setComponentSet(QtQuickApp::QtQuick10Components);
|
||||
d->app->setMainQml(QtQuickApp::ModeGenerate);
|
||||
break;
|
||||
case ImportQml:
|
||||
d->app->setComponentSet(QtQuickApp::QtQuick10Components);
|
||||
d->app->setMainQml(QtQuickApp::ModeImport);
|
||||
break;
|
||||
case ImportQml2:
|
||||
d->app->setComponentSet(QtQuickApp::QtQuick20Components);
|
||||
d->app->setMainQml(QtQuickApp::ModeImport);
|
||||
break;
|
||||
case QtQuick2_0:
|
||||
d->app->setComponentSet(QtQuickApp::QtQuick20Components);
|
||||
d->app->setMainQml(QtQuickApp::ModeGenerate);
|
||||
break;
|
||||
case QtQuick_Controls_1_0:
|
||||
d->app->setComponentSet(QtQuickApp::QtQuickControls10);
|
||||
d->app->setMainQml(QtQuickApp::ModeGenerate);
|
||||
break;
|
||||
default:
|
||||
qWarning() << "QtQuickAppWizard illegal subOption:" << qtQuickKind();
|
||||
break;
|
||||
}
|
||||
|
||||
d->wizardDialog = new QtQuickAppWizardDialog(parent, parameters);
|
||||
return d->wizardDialog;
|
||||
}
|
||||
|
||||
void QtQuickAppWizard::projectPathChanged(const QString &path) const
|
||||
{
|
||||
if (d->wizardDialog->targetsPage())
|
||||
d->wizardDialog->targetsPage()->setProjectPath(path);
|
||||
if (d->wizardDialog->kitsPage())
|
||||
d->wizardDialog->kitsPage()->setProjectPath(path);
|
||||
}
|
||||
|
||||
void QtQuickAppWizard::prepareGenerateFiles(const QWizard *w,
|
||||
@@ -235,23 +119,7 @@ void QtQuickAppWizard::prepareGenerateFiles(const QWizard *w,
|
||||
{
|
||||
Q_UNUSED(errorMessage)
|
||||
const QtQuickAppWizardDialog *wizard = qobject_cast<const QtQuickAppWizardDialog*>(w);
|
||||
|
||||
if (d->app->mainQmlMode() == QtQuickApp::ModeGenerate) {
|
||||
d->app->setMainQml(QtQuickApp::ModeGenerate);
|
||||
} else {
|
||||
const QString mainQmlFile = wizard->m_componentOptionsPage->mainQmlFile();
|
||||
d->app->setMainQml(QtQuickApp::ModeImport, mainQmlFile);
|
||||
}
|
||||
}
|
||||
|
||||
void QtQuickAppWizard::setQtQuickKind(QtQuickAppWizard::Kind kind)
|
||||
{
|
||||
d->kind = kind;
|
||||
}
|
||||
|
||||
QtQuickAppWizard::Kind QtQuickAppWizard::qtQuickKind() const
|
||||
{
|
||||
return d->kind;
|
||||
d->app->setComponentSet(wizard->componentSet());
|
||||
}
|
||||
|
||||
QString QtQuickAppWizard::fileToOpenPostGeneration() const
|
||||
|
@@ -40,19 +40,9 @@ class QtQuickAppWizard : public AbstractMobileAppWizard
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Kind {
|
||||
QtQuick1_1 = 0,
|
||||
QtQuick2_0 = 1,
|
||||
ImportQml = 3,
|
||||
ImportQml2 = 4,
|
||||
QtQuick_Controls_1_0 = 5
|
||||
};
|
||||
|
||||
QtQuickAppWizard();
|
||||
~QtQuickAppWizard();
|
||||
|
||||
static void createInstances(ExtensionSystem::IPlugin *plugin);
|
||||
|
||||
protected:
|
||||
QString fileToOpenPostGeneration() const;
|
||||
|
||||
@@ -64,8 +54,6 @@ private:
|
||||
virtual void projectPathChanged(const QString &path) const;
|
||||
virtual void prepareGenerateFiles(const QWizard *wizard,
|
||||
QString *errorMessage) const;
|
||||
void setQtQuickKind(Kind kind);
|
||||
Kind qtQuickKind() const;
|
||||
|
||||
class QtQuickAppWizardPrivate *d;
|
||||
};
|
||||
|
@@ -29,43 +29,88 @@
|
||||
|
||||
#include "qtquickappwizardpages.h"
|
||||
#include "ui_qtquickcomponentsetoptionspage.h"
|
||||
#include <QComboBox>
|
||||
|
||||
namespace QmakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class QtQuickComponentSetOptionsPagePrivate
|
||||
class QtQuickComponentSetPagePrivate
|
||||
{
|
||||
Ui::QtQuickComponentSetOptionsPage ui;
|
||||
friend class QtQuickComponentSetOptionsPage;
|
||||
public:
|
||||
QComboBox *m_versionComboBox;
|
||||
QLabel *m_descriptionLabel;
|
||||
};
|
||||
|
||||
QtQuickComponentSetOptionsPage::QtQuickComponentSetOptionsPage(QWidget *parent)
|
||||
: QWizardPage(parent)
|
||||
, d(new QtQuickComponentSetOptionsPagePrivate)
|
||||
QString QtQuickComponentSetPage::description(QtQuickApp::ComponentSet componentSet) const
|
||||
{
|
||||
d->ui.setupUi(this);
|
||||
|
||||
d->ui.importLineEdit->setExpectedKind(Utils::PathChooser::File);
|
||||
d->ui.importLineEdit->setPromptDialogFilter(QLatin1String("*.qml"));
|
||||
d->ui.importLineEdit->setPromptDialogTitle(tr("Select QML File"));
|
||||
connect(d->ui.importLineEdit, SIGNAL(changed(QString)), SIGNAL(completeChanged()));
|
||||
|
||||
setTitle(tr("Select Existing QML file"));
|
||||
const QString basicDescription = tr("Creates a Qt Quick 1 application project that can contain "
|
||||
"both QML and C++ code and includes a QDeclarativeView.<br><br>");
|
||||
const QString basicDescription2 = tr("Creates a Qt Quick 2 application project that can contain "
|
||||
"both QML and C++ code and includes a QQuickView.<br><br>");
|
||||
switch (componentSet) {
|
||||
case QtQuickApp::QtQuickControls10:
|
||||
return basicDescription2 + tr("Creates a deployable Qt Quick application using "
|
||||
"Qt Quick Controls. All files and directories that "
|
||||
"reside in the same directory as the main .qml file "
|
||||
"are deployed. You can modify the contents of the "
|
||||
"directory any time before deploying.\n\nRequires <b>Qt 5.1</b> or newer.");
|
||||
case QtQuickApp::QtQuick20Components:
|
||||
return basicDescription2 + tr("The built-in QML types in the QtQuick 2 namespace allow "
|
||||
"you to write cross-platform applications with "
|
||||
"a custom look and feel.\n\nRequires <b>Qt 5.0</b> or newer.");
|
||||
case QtQuickApp::QtQuick10Components:
|
||||
return basicDescription + tr("The built-in QML types in the QtQuick 1 namespace allow "
|
||||
"you to write cross-platform applications with "
|
||||
"a custom look and feel.\n\nRequires <b>Qt 4.8</b> or newer.");
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
QtQuickComponentSetOptionsPage::~QtQuickComponentSetOptionsPage()
|
||||
QtQuickComponentSetPage::QtQuickComponentSetPage(QWidget *parent)
|
||||
: QWizardPage(parent)
|
||||
, d(new QtQuickComponentSetPagePrivate)
|
||||
{
|
||||
setTitle(tr("Select Qt Quick Component Set"));
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||
QHBoxLayout *l = new QHBoxLayout();
|
||||
|
||||
QLabel *label = new QLabel(tr("Qt Quick component set:"), this);
|
||||
d->m_versionComboBox = new QComboBox(this);
|
||||
d->m_versionComboBox->addItem(tr("Qt Quick Controls 1.0"), QtQuickApp::QtQuickControls10);
|
||||
d->m_versionComboBox->addItem(tr("Qt Quick 2.0"), QtQuickApp::QtQuick20Components);
|
||||
d->m_versionComboBox->addItem(tr("Qt Quick 1.1"), QtQuickApp::QtQuick10Components);
|
||||
|
||||
l->addWidget(label);
|
||||
l->addWidget(d->m_versionComboBox);
|
||||
|
||||
d->m_descriptionLabel = new QLabel(this);
|
||||
d->m_descriptionLabel->setWordWrap(true);
|
||||
d->m_descriptionLabel->setTextFormat(Qt::RichText);
|
||||
connect(d->m_versionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateDescription(int)));
|
||||
updateDescription(d->m_versionComboBox->currentIndex());
|
||||
|
||||
mainLayout->addLayout(l);
|
||||
mainLayout->addWidget(d->m_descriptionLabel);
|
||||
}
|
||||
|
||||
QtQuickComponentSetPage::~QtQuickComponentSetPage()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
QString QtQuickComponentSetOptionsPage::mainQmlFile() const
|
||||
QtQuickApp::ComponentSet QtQuickComponentSetPage::componentSet(int index) const
|
||||
{
|
||||
return d->ui.importLineEdit->path();
|
||||
return (QtQuickApp::ComponentSet)d->m_versionComboBox->itemData(index).toInt();
|
||||
}
|
||||
|
||||
bool QtQuickComponentSetOptionsPage::isComplete() const
|
||||
QtQuickApp::ComponentSet QtQuickComponentSetPage::componentSet() const
|
||||
{
|
||||
return d->ui.importLineEdit->isValid();
|
||||
return componentSet(d->m_versionComboBox->currentIndex());
|
||||
}
|
||||
|
||||
void QtQuickComponentSetPage::updateDescription(int index)
|
||||
{
|
||||
d->m_descriptionLabel->setText(description(componentSet(index)));
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -31,23 +31,29 @@
|
||||
#define QTQUICKAPPWIZARDPAGES_H
|
||||
|
||||
#include <QWizardPage>
|
||||
#include "qtquickapp.h"
|
||||
|
||||
namespace QmakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class QtQuickComponentSetOptionsPage : public QWizardPage
|
||||
class QtQuickComponentSetPage : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QtQuickComponentSetOptionsPage(QWidget *parent = 0);
|
||||
virtual ~QtQuickComponentSetOptionsPage();
|
||||
explicit QtQuickComponentSetPage(QWidget *parent = 0);
|
||||
virtual ~QtQuickComponentSetPage();
|
||||
|
||||
QString mainQmlFile() const;
|
||||
virtual bool isComplete() const;
|
||||
QtQuickApp::ComponentSet componentSet() const;
|
||||
|
||||
private slots:
|
||||
void updateDescription(int index);
|
||||
|
||||
private:
|
||||
class QtQuickComponentSetOptionsPagePrivate *d;
|
||||
QtQuickApp::ComponentSet componentSet(int index) const;
|
||||
QString description(QtQuickApp::ComponentSet componentSet) const;
|
||||
|
||||
class QtQuickComponentSetPagePrivate *d;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
Reference in New Issue
Block a user