OSDN Git Service

Mobile wizards: Make options pages target-specific.
authorChristian Kandeler <christian.kandeler@nokia.com>
Wed, 1 Dec 2010 15:55:42 +0000 (16:55 +0100)
committerChristian Kandeler <christian.kandeler@nokia.com>
Wed, 1 Dec 2010 15:56:51 +0000 (16:56 +0100)
Task-number: QTCREATORBUG-2511
Reviewed-by: Alessandro Portale
src/plugins/qt4projectmanager/qt4projectmanager.pro
src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp
src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.h
src/plugins/qt4projectmanager/wizards/mobileappwizardgenericoptionspage.ui [new file with mode: 0644]
src/plugins/qt4projectmanager/wizards/mobileappwizardmaemooptionspage.ui [new file with mode: 0644]
src/plugins/qt4projectmanager/wizards/mobileappwizardoptionspage.ui [deleted file]
src/plugins/qt4projectmanager/wizards/mobileappwizardpages.cpp
src/plugins/qt4projectmanager/wizards/mobileappwizardpages.h
src/plugins/qt4projectmanager/wizards/mobileappwizardsymbianoptionspage.ui [new file with mode: 0644]
src/plugins/qt4projectmanager/wizards/qmlstandaloneappwizard.cpp

index 564d471..9e22121 100644 (file)
@@ -139,8 +139,10 @@ FORMS += makestep.ui \
     wizards/testwizardpage.ui \
     wizards/targetsetuppage.ui \
     wizards/qmlstandaloneappwizardsourcespage.ui \
-    wizards/mobileappwizardoptionspage.ui \
     wizards/mobilelibrarywizardoptionpage.ui \
+    wizards/mobileappwizardgenericoptionspage.ui \
+    wizards/mobileappwizardsymbianoptionspage.ui \
+    wizards/mobileappwizardmaemooptionspage.ui \
     librarydetailswidget.ui
 RESOURCES += qt4projectmanager.qrc \
     wizards/wizards.qrc
index e780719..4abd624 100644 (file)
@@ -36,6 +36,7 @@
 #include <extensionsystem/pluginmanager.h>
 #include <qt4projectmanager/qt4project.h>
 #include <qt4projectmanager/qt4projectmanager.h>
+#include <qt4projectmanager/qt4projectmanagerconstants.h>
 
 #include <QtGui/QIcon>
 
@@ -48,13 +49,57 @@ AbstractMobileAppWizardDialog::AbstractMobileAppWizardDialog(QWidget *parent)
     m_targetsPage = new TargetSetupPage;
     resize(900, 450);
     m_targetsPage->setImportDirectoryBrowsingEnabled(false);
-    int pageId = addPage(m_targetsPage);
-    wizardProgress()->item(pageId)->setTitle(tr("Qt Versions"));
-    m_optionsPage = new MobileAppWizardOptionsPage;
-    pageId = addPage(m_optionsPage);
-    wizardProgress()->item(pageId)->setTitle(tr("Application Options"));
+    addPageWithTitle(m_targetsPage, tr("Qt Versions"));
+    m_genericOptionsPage = new MobileAppWizardGenericOptionsPage;
+    m_genericOptionsPageId = addPageWithTitle(m_genericOptionsPage,
+        tr("Generic Mobile Application Options"));
+    m_symbianOptionsPage = new MobileAppWizardSymbianOptionsPage;
+    m_symbianOptionsPageId = addPageWithTitle(m_symbianOptionsPage,
+        tr("Symbian-specific Options"));
+    m_maemoOptionsPage = new MobileAppWizardMaemoOptionsPage;
+    m_maemoOptionsPageId = addPageWithTitle(m_maemoOptionsPage,
+        tr("Maemo-specific Options"));
 }
 
