Add mobile Qt gui wizard

This commit is contained in:
Tobias Hunger
2010-03-30 15:55:45 +02:00
parent e68e3f168e
commit c30d18b51a
12 changed files with 156 additions and 11 deletions

View File

@@ -13,6 +13,7 @@ HEADERS += qt4projectmanagerplugin.h \
profilereader.h \ profilereader.h \
wizards/qtprojectparameters.h \ wizards/qtprojectparameters.h \
wizards/guiappwizard.h \ wizards/guiappwizard.h \
wizards/mobileguiappwizard.h \
wizards/consoleappwizard.h \ wizards/consoleappwizard.h \
wizards/consoleappwizarddialog.h \ wizards/consoleappwizarddialog.h \
wizards/libraryparameters.h \ wizards/libraryparameters.h \
@@ -54,6 +55,7 @@ SOURCES += qt4projectmanagerplugin.cpp \
profilereader.cpp \ profilereader.cpp \
wizards/qtprojectparameters.cpp \ wizards/qtprojectparameters.cpp \
wizards/guiappwizard.cpp \ wizards/guiappwizard.cpp \
wizards/mobileguiappwizard.cpp \
wizards/consoleappwizard.cpp \ wizards/consoleappwizard.cpp \
wizards/consoleappwizarddialog.cpp \ wizards/consoleappwizarddialog.cpp \
wizards/libraryparameters.cpp \ wizards/libraryparameters.cpp \

View File

@@ -34,6 +34,7 @@
#include "makestep.h" #include "makestep.h"
#include "wizards/consoleappwizard.h" #include "wizards/consoleappwizard.h"
#include "wizards/guiappwizard.h" #include "wizards/guiappwizard.h"
#include "wizards/mobileguiappwizard.h"
#include "wizards/librarywizard.h" #include "wizards/librarywizard.h"
#include "wizards/testwizard.h" #include "wizards/testwizard.h"
#include "wizards/emptyprojectwizard.h" #include "wizards/emptyprojectwizard.h"
@@ -129,6 +130,9 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
ConsoleAppWizard *consoleWizard = new ConsoleAppWizard; ConsoleAppWizard *consoleWizard = new ConsoleAppWizard;
addAutoReleasedObject(consoleWizard); addAutoReleasedObject(consoleWizard);
MobileGuiAppWizard *mobileGuiWizard = new MobileGuiAppWizard();
addAutoReleasedObject(mobileGuiWizard);
LibraryWizard *libWizard = new LibraryWizard; LibraryWizard *libWizard = new LibraryWizard;
addAutoReleasedObject(libWizard); addAutoReleasedObject(libWizard);
addAutoReleasedObject(new TestWizard); addAutoReleasedObject(new TestWizard);

View File

@@ -75,7 +75,22 @@ GuiAppWizard::GuiAppWizard()
QLatin1String(Constants::QT_APP_WIZARD_TR_CATEGORY), QLatin1String(Constants::QT_APP_WIZARD_TR_CATEGORY),
tr("Qt Gui Application"), tr("Qt Gui Application"),
tr("Creates a Qt Gui Application with one form."), tr("Creates a Qt Gui Application with one form."),
QIcon(QLatin1String(":/wizards/images/gui.png"))) QIcon(QLatin1String(":/wizards/images/gui.png"))),
m_createMobileProject(false)
{
}
GuiAppWizard::GuiAppWizard(const QString &id,
const QString &category,
const QString &categoryTranslationScope,
const QString &displayCategory,
const QString &name,
const QString &description,
const QIcon &icon,
bool createMobile)
: QtWizard(id, category, categoryTranslationScope,
displayCategory, name, description, icon),
m_createMobileProject(createMobile)
{ {
} }
@@ -85,6 +100,7 @@ QWizard *GuiAppWizard::createWizardDialog(QWidget *parent,
{ {
GuiAppWizardDialog *dialog = new GuiAppWizardDialog(displayName(), icon(), extensionPages, GuiAppWizardDialog *dialog = new GuiAppWizardDialog(displayName(), icon(), extensionPages,
showModulesPageForApplications(), showModulesPageForApplications(),
m_createMobileProject,
parent); parent);
dialog->setPath(defaultPath); dialog->setPath(defaultPath);
dialog->setProjectName(GuiAppWizardDialog::uniqueProjectName(defaultPath)); dialog->setProjectName(GuiAppWizardDialog::uniqueProjectName(defaultPath));

View File

@@ -46,6 +46,14 @@ public:
GuiAppWizard(); GuiAppWizard();
protected: protected:
GuiAppWizard(const QString &id,
const QString &category,
const QString &categoryTranslationScope,
const QString &displayCategory,
const QString &name,
const QString &description,
const QIcon &icon,
bool createMobile);
virtual QWizard *createWizardDialog(QWidget *parent, virtual QWizard *createWizardDialog(QWidget *parent,
const QString &defaultPath, const QString &defaultPath,
const WizardPageList &extensionPages) const; const WizardPageList &extensionPages) const;
@@ -57,6 +65,8 @@ private:
static bool parametrizeTemplate(const QString &templatePath, const QString &templateName, static bool parametrizeTemplate(const QString &templatePath, const QString &templateName,
const GuiAppParameters &params, const GuiAppParameters &params,
QString *target, QString *errorMessage); QString *target, QString *errorMessage);
bool m_createMobileProject;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -49,6 +49,7 @@ GuiAppWizardDialog::GuiAppWizardDialog(const QString &templateName,
const QIcon &icon, const QIcon &icon,
const QList<QWizardPage*> &extensionPages, const QList<QWizardPage*> &extensionPages,
bool showModulesPage, bool showModulesPage,
bool isMobile,
QWidget *parent) : QWidget *parent) :
BaseQt4ProjectWizardDialog(showModulesPage, parent), BaseQt4ProjectWizardDialog(showModulesPage, parent),
m_filesPage(new FilesPage) m_filesPage(new FilesPage)
@@ -62,7 +63,7 @@ GuiAppWizardDialog::GuiAppWizardDialog(const QString &templateName,
"and includes an empty widget.")); "and includes an empty widget."));
addModulesPage(); addModulesPage();
addTargetSetupPage(); addTargetSetupPage(QSet<QString>(), isMobile);
m_filesPage->setFormInputCheckable(true); m_filesPage->setFormInputCheckable(true);
m_filesPage->setClassTypeComboVisible(false); m_filesPage->setClassTypeComboVisible(false);

