forked from qt-creator/qt-creator
Add mobile Qt gui wizard
This commit is contained in:
@@ -13,6 +13,7 @@ HEADERS += qt4projectmanagerplugin.h \
|
||||
profilereader.h \
|
||||
wizards/qtprojectparameters.h \
|
||||
wizards/guiappwizard.h \
|
||||
wizards/mobileguiappwizard.h \
|
||||
wizards/consoleappwizard.h \
|
||||
wizards/consoleappwizarddialog.h \
|
||||
wizards/libraryparameters.h \
|
||||
@@ -54,6 +55,7 @@ SOURCES += qt4projectmanagerplugin.cpp \
|
||||
profilereader.cpp \
|
||||
wizards/qtprojectparameters.cpp \
|
||||
wizards/guiappwizard.cpp \
|
||||
wizards/mobileguiappwizard.cpp \
|
||||
wizards/consoleappwizard.cpp \
|
||||
wizards/consoleappwizarddialog.cpp \
|
||||
wizards/libraryparameters.cpp \
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "makestep.h"
|
||||
#include "wizards/consoleappwizard.h"
|
||||
#include "wizards/guiappwizard.h"
|
||||
#include "wizards/mobileguiappwizard.h"
|
||||
#include "wizards/librarywizard.h"
|
||||
#include "wizards/testwizard.h"
|
||||
#include "wizards/emptyprojectwizard.h"
|
||||
@@ -129,6 +130,9 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
|
||||
ConsoleAppWizard *consoleWizard = new ConsoleAppWizard;
|
||||
addAutoReleasedObject(consoleWizard);
|
||||
|
||||
MobileGuiAppWizard *mobileGuiWizard = new MobileGuiAppWizard();
|
||||
addAutoReleasedObject(mobileGuiWizard);
|
||||
|
||||
LibraryWizard *libWizard = new LibraryWizard;
|
||||
addAutoReleasedObject(libWizard);
|
||||
addAutoReleasedObject(new TestWizard);
|
||||
|
||||
@@ -75,7 +75,22 @@ GuiAppWizard::GuiAppWizard()
|
||||
QLatin1String(Constants::QT_APP_WIZARD_TR_CATEGORY),
|
||||
tr("Qt Gui Application"),
|
||||
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,
|
||||
showModulesPageForApplications(),
|
||||
m_createMobileProject,
|
||||
parent);
|
||||
dialog->setPath(defaultPath);
|
||||
dialog->setProjectName(GuiAppWizardDialog::uniqueProjectName(defaultPath));
|
||||
|
||||
@@ -46,6 +46,14 @@ public:
|
||||
GuiAppWizard();
|
||||
|
||||
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,
|
||||
const QString &defaultPath,
|
||||
const WizardPageList &extensionPages) const;
|
||||
@@ -57,6 +65,8 @@ private:
|
||||
static bool parametrizeTemplate(const QString &templatePath, const QString &templateName,
|
||||
const GuiAppParameters ¶ms,
|
||||
QString *target, QString *errorMessage);
|
||||
|
||||
bool m_createMobileProject;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -49,6 +49,7 @@ GuiAppWizardDialog::GuiAppWizardDialog(const QString &templateName,
|
||||
const QIcon &icon,
|
||||
const QList<QWizardPage*> &extensionPages,
|
||||
bool showModulesPage,
|
||||
bool isMobile,
|
||||
QWidget *parent) :
|
||||
BaseQt4ProjectWizardDialog(showModulesPage, parent),
|
||||
m_filesPage(new FilesPage)
|
||||
@@ -62,7 +63,7 @@ GuiAppWizardDialog::GuiAppWizardDialog(const QString &templateName,
|
||||
"and includes an empty widget."));
|
||||
|
||||
addModulesPage();
|
||||
addTargetSetupPage();
|
||||
addTargetSetupPage(QSet<QString>(), isMobile);
|
||||
|
||||
m_filesPage->setFormInputCheckable(true);
|
||||
m_filesPage->setClassTypeComboVisible(false);
|
||||
|
||||
@@ -62,6 +62,7 @@ public:
|
||||
const QIcon &icon,
|
||||
const QList<QWizardPage*> &extensionPages,
|
||||
bool showModulesPage = false,
|
||||
bool mobile = false,
|
||||
QWidget *parent = 0);
|
||||
|
||||
void setBaseClasses(const QStringList &baseClasses);
|
||||
|
||||
52
src/plugins/qt4projectmanager/wizards/mobileguiappwizard.cpp
Normal file
52
src/plugins/qt4projectmanager/wizards/mobileguiappwizard.cpp
Normal 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
|
||||
49
src/plugins/qt4projectmanager/wizards/mobileguiappwizard.h
Normal file
49
src/plugins/qt4projectmanager/wizards/mobileguiappwizard.h
Normal 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
|
||||
@@ -165,7 +165,7 @@ QWizard *CustomQt4ProjectWizard::createWizardDialog(QWidget *parent,
|
||||
initProjectWizardDialog(wizard, defaultPath, extensionPages);
|
||||
if (wizard->pageIds().contains(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;
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ int BaseQt4ProjectWizardDialog::addModulesPage(int id)
|
||||
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;
|
||||
QList<TargetSetupPage::ImportInfo> infos = TargetSetupPage::importInfosForKnownQtVersions(0);
|
||||
@@ -231,6 +231,7 @@ int BaseQt4ProjectWizardDialog::addTargetSetupPage(QSet<QString> targets, int id
|
||||
infos = TargetSetupPage::filterImportInfos(targets, infos);
|
||||
m_targetSetupPage->setImportDirectoryBrowsingEnabled(false);
|
||||
m_targetSetupPage->setShowLocationInformation(false);
|
||||
m_targetSetupPage->setPreferMobile(mobile);
|
||||
|
||||
if (infos.count() <= 1)
|
||||
return -1;
|
||||
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
virtual ~BaseQt4ProjectWizardDialog();
|
||||
|
||||
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();
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "targetsetuppage.h"
|
||||
|
||||
#include "qt4project.h"
|
||||
#include "qt4projectmanagerconstants.h"
|
||||
#include "qt4target.h"
|
||||
|
||||
#include <utils/pathchooser.h>
|
||||
@@ -42,7 +43,8 @@
|
||||
using namespace Qt4ProjectManager::Internal;
|
||||
|
||||
TargetSetupPage::TargetSetupPage(QWidget *parent) :
|
||||
QWizardPage(parent)
|
||||
QWizardPage(parent),
|
||||
m_preferMobile(false)
|
||||
{
|
||||
resize(500, 400);
|
||||
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);
|
||||
// Prefer imports to creating new builds, but precheck any
|
||||
// Qt that exists (if there is no import with that version)
|
||||
bool shouldCheck = true;
|
||||
if (!i.isExistingBuild) {
|
||||
bool haveExistingBuildForQtVersion = false;
|
||||
foreach (const ImportInfo &j, m_infos) {
|
||||
if (j.isExistingBuild && j.version == i.version) {
|
||||
haveExistingBuildForQtVersion = true;
|
||||
shouldCheck = false;
|
||||
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):
|
||||
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);
|
||||
}
|
||||
|
||||
void TargetSetupPage::setPreferMobile(bool mobile)
|
||||
{
|
||||
m_preferMobile = mobile;
|
||||
}
|
||||
|
||||
QList<TargetSetupPage::ImportInfo>
|
||||
TargetSetupPage::importInfosForKnownQtVersions(Qt4ProjectManager::Qt4Project *project)
|
||||
{
|
||||
|
||||
@@ -94,6 +94,7 @@ public:
|
||||
void setImportDirectoryBrowsingEnabled(bool browsing);
|
||||
void setImportDirectoryBrowsingLocation(const QString &directory);
|
||||
void setShowLocationInformation(bool location);
|
||||
void setPreferMobile(bool mobile);
|
||||
|
||||
static QList<ImportInfo> importInfosForKnownQtVersions(Qt4ProjectManager::Qt4Project *project);
|
||||
static QList<ImportInfo> filterImportInfos(const QSet<QString> &validTargets,
|
||||
@@ -118,6 +119,7 @@ private:
|
||||
QTreeWidget *m_treeWidget;
|
||||
Utils::PathChooser *m_directoryChooser;
|
||||
QLabel *m_directoryLabel;
|
||||
bool m_preferMobile;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user