+int AbstractMobileAppWizardDialog::addPageWithTitle(QWizardPage *page, const QString &title)
+{
+    const int pageId = addPage(page);
+    wizardProgress()->item(pageId)->setTitle(title);
+    return pageId;
+}
+
+int AbstractMobileAppWizardDialog::nextId() const
+{
+    const bool symbianTargetSelected =
+        m_targetsPage->isTargetSelected(QLatin1String(Constants::S60_EMULATOR_TARGET_ID))
+        || m_targetsPage->isTargetSelected(QLatin1String(Constants::S60_DEVICE_TARGET_ID));
+    const bool maemoTargetSelected =
+        m_targetsPage->isTargetSelected(QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID));
+
+    if (currentPage() == m_targetsPage) {
+        if (symbianTargetSelected || maemoTargetSelected)
+            return m_genericOptionsPageId;
+        else
+            return idOfNextGenericPage();
+    } else if (currentPage() == m_genericOptionsPage) {
+        if (symbianTargetSelected)
+            return m_symbianOptionsPageId;
+        else
+            return m_maemoOptionsPageId;
+    } else if (currentPage() == m_symbianOptionsPage) {
+        if (maemoTargetSelected)
+            return m_maemoOptionsPageId;
+        else
+            return idOfNextGenericPage();
+    } else {
+        return BaseProjectWizardDialog::nextId();
+    }
+}
+
+int AbstractMobileAppWizardDialog::idOfNextGenericPage() const
+{
+    return pageIds().at(pageIds().indexOf(m_maemoOptionsPageId) + 1);
+}
 
 AbstractMobileAppWizard::AbstractMobileAppWizard(const Core::BaseFileWizardParameters &params,
     QObject *parent) : Core::BaseFileWizard(params, parent)