View File

@@ -62,6 +62,7 @@ public:
const QIcon &icon, const QIcon &icon,
const QList<QWizardPage*> &extensionPages, const QList<QWizardPage*> &extensionPages,
bool showModulesPage = false, bool showModulesPage = false,
bool mobile = false,
QWidget *parent = 0); QWidget *parent = 0);
void setBaseClasses(const QStringList &baseClasses); void setBaseClasses(const QStringList &baseClasses);

View File

@@ -0,0 +1,52 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#include "mobileguiappwizard.h"
#include "qt4projectmanagerconstants.h"
#include <QtGui/QIcon>
namespace Qt4ProjectManager {
namespace Internal {
MobileGuiAppWizard::MobileGuiAppWizard() :
GuiAppWizard(QLatin1String("C.Qt4GuiMobile"),
QLatin1String(Constants::QT_APP_WIZARD_CATEGORY),
QLatin1String(Constants::QT_APP_WIZARD_TR_SCOPE),
QLatin1String(Constants::QT_APP_WIZARD_TR_CATEGORY),
tr("Mobile Qt Application"),
tr("Creates a mobile Qt Gui Application with one form."),
QIcon(QLatin1String(":/projectexplorer/images/SymbianDevice.png")),
true)
{
}
} // namespace Internal
} // namespace Qt4ProjectManager

View File

@@ -0,0 +1,49 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef MOBILEGUIAPPWIZARD_H
#define MOBILEGUIAPPWIZARD_H
#include "guiappwizard.h"
namespace Qt4ProjectManager {
namespace Internal {
class MobileGuiAppWizard : public GuiAppWizard
{
Q_OBJECT
public:
MobileGuiAppWizard();
};
} // namespace Internal
} // namespace Qt4ProjectManager
#endif // GUIAPPWIZARD_H

View File

