Commit d8496527 authored by con's avatar con

Start on a build step for creating symbian package.

parent 4df33ec2
......@@ -109,7 +109,7 @@ bool MakeStep::fromMap(const QVariantMap &map)
m_userArgs = map.value(QLatin1String(MAKE_ARGUMENTS_KEY)).toStringList();
m_clean = map.value(QLatin1String(CLEAN_KEY)).toBool();
return BuildStep::fromMap(map);
return ProjectExplorer::AbstractProcessStep::fromMap(map);
}
bool MakeStep::init()
......
......@@ -34,6 +34,7 @@
#include "qt4target.h"
#include "makestep.h"
#include "qt4buildconfiguration.h"
#include "qt4projectmanagerconstants.h"
#include "wizards/targetspage.h"
......@@ -139,7 +140,6 @@ void ProjectLoadWizard::done(int result)
}
if (m_project->targets().isEmpty())
qWarning() << "Failed to populate project with default targets for imported Qt" << m_importVersion->displayName();
return;
}
......@@ -160,7 +160,7 @@ void ProjectLoadWizard::done(int result)
foreach (QtVersion *v, candidates) {
if (v->isValid())
defaultVersion = v;
if (v->supportsTargetId(DESKTOP_TARGET_ID) && v->isValid())
if (v->supportsTargetId(Constants::DESKTOP_TARGET_ID) && v->isValid())
break;
}
......
......@@ -37,6 +37,7 @@
#include "maemomanager.h"
#include "maemorunconfiguration.h"
#include "maemoruncontrol.h"
#include "qt4projectmanagerconstants.h"
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
......@@ -81,7 +82,7 @@ bool MaemoRunConfigurationFactory::canCreate(Target *parent,
{
Qt4Target *target = qobject_cast<Qt4Target *>(parent);
if (!target
|| target->id() != QLatin1String(MAEMO_DEVICE_TARGET_ID)) {
|| target->id() != QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID)) {
return false;
}
return id == MAEMO_RC_ID || id.startsWith(MAEMO_RC_ID_PREFIX);
......@@ -102,7 +103,7 @@ bool MaemoRunConfigurationFactory::canClone(Target *parent,
QStringList MaemoRunConfigurationFactory::availableCreationIds(Target *parent) const
{
if (Qt4Target *t = qobject_cast<Qt4Target *>(parent)) {
if (t->id() == QLatin1String(MAEMO_DEVICE_TARGET_ID)) {
if (t->id() == QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID)) {
return t->qt4Project()->
applicationProFilePathes(QLatin1String(MAEMO_RC_ID_PREFIX));
}
......@@ -181,12 +182,12 @@ void MaemoRunConfigurationFactory::projectRemoved(ProjectExplorer::Project *proj
void MaemoRunConfigurationFactory::projectChanged(ProjectExplorer::Project *project)
{
if (project)
updateMaemoEmulatorStarter(project->target(QLatin1String(MAEMO_DEVICE_TARGET_ID)));
updateMaemoEmulatorStarter(project->target(QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID)));
}
void MaemoRunConfigurationFactory::targetAdded(ProjectExplorer::Target *target)
{
if (!target || target->id() != QLatin1String(MAEMO_DEVICE_TARGET_ID))
if (!target || target->id() != QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID))
return;
MaemoManager::instance().addQemuSimulatorStarter(target->project());
......@@ -201,7 +202,7 @@ void MaemoRunConfigurationFactory::targetAdded(ProjectExplorer::Target *target)
void MaemoRunConfigurationFactory::targetRemoved(ProjectExplorer::Target *target)
{
if (!target || target->id() != QLatin1String(MAEMO_DEVICE_TARGET_ID))
if (!target || target->id() != QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID))
return;
MaemoManager::instance().removeQemuSimulatorStarter(target->project());
......
......@@ -14,7 +14,8 @@ SOURCES += $$PWD/s60devices.cpp \
$$PWD/s60runconfigbluetoothstarter.cpp \
$$PWD/abldparser.cpp \
$$PWD/rvctparser.cpp \
$$PWD/winscwparser.cpp
$$PWD/winscwparser.cpp \
qt-s60/s60createpackagestep.cpp
HEADERS += $$PWD/s60devices.h \
$$PWD/s60devicespreferencepane.h \
$$PWD/s60manager.h \
......@@ -27,6 +28,7 @@ HEADERS += $$PWD/s60devices.h \
$$PWD/s60runconfigbluetoothstarter.h \
$$PWD/abldparser.h \
$$PWD/rvctparser.h \
$$PWD/winscwparser.h
FORMS += $$PWD/s60devicespreferencepane.ui
$$PWD/winscwparser.h \
qt-s60/s60createpackagestep.h
FORMS += $$PWD/s60devicespreferencepane.ui \
qt-s60/s60createpackagestep.ui
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 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 "s60createpackagestep.h"
#include "qt4projectmanagerconstants.h"
#include "qt4buildconfiguration.h"
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/target.h>
using namespace Qt4ProjectManager::Internal;
namespace {
const char * const SIGN_BS_ID = "Qt4ProjectManager.S60SignBuildStep";
const char * const SIGNMODE_KEY("Qt4ProjectManager.S60CreatePackageStep.SignMode");
const char * const CERTIFICATE_KEY("Qt4ProjectManager.S60CreatePackageStep.Certificate");
const char * const KEYFILE_KEY("Qt4ProjectManager.S60CreatePackageStep.Keyfile");
}
// #pragma mark -- S60SignBuildStep
S60CreatePackageStep::S60CreatePackageStep(ProjectExplorer::BuildConfiguration *bc) :
MakeStep(bc, QLatin1String(SIGN_BS_ID)),
m_signingMode(SignSelf)
{
ctor_package();
}
S60CreatePackageStep::S60CreatePackageStep(ProjectExplorer::BuildConfiguration *bc, S60CreatePackageStep *bs) :
MakeStep(bc, bs),
m_signingMode(bs->m_signingMode),
m_customSignaturePath(bs->m_customSignaturePath),
m_customKeyPath(bs->m_customKeyPath)
{
ctor_package();
}
S60CreatePackageStep::S60CreatePackageStep(ProjectExplorer::BuildConfiguration *bc, const QString &id) :
MakeStep(bc, id),
m_signingMode(SignSelf)
{
ctor_package();
}
void S60CreatePackageStep::ctor_package()
{
setDisplayName(tr("Create sis Package", "Create sis package build step name"));
}
S60CreatePackageStep::~S60CreatePackageStep()
{
}
QVariantMap S60CreatePackageStep::toMap() const
{
QVariantMap map(MakeStep::toMap());
map.insert(QLatin1String(SIGNMODE_KEY), (int)m_signingMode);
map.insert(QLatin1String(CERTIFICATE_KEY), m_customSignaturePath);
map.insert(QLatin1String(KEYFILE_KEY), m_customKeyPath);
return map;
}
bool S60CreatePackageStep::fromMap(const QVariantMap &map)
{
m_signingMode = (SigningMode)map.value(QLatin1String(SIGNMODE_KEY)).toInt();
m_customSignaturePath = map.value(QLatin1String(CERTIFICATE_KEY)).toString();
m_customKeyPath = map.value(QLatin1String(KEYFILE_KEY)).toString();
return MakeStep::fromMap(map);
}
bool S60CreatePackageStep::init()
{
if (!MakeStep::init())
return false;
Qt4BuildConfiguration *bc = qt4BuildConfiguration();
ProjectExplorer::Environment environment = bc->environment();
if (signingMode() == SignCustom) {
environment.set(QLatin1String("QT_SIS_CERTIFICATE"), QDir::toNativeSeparators(customSignaturePath()));
environment.set(QLatin1String("QT_SIS_KEY"), QDir::toNativeSeparators(customKeyPath()));
}
setEnvironment(environment);
setArguments(QStringList() << "sis"); // overwrite any stuff done in make step
return true;
}
bool S60CreatePackageStep::immutable() const
{
return false;
}
ProjectExplorer::BuildStepConfigWidget *S60CreatePackageStep::createConfigWidget()
{
return new S60CreatePackageStepConfigWidget(this);
}
S60CreatePackageStep::SigningMode S60CreatePackageStep::signingMode() const
{
return m_signingMode;
}
void S60CreatePackageStep::setSigningMode(SigningMode mode)
{
m_signingMode = mode;
}
QString S60CreatePackageStep::customSignaturePath() const
{
return m_customSignaturePath;
}
void S60CreatePackageStep::setCustomSignaturePath(const QString &path)
{
m_customSignaturePath = path;
}
QString S60CreatePackageStep::customKeyPath() const
{
return m_customKeyPath;
}
void S60CreatePackageStep::setCustomKeyPath(const QString &path)
{
m_customKeyPath = path;
}
// #pragma mark -- S60SignBuildStepFactory
S60CreatePackageStepFactory::S60CreatePackageStepFactory(QObject *parent) :
ProjectExplorer::IBuildStepFactory(parent)
{
}
S60CreatePackageStepFactory::~S60CreatePackageStepFactory()
{
}
bool S60CreatePackageStepFactory::canCreate(ProjectExplorer::BuildConfiguration *parent, ProjectExplorer::StepType type, const QString &id) const
{
if (type != ProjectExplorer::Build)
return false;
if (parent->target()->id() != Constants::S60_DEVICE_TARGET_ID)
return false;
return (id == QLatin1String(SIGN_BS_ID));
}
ProjectExplorer::BuildStep *S60CreatePackageStepFactory::create(ProjectExplorer::BuildConfiguration *parent, ProjectExplorer::StepType type, const QString &id)
{
if (!canCreate(parent, type, id))
return 0;
return new S60CreatePackageStep(parent);
}
bool S60CreatePackageStepFactory::canClone(ProjectExplorer::BuildConfiguration *parent, ProjectExplorer::StepType type, ProjectExplorer::BuildStep *source) const
{
return canCreate(parent, type, source->id());
}
ProjectExplorer::BuildStep *S60CreatePackageStepFactory::clone(ProjectExplorer::BuildConfiguration *parent, ProjectExplorer::StepType type, ProjectExplorer::BuildStep *source)
{
if (!canClone(parent, type, source))
return 0;
return new S60CreatePackageStep(parent, static_cast<S60CreatePackageStep *>(source));
}
bool S60CreatePackageStepFactory::canRestore(ProjectExplorer::BuildConfiguration *parent, ProjectExplorer::StepType type, const QVariantMap &map) const
{
QString id(ProjectExplorer::idFromMap(map));
return canCreate(parent, type, id);
}
ProjectExplorer::BuildStep *S60CreatePackageStepFactory::restore(ProjectExplorer::BuildConfiguration *parent, ProjectExplorer::StepType type, const QVariantMap &map)
{
if (!canRestore(parent, type, map))
return 0;
S60CreatePackageStep *bs(new S60CreatePackageStep(parent));
if (bs->fromMap(map))
return bs;
delete bs;
return 0;
}
QStringList S60CreatePackageStepFactory::availableCreationIds(ProjectExplorer::BuildConfiguration *parent, ProjectExplorer::StepType type) const
{
if (type != ProjectExplorer::Build)
return QStringList();
if (parent->target()->id() == Constants::S60_DEVICE_TARGET_ID)
return QStringList() << QLatin1String(SIGN_BS_ID);
return QStringList();
}
QString S60CreatePackageStepFactory::displayNameForId(const QString &id) const
{
if (id == QLatin1String(SIGN_BS_ID))
return tr("Create sis Package");
return QString();
}
// #pragma mark -- S60SignBuildStepConfigWidget
S60CreatePackageStepConfigWidget::S60CreatePackageStepConfigWidget(S60CreatePackageStep *signStep)
: BuildStepConfigWidget(), m_signStep(signStep)
{
m_ui.setupUi(this);
updateUi();
connect(m_ui.customCertificateButton, SIGNAL(clicked()),
this, SLOT(updateFromUi()));
connect(m_ui.selfSignedButton, SIGNAL(clicked()),
this, SLOT(updateFromUi()));
connect(m_ui.signaturePath, SIGNAL(changed(QString)),
this, SLOT(updateFromUi()));
connect(m_ui.keyFilePath, SIGNAL(changed(QString)),
this, SLOT(updateFromUi()));
}
void S60CreatePackageStepConfigWidget::updateUi()
{
bool selfSigned = m_signStep->signingMode() == S60CreatePackageStep::SignSelf;
m_ui.selfSignedButton->setChecked(selfSigned);
m_ui.customCertificateButton->setChecked(!selfSigned);
m_ui.signaturePath->setEnabled(!selfSigned);
m_ui.keyFilePath->setEnabled(!selfSigned);
m_ui.signaturePath->setPath(m_signStep->customSignaturePath());
m_ui.keyFilePath->setPath(m_signStep->customKeyPath());
emit updateSummary();
}
void S60CreatePackageStepConfigWidget::updateFromUi()
{
bool selfSigned = m_ui.selfSignedButton->isChecked();
m_signStep->setSigningMode(selfSigned ? S60CreatePackageStep::SignSelf
: S60CreatePackageStep::SignCustom);
m_signStep->setCustomSignaturePath(m_ui.signaturePath->path());
m_signStep->setCustomKeyPath(m_ui.keyFilePath->path());
updateUi();
}
QString S60CreatePackageStepConfigWidget::summaryText() const
{
QString text;
if (m_signStep->signingMode() == S60CreatePackageStep::SignSelf) {
text = tr("self-signed");
} else {
text = tr("signed with certificate %1 and key file %2")
.arg(m_signStep->customSignaturePath())
.arg(m_signStep->customKeyPath());
}
return tr("<b>Create sis Package:</b> %1").arg(text);
}
QString S60CreatePackageStepConfigWidget::displayName() const
{
return m_signStep->displayName();
}
void S60CreatePackageStepConfigWidget::init()
{
}
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 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 S60CREATEPACKAGESTEP_H
#define S60CREATEPACKAGESTEP_H
#include "ui_s60createpackagestep.h"
#include <projectexplorer/buildstep.h>
#include <qt4projectmanager/makestep.h>
namespace Qt4ProjectManager {
namespace Internal {
class S60CreatePackageStepFactory : public ProjectExplorer::IBuildStepFactory
{
Q_OBJECT
public:
explicit S60CreatePackageStepFactory(QObject *parent = 0);
~S60CreatePackageStepFactory();
// used to show the list of possible additons to a target, returns a list of types
QStringList availableCreationIds(ProjectExplorer::BuildConfiguration *parent, ProjectExplorer::StepType type) const;
// used to translate the types to names to display to the user
QString displayNameForId(const QString &id) const;
bool canCreate(ProjectExplorer::BuildConfiguration *parent, ProjectExplorer::StepType type, const QString &id) const;
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildConfiguration *parent, ProjectExplorer::StepType type, const QString &id);
// used to recreate the runConfigurations when restoring settings
bool canRestore(ProjectExplorer::BuildConfiguration *parent, ProjectExplorer::StepType type, const QVariantMap &map) const;
ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildConfiguration *parent, ProjectExplorer::StepType type, const QVariantMap &map);
bool canClone(ProjectExplorer::BuildConfiguration *parent, ProjectExplorer::StepType type, ProjectExplorer::BuildStep *product) const;
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildConfiguration *parent, ProjectExplorer::StepType type, ProjectExplorer::BuildStep *product);
};
class S60CreatePackageStep : public MakeStep {
Q_OBJECT
friend class S60CreatePackageStepFactory;
public:
enum SigningMode {
SignSelf,
SignCustom
};
explicit S60CreatePackageStep(ProjectExplorer::BuildConfiguration *bc);
virtual ~S60CreatePackageStep();
virtual bool init();
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
virtual bool immutable() const;
QVariantMap toMap() const;
SigningMode signingMode() const;
void setSigningMode(SigningMode mode);
QString customSignaturePath() const;
void setCustomSignaturePath(const QString &path);
QString customKeyPath() const;
void setCustomKeyPath(const QString &path);
protected:
S60CreatePackageStep(ProjectExplorer::BuildConfiguration *bc, S60CreatePackageStep *bs);
S60CreatePackageStep(ProjectExplorer::BuildConfiguration *bc, const QString &id);
bool fromMap(const QVariantMap &map);
private:
void ctor_package();
SigningMode m_signingMode;
QString m_customSignaturePath;
QString m_customKeyPath;
};
class S60CreatePackageStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
{
Q_OBJECT
public:
S60CreatePackageStepConfigWidget(S60CreatePackageStep *signStep);
QString displayName() const;
void init();
QString summaryText() const;
private slots:
void updateUi();
void updateFromUi();
private:
S60CreatePackageStep *m_signStep;
Ui::S60CreatePackageStepWidget m_ui;
};
} // Internal
} // Qt4ProjectManager
#endif // S60CREATEPACKAGESTEP_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Qt4ProjectManager::Internal::S60CreatePackageStepWidget</class>
<widget class="QWidget" name="Qt4ProjectManager::Internal::S60CreatePackageStepWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>517</width>
<height>95</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QRadioButton" name="selfSignedButton">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="selfSignedLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Self-signed certificate</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QRadioButton" name="customCertificateButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1" rowspan="2">
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="customLabel">
<property name="text">
<string>Custom certificate:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Utils::PathChooser" name="signaturePath" native="true">
<property name="promptDialogTitle" stdset="0">
<string>Choose certificate file (.cer)</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">