@@ -68,10 +113,10 @@ QWizard *AbstractMobileAppWizard::createWizardDialog(QWidget *parent,
         = createWizardDialogInternal(parent);
     wdlg->setPath(defaultPath);
     wdlg->setProjectName(ProjectExplorer::BaseProjectWizardDialog::uniqueProjectName(defaultPath));
-    wdlg->m_optionsPage->setSymbianSvgIcon(app()->symbianSvgIcon());
-    wdlg->m_optionsPage->setMaemoPngIcon(app()->maemoPngIcon());
-    wdlg->m_optionsPage->setOrientation(app()->orientation());
-    wdlg->m_optionsPage->setNetworkEnabled(app()->networkEnabled());
+    wdlg->m_genericOptionsPage->setOrientation(app()->orientation());
+    wdlg->m_symbianOptionsPage->setSvgIcon(app()->symbianSvgIcon());
+    wdlg->m_symbianOptionsPage->setNetworkEnabled(app()->networkEnabled());
+    wdlg->m_maemoOptionsPage->setPngIcon(app()->maemoPngIcon());
     connect(wdlg, SIGNAL(projectParametersChanged(QString, QString)),
         SLOT(useProjectPath(QString, QString)));
     foreach (QWizardPage *p, extensionPages)
@@ -85,11 +130,11 @@ Core::GeneratedFiles AbstractMobileAppWizard::generateFiles(const QWizard *wizar
     prepareGenerateFiles(wizard, errorMessage);
     const AbstractMobileAppWizardDialog *wdlg
         = qobject_cast<const AbstractMobileAppWizardDialog*>(wizard);
-    app()->setSymbianTargetUid(wdlg->m_optionsPage->symbianUid());
-    app()->setSymbianSvgIcon(wdlg->m_optionsPage->symbianSvgIcon());
-    app()->setMaemoPngIcon(wdlg->m_optionsPage->maemoPngIcon());
-    app()->setOrientation(wdlg->m_optionsPage->orientation());
-    app()->setNetworkEnabled(wdlg->m_optionsPage->networkEnabled());
+    app()->setOrientation(wdlg->m_genericOptionsPage->orientation());
+    app()->setSymbianTargetUid(wdlg->m_symbianOptionsPage->symbianUid());
+    app()->setSymbianSvgIcon(wdlg->m_symbianOptionsPage->svgIcon());
+    app()->setNetworkEnabled(wdlg->m_symbianOptionsPage->networkEnabled());
+    app()->setMaemoPngIcon(wdlg->m_maemoOptionsPage->pngIcon());
     return app()->generateFiles(errorMessage);
 }
 
@@ -112,7 +157,7 @@ bool AbstractMobileAppWizard::postGenerateFiles(const QWizard *w,
 void AbstractMobileAppWizard::useProjectPath(const QString &projectName,
     const QString &projectPath)
 {
-    wizardDialog()->m_optionsPage->setSymbianUid(app()->symbianUidForPath(projectPath + projectName));
+    wizardDialog()->m_symbianOptionsPage->setSymbianUid(app()->symbianUidForPath(projectPath + projectName));
     app()->setProjectName(projectName);
     app()->setProjectPath(projectPath);
     wizardDialog()->m_targetsPage->setProFilePath(app()->path(AbstractMobileApp::AppPro));
index 965d3d6..b6aa8de 100644 (file)
@@ -37,16 +37,33 @@ namespace Qt4ProjectManager {
 namespace Internal {
 
 class AbstractMobileApp;
+class MobileAppWizardGenericOptionsPage;
+class MobileAppWizardSymbianOptionsPage;
+class MobileAppWizardMaemoOptionsPage;
 
-class AbstractMobileAppWizardDialog  : public ProjectExplorer::BaseProjectWizardDialog
+class AbstractMobileAppWizardDialog : public ProjectExplorer::BaseProjectWizardDialog
 {
     Q_OBJECT
 protected:
     explicit AbstractMobileAppWizardDialog(QWidget *parent = 0);
 
 public:
-    class MobileAppWizardOptionsPage *m_optionsPage;
+    MobileAppWizardGenericOptionsPage *m_genericOptionsPage;
+    MobileAppWizardSymbianOptionsPage *m_symbianOptionsPage;
+    MobileAppWizardMaemoOptionsPage *m_maemoOptionsPage;
     class TargetSetupPage *m_targetsPage;
+
+protected:
+    int addPageWithTitle(QWizardPage *page, const QString &title);
+
+private:
+    virtual int nextId() const;
+
+    int idOfNextGenericPage() const;
+
+    int m_genericOptionsPageId;
+    int m_symbianOptionsPageId;
+    int m_maemoOptionsPageId;
 };
 
 class AbstractMobileAppWizard : public Core::BaseFileWizard
diff --git a/src/plugins/qt4projectmanager/wizards/mobileappwizardgenericoptionspage.ui b/src/plugins/qt4projectmanager/wizards/mobileappwizardgenericoptionspage.ui
new file mode 100644 (file)
index 0000000..337fdbc
--- /dev/null
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MobileAppWizardGenericOptionsPage</class>
+ <widget class="QWizardPage" name="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>
diff --git a/src/plugins/qt4projectmanager/wizards/mobileappwizardmaemooptionspage.ui b/src/plugins/qt4projectmanager/wizards/mobileappwizardmaemooptionspage.ui
new file mode 100644 (file)
index 0000000..20f1f97
--- /dev/null
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MobileAppWizardMaemoOptionsPage</class>
+ <widget class="QWizardPage" name="MobileAppWizardMaemoOptionsPage">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>WizardPage</string>
+  </property>
+  <layout class="QFormLayout" name="formLayout">
+   <item row="0" column="0">
+    <widget class="QLabel" name="appIconLabel">
+     <property name="text">
+      <string>Application icon (64x64):</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="1">
+    <widget class="QToolButton" name="pngIconButton">
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>0</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>16777215</width>
+       <height>16777215</height>
+      </size>
+     </property>
+     <property name="text">
+      <string/>
+     </property>
+     <property name="iconSize">
+      <size>
+       <width>64</width>
+       <height>64</height>
+      </size>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/plugins/qt4projectmanager/wizards/mobileappwizardoptionspage.ui b/src/plugins/qt4projectmanager/wizards/mobileappwizardoptionspage.ui
deleted file mode 100644 (file)
index 95a6bc5..0000000
+++ /dev/null
@@ -1,233 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MobileAppWizardOptionPage</class>
- <widget class="QWizardPage" name="MobileAppWizardOptionPage">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>404</width>
-    <height>548</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>WizardPage</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <item>
-    <widget class="QGroupBox" name="groupBox_2">
-     <property name="title">
-      <string>General</string>
-     </property>
-     <layout class="QGridLayout" name="gridLayout_2">
-      <property name="verticalSpacing">
-       <number>12</number>
-      </property>
-      <item row="0" column="0">
-       <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 row="0" column="1">
-       <widget class="QComboBox" name="orientationBehaviorComboBox"/>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <widget class="QTabWidget" name="platformsTabWidget">
-     <property name="currentIndex">
-      <number>0</number>
-     </property>
-     <widget class="QWidget" name="tab">
-      <attribute name="title">
-       <string>Symbian Specific</string>
-      </attribute>
-      <layout class="QFormLayout" name="formLayout">
-       <item row="0" column="0">
-        <widget class="QLabel" name="symbianAppIconLabel">
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="text">
-          <string>Application icon (.svg):</string>
-         </property>
-         <property name="buddy">
-          <cstring>symbianAppIconLoadToolButton</cstring>
-         </property>
-        </widget>
-       </item>
-       <item row="0" column="1">
-        <layout class="QHBoxLayout" name="horizontalLayout">
-         <item>
-          <widget class="QLabel" name="symbianAppIconPreview">
-           <property name="minimumSize">
-            <size>
-             <width>45</width>
-             <height>45</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>45</width>
-             <height>45</height>
-            </size>
-           </property>
-           <property name="frameShape">
-            <enum>QFrame::Panel</enum>
-           </property>
-           <property name="frameShadow">
-            <enum>QFrame::Sunken</enum>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QToolButton" name="symbianAppIconLoadToolButton">
-           <property name="text">
-            <string/>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <spacer name="horizontalSpacer">
-           <property name="orientation">
-            <enum>Qt::Horizontal</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>40</width>
-             <height>20</height>
-            </size>
-           </property>
-          </spacer>
-         </item>
-        </layout>
-       </item>
-       <item row="1" column="0">
-        <widget class="QLabel" name="symbianTargetUid3Label">
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="text">
-          <string>Target UID3:</string>
-         </property>
-         <property name="buddy">
-          <cstring>symbianTargetUid3LineEdit</cstring>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="1">
-        <layout class="QHBoxLayout" name="horizontalLayout_2">
-         <item>
-          <widget class="QLineEdit" name="symbianTargetUid3LineEdit"/>
-         </item>
-         <item>
-          <spacer name="horizontalSpacer_2">
-           <property name="orientation">
-            <enum>Qt::Horizontal</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>40</width>
-             <height>20</height>
-            </size>
-           </property>
-          </spacer>
-         </item>
-        </layout>
-       </item>
-       <item row="2" column="0" colspan="2">
-        <widget class="QCheckBox" name="symbianEnableNetworkChackBox">
-         <property name="text">
-          <string>Enable network access</string>
-         </property>
-        </widget>
-       </item>
-      </layout>
-     </widget>
-     <widget class="QWidget" name="tab_2">
-      <attribute name="title">
-       <string>Maemo Specific</string>
-      </attribute>
-      <widget class="QLabel" name="maemoAppIconLabel">
-       <property name="geometry">
-        <rect>
-         <x>9</x>
-         <y>9</y>
-         <width>155</width>
-         <height>16</height>
-        </rect>
-       </property>
-       <property name="text">
-        <string>Application icon (64x64):</string>
-       </property>
-      </widget>
-      <widget class="QToolButton" name="maemoPngIconButton">
-       <property name="geometry">
-        <rect>
-         <x>171</x>
-         <y>10</y>
-         <width>71</width>
-         <height>70</height>
-        </rect>
-       </property>
-       <property name="minimumSize">
-        <size>
-         <width>0</width>
-         <height>0</height>
-        </size>
-       </property>
-       <property name="maximumSize">
-        <size>
-         <width>16777215</width>
-         <height>16777215</height>
-        </size>
-       </property>
-       <property name="text">
-        <string/>
-       </property>
-       <property name="iconSize">
-        <size>
-         <width>64</width>
-         <height>64</height>
-        </size>
-       </property>
-      </widget>
-     </widget>
-    </widget>
-   </item>
-   <item>
-    <spacer name="verticalSpacer">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>40</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
index 01d64e1..107b891 100644 (file)
@@ -28,7 +28,9 @@
 **************************************************************************/
 
 #include "mobileappwizardpages.h"
-#include "ui_mobileappwizardoptionspage.h"
+#include "ui_mobileappwizardgenericoptionspage.h"
+#include "ui_mobileappwizardmaemooptionspage.h"
+#include "ui_mobileappwizardsymbianoptionspage.h"
 #include <coreplugin/coreconstants.h>
 
 #include <QtGui/QDesktopServices>
 namespace Qt4ProjectManager {
 namespace Internal {
 
-class MobileAppWizardOptionsPagePrivate
+class MobileAppWizardGenericOptionsPagePrivate
 {
-    Ui::MobileAppWizardOptionPage ui;
-    QString symbianSvgIcon;
-    QString maemoPngIcon;
-    friend class MobileAppWizardOptionsPage;
+    Ui::MobileAppWizardGenericOptionsPage ui;
+    friend class MobileAppWizardGenericOptionsPage;
 };
 
-MobileAppWizardOptionsPage::MobileAppWizardOptionsPage(QWidget *parent)
-    : QWizardPage(parent)
-    , m_d(new MobileAppWizardOptionsPagePrivate)
+class MobileAppWizardSymbianOptionsPagePrivate
 {
-    m_d->ui.setupUi(this);
+    Ui::MobileAppWizardSymbianOptionsPage ui;
+    QString svgIcon;
+    friend class MobileAppWizardSymbianOptionsPage;
+};
 
-    const QIcon open = QApplication::style()->standardIcon(QStyle::SP_DirOpenIcon);
-    m_d->ui.symbianAppIconLoadToolButton->setIcon(open);
-    connect(m_d->ui.symbianAppIconLoadToolButton, SIGNAL(clicked()), SLOT(openSymbianSvgIcon()));
-    connect(m_d->ui.maemoPngIconButton, SIGNAL(clicked()), this,
-        SLOT(openMaemoPngIcon()));
+class MobileAppWizardMaemoOptionsPagePrivate
+{
+    Ui::MobileAppWizardMaemoOptionsPage ui;
+    QString pngIcon;
+    friend class MobileAppWizardMaemoOptionsPage;
+};
 
+
+MobileAppWizardGenericOptionsPage::MobileAppWizardGenericOptionsPage(QWidget *parent)
+    : QWizardPage(parent)
+    , m_d(new MobileAppWizardGenericOptionsPagePrivate)
+{
+    m_d->ui.setupUi(this);
     m_d->ui.orientationBehaviorComboBox->addItem(tr("Automatically Rotate Orientation"),
         AbstractMobileApp::ScreenOrientationAuto);
     m_d->ui.orientationBehaviorComboBox->addItem(tr("Lock to Landscape Orientation"),
@@ -67,12 +75,12 @@ MobileAppWizardOptionsPage::MobileAppWizardOptionsPage(QWidget *parent)
         AbstractMobileApp::ScreenOrientationLockPortrait);
 }
 
-MobileAppWizardOptionsPage::~MobileAppWizardOptionsPage()
+MobileAppWizardGenericOptionsPage::~MobileAppWizardGenericOptionsPage()
 {
     delete m_d;
 }
 
-void MobileAppWizardOptionsPage::setOrientation(AbstractMobileApp::ScreenOrientation orientation)
+void MobileAppWizardGenericOptionsPage::setOrientation(AbstractMobileApp::ScreenOrientation orientation)
 {
     QComboBox *const comboBox = m_d->ui.orientationBehaviorComboBox;
     for (int i = 0; i < comboBox->count(); ++i)
@@ -82,88 +90,118 @@ void MobileAppWizardOptionsPage::setOrientation(AbstractMobileApp::ScreenOrienta
         }
 }
 
-AbstractMobileApp::ScreenOrientation MobileAppWizardOptionsPage::orientation() const
+AbstractMobileApp::ScreenOrientation MobileAppWizardGenericOptionsPage::orientation() const
 {
     const int index = m_d->ui.orientationBehaviorComboBox->currentIndex();
     return static_cast<AbstractMobileApp::ScreenOrientation>(m_d->ui.orientationBehaviorComboBox->itemData(index).toInt());
 }
 
-QString MobileAppWizardOptionsPage::symbianSvgIcon() const
+
+MobileAppWizardSymbianOptionsPage::MobileAppWizardSymbianOptionsPage(QWidget *parent)
+    : QWizardPage(parent)
+    , m_d(new MobileAppWizardSymbianOptionsPagePrivate)
 {
-    return m_d->symbianSvgIcon;
+    m_d->ui.setupUi(this);
+    const QIcon open = QApplication::style()->standardIcon(QStyle::SP_DirOpenIcon);
+    m_d->ui.appIconLoadToolButton->setIcon(open);
+    connect(m_d->ui.appIconLoadToolButton, SIGNAL(clicked()), SLOT(openSvgIcon()));
 }
 
-void MobileAppWizardOptionsPage::setSymbianSvgIcon(const QString &icon)
+MobileAppWizardSymbianOptionsPage::~MobileAppWizardSymbianOptionsPage()
 {
-    QPixmap iconPixmap(icon);
-    if (!iconPixmap.isNull()) {
-        const int symbianIconSize = 44;
-        if (iconPixmap.height() > symbianIconSize || iconPixmap.width() > symbianIconSize)
-            iconPixmap = iconPixmap.scaledToHeight(symbianIconSize, Qt::SmoothTransformation);
-        m_d->ui.symbianAppIconPreview->setPixmap(iconPixmap);
-        m_d->symbianSvgIcon = icon;
-    }
+    delete m_d;
 }
 
-QString MobileAppWizardOptionsPage::maemoPngIcon() const
+QString MobileAppWizardSymbianOptionsPage::svgIcon() const
 {
-    return m_d->maemoPngIcon;
+    return m_d->svgIcon;
 }
 
-void MobileAppWizardOptionsPage::setMaemoPngIcon(const QString &icon)
+void MobileAppWizardSymbianOptionsPage::setSvgIcon(const QString &icon)
 {
-    QString error;
     QPixmap iconPixmap(icon);
-    if (iconPixmap.isNull())
-        error = tr("The file is not a valid image.");
-    else if (iconPixmap.size() != QSize(64, 64))
-        error = tr("The icon has an invalid size.");
-    if (!error.isEmpty()) {
-        QMessageBox::warning(this, tr("Icon unusable"), error);
-    } else {
-        m_d->ui.maemoPngIconButton->setIcon(iconPixmap);
-        m_d->maemoPngIcon = icon;
+    if (!iconPixmap.isNull()) {
+        const int symbianIconSize = 44;
+        if (iconPixmap.height() > symbianIconSize || iconPixmap.width() > symbianIconSize)
+            iconPixmap = iconPixmap.scaledToHeight(symbianIconSize, Qt::SmoothTransformation);
+        m_d->ui.appIconPreview->setPixmap(iconPixmap);
+        m_d->svgIcon = icon;
     }
 }
 
-QString MobileAppWizardOptionsPage::symbianUid() const
+QString MobileAppWizardSymbianOptionsPage::symbianUid() const
 {
-    return m_d->ui.symbianTargetUid3LineEdit->text();
+    return m_d->ui.uid3LineEdit->text();
 }
 
-void MobileAppWizardOptionsPage::setSymbianUid(const QString &uid)
+void MobileAppWizardSymbianOptionsPage::setSymbianUid(const QString &uid)
 {
-    m_d->ui.symbianTargetUid3LineEdit->setText(uid);
+    m_d->ui.uid3LineEdit->setText(uid);
 }
 
-void MobileAppWizardOptionsPage::setNetworkEnabled(bool enableIt)
+void MobileAppWizardSymbianOptionsPage::setNetworkEnabled(bool enableIt)
 {
-    m_d->ui.symbianEnableNetworkChackBox->setChecked(enableIt);
+    m_d->ui.enableNetworkCheckBox->setChecked(enableIt);
 }
 
-bool MobileAppWizardOptionsPage::networkEnabled() const
+bool MobileAppWizardSymbianOptionsPage::networkEnabled() const
 {
-    return m_d->ui.symbianEnableNetworkChackBox->isChecked();
+    return m_d->ui.enableNetworkCheckBox->isChecked();
 }
 
-void MobileAppWizardOptionsPage::openSymbianSvgIcon()
+void MobileAppWizardSymbianOptionsPage::openSvgIcon()
 {
     const QString svgIcon = QFileDialog::getOpenFileName(
             this,
-            m_d->ui.symbianAppIconLabel->text(),
+            m_d->ui.appIconLabel->text(),
             QDesktopServices::storageLocation(QDesktopServices::PicturesLocation),
             QLatin1String("*.svg"));
     if (!svgIcon.isEmpty())
-        setSymbianSvgIcon(svgIcon);
+        setSvgIcon(svgIcon);
+}
+
+
+MobileAppWizardMaemoOptionsPage::MobileAppWizardMaemoOptionsPage(QWidget *parent)
+    : QWizardPage(parent)
+    , m_d(new MobileAppWizardMaemoOptionsPagePrivate)
+{
+    m_d->ui.setupUi(this);
+    connect(m_d->ui.pngIconButton, SIGNAL(clicked()), this, SLOT(openPngIcon()));
+}
+
+MobileAppWizardMaemoOptionsPage::~MobileAppWizardMaemoOptionsPage()
+{
+    delete m_d;
+}
+
+QString MobileAppWizardMaemoOptionsPage::pngIcon() const
+{
+    return m_d->pngIcon;
+}
+
+void MobileAppWizardMaemoOptionsPage::setPngIcon(const QString &icon)
+{
+    QString error;
+    QPixmap iconPixmap(icon);
+    if (iconPixmap.isNull())
+        error = tr("The file is not a valid image.");
+    else if (iconPixmap.size() != QSize(64, 64))
+        error = tr("The icon has an invalid size.");
+    if (!error.isEmpty()) {
+        QMessageBox::warning(this, tr("Icon unusable"), error);
+    } else {
+        m_d->ui.pngIconButton->setIcon(iconPixmap);
+        m_d->pngIcon = icon;
+    }
 }
 
-void MobileAppWizardOptionsPage::openMaemoPngIcon()
+void MobileAppWizardMaemoOptionsPage::openPngIcon()
 {
     const QString iconPath = QFileDialog::getOpenFileName(this,
-        m_d->ui.maemoAppIconLabel->text(), m_d->maemoPngIcon,
+        m_d->ui.appIconLabel->text(), m_d->pngIcon,
         QLatin1String("*.png"));
     if (!iconPath.isEmpty())
-        setMaemoPngIcon(iconPath);
+        setPngIcon(iconPath);
 }
 
 } // namespace Internal
index 4b803b2..35d01dd 100644 (file)
 namespace Qt4ProjectManager {
 namespace Internal {
 
-class MobileAppWizardOptionsPage : public QWizardPage
+class MobileAppWizardGenericOptionsPage : public QWizardPage
 {
     Q_OBJECT
-    Q_DISABLE_COPY(MobileAppWizardOptionsPage)
+    Q_DISABLE_COPY(MobileAppWizardGenericOptionsPage)
 
 public:
-    explicit MobileAppWizardOptionsPage(QWidget *parent = 0);
-    virtual ~MobileAppWizardOptionsPage();
+    explicit MobileAppWizardGenericOptionsPage(QWidget *parent = 0);
+    virtual ~MobileAppWizardGenericOptionsPage();
 
     void setOrientation(AbstractMobileApp::ScreenOrientation orientation);
     AbstractMobileApp::ScreenOrientation orientation() const;
-    QString symbianSvgIcon() const;
-    void setSymbianSvgIcon(const QString &icon);
-    QString maemoPngIcon() const;
-    void setMaemoPngIcon(const QString &icon);
+
+private:
+    class MobileAppWizardGenericOptionsPagePrivate *m_d;
+};
+
+class MobileAppWizardSymbianOptionsPage : public QWizardPage
+{
+    Q_OBJECT
+    Q_DISABLE_COPY(MobileAppWizardSymbianOptionsPage)
+
+public:
+    explicit MobileAppWizardSymbianOptionsPage(QWidget *parent = 0);
+    virtual ~MobileAppWizardSymbianOptionsPage();
+
+    QString svgIcon() const;
+    void setSvgIcon(const QString &icon);
     QString symbianUid() const;
     void setNetworkEnabled(bool enableIt);
     bool networkEnabled() const;
     void setSymbianUid(const QString &uid);
 
 private slots:
-    void openSymbianSvgIcon(); // Via file open dialog
-    void openMaemoPngIcon();
+    void openSvgIcon(); // Via file open dialog
+
+private:
+    class MobileAppWizardSymbianOptionsPagePrivate *m_d;
+};
+
+class MobileAppWizardMaemoOptionsPage : public QWizardPage
+{
+    Q_OBJECT
+    Q_DISABLE_COPY(MobileAppWizardMaemoOptionsPage)
+
+public:
+    explicit MobileAppWizardMaemoOptionsPage(QWidget *parent = 0);
+    virtual ~MobileAppWizardMaemoOptionsPage();
+
+    QString pngIcon() const;
+    void setPngIcon(const QString &icon);
+
+private slots:
+    void openPngIcon();
 
 private:
-    class MobileAppWizardOptionsPagePrivate *m_d;
+    class MobileAppWizardMaemoOptionsPagePrivate *m_d;
 };
 
 } // end of namespace Internal
diff --git a/src/plugins/qt4projectmanager/wizards/mobileappwizardsymbianoptionspage.ui b/src/plugins/qt4projectmanager/wizards/mobileappwizardsymbianoptionspage.ui
new file mode 100644 (file)
index 0000000..48919f8
--- /dev/null
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MobileAppWizardSymbianOptionsPage</class>
+ <widget class="QWizardPage" name="MobileAppWizardSymbianOptionsPage">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>WizardPage</string>
+  </property>
+  <layout class="QFormLayout" name="formLayout">
+   <item row="0" column="0">
+    <widget class="QLabel" name="appIconLabel">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text">
+      <string>Application icon (.svg):</string>
+     </property>
+     <property name="buddy">
+      <cstring>appIconLoadToolButton</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="1">
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="QLabel" name="appIconPreview">
+       <property name="minimumSize">
+        <size>
+         <width>45</width>
+         <height>45</height>
+        </size>
+       </property>
+       <property name="maximumSize">
+        <size>
+         <width>45</width>
+         <height>45</height>
+        </size>
+       </property>
+       <property name="frameShape">
+        <enum>QFrame::Panel</enum>
+       </property>
+       <property name="frameShadow">
+        <enum>QFrame::Sunken</enum>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QToolButton" name="appIconLoadToolButton">
+       <property name="text">
+        <string/>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+   <item row="1" column="0">
+    <widget class="QLabel" name="symbianTargetUid3Label">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="text">
+      <string>Target UID3:</string>
+     </property>
+     <property name="buddy">
+      <cstring>uid3LineEdit</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
+     <item>
+      <widget class="QLineEdit" name="uid3LineEdit"/>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer_2">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+   <item row="2" column="0" colspan="2">
+    <widget class="QCheckBox" name="enableNetworkCheckBox">
+     <property name="text">
+      <string>Enable network access</string>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
index 87fac8e..e7c79f4 100644 (file)
@@ -67,10 +67,10 @@ QmlStandaloneAppWizardDialog::QmlStandaloneAppWizardDialog(QWidget *parent)
     setIntroDescription(tr("This wizard generates a Qt Quick application project."));
 
     m_qmlSourcesPage = new QmlStandaloneAppWizardSourcesPage;
-    const int qmlSourcesPagePageId = addPage(m_qmlSourcesPage);
-    wizardProgress()->item(qmlSourcesPagePageId)->setTitle(tr("QML Sources"));
+    addPageWithTitle(m_qmlSourcesPage, tr("QML Sources"));
 }
 
+
 class QmlStandaloneAppWizardPrivate
 {
     class QmlStandaloneApp *standaloneApp;