@@ -165,7 +165,7 @@ QWizard *CustomQt4ProjectWizard::createWizardDialog(QWidget *parent,
initProjectWizardDialog(wizard, defaultPath, extensionPages); initProjectWizardDialog(wizard, defaultPath, extensionPages);
if (wizard->pageIds().contains(targetPageId)) if (wizard->pageIds().contains(targetPageId))
qWarning("CustomQt4ProjectWizard: Unable to insert target page at %d", int(targetPageId)); qWarning("CustomQt4ProjectWizard: Unable to insert target page at %d", int(targetPageId));
wizard->addTargetSetupPage(QSet<QString>(), targetPageId); wizard->addTargetSetupPage(QSet<QString>(), false, targetPageId);
return wizard; return wizard;
} }
@@ -223,7 +223,7 @@ int BaseQt4ProjectWizardDialog::addModulesPage(int id)
return addPage(m_modulesPage); return addPage(m_modulesPage);
} }
int BaseQt4ProjectWizardDialog::addTargetSetupPage(QSet<QString> targets, int id) int BaseQt4ProjectWizardDialog::addTargetSetupPage(QSet<QString> targets, bool mobile, int id)
{ {
m_targetSetupPage = new TargetSetupPage; m_targetSetupPage = new TargetSetupPage;
QList<TargetSetupPage::ImportInfo> infos = TargetSetupPage::importInfosForKnownQtVersions(0); QList<TargetSetupPage::ImportInfo> infos = TargetSetupPage::importInfosForKnownQtVersions(0);
@@ -231,6 +231,7 @@ int BaseQt4ProjectWizardDialog::addTargetSetupPage(QSet<QString> targets, int id
infos = TargetSetupPage::filterImportInfos(targets, infos); infos = TargetSetupPage::filterImportInfos(targets, infos);
m_targetSetupPage->setImportDirectoryBrowsingEnabled(false); m_targetSetupPage->setImportDirectoryBrowsingEnabled(false);
m_targetSetupPage->setShowLocationInformation(false); m_targetSetupPage->setShowLocationInformation(false);
m_targetSetupPage->setPreferMobile(mobile);
if (infos.count() <= 1) if (infos.count() <= 1)
return -1; return -1;

View File

@@ -128,7 +128,7 @@ public:
virtual ~BaseQt4ProjectWizardDialog(); virtual ~BaseQt4ProjectWizardDialog();
int addModulesPage(int id = -1); int addModulesPage(int id = -1);
int addTargetSetupPage(QSet<QString> targets = QSet<QString>(), int id = -1); int addTargetSetupPage(QSet<QString> targets = QSet<QString>(), bool mobile = false, int id = -1);
static QSet<QString> desktopTarget(); static QSet<QString> desktopTarget();

View File

@@ -30,6 +30,7 @@
#include "targetsetuppage.h" #include "targetsetuppage.h"
#include "qt4project.h" #include "qt4project.h"
#include "qt4projectmanagerconstants.h"
#include "qt4target.h" #include "qt4target.h"
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
@@ -42,7 +43,8 @@
using namespace Qt4ProjectManager::Internal; using namespace Qt4ProjectManager::Internal;
TargetSetupPage::TargetSetupPage(QWidget *parent) : TargetSetupPage::TargetSetupPage(QWidget *parent) :
QWizardPage(parent) QWizardPage(parent),
m_preferMobile(false)
{ {
resize(500, 400); resize(500, 400);
setTitle(tr("Set up targets for your project")); setTitle(tr("Set up targets for your project"));
@@ -136,18 +138,18 @@ void TargetSetupPage::setImportInfos(const QList<ImportInfo> &infos)
versionItem->setData(0, Qt::UserRole, pos); versionItem->setData(0, Qt::UserRole, pos);
// Prefer imports to creating new builds, but precheck any // Prefer imports to creating new builds, but precheck any
// Qt that exists (if there is no import with that version) // Qt that exists (if there is no import with that version)
bool shouldCheck = true;
if (!i.isExistingBuild) { if (!i.isExistingBuild) {
bool haveExistingBuildForQtVersion = false;
foreach (const ImportInfo &j, m_infos) { foreach (const ImportInfo &j, m_infos) {
if (j.isExistingBuild && j.version == i.version) { if (j.isExistingBuild && j.version == i.version) {
haveExistingBuildForQtVersion = true; shouldCheck = false;
break; break;
} }
} }
versionItem->setCheckState(0, haveExistingBuildForQtVersion ? Qt::Unchecked : Qt::Checked);
} else {
versionItem->setCheckState(0, Qt::Checked);
} }
shouldCheck = shouldCheck && (m_preferMobile == i.version->supportsMobileTarget());
shouldCheck = shouldCheck || i.isExistingBuild; // always check imports
versionItem->setCheckState(0, shouldCheck ? Qt::Checked : Qt::Unchecked);
// Column 1 (status): // Column 1 (status):
versionItem->setText(1, i.isExistingBuild ? tr("Import", "Is this an import of an existing build or a new one?") : versionItem->setText(1, i.isExistingBuild ? tr("Import", "Is this an import of an existing build or a new one?") :
@@ -265,6 +267,11 @@ void TargetSetupPage::setShowLocationInformation(bool location)
m_treeWidget->setColumnCount(location ? 3 : 1); m_treeWidget->setColumnCount(location ? 3 : 1);
} }
void TargetSetupPage::setPreferMobile(bool mobile)
{
m_preferMobile = mobile;
}
QList<TargetSetupPage::ImportInfo> QList<TargetSetupPage::ImportInfo>
TargetSetupPage::importInfosForKnownQtVersions(Qt4ProjectManager::Qt4Project *project) TargetSetupPage::importInfosForKnownQtVersions(Qt4ProjectManager::Qt4Project *project)
{ {

View File

@@ -94,6 +94,7 @@ public:
void setImportDirectoryBrowsingEnabled(bool browsing); void setImportDirectoryBrowsingEnabled(bool browsing);
void setImportDirectoryBrowsingLocation(const QString &directory); void setImportDirectoryBrowsingLocation(const QString &directory);
void setShowLocationInformation(bool location); void setShowLocationInformation(bool location);
void setPreferMobile(bool mobile);
static QList<ImportInfo> importInfosForKnownQtVersions(Qt4ProjectManager::Qt4Project *project); static QList<ImportInfo> importInfosForKnownQtVersions(Qt4ProjectManager::Qt4Project *project);
static QList<ImportInfo> filterImportInfos(const QSet<QString> &validTargets, static QList<ImportInfo> filterImportInfos(const QSet<QString> &validTargets,
@@ -118,6 +119,7 @@ private:
QTreeWidget *m_treeWidget; QTreeWidget *m_treeWidget;
Utils::PathChooser *m_directoryChooser; Utils::PathChooser *m_directoryChooser;
QLabel *m_directoryLabel; QLabel *m_directoryLabel;
bool m_preferMobile;
}; };
} // namespace Internal } // namespace Internal