diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.pro b/src/plugins/qt4projectmanager/qt4projectmanager.pro index 564d471da7888064dd606a9ac9b959540a2e21b1..9e221211fdc7452795ee7e9948f780ed5f421f73 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanager.pro +++ b/src/plugins/qt4projectmanager/qt4projectmanager.pro @@ -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 diff --git a/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp b/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp index e7807197ce4ae1799b44cd5befe4d44669be68fb..4abd624927762a808c6774fd7fd030093bfcfa86 100644 --- a/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp @@ -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 ¶ms, 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)); diff --git a/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.h b/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.h index 965d3d6e9eccd9f10af35debc19a8a26ef3c22ca..b6aa8de4c290c69c1fcd7c6ff62fc1f55ce505f1 100644 --- a/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.h +++ b/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.h @@ -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 index 0000000000000000000000000000000000000000..337fdbc7d37163657f50fa31ae5c3d1d1cec520c --- /dev/null +++ b/src/plugins/qt4projectmanager/wizards/mobileappwizardgenericoptionspage.ui @@ -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 index 0000000000000000000000000000000000000000..20f1f979d215ace0f5416f8615cd46b031d6489b --- /dev/null +++ b/src/plugins/qt4projectmanager/wizards/mobileappwizardmaemooptionspage.ui @@ -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 index 95a6bc5f1cdb800498f7dc0bbd3c7e95ac47ab35..0000000000000000000000000000000000000000 --- a/src/plugins/qt4projectmanager/wizards/mobileappwizardoptionspage.ui +++ /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> diff --git a/src/plugins/qt4projectmanager/wizards/mobileappwizardpages.cpp b/src/plugins/qt4projectmanager/wizards/mobileappwizardpages.cpp index 01d64e17a6cb76c2bdc2b5727497753fa99ecff2..107b89132b57f0ad9318f62f49cb87bae53dfda1 100644 --- a/src/plugins/qt4projectmanager/wizards/mobileappwizardpages.cpp +++ b/src/plugins/qt4projectmanager/wizards/mobileappwizardpages.cpp @@ -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> @@ -39,26 +41,32 @@ 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 diff --git a/src/plugins/qt4projectmanager/wizards/mobileappwizardpages.h b/src/plugins/qt4projectmanager/wizards/mobileappwizardpages.h index 4b803b2f0fc1ee0cf035ef2e03701f15589506d7..35d01ddceb30f552d4e9e5fa002043ec53c4d310 100644 --- a/src/plugins/qt4projectmanager/wizards/mobileappwizardpages.h +++ b/src/plugins/qt4projectmanager/wizards/mobileappwizardpages.h @@ -37,32 +37,62 @@ 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 index 0000000000000000000000000000000000000000..48919f89d5632dd399bed15ced6519d3d3ff6772 --- /dev/null +++ b/src/plugins/qt4projectmanager/wizards/mobileappwizardsymbianoptionspage.ui @@ -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> diff --git a/src/plugins/qt4projectmanager/wizards/qmlstandaloneappwizard.cpp b/src/plugins/qt4projectmanager/wizards/qmlstandaloneappwizard.cpp index 87fac8e16129afd107b35525048cfe21cddc6031..e7c79f4d8bf8f9b686f7d9acef0186bbf9940d83 100644 --- a/src/plugins/qt4projectmanager/wizards/qmlstandaloneappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/qmlstandaloneappwizard.cpp @@ -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;