Commit 07187e0a authored by con's avatar con
Browse files

Custom signature support.

Not able to give it an additional passphrase yet, though.
parent d0c21f9d
......@@ -106,7 +106,7 @@ PathChooser::PathChooser(QWidget *parent) :
m_d->m_hLayout->setContentsMargins(0, 0, 0, 0);
connect(m_d->m_lineEdit, SIGNAL(validReturnPressed()), this, SIGNAL(returnPressed()));
connect(m_d->m_lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
connect(m_d->m_lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(changed(QString)));
connect(m_d->m_lineEdit, SIGNAL(validChanged()), this, SIGNAL(validChanged()));
connect(m_d->m_lineEdit, SIGNAL(editingFinished()), this, SIGNAL(editingFinished()));
......
......@@ -90,7 +90,7 @@ private:
signals:
void validChanged();
void changed();
void changed(const QString &text);
void editingFinished();
void beforeBrowsing();
void browsingFinished();
......
......@@ -65,7 +65,7 @@ ProjectIntroPage::ProjectIntroPage(QWidget *parent) :
hideStatusLabel();
m_d->m_ui.nameLineEdit->setInitialText(tr("<Enter_Name>"));
m_d->m_ui.nameLineEdit->setFocus(Qt::TabFocusReason);
connect(m_d->m_ui.pathChooser, SIGNAL(changed()), this, SLOT(slotChanged()));
connect(m_d->m_ui.pathChooser, SIGNAL(changed(QString)), this, SLOT(slotChanged()));
connect(m_d->m_ui.nameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotChanged()));
connect(m_d->m_ui.pathChooser, SIGNAL(returnPressed()), this, SLOT(slotActivated()));
connect(m_d->m_ui.nameLineEdit, SIGNAL(validReturnPressed()), this, SLOT(slotActivated()));
......
......@@ -237,7 +237,7 @@ ShadowBuildPage::ShadowBuildPage(CMakeOpenProjectWizard *cmakeWizard, bool chang
fl->addWidget(label);
m_pc = new Core::Utils::PathChooser(this);
m_pc->setPath(m_cmakeWizard->buildDirectory());
connect(m_pc, SIGNAL(changed()), this, SLOT(buildDirectoryChanged()));
connect(m_pc, SIGNAL(changed(QString)), this, SLOT(buildDirectoryChanged()));
fl->addRow(tr("Build directory:"), m_pc);
}
......
......@@ -267,7 +267,7 @@ CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration *
boxLayout->addWidget(m_systemEnvironmentRadioButton);
boxLayout->addWidget(m_buildEnvironmentRadioButton);
connect(m_workingDirectoryEdit, SIGNAL(changed()),
connect(m_workingDirectoryEdit, SIGNAL(changed(QString)),
this, SLOT(setWorkingDirectory()));
connect(resetButton, SIGNAL(clicked()),
......
......@@ -486,7 +486,7 @@ GenericBuildSettingsWidget::GenericBuildSettingsWidget(GenericProject *project)
m_pathChooser = new Core::Utils::PathChooser(this);
m_pathChooser->setEnabled(true);
fl->addRow(tr("Build directory:"), m_pathChooser);
connect(m_pathChooser, SIGNAL(changed()), this, SLOT(buildDirectoryChanged()));
connect(m_pathChooser, SIGNAL(changed(QString)), this, SLOT(buildDirectoryChanged()));
// tool chain
QComboBox *toolChainChooser = new QComboBox;
......
......@@ -130,11 +130,11 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
connect(m_userName, SIGNAL(textEdited(QString)),
this, SLOT(setUserName(QString)));
connect(m_executableChooser, SIGNAL(changed()),
connect(m_executableChooser, SIGNAL(changed(QString)),
this, SLOT(setExecutable()));
connect(m_commandLineArgumentsLineEdit, SIGNAL(textEdited(const QString&)),
this, SLOT(setCommandLineArguments(const QString&)));
connect(m_workingDirectory, SIGNAL(changed()),
connect(m_workingDirectory, SIGNAL(changed(QString)),
this, SLOT(setWorkingDirectory()));
connect(m_useTerminalCheck, SIGNAL(toggled(bool)),
this, SLOT(termToggled(bool)));
......
......@@ -133,9 +133,9 @@ ProcessStepConfigWidget::ProcessStepConfigWidget(ProcessStep *step)
{
m_ui.setupUi(this);
m_ui.command->setExpectedKind(Core::Utils::PathChooser::File);
connect(m_ui.command, SIGNAL(changed()),
connect(m_ui.command, SIGNAL(changed(QString)),
this, SLOT(commandLineEditTextEdited()));
connect(m_ui.workingDirectory, SIGNAL(changed()),
connect(m_ui.workingDirectory, SIGNAL(changed(QString)),
this, SLOT(workingDirectoryLineEditTextEdited()));
connect(m_ui.nameLineEdit, SIGNAL(textEdited(const QString&)),
......
......@@ -22,10 +22,11 @@
* missing signals qtVersionChanged + toolChainChanged
* handling of active run config getting disabled
* Run on device
* makesis, signsis and applicationinstaller don't report errors back
via exit code :-(
* Add compile output parser winscw at least!
* WINSCW tool chain:
* predefined macros
* Deploy gcce executables
......@@ -9,9 +9,12 @@
#include <coreplugin/icore.h>
#include <coreplugin/messagemanager.h>
#include <utils/qtcassert.h>
#include <utils/pathchooser.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/project.h>
#include <QtGui/QRadioButton>
using namespace ProjectExplorer;
using namespace Qt4ProjectManager::Internal;
......@@ -19,7 +22,8 @@ using namespace Qt4ProjectManager::Internal;
S60DeviceRunConfiguration::S60DeviceRunConfiguration(Project *project, const QString &proFilePath)
: RunConfiguration(project),
m_proFilePath(proFilePath),
m_cachedTargetInformationValid(false)
m_cachedTargetInformationValid(false),
m_signingMode(SignSelf)
{
if (!m_proFilePath.isEmpty())
setName(tr("%1 on Device").arg(QFileInfo(m_proFilePath).completeBaseName()));
......@@ -56,6 +60,9 @@ void S60DeviceRunConfiguration::save(PersistentSettingsWriter &writer) const
{
const QDir projectDir = QFileInfo(project()->file()->fileName()).absoluteDir();
writer.saveValue("ProFile", projectDir.relativeFilePath(m_proFilePath));
writer.saveValue("SigningMode", (int)m_signingMode);
writer.saveValue("CustomSignaturePath", m_customSignaturePath);
writer.saveValue("CustomKeyPath", m_customKeyPath);
RunConfiguration::save(writer);
}
......@@ -64,6 +71,9 @@ void S60DeviceRunConfiguration::restore(const PersistentSettingsReader &reader)
RunConfiguration::restore(reader);
const QDir projectDir = QFileInfo(project()->file()->fileName()).absoluteDir();
m_proFilePath = projectDir.filePath(reader.restoreValue("ProFile").toString());
m_signingMode = (SigningMode)reader.restoreValue("SigningMode").toInt();
m_customSignaturePath = reader.restoreValue("CustomSignaturePath").toString();
m_customKeyPath = reader.restoreValue("CustomKeyPath").toString();
}
QString S60DeviceRunConfiguration::basePackageFilePath() const
......@@ -72,6 +82,36 @@ QString S60DeviceRunConfiguration::basePackageFilePath() const
return m_baseFileName;
}
S60DeviceRunConfiguration::SigningMode S60DeviceRunConfiguration::signingMode() const
{
return m_signingMode;
}
void S60DeviceRunConfiguration::setSigningMode(SigningMode mode)
{
m_signingMode = mode;
}
QString S60DeviceRunConfiguration::customSignaturePath() const
{
return m_customSignaturePath;
}
void S60DeviceRunConfiguration::setCustomSignaturePath(const QString &path)
{
m_customSignaturePath = path;
}
QString S60DeviceRunConfiguration::customKeyPath() const
{
return m_customKeyPath;
}
void S60DeviceRunConfiguration::setCustomKeyPath(const QString &path)
{
m_customKeyPath = path;
}
void S60DeviceRunConfiguration::updateTarget()
{
if (m_cachedTargetInformationValid)
......@@ -157,22 +197,70 @@ S60DeviceRunConfigurationWidget::S60DeviceRunConfigurationWidget(S60DeviceRunCon
: QWidget(parent),
m_runConfiguration(runConfiguration)
{
QFormLayout *toplayout = new QFormLayout();
toplayout->setMargin(0);
setLayout(toplayout);
QVBoxLayout *mainBoxLayout = new QVBoxLayout();
mainBoxLayout->setMargin(0);
setLayout(mainBoxLayout);
QFormLayout *formLayout = new QFormLayout();
formLayout->setMargin(0);
mainBoxLayout->addLayout(formLayout);
QLabel *nameLabel = new QLabel(tr("Name:"));
m_nameLineEdit = new QLineEdit(m_runConfiguration->name());
nameLabel->setBuddy(m_nameLineEdit);
toplayout->addRow(nameLabel, m_nameLineEdit);
formLayout->addRow(nameLabel, m_nameLineEdit);
m_sisxFileLabel = new QLabel(m_runConfiguration->basePackageFilePath() + ".sisx");
toplayout->addRow(tr("Install File:"), m_sisxFileLabel);
formLayout->addRow(tr("Install File:"), m_sisxFileLabel);
QWidget *signatureWidget = new QWidget();
QVBoxLayout *layout = new QVBoxLayout();
signatureWidget->setLayout(layout);
mainBoxLayout->addWidget(signatureWidget);
QRadioButton *selfSign = new QRadioButton(tr("Self-sign"));
QHBoxLayout *customHBox = new QHBoxLayout();
customHBox->setMargin(0);
QVBoxLayout *radioLayout = new QVBoxLayout();
QRadioButton *customSignature = new QRadioButton();
radioLayout->addWidget(customSignature);
radioLayout->addStretch(10);
customHBox->addLayout(radioLayout);
QFormLayout *customLayout = new QFormLayout();
customLayout->setMargin(0);
customLayout->setLabelAlignment(Qt::AlignRight);
Core::Utils::PathChooser *signaturePath = new Core::Utils::PathChooser();
signaturePath->setExpectedKind(Core::Utils::PathChooser::File);
signaturePath->setPromptDialogTitle(tr("Choose certificate file (.cer)"));
customLayout->addRow(new QLabel(tr("Custom signature:")), signaturePath);
Core::Utils::PathChooser *keyPath = new Core::Utils::PathChooser();
keyPath->setExpectedKind(Core::Utils::PathChooser::File);
keyPath->setPromptDialogTitle(tr("Choose key file (.key / .pem)"));
customLayout->addRow(new QLabel(tr("Key file:")), keyPath);
customHBox->addLayout(customLayout);
customHBox->addStretch(10);
layout->addWidget(selfSign);
layout->addLayout(customHBox);
layout->addStretch(10);
switch (m_runConfiguration->signingMode()) {
case S60DeviceRunConfiguration::SignSelf:
selfSign->setChecked(true);
break;
case S60DeviceRunConfiguration::SignCustom:
customSignature->setChecked(true);
break;
}
signaturePath->setPath(m_runConfiguration->customSignaturePath());
keyPath->setPath(m_runConfiguration->customKeyPath());
connect(m_nameLineEdit, SIGNAL(textEdited(QString)),
this, SLOT(nameEdited(QString)));
connect(m_runConfiguration, SIGNAL(targetInformationChanged()),
this, SLOT(updateTargetInformation()));
connect(selfSign, SIGNAL(toggled(bool)), this, SLOT(selfSignToggled(bool)));
connect(customSignature, SIGNAL(toggled(bool)), this, SLOT(customSignatureToggled(bool)));
connect(signaturePath, SIGNAL(changed(QString)), this, SLOT(signaturePathChanged(QString)));
connect(keyPath, SIGNAL(changed(QString)), this, SLOT(keyPathChanged(QString)));
}
void S60DeviceRunConfigurationWidget::nameEdited(const QString &text)
......@@ -185,6 +273,28 @@ void S60DeviceRunConfigurationWidget::updateTargetInformation()
m_sisxFileLabel->setText(m_runConfiguration->basePackageFilePath() + ".sisx");
}
void S60DeviceRunConfigurationWidget::selfSignToggled(bool toggle)
{
if (toggle)
m_runConfiguration->setSigningMode(S60DeviceRunConfiguration::SignSelf);
}
void S60DeviceRunConfigurationWidget::customSignatureToggled(bool toggle)
{
if (toggle)
m_runConfiguration->setSigningMode(S60DeviceRunConfiguration::SignCustom);
}
void S60DeviceRunConfigurationWidget::signaturePathChanged(const QString &path)
{
m_runConfiguration->setCustomSignaturePath(path);
}
void S60DeviceRunConfigurationWidget::keyPathChanged(const QString &path)
{
m_runConfiguration->setCustomKeyPath(path);
}
// ======== S60DeviceRunConfigurationFactory
S60DeviceRunConfigurationFactory::S60DeviceRunConfigurationFactory(QObject *parent)
......@@ -298,11 +408,14 @@ void S60DeviceRunControl::start()
QSharedPointer<S60DeviceRunConfiguration> rc = runConfiguration().dynamicCast<S60DeviceRunConfiguration>();
Q_ASSERT(!rc.isNull());
Qt4Project *project = qobject_cast<Qt4Project *>(runConfiguration()->project());
Qt4Project *project = qobject_cast<Qt4Project *>(rc->project());
m_baseFileName = rc->basePackageFilePath();
m_workingDirectory = QFileInfo(m_baseFileName).absolutePath();
m_qtDir = project->qtVersion(project->activeBuildConfiguration())->path();
m_useCustomSignature = (rc->signingMode() == S60DeviceRunConfiguration::SignCustom);
m_customSignaturePath = rc->customSignaturePath();
m_customKeyPath = rc->customKeyPath();
emit started();
......@@ -362,10 +475,14 @@ void S60DeviceRunControl::makesisProcessFinished()
QString signsisTool = m_toolsDirectory + "/signsis.exe";
QString sisFile = QFileInfo(m_baseFileName + ".sis").fileName();
QString sisxFile = QFileInfo(m_baseFileName + ".sisx").fileName();
QString signature = (m_useCustomSignature ? m_customSignaturePath
: m_qtDir + "/selfsigned.cer");
QString key = (m_useCustomSignature ? m_customKeyPath
: m_qtDir + "/selfsigned.key");
QStringList arguments;
arguments << sisFile
<< sisxFile << QDir::toNativeSeparators(m_qtDir + "/selfsigned.cer")
<< QDir::toNativeSeparators(m_qtDir + "/selfsigned.key");
<< sisxFile << QDir::toNativeSeparators(signature)
<< QDir::toNativeSeparators(key);
m_signsis->setWorkingDirectory(m_workingDirectory);
emit addToOutputWindow(this, tr("%1 %2").arg(QDir::toNativeSeparators(signsisTool), arguments.join(tr(" "))));
m_signsis->start(signsisTool, arguments, QIODevice::ReadOnly);
......@@ -398,6 +515,9 @@ void S60DeviceRunControl::installProcessFailed()
void S60DeviceRunControl::installProcessFinished()
{
if (m_install->exitStatus() != 0) {
error(this, tr("An error occurred while creating the package."));
}
emit addToOutputWindow(this, tr("Finished."));
emit finished();
}
......
......@@ -15,6 +15,11 @@ class S60DeviceRunConfiguration : public ProjectExplorer::RunConfiguration
{
Q_OBJECT
public:
enum SigningMode {
SignSelf,
SignCustom
};
S60DeviceRunConfiguration(ProjectExplorer::Project *project, const QString &proFilePath);
~S60DeviceRunConfiguration();
......@@ -25,6 +30,12 @@ public:
void restore(const ProjectExplorer::PersistentSettingsReader &reader);
QString basePackageFilePath() const;
SigningMode signingMode() const;
void setSigningMode(SigningMode mode);
QString customSignaturePath() const;
void setCustomSignaturePath(const QString &path);
QString customKeyPath() const;
void setCustomKeyPath(const QString &path);
signals:
void targetInformationChanged();
......@@ -38,6 +49,9 @@ private:
QString m_proFilePath;
QString m_baseFileName;
bool m_cachedTargetInformationValid;
SigningMode m_signingMode;
QString m_customSignaturePath;
QString m_customKeyPath;
};
class S60DeviceRunConfigurationWidget : public QWidget
......@@ -50,6 +64,10 @@ public:
private slots:
void nameEdited(const QString &text);
void updateTargetInformation();
void selfSignToggled(bool toggle);
void customSignatureToggled(bool toggle);
void signaturePathChanged(const QString &path);
void keyPathChanged(const QString &path);
private:
S60DeviceRunConfiguration *m_runConfiguration;
......@@ -108,6 +126,9 @@ private:
QString m_workingDirectory;
QString m_toolsDirectory;
QString m_qtDir;
bool m_useCustomSignature;
QString m_customSignaturePath;
QString m_customKeyPath;
QProcess *m_makesis;
QProcess *m_signsis;
QProcess *m_install;
......
......@@ -69,7 +69,7 @@ Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(Qt4Project *project)
connect(m_ui->shadowBuildDirEdit, SIGNAL(beforeBrowsing()),
this, SLOT(onBeforeBeforeShadowBuildDirBrowsed()));
connect(m_ui->shadowBuildDirEdit, SIGNAL(changed()),
connect(m_ui->shadowBuildDirEdit, SIGNAL(changed(QString)),
this, SLOT(shadowBuildLineEditTextChanged()));
connect(m_ui->qtVersionComboBox, SIGNAL(currentIndexChanged(QString)),
......@@ -325,8 +325,7 @@ void Qt4ProjectConfigWidget::setToolChain(int index)
ProjectExplorer::ToolChain::ToolChainType selectedToolChainType =
m_ui->toolChainComboBox->itemData(index,
Qt::UserRole).value<ProjectExplorer::ToolChain::ToolChainType>();
m_pro->setToolChainType(m_buildConfiguration, m_ui->toolChainComboBox->itemData(index,
Qt::UserRole).value<ProjectExplorer::ToolChain::ToolChainType>());
m_pro->setToolChainType(m_buildConfiguration, selectedToolChainType);
if (m_ui->toolChainComboBox->currentIndex() != index)
m_ui->toolChainComboBox->setCurrentIndex(index);
}
......@@ -197,7 +197,7 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run
vbox->addLayout(toplayout);
vbox->addWidget(box);
connect(m_workingDirectoryEdit, SIGNAL(changed()),
connect(m_workingDirectoryEdit, SIGNAL(changed(QString)),
this, SLOT(setWorkingDirectory()));
connect(resetButton, SIGNAL(clicked()),
......
......@@ -124,12 +124,12 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<QtVersion *> ver
this, SLOT(updateCurrentQtName()));
connect(m_ui->qtPath, SIGNAL(changed()),
connect(m_ui->qtPath, SIGNAL(changed(QString)),
this, SLOT(updateCurrentQtPath()));
connect(m_ui->mingwPath, SIGNAL(changed()),
connect(m_ui->mingwPath, SIGNAL(changed(QString)),
this, SLOT(updateCurrentMingwDirectory()));
#ifdef QTCREATOR_WITH_S60
connect(m_ui->mwcPath, SIGNAL(changed()),
connect(m_ui->mwcPath, SIGNAL(changed(QString)),
this, SLOT(updateCurrentMwcDirectory()));
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment