diff --git a/src/plugins/qt4projectmanager/qt-s60/qt-s60.pri b/src/plugins/qt4projectmanager/qt-s60/qt-s60.pri index a693c71e6e9..f6347e41fb9 100644 --- a/src/plugins/qt4projectmanager/qt-s60/qt-s60.pri +++ b/src/plugins/qt4projectmanager/qt-s60/qt-s60.pri @@ -31,7 +31,13 @@ SOURCES += $$PWD/s60devices.cpp \ $$PWD/s60runcontrolfactory.cpp \ $$PWD/codaruncontrol.cpp \ $$PWD/trkruncontrol.cpp \ - $$PWD/s60runcontrolbase.cpp + $$PWD/s60runcontrolbase.cpp \ + $$PWD/s60publishingwizardfactories.cpp \ + $$PWD/s60publishingwizardovi.cpp \ + $$PWD/s60publishingsissettingspageovi.cpp \ + $$PWD/s60publisherovi.cpp \ + $$PWD/s60publishingbuildsettingspageovi.cpp \ + $$PWD/s60publishingresultspageovi.cpp HEADERS += $$PWD/s60devices.h \ $$PWD/s60devicespreferencepane.h \ @@ -63,10 +69,19 @@ HEADERS += $$PWD/s60devices.h \ $$PWD/s60runcontrolfactory.h \ $$PWD/codaruncontrol.h \ $$PWD/trkruncontrol.h \ - $$PWD/s60runcontrolbase.h + $$PWD/s60runcontrolbase.h \ + $$PWD/s60publishingwizardfactories.h \ + $$PWD/s60publishingwizardovi.h \ + $$PWD/s60publishingsissettingspageovi.h \ + $$PWD/s60publisherovi.h \ + $$PWD/s60publishingbuildsettingspageovi.h \ + $$PWD/s60publishingresultspageovi.h FORMS += $$PWD/s60devicespreferencepane.ui \ $$PWD/s60createpackagestep.ui \ $$PWD/s60certificatedetailsdialog.ui \ - qt-s60/rvcttoolchainconfigwidget.ui \ - qt-s60/winscwtoolchainconfigwidget.ui + $$PWD/rvcttoolchainconfigwidget.ui \ + $$PWD/winscwtoolchainconfigwidget.ui \ + $$PWD/s60publishingbuildsettingspageovi.ui \ + $$PWD/s60publishingresultspageovi.ui \ + $$PWD/s60publishingsissettingspageovi.ui diff --git a/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp b/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp index 25ced39820e..9a5e7b5d69f 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp @@ -42,6 +42,7 @@ #include "s60runcontrolfactory.h" #include "qt4symbiantargetfactory.h" +#include "s60publishingwizardfactories.h" #include "gccetoolchain.h" #include "rvcttoolchain.h" @@ -134,6 +135,8 @@ S60Manager::S60Manager(QObject *parent) addAutoReleasedObject(new S60DeviceDebugRunControlFactory); addAutoReleasedObject(new Qt4SymbianTargetFactory); + addAutoReleasedObject(new S60PublishingWizardFactoryOvi); + updateQtVersions(); connect(m_devices, SIGNAL(qtVersionsChanged()), this, SLOT(updateQtVersions())); diff --git a/src/plugins/qt4projectmanager/qt-s60/s60publisherovi.cpp b/src/plugins/qt4projectmanager/qt-s60/s60publisherovi.cpp new file mode 100644 index 00000000000..b9de4a6722d --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-s60/s60publisherovi.cpp @@ -0,0 +1,399 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** No Commercial Usage +** +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ +#include "s60publisherovi.h" + +#include "qt4symbiantarget.h" +#include "s60certificateinfo.h" +#include "s60manager.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "projectexplorer/buildsteplist.h" +#include "projectexplorer/buildstep.h" +#include "projectexplorer/abstractprocessstep.h" + +namespace Qt4ProjectManager { +namespace Internal { + +S60PublisherOvi::S60PublisherOvi(QObject *parent) : + QObject(parent), + m_reader(0) +{ + // build m_rejectedVendorNames + m_rejectedVendorNames.append(Constants::REJECTED_VENDOR_NAMES_NOKIA); + m_rejectedVendorNames.append(Constants::REJECTED_VENDOR_NAMES_VENDOR); + m_rejectedVendorNames.append(Constants::REJECTED_VENDOR_NAMES_VENDOR_EN); + m_rejectedVendorNames.append(Constants::REJECTED_VENDOR_NAMES_EMPTY); + + // build m_capabilitiesForCertifiedSigned + m_capabilitiesForCertifiedSigned.append(Constants::CERTIFIED_SIGNED_CAPABILITY_COMM_DD); + m_capabilitiesForCertifiedSigned.append(Constants::CERTIFIED_SIGNED_CAPABILITY_DISK_ADMIN); + m_capabilitiesForCertifiedSigned.append(Constants::CERTIFIED_SIGNED_CAPABILITY_MULTIMEDIA_DD); + m_capabilitiesForCertifiedSigned.append(Constants::CERTIFIED_SIGNED_CAPABILITY_NETWORK_CONTROL); + + // build m_capabilitesForManufacturerApproved + m_capabilitesForManufacturerApproved.append(Constants::MANUFACTURER_APPROVED_CAPABILITY_ALL_FILES); + m_capabilitesForManufacturerApproved.append(Constants::MANUFACTURER_APPROVED_CAPABILITY_DRM); + m_capabilitesForManufacturerApproved.append(Constants::MANUFACTURER_APPROVED_CAPABILITY_TCB); + + // set up colours for progress reports + m_errorColor = Qt::red; + m_commandColor = Qt::blue; + m_okColor = Qt::darkGreen; + m_normalColor = Qt::black; + + m_finishedAndSuccessful = false; + + m_qmakeProc = new QProcess(this); + m_buildProc = new QProcess(this); + m_createSisProc = new QProcess(this); + connect(m_qmakeProc,SIGNAL(finished(int)), SLOT(runBuild(int))); + connect(m_buildProc,SIGNAL(finished(int)), SLOT(runCreateSis(int))); + connect(m_createSisProc,SIGNAL(finished(int)), SLOT(endBuild(int))); +} + +S60PublisherOvi::~S60PublisherOvi() +{ + cleanUp(); +} + +void S60PublisherOvi::setBuildConfiguration(Qt4BuildConfiguration *qt4bc) +{ + // set build configuration + m_qt4bc = qt4bc; +} + +void S60PublisherOvi::setVendorName(const QString &vendorName) +{ + m_vendorName = vendorName; +} + +void S60PublisherOvi::setLocalVendorName(const QString &localVendorName) +{ + m_localVendorName = localVendorName; +} + +void S60PublisherOvi::setAppUid(const QString &appuid) +{ + m_appUid = appuid; +} + +void S60PublisherOvi::cleanUp() +{ + if (m_qt4project && m_reader) { + m_qt4project->destroyProFileReader(m_reader); + m_reader = 0; + } +} + +void S60PublisherOvi::completeCreation() +{ + // set active target + m_activeTargetOfProject = qobject_cast(m_qt4bc->target()); + QTC_ASSERT(m_activeTargetOfProject, return); + + //set up project + m_qt4project = m_activeTargetOfProject->qt4Project(); + + // set up pro file reader + m_reader = m_qt4project->createProFileReader(m_qt4project->rootProjectNode(), m_qt4bc); + //m_reader->setCumulative(false); // todo need to reenable that, after fixing parsing for symbian scopes + + ProFile *profile = m_reader->parsedProFile(m_qt4project->rootProjectNode()->path()); + m_reader->accept(profile, ProFileEvaluator::LoadProOnly); + profile->deref(); + + // set up process for creating the resulting sis files + m_qmakeProc->setEnvironment(m_qt4bc->environment().toStringList()); + m_qmakeProc->setWorkingDirectory(m_qt4bc->buildDirectory()); + + m_buildProc->setEnvironment(m_qt4bc->environment().toStringList()); + m_buildProc->setWorkingDirectory(m_qt4bc->buildDirectory()); + + m_createSisProc->setEnvironment(m_qt4bc->environment().toStringList()); + m_createSisProc->setWorkingDirectory(m_qt4bc->buildDirectory()); +} + +QString S60PublisherOvi::getGlobalVendorNameFromProFile() +{ + QStringList vendorinfos = m_reader->values("vendorinfo"); + + foreach (QString vendorinfo, vendorinfos) { + if (vendorinfo.startsWith(":")) { + return vendorinfo.remove(":").remove("\"").trimmed(); + } + } + return ""; +} + +QString S60PublisherOvi::getLocalisedVendorNamesFromProFile() +{ + QStringList vendorinfos = m_reader->values("vendorinfo"); + QString result; + + QStringList localisedVendorNames; + foreach (QString vendorinfo, vendorinfos) { + if (vendorinfo.startsWith("%")) { + localisedVendorNames = vendorinfo.remove("%{").remove("}").split(","); + foreach (QString localisedVendorName, localisedVendorNames) { + if (!result.isEmpty()) + result.append(", "); + result.append(localisedVendorName.remove("\"").trimmed()); + } + return result; + } + } + return ""; +} + +bool S60PublisherOvi::isVendorNameValid(const QString &vendorName) +{ + //Check the given vendor name + foreach (const QString &rejectedVendorName, m_rejectedVendorNames) + if (vendorName.trimmed().compare(rejectedVendorName, Qt::CaseInsensitive) == 0) + return false; + return true; +} + +QString S60PublisherOvi::getQtVersionFromProFile() +{ + return m_qt4bc->qtVersion()->displayName(); +} + +QString S60PublisherOvi::getUID3FromProFile() +{ + return m_reader->value("TARGET.UID3"); +} + +bool S60PublisherOvi::isUID3Valid(const QString &uid3) +{ + bool ok; + ulong hex = uid3.trimmed().toULong(&ok, 0); + + return ok && (hex >= AssignedRestrictedStart && hex <= AssignedRestrictedEnd); +} + +bool S60PublisherOvi::isTestUID3(const QString &uid3) +{ + bool ok; + ulong hex = uid3.trimmed().toULong(&ok, 0); + return ok && (hex >= TestStart && hex <=TestEnd); +} + +bool S60PublisherOvi::isKnownSymbianSignedUID3(const QString &uid3) +{ + bool ok; + ulong hex = uid3.trimmed().toULong(&ok, 0); + return ok && (hex >= SymbianSignedUnprotectedStart && hex <= SymbianSignedUnprotectedEnd); +} + +QString S60PublisherOvi::getCapabilitiesFromProFile() +{ + return m_reader->values("TARGET.CAPABILITY").join(", "); +} + +bool S60PublisherOvi::isCapabilityOneOf(const QString &capability, CapabilityLevel level) +{ + QStringList capabilitiesInLevel; + if (level == CertifiedSigned) + capabilitiesInLevel = m_capabilitiesForCertifiedSigned; + else if (level == ManufacturerApproved) + capabilitiesInLevel = m_capabilitesForManufacturerApproved; + + return capabilitiesInLevel.contains(capability.trimmed()); +} + +void S60PublisherOvi::updateProFile(const QString &var, const QString &values) +{ + QStringList lines; + ProFile *profile = m_reader->parsedProFile(m_qt4project->rootProjectNode()->path()); + + QFile qfile(m_qt4project->rootProjectNode()->path()); + if (qfile.open(QIODevice::ReadOnly | QIODevice::Text)) { + lines = QString::fromLocal8Bit(qfile.readAll()).split(QLatin1Char('\n')); + qfile.close(); + while (!lines.isEmpty() && lines.last().isEmpty()) + lines.removeLast(); + } else { + m_qt4project->proFileParseError(tr("Error while reading .pro file %1: %2").arg(m_qt4project->rootProjectNode()->path(), qfile.errorString())); + return; + } + + //todo: after ossi has added scope profile writing, make sure the following works + //QString scope("symbian"); + ProWriter::addVarValues(profile, &lines, m_qt4project->rootProjectNode()->path(), QStringList() << values, var); + + if (qfile.open(QIODevice::WriteOnly | QIODevice::Text)) { + qfile.write(lines.join("\n").toLocal8Bit()); + qfile.close(); + } +} + +void S60PublisherOvi::updateProFile() +{ + updateProFile("vendor", m_vendorName); + updateProFile("localised vendor", m_localVendorName); + updateProFile("TARGET.UID3", m_appUid); +} + +void S60PublisherOvi::buildSis() +{ + updateProFile(); + runQMake(); +} + +void S60PublisherOvi::runQMake() +{ + m_finishedAndSuccessful = false; + + ProjectExplorer::AbstractProcessStep *qmakeStep = m_qt4bc->qmakeStep(); + qmakeStep->init(); + const ProjectExplorer::ProcessParameters * const qmakepp = qmakeStep->processParameters(); + runStep(QProcess::NormalExit, + "Running QMake", + qmakepp->effectiveCommand() + QLatin1String(" ") + qmakepp->arguments(), + m_qmakeProc, + NULL); +} + +void S60PublisherOvi::runBuild(int result) +{ + ProjectExplorer::AbstractProcessStep * makeStep = m_qt4bc->makeStep(); + makeStep->init(); + const ProjectExplorer::ProcessParameters * const makepp = makeStep->processParameters(); + runStep(result, + "Running Build Steps", + makepp->effectiveCommand() + QLatin1String(" ") + makepp->arguments(), + m_buildProc, + m_qmakeProc); +} + +void S60PublisherOvi::runCreateSis(int result) +{ + ProjectExplorer::AbstractProcessStep * makeStep = m_qt4bc->makeStep(); + makeStep->init(); + const ProjectExplorer::ProcessParameters * const makepp = makeStep->processParameters(); + QString makeTarget = QLatin1String(" unsigned_installer_sis"); + + if (m_qt4bc->qtVersion()->qtVersion() == QtVersionNumber(4,6,3) ) + makeTarget = QLatin1String(" installer_sis"); + runStep(result, + "Making Sis File", + makepp->effectiveCommand() + makeTarget, + m_createSisProc, + m_buildProc); +} + +void S60PublisherOvi::endBuild(int result) +{ + // show what happened in last step + emit progressReport(QString(m_createSisProc->readAllStandardOutput() + "\n"), m_okColor); + emit progressReport(QString(m_createSisProc->readAllStandardError() + "\n"), m_errorColor); + + QString fileNamePostFix = QLatin1String("_installer_unsigned.sis"); + if (m_qt4bc->qtVersion()->qtVersion() == QtVersionNumber(4,6,3) ) + fileNamePostFix = QLatin1String("_installer.sis"); + + QString resultFile = m_qt4bc->buildDirectory() + "/" + m_qt4project->displayName() + fileNamePostFix; + + + + QFileInfo fi(resultFile); + if (result == QProcess::NormalExit && fi.exists()) { + emit progressReport(tr("Created ") + QDir::toNativeSeparators(resultFile) + "\n", m_normalColor); + m_finishedAndSuccessful = true; + emit succeeded(); + } else { + emit progressReport(tr(" Sis file not created due to previous errors") + "\n", m_errorColor); + } + emit progressReport(tr("Done!\n"), m_commandColor); +} + +QString S60PublisherOvi::getCreatedSisFileContainingFolder() +{ + QString fileNamePostFix = QLatin1String("_installer_unsigned.sis"); + if (m_qt4bc->qtVersion()->qtVersion() == QtVersionNumber(4,6,3) ) + fileNamePostFix = QLatin1String("_installer.sis"); + + QString resultFile = m_qt4bc->buildDirectory() + "/" + m_qt4project->displayName() + fileNamePostFix; + QFileInfo fi(resultFile); + + return fi.exists() ? QDir::toNativeSeparators(m_qt4bc->buildDirectory()) : QString(); +} + +QString S60PublisherOvi::getCreatedSisFilePath() +{ + QString fileNamePostFix = QLatin1String("_installer_unsigned.sis"); + if (m_qt4bc->qtVersion()->qtVersion() == QtVersionNumber(4,6,3) ) + fileNamePostFix = QLatin1String("_installer.sis"); + + QString resultFile = m_qt4bc->buildDirectory() + "/" + m_qt4project->displayName() + fileNamePostFix; + QFileInfo fi(resultFile); + + return fi.exists() ? QDir::toNativeSeparators(m_qt4bc->buildDirectory()+ "/" + m_qt4project->displayName() + fileNamePostFix) : QString(); +} + +bool S60PublisherOvi::hasSucceeded() +{ + return m_finishedAndSuccessful; +} + +void S60PublisherOvi::runStep(int result, const QString& buildStep, const QString& command, QProcess* currProc, QProcess* prevProc) +{ + // todo react to readyRead() instead of reading all at the end + // show what happened in last step + if (prevProc) { + emit progressReport(QString(prevProc->readAllStandardOutput() + "\n"), m_okColor); + emit progressReport(QString(prevProc->readAllStandardError() + "\n"), m_errorColor); + } + + // if the last state finished ok then run the build. + if (result == QProcess::NormalExit) { + emit progressReport(buildStep + "\n", m_commandColor); + emit progressReport(command + "\n", m_commandColor); + + currProc->start(command); + } else { + emit progressReport(tr("Sis file not created due to previous errors") + "\n", m_errorColor); + } +} + +} // namespace Internal +} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-s60/s60publisherovi.h b/src/plugins/qt4projectmanager/qt-s60/s60publisherovi.h new file mode 100644 index 00000000000..60f75d0f34a --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-s60/s60publisherovi.h @@ -0,0 +1,173 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** No Commercial Usage +** +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ +#ifndef S60PUBLISHEROVI_H +#define S60PUBLISHEROVI_H + +#include +#include +#include + +#include "qt4buildconfiguration.h" + +namespace ProjectExplorer { +class Project; +} + +namespace Qt4ProjectManager { +class Qt4Project; +namespace Internal { +class Qt4SymbianTarget; +class ProFileReader; + +namespace Constants { +const char * const REJECTED_VENDOR_NAMES_VENDOR = "Vendor"; +const char * const REJECTED_VENDOR_NAMES_VENDOR_EN = "Vendor-EN"; +const char * const REJECTED_VENDOR_NAMES_NOKIA = "Nokia"; +const char * const REJECTED_VENDOR_NAMES_EMPTY = ""; + +const char * const CERTIFIED_SIGNED_CAPABILITY_NETWORK_CONTROL = "NetworkControl"; +const char * const CERTIFIED_SIGNED_CAPABILITY_MULTIMEDIA_DD = "MultimediaDD"; +const char * const CERTIFIED_SIGNED_CAPABILITY_COMM_DD = "CommDD"; +const char * const CERTIFIED_SIGNED_CAPABILITY_DISK_ADMIN = "DiskAdmin"; +const char * const MANUFACTURER_APPROVED_CAPABILITY_ALL_FILES = "AllFiles"; +const char * const MANUFACTURER_APPROVED_CAPABILITY_DRM = "DRM"; +const char * const MANUFACTURER_APPROVED_CAPABILITY_TCB = "TCB"; +} + +class S60PublisherOvi : public QObject +{ + Q_OBJECT + +public: + enum UID3Ranges { + // Protected UID range: 0x00000000 - 0x7FFFFFFF + // Unprotected UID range: 0x80000000 - 0xFFFFFFFF + // + // Specifically, there are two important unprotected UID ranges: + // UIDs from Symbian Signed: 0xA0000000 - 0xAFFFFFFF + // UIDs for test/development use: 0xE0000000 - 0xEFFFFFFF + // + // And one important protected range: + // UIDs from Ovi Sign: 0x20000000 to 0x2FFFFFFF + // Warning: Some of these UIDs are assigned by Symbiansigned. + // Apps with such UIDs cannot be signed by Ovi. + // It is currently impossible to say which UIDs have been assigned by whome. + + AssignedRestrictedStart = 0x20000000, + AssignedRestrictedEnd = 0x2FFFFFFF, + SymbianSignedUnprotectedStart = 0xA0000000, + SymbianSignedUnprotectedEnd = 0xAFFFFFFF, + TestStart = 0xE0000000, + TestEnd = 0xEFFFFFFF + }; + + enum CapabilityLevel { + CertifiedSigned, + ManufacturerApproved + }; + +public: + explicit S60PublisherOvi(QObject *parent = 0); + ~S60PublisherOvi(); + + void setBuildConfiguration(Qt4BuildConfiguration *qt4bc); + void cleanUp(); + void completeCreation(); + + QString getGlobalVendorNameFromProFile(); + QString getLocalisedVendorNamesFromProFile(); + bool isVendorNameValid(const QString &vendorName); + + QString getQtVersionFromProFile(); + + QString getUID3FromProFile(); + bool isUID3Valid(const QString &uid3); + bool isTestUID3(const QString &uid3); + bool isKnownSymbianSignedUID3(const QString &uid3); + + QString getCapabilitiesFromProFile(); + bool isCapabilityOneOf(const QString &capability, CapabilityLevel level); + + void updateProFile(); + void updateProFile(const QString &var, const QString &values); + void buildSis(); + + QString getCreatedSisFileContainingFolder(); + QString getCreatedSisFilePath(); + + bool hasSucceeded(); + + void setVendorName(const QString &vendorName); + void setLocalVendorName(const QString &localVendorName); + void setAppUid(const QString &appuid); + +signals: + void progressReport(const QString& status, QColor c); + void succeeded(); + +public slots: + void runQMake(); + void runBuild(int result); + void runCreateSis(int result); + void endBuild(int result); + +private: + void runStep(int result, const QString& buildStep, const QString& command, QProcess* currProc, QProcess* prevProc); + + QColor m_errorColor; + QColor m_commandColor; + QColor m_okColor; + QColor m_normalColor; + + QProcess* m_qmakeProc; + QProcess* m_buildProc; + QProcess* m_createSisProc; + + Qt4BuildConfiguration * m_qt4bc; + const Qt4SymbianTarget * m_activeTargetOfProject; + Qt4Project * m_qt4project; + ProFileReader *m_reader; + QStringList m_rejectedVendorNames; + QStringList m_capabilitiesForCertifiedSigned; + QStringList m_capabilitesForManufacturerApproved; + QString m_vendorName; + QString m_localVendorName; + QString m_appUid; + + bool m_finishedAndSuccessful; +}; + +} // namespace Internal +} // namespace Qt4ProjectManager + +#endif // S60PUBLISHEROVI_H diff --git a/src/plugins/qt4projectmanager/qt-s60/s60publishingbuildsettingspageovi.cpp b/src/plugins/qt4projectmanager/qt-s60/s60publishingbuildsettingspageovi.cpp new file mode 100644 index 00000000000..4c962cf342f --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-s60/s60publishingbuildsettingspageovi.cpp @@ -0,0 +1,106 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** No Commercial Usage +** +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ +#include "s60publishingbuildsettingspageovi.h" +#include "s60publisherovi.h" + +#include +#include +#include +#include +#include + +namespace Qt4ProjectManager { +namespace Internal { + +S60PublishingBuildSettingsPageOvi::S60PublishingBuildSettingsPageOvi(S60PublisherOvi *publisher, const ProjectExplorer::Project *project, QWidget *parent) : + QWizardPage(parent), + m_publisher(publisher), + m_ui(new Ui::S60PublishingBuildSettingsPageOvi) +{ + m_ui->setupUi(this); + + QList list; + foreach (const ProjectExplorer::Target *const target, project->targets()) { + if (target->id() != QLatin1String(Qt4ProjectManager::Constants::S60_DEVICE_TARGET_ID)) + continue; + foreach (ProjectExplorer::BuildConfiguration * const bc, target->buildConfigurations()) { + Qt4BuildConfiguration * const qt4bc + = qobject_cast(bc); + if (!qt4bc) + continue; + if (qt4bc->qtVersion()->qtVersion() > QtVersionNumber(4, 6, 2)) + list << qt4bc; + } + break; + } + + foreach (Qt4BuildConfiguration *qt4bc, list) + m_ui->chooseBuildConfigDropDown->addItem(qt4bc->displayName(), QVariant::fromValue(static_cast(qt4bc))); + + + m_bc = 0; + + // todo more intelligent selection? prefer newer versions? + foreach (Qt4BuildConfiguration *qt4bc, list) + if (!m_bc && !(qt4bc->qmakeBuildConfiguration() & QtVersion::DebugBuild)) + m_bc = qt4bc; + + if (!m_bc && !list.isEmpty()) + m_bc = list.first(); + + m_ui->chooseBuildConfigDropDown->setSizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow); + int focusedIndex = m_ui->chooseBuildConfigDropDown->findData(QVariant::fromValue(m_bc)); + m_ui->chooseBuildConfigDropDown->setCurrentIndex(focusedIndex); + + m_publisher->setBuildConfiguration(static_cast(m_bc)); + + //change the build configuration if the user changes it + connect(m_ui->chooseBuildConfigDropDown, SIGNAL(currentIndexChanged(int)), this, SLOT(buildConfigChosen())); +} + +void S60PublishingBuildSettingsPageOvi::buildConfigChosen() +{ + int currentIndex = m_ui->chooseBuildConfigDropDown->currentIndex(); + if (currentIndex == -1) + return; + m_bc = m_ui->chooseBuildConfigDropDown->itemData(currentIndex).value(); + m_publisher->setBuildConfiguration(static_cast(m_bc)); +} + +S60PublishingBuildSettingsPageOvi::~S60PublishingBuildSettingsPageOvi() +{ + delete m_ui; +} + +} // namespace Internal +} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-s60/s60publishingbuildsettingspageovi.h b/src/plugins/qt4projectmanager/qt-s60/s60publishingbuildsettingspageovi.h new file mode 100644 index 00000000000..86c406797b6 --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-s60/s60publishingbuildsettingspageovi.h @@ -0,0 +1,75 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** No Commercial Usage +** +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#ifndef S60PUBLISHINGBUILDSETTINGSPAGEOVI_H +#define S60PUBLISHINGBUILDSETTINGSPAGEOVI_H + +#include "ui_s60publishingbuildsettingspageovi.h" +#include "qt4buildconfiguration.h" + +#include +#include + + + +namespace Ui { +class S60PublishingBuildSettingsPageOvi; +} +namespace ProjectExplorer { +class Project; +} + +namespace Qt4ProjectManager { +namespace Internal { +class S60PublisherOvi; + +class S60PublishingBuildSettingsPageOvi : public QWizardPage +{ + Q_OBJECT +public: + explicit S60PublishingBuildSettingsPageOvi(S60PublisherOvi *publisher, const ProjectExplorer::Project *project, QWidget *parent = 0); + ~S60PublishingBuildSettingsPageOvi(); + +private slots: + void buildConfigChosen(); + +private: + ProjectExplorer::BuildConfiguration *m_bc; + Ui::S60PublishingBuildSettingsPageOvi * m_ui; + S60PublisherOvi * const m_publisher; +}; + +} // namespace Internal +} // namespace Qt4ProjectManager + +#endif // S60PUBLISHINGBUILDSETTINGSPAGEOVI_H diff --git a/src/plugins/qt4projectmanager/qt-s60/s60publishingbuildsettingspageovi.ui b/src/plugins/qt4projectmanager/qt-s60/s60publishingbuildsettingspageovi.ui new file mode 100644 index 00000000000..676d889af9f --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-s60/s60publishingbuildsettingspageovi.ui @@ -0,0 +1,65 @@ + + + S60PublishingBuildSettingsPageOvi + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + Choose a build configuration + + + + + + + + + + Qt::Horizontal + + + + 252 + 20 + + + + + + + + Only Qt versions above 4.6.3 are made available in this wizard. +This is because previous Qt Versions have limitations in building suitable sis files. + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + diff --git a/src/plugins/qt4projectmanager/qt-s60/s60publishingresultspageovi.cpp b/src/plugins/qt4projectmanager/qt-s60/s60publishingresultspageovi.cpp new file mode 100644 index 00000000000..e0926d6d168 --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-s60/s60publishingresultspageovi.cpp @@ -0,0 +1,88 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** No Commercial Usage +** +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ +#include "s60publishingresultspageovi.h" +#include "s60publisherovi.h" + +#include +#include + +namespace Qt4ProjectManager { +namespace Internal { + +S60PublishingResultsPageOvi::S60PublishingResultsPageOvi(S60PublisherOvi *publisher, QWidget *parent) : + QWizardPage(parent), + m_publisher(publisher), + ui(new Ui::S60PublishingResultsPageOvi) +{ + ui->setupUi(this); + connect(m_publisher, SIGNAL(progressReport(QString,QColor)), SLOT(updateResultsPage(QString,QColor))); +} + +S60PublishingResultsPageOvi::~S60PublishingResultsPageOvi() +{ + delete ui; +} + +void S60PublishingResultsPageOvi::initializePage() +{ + wizard()->setButtonText(QWizard::FinishButton, tr("Open Containing Folder")); + connect(m_publisher, SIGNAL(succeeded()), SIGNAL(completeChanged())); + connect(wizard()->button(QWizard::FinishButton), SIGNAL(clicked()), SLOT(openFileLocation())); + m_publisher->buildSis(); +} + +bool S60PublishingResultsPageOvi::isComplete() const +{ + return m_publisher->hasSucceeded(); +} + +void S60PublishingResultsPageOvi::updateResultsPage(const QString& status, QColor c) +{ + QTextCursor cur(ui->resultsTextBrowser->document()); + QTextCharFormat tcf = cur.charFormat(); + tcf.setForeground(c); + cur.movePosition(QTextCursor::End); + cur.insertText(status, tcf); +} + +void S60PublishingResultsPageOvi::openFileLocation() +{ +#ifdef Q_OS_WIN + QProcess::startDetached("explorer /select,"+ m_publisher->getCreatedSisFilePath()); +#else + QDesktopServices::openUrl(QUrl("file:///" + m_publisher->getCreatedSisFileContainingFolder())); +#endif +} + +} // namespace Internal +} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-s60/s60publishingresultspageovi.h b/src/plugins/qt4projectmanager/qt-s60/s60publishingresultspageovi.h new file mode 100644 index 00000000000..f47fa96d6a4 --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-s60/s60publishingresultspageovi.h @@ -0,0 +1,73 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** No Commercial Usage +** +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#ifndef S60PUBLISHINGRESULTSPAGEOVI_H +#define S60PUBLISHINGRESULTSPAGEOVI_H + +#include "ui_s60publishingresultspageovi.h" + +#include + +QT_BEGIN_NAMESPACE +namespace Ui {class S60PublishingResultsPageOvi;} +QT_END_NAMESPACE + +namespace Qt4ProjectManager { +namespace Internal { +class S60PublisherOvi; + +class S60PublishingResultsPageOvi : public QWizardPage +{ + Q_OBJECT +public: + explicit S60PublishingResultsPageOvi(S60PublisherOvi *publisher, QWidget *parent = 0); + ~S60PublishingResultsPageOvi(); + + virtual void initializePage(); + virtual bool isComplete() const; + +signals: + +public slots: + void updateResultsPage(const QString &status, QColor c); + void openFileLocation(); + +private: + Ui::S60PublishingResultsPageOvi *ui; + S60PublisherOvi * const m_publisher; +}; + +} // namespace Internal +} // namespace Qt4ProjectManager + +#endif // S60PUBLISHINGRESULTSPAGEOVI_H diff --git a/src/plugins/qt4projectmanager/qt-s60/s60publishingresultspageovi.ui b/src/plugins/qt4projectmanager/qt-s60/s60publishingresultspageovi.ui new file mode 100644 index 00000000000..1f08d83681d --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-s60/s60publishingresultspageovi.ui @@ -0,0 +1,31 @@ + + + S60PublishingResultsPageOvi + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + 0 + 0 + + + + + + + + + diff --git a/src/plugins/qt4projectmanager/qt-s60/s60publishingsissettingspageovi.cpp b/src/plugins/qt4projectmanager/qt-s60/s60publishingsissettingspageovi.cpp new file mode 100644 index 00000000000..d9b23dce7f5 --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-s60/s60publishingsissettingspageovi.cpp @@ -0,0 +1,268 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** No Commercial Usage +** +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ +#include "s60publishingsissettingspageovi.h" +#include "s60publisherovi.h" +#include "s60certificateinfo.h" + +#include + +using namespace ProjectExplorer; + +namespace Qt4ProjectManager { +namespace Internal { + +S60PublishingSisSettingsPageOvi::S60PublishingSisSettingsPageOvi(S60PublisherOvi *publisher, QWidget *parent) : + QWizardPage(parent), + m_publisher(publisher), + ui(new Ui::S60PublishingSisSettingsPageOvi) +{ + ui->setupUi(this); + + //Setup labels which display icons about the state of the entry + //error icons + ui->capabilitiesErrorLabel->hide(); + ui->qtVersionErrorLabel->hide(); + ui->uid3ErrorLabel->hide(); + ui->globalVendorNameErrorLabel->hide(); + ui->localisedVendorNamesErrorLabel->hide(); + //ok icons + ui->capabilitiesOkLabel->hide(); + ui->qtVersionOkLabel->hide(); + ui->uid3OkLabel->hide(); + ui->globalVendorNameOkLabel->hide(); + ui->localisedVendorNamesOkLabel->hide(); + //warning icons + ui->globalVendorNameWarningLabel->hide(); + ui->localisedVendorNamesWarningLabel->hide(); + ui->qtVersionWarningLabel->hide(); + ui->uid3WarningLabel->hide(); +} + +void S60PublishingSisSettingsPageOvi::initializePage() +{ + //Finish creation of the publisher + m_publisher->completeCreation(); + + showWarningsForUnenforcableChecks(); + + //Check Global Vendor Name + ui->globalVendorNameLineEdit->setText(m_publisher->getGlobalVendorNameFromProFile()); + globalVendorNameChanged(); + connect(ui->globalVendorNameLineEdit,SIGNAL(textChanged(QString)),SLOT(globalVendorNameChanged())); + + //Check Localised Vendor Names + ui->localisedVendorNamesLineEdit->setText(m_publisher->getLocalisedVendorNamesFromProFile()); + localisedVendorNamesChanged(); + connect(ui->localisedVendorNamesLineEdit,SIGNAL(textChanged(QString)),SLOT(localisedVendorNamesChanged())); + + //Check Qt Version Used in Builds + ui->qtVersionDisplayLabel->setText(m_publisher->getQtVersionFromProFile()); + qtVersionChanged(); + + //Check UID3 + ui->uid3LineEdit->setText(m_publisher->getUID3FromProFile()); + uid3Changed(); + connect(ui->uid3LineEdit,SIGNAL(textChanged(QString)),SLOT(uid3Changed())); + + //Check for capabilities which are not signed for + ui->capabilitiesDisplayLabel->setText(m_publisher->getCapabilitiesFromProFile()); + capabilitiesChanged(); +} + +void S60PublishingSisSettingsPageOvi::cleanupPage() +{ + m_publisher->cleanUp(); +} + +S60PublishingSisSettingsPageOvi::~S60PublishingSisSettingsPageOvi() +{ + delete ui; +} + +void S60PublishingSisSettingsPageOvi::reflectSettingState(bool settingState, QLabel *okLabel, QLabel *errorLabel, QLabel *errorReasonLabel, const QString &errorReason) +{ + if (!settingState) { + okLabel->hide(); + errorLabel->show(); + errorReasonLabel->setTextFormat(Qt::RichText); + errorReasonLabel->setText(errorReason); + errorReasonLabel->show(); + } else { + okLabel->show(); + errorLabel->hide(); + errorReasonLabel->hide(); + } + + // This is a hack. + // the labels change size, most likely increasing height but that doesn't change the wizard layout + // It essentially forces QWizard to update its layout. (Until setTitleFormat checks whether the format changed at all...) + // todo figure out whether the QWizard should be doing that automatically + wizard()->setTitleFormat(wizard()->titleFormat()); +} + +void S60PublishingSisSettingsPageOvi::globalVendorNameChanged() +{ + reflectSettingState(m_publisher->isVendorNameValid(ui->globalVendorNameLineEdit->text()), + ui->globalVendorNameOkLabel, + ui->globalVendorNameErrorLabel, + ui->globalVendorNameErrorReasonLabel, + tr("\"") + ui->globalVendorNameLineEdit->text() + tr("\"")+ tr(" is a default vendor name used for testing and development.
" + "The Vendor_Name field cannot be, or contain, the name 'Nokia' in it.
" + "It is recommended to also not use the default name of 'Vendor'/'Vendor-EN', or to leave the entry blank.
" + "see Packaging and Signing for guidelines.
")); + m_publisher->setVendorName(ui->globalVendorNameLineEdit->text()); +} + +void S60PublishingSisSettingsPageOvi::localisedVendorNamesChanged() +{ + QStringList localisedVendorNames = ui->localisedVendorNamesLineEdit->text().split(","); + + bool settingState = true; + QStringList wrongVendorNames; + + foreach (const QString &localisedVendorName, localisedVendorNames) { + if (!m_publisher->isVendorNameValid(localisedVendorName)) { + wrongVendorNames.append(localisedVendorName); + settingState = false; + } + } + + reflectSettingState(settingState, + ui->localisedVendorNamesOkLabel, + ui->localisedVendorNamesErrorLabel, + ui->localisedVendorNamesErrorReasonLabel, + wrongVendorNames.join(", ") + tr(" are default vendor names used for testing and development.
" + "The Vendor_Name field cannot be, or contain, the name 'Nokia' in it.
" + "It is recommended to also not use the default name of 'Vendor'/'Vendor-EN', or to leave the entry blank.
" + "see Packaging and Signing for guidelines.
")); + m_publisher->setVendorName(ui->localisedVendorNamesLineEdit->text()); +} + +void S60PublishingSisSettingsPageOvi::qtVersionChanged() +{ +} + +void S60PublishingSisSettingsPageOvi::uid3Changed() +{ + QString testUID3ErrorMsg = tr(" is only for testing and development.
" + "SIS packages built with it, cannot be distributed via the OVI Store.
"); + + QString symbianSignedUID3ErrorMsg = tr(" is a symbiansigned.com UID.
" + "Apps with this UID will be rejected by Ovi Sign.
" + "If you want to continue with this UID, sign your app on symbiansigned.com and upload the signed app to Ovi.
"); + + QString errorMsg = tr(" is not an acceptable UID.
" + " SIS packages built with it, cannot be signed by Ovi.
"); + + if (m_publisher->isTestUID3(ui->uid3LineEdit->text())) { + errorMsg = testUID3ErrorMsg; + } else if (m_publisher->isKnownSymbianSignedUID3(ui->uid3LineEdit->text())) { + errorMsg = symbianSignedUID3ErrorMsg; + } + + reflectSettingState(m_publisher->isUID3Valid(ui->uid3LineEdit->text()), + ui->uid3OkLabel, + ui->uid3ErrorLabel, + ui->uid3ErrorReasonLabel, + tr("The App UID is a global unique indentifier of the SIS package.
") + + tr("The App UID ") + ui->uid3LineEdit->text() + + errorMsg + + tr("To get a unique App UID for your package file,
" + "please register at publish.ovi.com")); + + if (m_publisher->isUID3Valid(ui->uid3LineEdit->text())) { + ui->uid3WarningLabel->show(); + ui->uid3WarningReasonLabel->setText("If this UID is from symbiansigned.com, It will be rejected by Ovi Sign.
" + "If you want to continue with this UID, sign your app on symbiansigned.com and upload the signed app to Ovi.
" + "It is however recommended you obtain a UID from publish.ovi.com"); + ui->uid3WarningReasonLabel->show(); + } else { + ui->uid3WarningLabel->hide(); + ui->uid3WarningReasonLabel->hide(); + } + + m_publisher->setAppUid(ui->uid3LineEdit->text()); +} + +void S60PublishingSisSettingsPageOvi::capabilitiesChanged() +{ + QStringList capabilities = ui->capabilitiesDisplayLabel->text().split(","); + QString errorMessage; + + //Check for certified Signed capabilities + QStringList capabilitesNeedingCertifiedSigned; + foreach (const QString &capability, capabilities) { + if( m_publisher->isCapabilityOneOf(capability, S60PublisherOvi::CertifiedSigned)) { + capabilitesNeedingCertifiedSigned.append(capability); + capabilities.removeOne(capability); + } + } + + if (!capabilitesNeedingCertifiedSigned.isEmpty()) + errorMessage.append(capabilitesNeedingCertifiedSigned.join(", ") + + tr(" need(s) to be certified signed. " + "Please go to symbiansigned.com for guidance.")); + + //Check for capabilities needing manufacturer approval + QStringList capabilitiesNeedingManufacturerApproved; + + foreach (const QString &capability, capabilities) { + if( m_publisher->isCapabilityOneOf(capability, S60PublisherOvi::ManufacturerApproved)) + capabilitiesNeedingManufacturerApproved.append(capability); + } + + if (!capabilitiesNeedingManufacturerApproved.isEmpty()) { + errorMessage.append(tr("
")+ + capabilitiesNeedingManufacturerApproved.join(", ") + + tr(" need(s) manufacturer approval.
")); + } + + errorMessage.prepend(tr("Some capabilities might require a special kind of signing or approval from the manufacturer.
")); + + reflectSettingState(capabilitesNeedingCertifiedSigned.isEmpty() && capabilitiesNeedingManufacturerApproved.isEmpty(), + ui->capabilitiesOkLabel, + ui->capabilitiesErrorLabel, + ui->capabilitiesErrorReasonLabel, + errorMessage); +} + +void S60PublishingSisSettingsPageOvi::showWarningsForUnenforcableChecks() +{ + //Warn about use of unreleased Qt Versions + //ui->qtVersionWarningLabel->show(); //looks better without... + ui->qtVersionWarningReasonLabel->setText(tr("Please verify that you have a released version of Qt.
" + "Qt Packages Distributed by Smart Installer has a list of released Qt versions.")); +} + +} // namespace Internal +} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-s60/s60publishingsissettingspageovi.h b/src/plugins/qt4projectmanager/qt-s60/s60publishingsissettingspageovi.h new file mode 100644 index 00000000000..b6c9f744214 --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-s60/s60publishingsissettingspageovi.h @@ -0,0 +1,83 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** No Commercial Usage +** +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#ifndef S60PUBLISHINGSISSETTINGSPAGEOVI_H +#define S60PUBLISHINGSISSETTINGSPAGEOVI_H + +#include "ui_s60publishingsissettingspageovi.h" + +#include + +namespace Ui { +class S60PublishingSisSettingsPageOvi; +} + +QT_BEGIN_NAMESPACE +class QLabel; +QT_END_NAMESPACE + +namespace ProjectExplorer { class Project; } + +namespace Qt4ProjectManager { +namespace Internal { +class S60PublisherOvi; + +class S60PublishingSisSettingsPageOvi : public QWizardPage +{ + Q_OBJECT +public: + explicit S60PublishingSisSettingsPageOvi(S60PublisherOvi *publisher, QWidget *parent = 0); + ~S60PublishingSisSettingsPageOvi(); + + virtual void initializePage(); + virtual void cleanupPage(); + +private slots: + void globalVendorNameChanged(); + void localisedVendorNamesChanged(); + void qtVersionChanged(); + void uid3Changed(); + void capabilitiesChanged(); + +private: + void reflectSettingState(bool settingState, QLabel *okLabel, QLabel *errorLabel, QLabel *errorReasonLabel, const QString &errorReason); + void showWarningsForUnenforcableChecks(); + + Ui::S60PublishingSisSettingsPageOvi *ui; + S60PublisherOvi * const m_publisher; +}; + +} // namespace Internal +} // namespace Qt4ProjectManager + +#endif // S60PUBLISHINGSISSETTINGSPAGEOVI_H diff --git a/src/plugins/qt4projectmanager/qt-s60/s60publishingsissettingspageovi.ui b/src/plugins/qt4projectmanager/qt-s60/s60publishingsissettingspageovi.ui new file mode 100644 index 00000000000..31d41e5d228 --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-s60/s60publishingsissettingspageovi.ui @@ -0,0 +1,439 @@ + + + S60PublishingSisSettingsPageOvi + + + + 0 + 0 + 301 + 346 + + + + + 0 + 0 + + + + Form + + + + QLayout::SetMinAndMaxSize + + + + + Global Vendor Name + + + + + + + + + + :/projectexplorer/images/ConnectionOn.png + + + + + + + Qt Version used in builds + + + + + + + + 0 + 0 + + + + QFrame::NoFrame + + + Current Qt Version + + + + + + + + + + :/projectexplorer/images/ConnectionOn.png + + + + + + + App UID + + + + + + + + + + :/projectexplorer/images/ConnectionOn.png + + + + + + + Current UID3 + + + + + + + Capabilities + + + + + + + QFrame::NoFrame + + + Current set of capabilities + + + + + + + + + + :/projectexplorer/images/ConnectionOn.png + + + + + + + + 0 + 0 + + + + + + + + + + + + 0 + 0 + + + + + + + + + + + + 0 + 0 + + + + + + + + + + + + 0 + 0 + + + + + + + + + + + Qt::Horizontal + + + + + + + Qt::Horizontal + + + + + + + + 0 + 0 + + + + + + + :/projectexplorer/images/compile_error.png + + + + + + + + 0 + 0 + + + + + + + :/projectexplorer/images/compile_error.png + + + + + + + + 0 + 0 + + + + + + + :/projectexplorer/images/compile_error.png + + + + + + + + 0 + 0 + + + + + + + :/projectexplorer/images/compile_error.png + + + + + + + Current Global Vendor Name + + + + + + + Localised Vendor Names + + + + + + + Localised Vendor Names + + + + + + + + + + :/projectexplorer/images/ConnectionOn.png + + + + + + + + 0 + 0 + + + + + + + :/projectexplorer/images/compile_error.png + + + + + + + + 0 + 0 + + + + + + + + + + + Qt::Horizontal + + + + + + + + 0 + 0 + + + + + + + :/projectexplorer/images/compile_warning.png + + + + + + + + 0 + 0 + + + + + + + + + + + + 0 + 0 + + + + + + + :/projectexplorer/images/compile_warning.png + + + + + + + + 0 + 0 + + + + + + + + + + + + 0 + 0 + + + + + + + :/projectexplorer/images/compile_warning.png + + + + + + + + 0 + 0 + + + + + + + + + + + Qt::Horizontal + + + + + + + + + + :/projectexplorer/images/compile_warning.png + + + + + + + + + + + + + + + diff --git a/src/plugins/qt4projectmanager/qt-s60/s60publishingwizardfactories.cpp b/src/plugins/qt4projectmanager/qt-s60/s60publishingwizardfactories.cpp new file mode 100644 index 00000000000..cc3910f7364 --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-s60/s60publishingwizardfactories.cpp @@ -0,0 +1,81 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** No Commercial Usage +** +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ +#include "s60publishingwizardfactories.h" +#include "s60publishingwizardovi.h" + +#include +#include +#include +#include + + +using namespace ProjectExplorer; + +namespace Qt4ProjectManager { +namespace Internal { +S60PublishingWizardFactoryOvi::S60PublishingWizardFactoryOvi(QObject *parent) + : IPublishingWizardFactory(parent) +{} + +QString S60PublishingWizardFactoryOvi::displayName() const +{ + return tr("Publish for Qt Symbian Application on Ovi Store "); +} + +QString S60PublishingWizardFactoryOvi::description() const +{ + return tr("This wizard will check your resulting sis file and " + "some of your meta data to make sure it complies with " + "Ovi Store submission regulations."); +} + +bool S60PublishingWizardFactoryOvi::canCreateWizard(const Project *project) const +{ + if (!qobject_cast(project)) + return false; + foreach (const Target *const target, project->targets()) { + if (target->id() == QLatin1String(Constants::S60_DEVICE_TARGET_ID)) + return true; + } + return false; +} + +QWizard *S60PublishingWizardFactoryOvi::createWizard(const Project *project) const +{ + Q_ASSERT(canCreateWizard(project)); + return new S60PublishingWizardOvi(project); +} + +} // namespace Internal +} // namespace Qt4ProjectManager + diff --git a/src/plugins/qt4projectmanager/qt-s60/s60publishingwizardfactories.h b/src/plugins/qt4projectmanager/qt-s60/s60publishingwizardfactories.h new file mode 100644 index 00000000000..7162fc7ec64 --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-s60/s60publishingwizardfactories.h @@ -0,0 +1,57 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** No Commercial Usage +** +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#ifndef S60PUBLISHINGWIZARDFACTORIES_H +#define S60PUBLISHINGWIZARDFACTORIES_H + +#include + +namespace Qt4ProjectManager { +namespace Internal { + +class S60PublishingWizardFactoryOvi + : public ProjectExplorer::IPublishingWizardFactory +{ + Q_OBJECT +public: + explicit S60PublishingWizardFactoryOvi(QObject *parent =0); +private: + virtual QString displayName() const; + virtual QString description() const; + virtual bool canCreateWizard(const ProjectExplorer::Project *project) const; + virtual QWizard *createWizard(const ProjectExplorer::Project *project) const; +}; +} // namespace Internal +} // namespace Qt4ProjectManager + +#endif // S60PUBLISHINGWIZARDFACTORIES_H diff --git a/src/plugins/qt4projectmanager/qt-s60/s60publishingwizardovi.cpp b/src/plugins/qt4projectmanager/qt-s60/s60publishingwizardovi.cpp new file mode 100644 index 00000000000..f8dbb03a12a --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-s60/s60publishingwizardovi.cpp @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of Qt Creator. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "s60publishingwizardovi.h" +#include "s60publisherovi.h" + +using namespace ProjectExplorer; + +namespace Qt4ProjectManager { +namespace Internal { + +S60PublishingWizardOvi::S60PublishingWizardOvi(const Project *project, QWidget *parent) : + QWizard(parent), + m_publisher(new S60PublisherOvi(this)) +{ + setWindowTitle(tr("Publishing to Ovi Store")); + + m_buildSettingsPage = new S60PublishingBuildSettingsPageOvi(m_publisher, project); + m_buildSettingsPage->setTitle(tr("Build Configuration")); + addPage(m_buildSettingsPage); + + m_sisSettingsPage = new S60PublishingSisSettingsPageOvi(m_publisher); + m_sisSettingsPage->setTitle(tr(".Pro File Checks")); + m_sisSettingsPage->setCommitPage(true); + addPage(m_sisSettingsPage); + + m_resultsPage = new S60PublishingResultsPageOvi(m_publisher); + m_resultsPage->setTitle(tr("Creating Uploadable Sis File")); + m_resultsPage->setFinalPage(true); + addPage(m_resultsPage); + + setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); +} + +S60PublishingWizardOvi::~S60PublishingWizardOvi() +{ + delete m_publisher; +} + +} // namespace Internal +} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-s60/s60publishingwizardovi.h b/src/plugins/qt4projectmanager/qt-s60/s60publishingwizardovi.h new file mode 100644 index 00000000000..6ad3f811aef --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-s60/s60publishingwizardovi.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of Qt Creator. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef S60PUBLISHINGWIZARDOVI_H +#define S60PUBLISHINGWIZARDOVI_H + +#include "s60publishingbuildsettingspageovi.h" +#include "s60publishingsissettingspageovi.h" +#include "s60publishingresultspageovi.h" + +#include + +namespace ProjectExplorer { +class Project; +} + +namespace Qt4ProjectManager { +namespace Internal { +class S60PublisherOvi; + +class S60PublishingWizardOvi : public QWizard +{ + Q_OBJECT +public: + explicit S60PublishingWizardOvi(const ProjectExplorer::Project *project, QWidget *parent = 0); + ~S60PublishingWizardOvi(); + +private: + S60PublisherOvi *m_publisher; + S60PublishingBuildSettingsPageOvi *m_buildSettingsPage; + S60PublishingSisSettingsPageOvi *m_sisSettingsPage; + S60PublishingResultsPageOvi *m_resultsPage; + +}; +} // namespace Internal +} // namespace Qt4ProjectManager + +#endif // S60PUBLISHINGWIZARDOVI_H diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp index e48a3de6a6f..47021e2a60c 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.cpp +++ b/src/plugins/qt4projectmanager/qt4nodes.cpp @@ -38,7 +38,6 @@ #include "qt4projectmanager.h" #include "qt4projectmanagerconstants.h" #include "qtuicodemodelsupport.h" -#include "qt4buildconfiguration.h" #include "qmakestep.h" #include @@ -2120,11 +2119,15 @@ InstallsList Qt4ProFileNode::installsList() const return m_installsList; } -QString Qt4ProFileNode::buildDir() const +QString Qt4ProFileNode::buildDir(Qt4BuildConfiguration *bc) const { const QDir srcDirRoot = QFileInfo(m_project->rootProjectNode()->path()).absoluteDir(); const QString relativeDir = srcDirRoot.relativeFilePath(m_projectDir); - return QDir(m_project->activeTarget()->activeBuildConfiguration()->buildDirectory()).absoluteFilePath(relativeDir); + if (!bc && m_project->activeTarget()) + bc = m_project->activeTarget()->activeBuildConfiguration(); + if (!bc) + return QString(); + return QDir(bc->buildDirectory()).absoluteFilePath(relativeDir); } /* diff --git a/src/plugins/qt4projectmanager/qt4nodes.h b/src/plugins/qt4projectmanager/qt4nodes.h index 03eef8837a7..369ca5a5e33 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.h +++ b/src/plugins/qt4projectmanager/qt4nodes.h @@ -34,6 +34,8 @@ #ifndef QT4NODES_H #define QT4NODES_H +#include "qt4buildconfiguration.h" + #include #include #include @@ -289,7 +291,7 @@ public: void updateCodeModelSupportFromBuild(const QStringList &files); void updateCodeModelSupportFromEditor(const QString &uiFileName, const QString &contents); - QString buildDir() const; + QString buildDir(Qt4BuildConfiguration *bc = 0) const; QString uiDirectory() const; static QString uiHeaderFile(const QString &uiDir, const QString &formFile); diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index e997d5e21d9..763e2bed09c 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -880,22 +880,21 @@ void Qt4Project::proFileParseError(const QString &errorMessage) Core::ICore::instance()->messageManager()->printToOutputPane(errorMessage); } -ProFileReader *Qt4Project::createProFileReader(Qt4ProFileNode *qt4ProFileNode) +ProFileReader *Qt4Project::createProFileReader(Qt4ProFileNode *qt4ProFileNode, Qt4BuildConfiguration *bc) { if (!m_proFileOption) { m_proFileOption = new ProFileOption; m_proFileOptionRefCnt = 0; - if (activeTarget() && - activeTarget()->activeBuildConfiguration()) { - QtVersion *version = activeTarget()->activeBuildConfiguration()->qtVersion(); + if (!bc && activeTarget() && activeTarget()->activeBuildConfiguration()) + bc = activeTarget()->activeBuildConfiguration(); + + if (bc) { + QtVersion *version = bc->qtVersion(); if (version->isValid()) { m_proFileOption->properties = version->versionInfo(); - if (activeTarget() - && activeTarget()->activeBuildConfiguration() - && activeTarget()->activeBuildConfiguration()->toolChain()) - m_proFileOption->sysroot - = activeTarget()->activeBuildConfiguration()->qtVersion()->systemRoot(); + if (bc->toolChain()) + m_proFileOption->sysroot = bc->qtVersion()->systemRoot(); } } diff --git a/src/plugins/qt4projectmanager/qt4project.h b/src/plugins/qt4projectmanager/qt4project.h index 1bc3b083a90..3fe2e7ffdf3 100644 --- a/src/plugins/qt4projectmanager/qt4project.h +++ b/src/plugins/qt4projectmanager/qt4project.h @@ -166,7 +166,7 @@ public: void notifyChanged(const QString &name); /// \internal - Internal::ProFileReader *createProFileReader(Internal::Qt4ProFileNode *qt4ProFileNode); + Internal::ProFileReader *createProFileReader(Internal::Qt4ProFileNode *qt4ProFileNode, Qt4BuildConfiguration *bc = 0); /// \internal void destroyProFileReader(Internal::ProFileReader *reader);