forked from qt-creator/qt-creator
Deploy related data has been moved from Run-Configuration into Deploy-Configuration. Symbian OS
Reviewed-by: Tobias Hunger
This commit is contained in:
@@ -201,6 +201,23 @@ public:
|
||||
QVariantMap update(Project *project, const QVariantMap &map);
|
||||
};
|
||||
|
||||
// Version 5 reflects the introduction of new deploy configuration for Symbian
|
||||
class Version7Handler : public UserFileVersionHandler
|
||||
{
|
||||
public:
|
||||
int userFileVersion() const
|
||||
{
|
||||
return 7;
|
||||
}
|
||||
|
||||
QString displayUserFileVersion() const
|
||||
{
|
||||
return QLatin1String("2.2pre4");
|
||||
}
|
||||
|
||||
QVariantMap update(Project *project, const QVariantMap &map);
|
||||
};
|
||||
|
||||
//
|
||||
// Helper functions:
|
||||
//
|
||||
@@ -274,6 +291,7 @@ UserFileAccessor::UserFileAccessor() :
|
||||
addVersionHandler(new Version4Handler);
|
||||
addVersionHandler(new Version5Handler);
|
||||
addVersionHandler(new Version6Handler);
|
||||
addVersionHandler(new Version7Handler);
|
||||
}
|
||||
|
||||
UserFileAccessor::~UserFileAccessor()
|
||||
@@ -1312,3 +1330,64 @@ QVariantMap Version6Handler::update(Project *, const QVariantMap &map)
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Version7Handler
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
// new implementation of DeployConfiguration
|
||||
QVariantMap Version7Handler::update(Project *, const QVariantMap &map)
|
||||
{
|
||||
QVariantMap result;
|
||||
QMapIterator<QString, QVariant> it(map);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
const QString &globalKey = it.key();
|
||||
// check for target info
|
||||
if (!globalKey.startsWith(QLatin1String("ProjectExplorer.Project.Target."))) {
|
||||
result.insert(globalKey, it.value());
|
||||
continue;
|
||||
}
|
||||
const QVariantMap &originalTarget = it.value().toMap();
|
||||
// check for symbian device target
|
||||
if (originalTarget.value(QLatin1String("ProjectExplorer.ProjectConfiguration.Id"))
|
||||
!= QLatin1String("Qt4ProjectManager.Target.S60DeviceTarget") ) {
|
||||
result.insert(globalKey, originalTarget);
|
||||
continue;
|
||||
}
|
||||
|
||||
QVariantMap newTarget;
|
||||
QMapIterator<QString, QVariant> targetIt(originalTarget);
|
||||
while (targetIt.hasNext()) {
|
||||
targetIt.next();
|
||||
const QString &targetKey = targetIt.key();
|
||||
if (targetKey.startsWith(QLatin1String("ProjectExplorer.Target.RunConfiguration."))) {
|
||||
QVariantMap newRunConfiguration;
|
||||
const QVariantMap &originalRc = targetIt.value().toMap();
|
||||
|
||||
QMapIterator<QString, QVariant> rcIt(originalRc);
|
||||
while (rcIt.hasNext()) {
|
||||
rcIt.next();
|
||||
const QString &rcKey = rcIt.key();
|
||||
// remove installation related data from RunConfiguration
|
||||
if (rcKey.startsWith(QLatin1String("Qt4ProjectManager.S60DeviceRunConfiguration.InstallationDriveLetter"))) {
|
||||
continue;
|
||||
}
|
||||
if (rcKey.startsWith(QLatin1String("Qt4ProjectManager.S60DeviceRunConfiguration.SerialPortName"))) {
|
||||
continue;
|
||||
}
|
||||
if (rcKey.startsWith(QLatin1String("Qt4ProjectManager.S60DeviceRunConfiguration.SilentInstall"))) {
|
||||
continue;
|
||||
}
|
||||
newRunConfiguration.insert(rcKey, rcIt.value());
|
||||
}
|
||||
newTarget.insert(targetKey, newRunConfiguration);
|
||||
} else {
|
||||
newTarget.insert(targetKey, targetIt.value());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
result.insert(globalKey, newTarget);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@@ -19,7 +19,9 @@ SOURCES += $$PWD/s60devices.cpp \
|
||||
$$PWD/s60createpackagestep.cpp \
|
||||
$$PWD/s60deploystep.cpp \
|
||||
$$PWD/signsisparser.cpp \
|
||||
$$PWD/passphraseforkeydialog.cpp
|
||||
$$PWD/passphraseforkeydialog.cpp \
|
||||
$$PWD/s60deployconfiguration.cpp \
|
||||
$$PWD/s60deployconfigurationwidget.cpp
|
||||
HEADERS += $$PWD/s60devices.h \
|
||||
$$PWD/s60devicespreferencepane.h \
|
||||
$$PWD/s60manager.h \
|
||||
@@ -38,6 +40,8 @@ HEADERS += $$PWD/s60devices.h \
|
||||
$$PWD/s60createpackagestep.h \
|
||||
$$PWD/s60deploystep.h \
|
||||
$$PWD/signsisparser.h \
|
||||
$$PWD/passphraseforkeydialog.h
|
||||
$$PWD/passphraseforkeydialog.h \
|
||||
$$PWD/s60deployconfiguration.h \
|
||||
$$PWD/s60deployconfigurationwidget.h
|
||||
FORMS += $$PWD/s60devicespreferencepane.ui \
|
||||
$$PWD/s60createpackagestep.ui
|
||||
|
479
src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.cpp
Normal file
479
src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.cpp
Normal file
@@ -0,0 +1,479 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "s60deployconfiguration.h"
|
||||
#include "s60deployconfigurationwidget.h"
|
||||
#include "s60devicerunconfiguration.h"
|
||||
|
||||
#include "qt4project.h"
|
||||
#include "qt4target.h"
|
||||
#include "s60devices.h"
|
||||
#include "s60manager.h"
|
||||
#include "qt4projectmanagerconstants.h"
|
||||
#include "qtversionmanager.h"
|
||||
#include "profilereader.h"
|
||||
#include "s60manager.h"
|
||||
#include "s60devices.h"
|
||||
#include "symbiandevicemanager.h"
|
||||
#include "qt4buildconfiguration.h"
|
||||
#include "qt4projectmanagerconstants.h"
|
||||
#include "s60createpackagestep.h"
|
||||
#include "qtoutputformatter.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Qt4ProjectManager;
|
||||
using namespace Qt4ProjectManager::Internal;
|
||||
|
||||
namespace {
|
||||
const char * const S60_DC_ID("Qt4ProjectManager.S60DeployConfiguration");
|
||||
const char * const S60_DC_PREFIX("Qt4ProjectManager.S60DeployConfiguration.");
|
||||
|
||||
const char * const SERIAL_PORT_NAME_KEY("Qt4ProjectManager.S60DeployConfiguration.SerialPortName");
|
||||
const char * const INSTALLATION_DRIVE_LETTER_KEY("Qt4ProjectManager.S60DeployConfiguration.InstallationDriveLetter");
|
||||
const char * const SILENT_INSTALL_KEY("Qt4ProjectManager.S60DeployConfiguration.SilentInstall");
|
||||
|
||||
QString pathFromId(const QString &id)
|
||||
{
|
||||
if (!id.startsWith(QLatin1String(S60_DC_PREFIX)))
|
||||
return QString();
|
||||
return id.mid(QString::fromLatin1(S60_DC_PREFIX).size());
|
||||
}
|
||||
|
||||
QString pathToId(const QString &path)
|
||||
{
|
||||
return QString::fromLatin1(S60_DC_PREFIX) + path;
|
||||
}
|
||||
}
|
||||
|
||||
// ======== S60DeployConfiguration
|
||||
|
||||
S60DeployConfiguration::S60DeployConfiguration(Target *parent) :
|
||||
DeployConfiguration(parent, QLatin1String(S60_DC_ID)),
|
||||
m_activeBuildConfiguration(0),
|
||||
#ifdef Q_OS_WIN
|
||||
m_serialPortName(QLatin1String("COM5")),
|
||||
#else
|
||||
m_serialPortName(QLatin1String(SymbianUtils::SymbianDeviceManager::linuxBlueToothDeviceRootC) + QLatin1Char('0')),
|
||||
#endif
|
||||
m_installationDrive('C')
|
||||
{
|
||||
ctor();
|
||||
}
|
||||
|
||||
S60DeployConfiguration::S60DeployConfiguration(Target *target, S60DeployConfiguration *source) :
|
||||
DeployConfiguration(target, source),
|
||||
m_activeBuildConfiguration(0),
|
||||
m_serialPortName(source->m_serialPortName),
|
||||
m_installationDrive(source->m_installationDrive)
|
||||
{
|
||||
ctor();
|
||||
}
|
||||
|
||||
void S60DeployConfiguration::ctor()
|
||||
{
|
||||
S60DeviceRunConfiguration* runConf = s60DeviceRunConf();
|
||||
if (runConf && !runConf->projectFilePath().isEmpty())
|
||||
setDisplayName(tr("%1 on Symbian Device").arg(QFileInfo(runConf->projectFilePath()).completeBaseName()));
|
||||
|
||||
connect(qt4Target()->qt4Project(), SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*)),
|
||||
this, SLOT(proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode*)));
|
||||
connect(qt4Target(), SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
|
||||
this, SLOT(updateActiveBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
|
||||
updateActiveBuildConfiguration(qt4Target()->activeBuildConfiguration());
|
||||
}
|
||||
|
||||
S60DeployConfiguration::~S60DeployConfiguration()
|
||||
{
|
||||
}
|
||||
|
||||
ProjectExplorer::DeployConfigurationWidget *S60DeployConfiguration::configurationWidget() const
|
||||
{
|
||||
return new S60DeployConfigurationWidget();
|
||||
}
|
||||
|
||||
void S60DeployConfiguration::proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode *pro)
|
||||
{
|
||||
S60DeviceRunConfiguration *deviceRunConf = s60DeviceRunConf();
|
||||
Q_ASSERT(deviceRunConf);
|
||||
if (deviceRunConf->projectFilePath() == pro->path())
|
||||
emit targetInformationChanged();
|
||||
}
|
||||
|
||||
QStringList S60DeployConfiguration::signedPackages() const
|
||||
{
|
||||
QList<Qt4ProFileNode *> list = qt4Target()->qt4Project()->leafProFiles();
|
||||
QStringList result;
|
||||
foreach (Qt4ProFileNode *node, list) {
|
||||
TargetInformation ti = node->targetInformation();
|
||||
if (ti.valid)
|
||||
result << ti.buildDir + QLatin1Char('/') + ti.target
|
||||
+ (runSmartInstaller() ? QLatin1String("_installer") : QLatin1String(""))
|
||||
+ QLatin1String(".sis");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QString S60DeployConfiguration::appSignedPackage() const
|
||||
{
|
||||
S60DeviceRunConfiguration *deviceRunConf = s60DeviceRunConf();
|
||||
Q_ASSERT(deviceRunConf);
|
||||
TargetInformation ti = qt4Target()->qt4Project()->rootProjectNode()->targetInformation(deviceRunConf->projectFilePath());
|
||||
if (!ti.valid)
|
||||
return QString();
|
||||
return ti.buildDir + QLatin1Char('/') + ti.target
|
||||
+ (runSmartInstaller() ? QLatin1String("_installer") : QLatin1String(""))
|
||||
+ QLatin1String(".sis");
|
||||
}
|
||||
|
||||
QStringList S60DeployConfiguration::packageFileNamesWithTargetInfo() const
|
||||
{
|
||||
QList<Qt4ProFileNode *> leafs = qt4Target()->qt4Project()->leafProFiles();
|
||||
|
||||
QStringList result;
|
||||
foreach (Qt4ProFileNode *qt4ProFileNode, leafs) {
|
||||
TargetInformation ti = qt4ProFileNode->targetInformation();
|
||||
if (!ti.valid)
|
||||
continue;
|
||||
QString baseFileName = ti.buildDir + QLatin1Char('/') + ti.target;
|
||||
baseFileName += QLatin1Char('_')
|
||||
+ (isDebug() ? QLatin1String("debug") : QLatin1String("release"))
|
||||
+ QLatin1Char('-') + symbianPlatform() + QLatin1String(".sis");
|
||||
result << baseFileName;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QStringList S60DeployConfiguration::packageTemplateFileNames() const
|
||||
{
|
||||
QList<Qt4ProFileNode *> list = qt4Target()->qt4Project()->leafProFiles();
|
||||
QStringList result;
|
||||
foreach (Qt4ProFileNode *node, list) {
|
||||
TargetInformation ti = node->targetInformation();
|
||||
if (ti.valid)
|
||||
result << ti.buildDir + QLatin1Char('/') + ti.target + QLatin1String("_template.pkg");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QString S60DeployConfiguration::appPackageTemplateFileName() const
|
||||
{
|
||||
S60DeviceRunConfiguration *deviceRunConf = s60DeviceRunConf();
|
||||
Q_ASSERT(deviceRunConf);
|
||||
TargetInformation ti = qt4Target()->qt4Project()->rootProjectNode()->targetInformation(deviceRunConf->projectFilePath());
|
||||
if (!ti.valid)
|
||||
return QString();
|
||||
return ti.buildDir + QLatin1Char('/') + ti.target + QLatin1String("_template.pkg");
|
||||
}
|
||||
|
||||
/* Grep a package file for the '.exe' file. Curently for use on Linux only
|
||||
* as the '.pkg'-files on Windows do not contain drive letters, which is not
|
||||
* handled here. \code
|
||||
; Executable and default resource files
|
||||
"./foo.exe" - "!:\sys\bin\foo.exe"
|
||||
\endcode */
|
||||
|
||||
static inline QString executableFromPackageUnix(const QString &packageFileName)
|
||||
{
|
||||
QFile packageFile(packageFileName);
|
||||
if (!packageFile.open(QIODevice::ReadOnly|QIODevice::Text))
|
||||
return QString();
|
||||
QRegExp pattern(QLatin1String("^\"(.*.exe)\" *- \"!:.*.exe\"$"));
|
||||
QTC_ASSERT(pattern.isValid(), return QString());
|
||||
foreach(const QString &line, QString::fromLocal8Bit(packageFile.readAll()).split(QLatin1Char('\n')))
|
||||
if (pattern.exactMatch(line)) {
|
||||
// Expand relative paths by package file paths
|
||||
QString rc = pattern.cap(1);
|
||||
if (rc.startsWith(QLatin1String("./")))
|
||||
rc.remove(0, 2);
|
||||
const QFileInfo fi(rc);
|
||||
if (fi.isAbsolute())
|
||||
return rc;
|
||||
return QFileInfo(packageFileName).absolutePath() + QLatin1Char('/') + rc;
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString S60DeployConfiguration::localExecutableFileName() const
|
||||
{
|
||||
QString localExecutable;
|
||||
switch (toolChainType()) {
|
||||
case ToolChain::GCCE_GNUPOC:
|
||||
case ToolChain::RVCT_ARMV5_GNUPOC:
|
||||
localExecutable = executableFromPackageUnix(appPackageTemplateFileName());
|
||||
break;
|
||||
default: {
|
||||
const QtVersion *qtv = qtVersion();
|
||||
QTC_ASSERT(qtv, return QString());
|
||||
const S60Devices::Device device = S60Manager::instance()->deviceForQtVersion(qtv);
|
||||
QTextStream(&localExecutable) << device.epocRoot << "/epoc32/release/"
|
||||
<< symbianPlatform() << '/' << symbianTarget() << '/' << targetName()
|
||||
<< ".exe";
|
||||
}
|
||||
break;
|
||||
}
|
||||
return QDir::toNativeSeparators(localExecutable);
|
||||
}
|
||||
|
||||
bool S60DeployConfiguration::runSmartInstaller() const
|
||||
{
|
||||
DeployConfiguration *dc = target()->activeDeployConfiguration();
|
||||
QTC_ASSERT(dc, return false);
|
||||
BuildStepList *bsl = dc->stepList();
|
||||
QTC_ASSERT(bsl, return false);
|
||||
QList<BuildStep *> steps = bsl->steps();
|
||||
foreach (const BuildStep *step, steps) {
|
||||
if (const S60CreatePackageStep *packageStep = qobject_cast<const S60CreatePackageStep *>(step)) {
|
||||
return packageStep->createsSmartInstaller();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
ProjectExplorer::ToolChain::ToolChainType S60DeployConfiguration::toolChainType() const
|
||||
{
|
||||
if (Qt4BuildConfiguration *bc = qobject_cast<Qt4BuildConfiguration *>(target()->activeBuildConfiguration()))
|
||||
return bc->toolChainType();
|
||||
return ProjectExplorer::ToolChain::INVALID;
|
||||
}
|
||||
|
||||
QString S60DeployConfiguration::targetName() const
|
||||
{
|
||||
S60DeviceRunConfiguration *deviceRunConf = s60DeviceRunConf();
|
||||
Q_ASSERT(deviceRunConf);
|
||||
TargetInformation ti = qt4Target()->qt4Project()->rootProjectNode()->targetInformation(deviceRunConf->projectFilePath());
|
||||
if (!ti.valid)
|
||||
return QString();
|
||||
return ti.target;
|
||||
}
|
||||
|
||||
QString S60DeployConfiguration::symbianPlatform() const
|
||||
{
|
||||
const Qt4BuildConfiguration *qt4bc = qt4Target()->activeBuildConfiguration();
|
||||
switch (qt4bc->toolChainType()) {
|
||||
case ToolChain::GCCE:
|
||||
case ToolChain::GCCE_GNUPOC:
|
||||
return QLatin1String("gcce");
|
||||
case ToolChain::RVCT_ARMV5:
|
||||
return QLatin1String("armv5");
|
||||
default: // including ToolChain::RVCT_ARMV6_GNUPOC:
|
||||
return QLatin1String("armv6");
|
||||
}
|
||||
}
|
||||
|
||||
bool S60DeployConfiguration::isDebug() const
|
||||
{
|
||||
const Qt4BuildConfiguration *qt4bc = qt4Target()->activeBuildConfiguration();
|
||||
return (qt4bc->qmakeBuildConfiguration() & QtVersion::DebugBuild);
|
||||
}
|
||||
|
||||
QString S60DeployConfiguration::symbianTarget() const
|
||||
{
|
||||
return isDebug() ? QLatin1String("udeb") : QLatin1String("urel");
|
||||
}
|
||||
|
||||
const QtVersion *S60DeployConfiguration::qtVersion() const
|
||||
{
|
||||
if (const BuildConfiguration *bc = target()->activeBuildConfiguration())
|
||||
if (const Qt4BuildConfiguration *qt4bc = qobject_cast<const Qt4BuildConfiguration *>(bc))
|
||||
return qt4bc->qtVersion();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void S60DeployConfiguration::updateActiveBuildConfiguration(ProjectExplorer::BuildConfiguration *buildConfiguration)
|
||||
{
|
||||
if (m_activeBuildConfiguration)
|
||||
disconnect(m_activeBuildConfiguration, SIGNAL(s60CreatesSmartInstallerChanged()),
|
||||
this, SIGNAL(targetInformationChanged()));
|
||||
m_activeBuildConfiguration = buildConfiguration;
|
||||
if (m_activeBuildConfiguration)
|
||||
connect(m_activeBuildConfiguration, SIGNAL(s60CreatesSmartInstallerChanged()),
|
||||
this, SIGNAL(targetInformationChanged()));
|
||||
}
|
||||
|
||||
S60DeviceRunConfiguration* S60DeployConfiguration::s60DeviceRunConf() const
|
||||
{
|
||||
const char * const S60_DEVICE_RC_ID("Qt4ProjectManager.S60DeviceRunConfiguration");
|
||||
|
||||
foreach( RunConfiguration *runConf, qt4Target()->runConfigurations() )
|
||||
if (runConf->id() == QLatin1String(S60_DEVICE_RC_ID))
|
||||
return qobject_cast<S60DeviceRunConfiguration *>(runConf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
QVariantMap S60DeployConfiguration::toMap() const
|
||||
{
|
||||
QVariantMap map(ProjectExplorer::DeployConfiguration::toMap());
|
||||
map.insert(QLatin1String(SERIAL_PORT_NAME_KEY), m_serialPortName);
|
||||
map.insert(QLatin1String(INSTALLATION_DRIVE_LETTER_KEY), QChar(m_installationDrive));
|
||||
map.insert(QLatin1String(SILENT_INSTALL_KEY), QVariant(m_silentInstall));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
bool S60DeployConfiguration::fromMap(const QVariantMap &map)
|
||||
{
|
||||
m_serialPortName = map.value(QLatin1String(SERIAL_PORT_NAME_KEY)).toString().trimmed();
|
||||
m_installationDrive = map.value(QLatin1String(INSTALLATION_DRIVE_LETTER_KEY), QChar('C'))
|
||||
.toChar().toAscii();
|
||||
m_silentInstall = map.value(QLatin1String(SILENT_INSTALL_KEY), QVariant(true)).toBool();
|
||||
return DeployConfiguration::fromMap(map);
|
||||
}
|
||||
|
||||
Qt4Target *S60DeployConfiguration::qt4Target() const
|
||||
{
|
||||
return static_cast<Qt4Target *>(target());
|
||||
}
|
||||
|
||||
QString S60DeployConfiguration::serialPortName() const
|
||||
{
|
||||
return m_serialPortName;
|
||||
}
|
||||
|
||||
void S60DeployConfiguration::setSerialPortName(const QString &name)
|
||||
{
|
||||
const QString &candidate = name.trimmed();
|
||||
if (m_serialPortName == candidate)
|
||||
return;
|
||||
m_serialPortName = candidate;
|
||||
emit serialPortNameChanged();
|
||||
}
|
||||
|
||||
char S60DeployConfiguration::installationDrive() const
|
||||
{
|
||||
return m_installationDrive;
|
||||
}
|
||||
|
||||
void S60DeployConfiguration::setInstallationDrive(char drive)
|
||||
{
|
||||
m_installationDrive = drive;
|
||||
}
|
||||
|
||||
bool S60DeployConfiguration::silentInstall() const
|
||||
{
|
||||
return m_silentInstall;
|
||||
}
|
||||
|
||||
void S60DeployConfiguration::setSilentInstall(bool silent)
|
||||
{
|
||||
m_silentInstall = silent;
|
||||
}
|
||||
|
||||
// ======== S60DeployConfigurationFactory
|
||||
|
||||
S60DeployConfigurationFactory::S60DeployConfigurationFactory(QObject *parent) :
|
||||
DeployConfigurationFactory(parent)
|
||||
{
|
||||
}
|
||||
|
||||
S60DeployConfigurationFactory::~S60DeployConfigurationFactory()
|
||||
{
|
||||
}
|
||||
|
||||
QStringList S60DeployConfigurationFactory::availableCreationIds(Target *parent) const
|
||||
{
|
||||
Qt4Target *target = qobject_cast<Qt4Target *>(parent);
|
||||
if (!target ||
|
||||
target->id() != QLatin1String(Constants::S60_DEVICE_TARGET_ID))
|
||||
return QStringList();
|
||||
|
||||
return target->qt4Project()->applicationProFilePathes(QLatin1String(S60_DC_PREFIX));
|
||||
}
|
||||
|
||||
QString S60DeployConfigurationFactory::displayNameForId(const QString &id) const
|
||||
{
|
||||
if (!pathFromId(id).isEmpty())
|
||||
return tr("%1 on Symbian Device").arg(QFileInfo(pathFromId(id)).completeBaseName());
|
||||
return QString();
|
||||
}
|
||||
|
||||
DeployConfiguration *S60DeployConfigurationFactory::create(Target *parent, const QString &id)
|
||||
{
|
||||
if (!canCreate(parent, id))
|
||||
return 0;
|
||||
|
||||
Qt4Target *t(static_cast<Qt4Target *>(parent));
|
||||
return new S60DeployConfiguration(t);
|
||||
}
|
||||
|
||||
bool S60DeployConfigurationFactory::canCreate(Target *parent, const QString& /*id*/) const
|
||||
{
|
||||
Qt4Target * t(qobject_cast<Qt4Target *>(parent));
|
||||
if (!t ||
|
||||
t->id() != QLatin1String(Constants::S60_DEVICE_TARGET_ID))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool S60DeployConfigurationFactory::canRestore(Target *parent, const QVariantMap& /*map*/) const
|
||||
{
|
||||
Qt4Target * t(qobject_cast<Qt4Target *>(parent));
|
||||
return t &&
|
||||
t->id() == QLatin1String(Constants::S60_DEVICE_TARGET_ID);
|
||||
}
|
||||
|
||||
DeployConfiguration *S60DeployConfigurationFactory::restore(Target *parent, const QVariantMap &map)
|
||||
{
|
||||
if (!canRestore(parent, map))
|
||||
return 0;
|
||||
Qt4Target *t(static_cast<Qt4Target *>(parent));
|
||||
S60DeployConfiguration *dc(new S60DeployConfiguration(t));
|
||||
if (dc->fromMap(map))
|
||||
return dc;
|
||||
|
||||
delete dc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool S60DeployConfigurationFactory::canClone(Target *parent, DeployConfiguration *source) const
|
||||
{
|
||||
if (!qobject_cast<Qt4Target *>(parent))
|
||||
return false;
|
||||
return source->id() == QLatin1String(S60_DC_ID);
|
||||
}
|
||||
|
||||
DeployConfiguration *S60DeployConfigurationFactory::clone(Target *parent, DeployConfiguration *source)
|
||||
{
|
||||
if (!canClone(parent, source))
|
||||
return 0;
|
||||
Qt4Target *t = static_cast<Qt4Target *>(parent);
|
||||
S60DeployConfiguration * old(static_cast<S60DeployConfiguration *>(source));
|
||||
return new S60DeployConfiguration(t, old);
|
||||
}
|
134
src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.h
Normal file
134
src/plugins/qt4projectmanager/qt-s60/s60deployconfiguration.h
Normal file
@@ -0,0 +1,134 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef S60DEPLOYCONFIGURATION_H
|
||||
#define S60DEPLOYCONFIGURATION_H
|
||||
|
||||
#include <projectexplorer/deployconfiguration.h>
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
class QtVersion;
|
||||
|
||||
namespace Internal {
|
||||
class Qt4ProFileNode;
|
||||
class Qt4Target;
|
||||
class S60DeployConfigurationFactory;
|
||||
class S60DeviceRunConfiguration;
|
||||
|
||||
class S60DeployConfiguration : public ProjectExplorer::DeployConfiguration
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class S60DeployConfigurationFactory;
|
||||
|
||||
public:
|
||||
S60DeployConfiguration(ProjectExplorer::Target *parent);
|
||||
virtual ~S60DeployConfiguration();
|
||||
|
||||
bool isEnabled(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
|
||||
ProjectExplorer::DeployConfigurationWidget *configurationWidget() const;
|
||||
|
||||
QString targetName() const;
|
||||
const QtVersion *qtVersion() const;
|
||||
Qt4Target *qt4Target() const;
|
||||
ProjectExplorer::ToolChain::ToolChainType toolChainType() const;
|
||||
|
||||
QString serialPortName() const;
|
||||
void setSerialPortName(const QString &name);
|
||||
|
||||
char installationDrive() const;
|
||||
void setInstallationDrive(char drive);
|
||||
|
||||
bool silentInstall() const;
|
||||
void setSilentInstall(bool silent);
|
||||
|
||||
QStringList signedPackages() const;
|
||||
QString appSignedPackage() const;
|
||||
QStringList packageFileNamesWithTargetInfo() const;
|
||||
QStringList packageTemplateFileNames() const;
|
||||
QString appPackageTemplateFileName() const;
|
||||
QString localExecutableFileName() const;
|
||||
|
||||
QVariantMap toMap() const;
|
||||
|
||||
signals:
|
||||
void targetInformationChanged();
|
||||
void serialPortNameChanged();
|
||||
|
||||
private slots:
|
||||
void updateActiveBuildConfiguration(ProjectExplorer::BuildConfiguration *buildConfiguration);
|
||||
void proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode *pro);
|
||||
|
||||
protected:
|
||||
S60DeployConfiguration(ProjectExplorer::Target *parent, S60DeployConfiguration *source);
|
||||
virtual bool fromMap(const QVariantMap &map);
|
||||
|
||||
private:
|
||||
void ctor();
|
||||
S60DeviceRunConfiguration* s60DeviceRunConf() const;
|
||||
bool runSmartInstaller() const;
|
||||
QString symbianPlatform() const;
|
||||
QString symbianTarget() const;
|
||||
bool isDebug() const;
|
||||
|
||||
private:
|
||||
ProjectExplorer::BuildConfiguration *m_activeBuildConfiguration;
|
||||
QString m_serialPortName;
|
||||
|
||||
char m_installationDrive;
|
||||
bool m_silentInstall;
|
||||
};
|
||||
|
||||
class S60DeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit S60DeployConfigurationFactory(QObject *parent = 0);
|
||||
~S60DeployConfigurationFactory();
|
||||
|
||||
bool canCreate(ProjectExplorer::Target *parent, const QString &id) const;
|
||||
ProjectExplorer::DeployConfiguration *create(ProjectExplorer::Target *parent, const QString &id);
|
||||
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
|
||||
ProjectExplorer::DeployConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
|
||||
bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::DeployConfiguration *source) const;
|
||||
ProjectExplorer::DeployConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::DeployConfiguration *source);
|
||||
|
||||
QStringList availableCreationIds(ProjectExplorer::Target *parent) const;
|
||||
// used to translate the ids to names to display to the user
|
||||
QString displayNameForId(const QString &id) const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qt4ProjectManager
|
||||
|
||||
#endif // S60DEPLOYCONFIGURATION_H
|
@@ -0,0 +1,331 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "s60deployconfigurationwidget.h"
|
||||
#include "s60deployconfiguration.h"
|
||||
#include "s60devicerunconfiguration.h"
|
||||
|
||||
#include "s60runconfigbluetoothstarter.h"
|
||||
#include "bluetoothlistener_gui.h"
|
||||
#include "s60manager.h"
|
||||
#include "launcher.h"
|
||||
#include "bluetoothlistener.h"
|
||||
#include "symbiandevicemanager.h"
|
||||
|
||||
#include <utils/detailswidget.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/pathchooser.h>
|
||||
|
||||
#include <QtCore/QDir>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QLineEdit>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
#include <QtGui/QHBoxLayout>
|
||||
#include <QtGui/QFormLayout>
|
||||
#include <QtGui/QToolButton>
|
||||
#include <QtGui/QStyle>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QSpacerItem>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QCheckBox>
|
||||
|
||||
Q_DECLARE_METATYPE(SymbianUtils::SymbianDevice)
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
const char STARTING_DRIVE_LETTER = 'C';
|
||||
const char LAST_DRIVE_LETTER = 'Z';
|
||||
|
||||
S60DeployConfigurationWidget::S60DeployConfigurationWidget(QWidget *parent)
|
||||
: ProjectExplorer::DeployConfigurationWidget(parent),
|
||||
m_detailsWidget(new Utils::DetailsWidget),
|
||||
m_serialPortsCombo(new QComboBox),
|
||||
m_sisFileLabel(new QLabel),
|
||||
m_deviceInfoButton(new QToolButton),
|
||||
m_deviceInfoDescriptionLabel(new QLabel(tr("Device:"))),
|
||||
m_deviceInfoLabel(new QLabel),
|
||||
m_installationDriveCombo(new QComboBox()),
|
||||
m_silentInstallCheckBox(new QCheckBox(tr("Silent installation")))
|
||||
{
|
||||
}
|
||||
|
||||
S60DeployConfigurationWidget::~S60DeployConfigurationWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void S60DeployConfigurationWidget::init(ProjectExplorer::DeployConfiguration *dc)
|
||||
{
|
||||
m_deployConfiguration = qobject_cast<S60DeployConfiguration *>(dc);
|
||||
|
||||
m_detailsWidget->setState(Utils::DetailsWidget::NoSummary);
|
||||
|
||||
QVBoxLayout *mainBoxLayout = new QVBoxLayout();
|
||||
mainBoxLayout->setMargin(0);
|
||||
setLayout(mainBoxLayout);
|
||||
mainBoxLayout->addWidget(m_detailsWidget);
|
||||
QWidget *detailsContainer = new QWidget;
|
||||
m_detailsWidget->setWidget(detailsContainer);
|
||||
|
||||
QVBoxLayout *detailsBoxLayout = new QVBoxLayout();
|
||||
detailsBoxLayout->setMargin(0);
|
||||
detailsContainer->setLayout(detailsBoxLayout);
|
||||
|
||||
QFormLayout *formLayout = new QFormLayout();
|
||||
formLayout->setMargin(0);
|
||||
detailsBoxLayout->addLayout(formLayout);
|
||||
formLayout->addRow(tr("Installation file:"), m_sisFileLabel);
|
||||
|
||||
// Installation Drive control
|
||||
updateInstallationDrives();
|
||||
|
||||
QHBoxLayout *installationBoxLayout = new QHBoxLayout();
|
||||
m_installationDriveCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
connect(m_installationDriveCombo, SIGNAL(activated(int)), this, SLOT(setInstallationDrive(int)));
|
||||
QHBoxLayout *installationDriveHBoxLayout = new QHBoxLayout;
|
||||
installationDriveHBoxLayout->addWidget(m_installationDriveCombo);
|
||||
installationBoxLayout->addLayout(installationDriveHBoxLayout);
|
||||
|
||||
// Non-silent installs are a fallback if one wants to override missing dependencies.
|
||||
m_silentInstallCheckBox->setChecked(m_deployConfiguration->silentInstall());
|
||||
m_silentInstallCheckBox->setToolTip(tr("Silent installation is an installation mode "
|
||||
"that does not require user's intervention. "
|
||||
"In case it fails the non silent installation is launched."));
|
||||
connect(m_silentInstallCheckBox, SIGNAL(stateChanged(int)), this, SLOT(silentInstallChanged(int)));
|
||||
installationBoxLayout->addWidget(m_silentInstallCheckBox);
|
||||
installationBoxLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored));
|
||||
formLayout->addRow(tr("Installation drive:"), installationBoxLayout);
|
||||
|
||||
updateSerialDevices();
|
||||
connect(SymbianUtils::SymbianDeviceManager::instance(), SIGNAL(updated()),
|
||||
this, SLOT(updateSerialDevices()));
|
||||
// Serial devices control
|
||||
m_serialPortsCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
connect(m_serialPortsCombo, SIGNAL(activated(int)), this, SLOT(setSerialPort(int)));
|
||||
QHBoxLayout *serialPortHBoxLayout = new QHBoxLayout;
|
||||
serialPortHBoxLayout->addWidget(m_serialPortsCombo);
|
||||
serialPortHBoxLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored));
|
||||
|
||||
#ifndef Q_OS_WIN
|
||||
// Update device list: on Linux only.
|
||||
QToolButton *updateSerialDevicesButton(new QToolButton);
|
||||
updateSerialDevicesButton->setIcon(qApp->style()->standardIcon(QStyle::SP_BrowserReload));
|
||||
connect(updateSerialDevicesButton, SIGNAL(clicked()),
|
||||
SymbianUtils::SymbianDeviceManager::instance(), SLOT(update()));
|
||||
serialPortHBoxLayout->addWidget(updateSerialDevicesButton);
|
||||
#endif
|
||||
|
||||
formLayout->addRow(tr("Device on serial port:"), serialPortHBoxLayout);
|
||||
|
||||
// Device Info with button. Widgets are enabled in above call to updateSerialDevices()
|
||||
QHBoxLayout *infoHBoxLayout = new QHBoxLayout;
|
||||
m_deviceInfoLabel->setWordWrap(true);
|
||||
m_deviceInfoLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
|
||||
infoHBoxLayout->addWidget(m_deviceInfoLabel);
|
||||
infoHBoxLayout->addWidget(m_deviceInfoButton);
|
||||
m_deviceInfoButton->setIcon(qApp->style()->standardIcon(QStyle::SP_MessageBoxInformation));
|
||||
m_deviceInfoButton->setToolTip(tr("Queries the device for information"));
|
||||
connect(m_deviceInfoButton, SIGNAL(clicked()), this, SLOT(updateDeviceInfo()));
|
||||
formLayout->addRow(m_deviceInfoDescriptionLabel, infoHBoxLayout);
|
||||
updateTargetInformation();
|
||||
connect(m_deployConfiguration, SIGNAL(targetInformationChanged()),
|
||||
this, SLOT(updateTargetInformation()));
|
||||
}
|
||||
|
||||
void S60DeployConfigurationWidget::updateInstallationDrives()
|
||||
{
|
||||
m_installationDriveCombo->clear();
|
||||
for (int i = STARTING_DRIVE_LETTER; i <= LAST_DRIVE_LETTER; ++i) {
|
||||
m_installationDriveCombo->addItem(QString("%1:").arg((char)i), qVariantFromValue(i));
|
||||
}
|
||||
ushort installationDrive = m_deployConfiguration->installationDrive();
|
||||
int index = QChar::toUpper(installationDrive) - STARTING_DRIVE_LETTER;
|
||||
|
||||
Q_ASSERT(index >= 0 && index <= LAST_DRIVE_LETTER-STARTING_DRIVE_LETTER);
|
||||
|
||||
m_installationDriveCombo->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
void S60DeployConfigurationWidget::silentInstallChanged(int state)
|
||||
{
|
||||
m_deployConfiguration->setSilentInstall(state == Qt::Checked);
|
||||
}
|
||||
|
||||
void S60DeployConfigurationWidget::updateSerialDevices()
|
||||
{
|
||||
m_serialPortsCombo->clear();
|
||||
clearDeviceInfo();
|
||||
const QString previouPortName = m_deployConfiguration->serialPortName();
|
||||
const QList<SymbianUtils::SymbianDevice> devices = SymbianUtils::SymbianDeviceManager::instance()->devices();
|
||||
int newIndex = -1;
|
||||
for (int i = 0; i < devices.size(); ++i) {
|
||||
const SymbianUtils::SymbianDevice &device = devices.at(i);
|
||||
m_serialPortsCombo->addItem(device.friendlyName(), qVariantFromValue(device));
|
||||
if (device.portName() == previouPortName)
|
||||
newIndex = i;
|
||||
}
|
||||
// Set new index: prefer to keep old or set to 0, if available.
|
||||
if (newIndex == -1 && !devices.empty())
|
||||
newIndex = 0;
|
||||
m_serialPortsCombo->setCurrentIndex(newIndex);
|
||||
if (newIndex == -1) {
|
||||
m_deviceInfoButton->setEnabled(false);
|
||||
m_deployConfiguration->setSerialPortName(QString());
|
||||
} else {
|
||||
m_deviceInfoButton->setEnabled(true);
|
||||
const QString newPortName = device(newIndex).portName();
|
||||
m_deployConfiguration->setSerialPortName(newPortName);
|
||||
}
|
||||
}
|
||||
|
||||
SymbianUtils::SymbianDevice S60DeployConfigurationWidget::device(int i) const
|
||||
{
|
||||
const QVariant data = m_serialPortsCombo->itemData(i);
|
||||
if (data.isValid() && qVariantCanConvert<SymbianUtils::SymbianDevice>(data))
|
||||
return qVariantValue<SymbianUtils::SymbianDevice>(data);
|
||||
return SymbianUtils::SymbianDevice();
|
||||
}
|
||||
|
||||
SymbianUtils::SymbianDevice S60DeployConfigurationWidget::currentDevice() const
|
||||
{
|
||||
return device(m_serialPortsCombo->currentIndex());
|
||||
}
|
||||
|
||||
void S60DeployConfigurationWidget::updateTargetInformation()
|
||||
{
|
||||
QString package;
|
||||
if (m_deployConfiguration->signedPackages().count())
|
||||
package = m_deployConfiguration->signedPackages()[0];
|
||||
m_sisFileLabel->setText(QDir::toNativeSeparators(package));
|
||||
}
|
||||
|
||||
void S60DeployConfigurationWidget::setInstallationDrive(int index)
|
||||
{
|
||||
m_deployConfiguration->setInstallationDrive((char)(STARTING_DRIVE_LETTER + index));
|
||||
}
|
||||
|
||||
void S60DeployConfigurationWidget::setSerialPort(int index)
|
||||
{
|
||||
const SymbianUtils::SymbianDevice d = device(index);
|
||||
m_deployConfiguration->setSerialPortName(d.portName());
|
||||
m_deviceInfoButton->setEnabled(index >= 0);
|
||||
clearDeviceInfo();
|
||||
}
|
||||
|
||||
void S60DeployConfigurationWidget::clearDeviceInfo()
|
||||
{
|
||||
// Restore text & color
|
||||
m_deviceInfoLabel->clear();
|
||||
m_deviceInfoLabel->setStyleSheet(QString());
|
||||
}
|
||||
|
||||
void S60DeployConfigurationWidget::setDeviceInfoLabel(const QString &message, bool isError)
|
||||
{
|
||||
m_deviceInfoLabel->setStyleSheet(isError ?
|
||||
QString(QLatin1String("background-color: red;")) :
|
||||
QString());
|
||||
m_deviceInfoLabel->setText(message);
|
||||
m_deviceInfoLabel->adjustSize();
|
||||
}
|
||||
|
||||
void S60DeployConfigurationWidget::slotLauncherStateChanged(int s)
|
||||
{
|
||||
switch (s) {
|
||||
case trk::Launcher::WaitingForTrk: {
|
||||
// Entered trk wait state..open message box
|
||||
QMessageBox *mb = S60DeviceRunControlBase::createTrkWaitingMessageBox(m_infoLauncher->trkServerName(), this);
|
||||
connect(m_infoLauncher, SIGNAL(stateChanged(int)), mb, SLOT(close()));
|
||||
connect(mb, SIGNAL(finished(int)), this, SLOT(slotWaitingForTrkClosed()));
|
||||
mb->open();
|
||||
}
|
||||
break;
|
||||
case trk::Launcher::DeviceDescriptionReceived: // All ok, done
|
||||
setDeviceInfoLabel(m_infoLauncher->deviceDescription());
|
||||
m_deviceInfoButton->setEnabled(true);
|
||||
m_infoLauncher->deleteLater();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void S60DeployConfigurationWidget::slotWaitingForTrkClosed()
|
||||
{
|
||||
if (m_infoLauncher && m_infoLauncher->state() == trk::Launcher::WaitingForTrk) {
|
||||
m_infoLauncher->deleteLater();
|
||||
clearDeviceInfo();
|
||||
m_deviceInfoButton->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void S60DeployConfigurationWidget::updateDeviceInfo()
|
||||
{
|
||||
QTC_ASSERT(!m_infoLauncher, return)
|
||||
setDeviceInfoLabel(tr("Connecting..."));
|
||||
// Do a launcher run with the ping protocol. Prompt to connect and
|
||||
// go asynchronous afterwards to pop up launch trk box if a timeout occurs.
|
||||
QString message;
|
||||
const SymbianUtils::SymbianDevice commDev = currentDevice();
|
||||
m_infoLauncher = trk::Launcher::acquireFromDeviceManager(commDev.portName(), this, &message);
|
||||
if (!m_infoLauncher) {
|
||||
setDeviceInfoLabel(message, true);
|
||||
return;
|
||||
}
|
||||
connect(m_infoLauncher, SIGNAL(stateChanged(int)), this, SLOT(slotLauncherStateChanged(int)));
|
||||
|
||||
m_infoLauncher->setSerialFrame(commDev.type() == SymbianUtils::SerialPortCommunication);
|
||||
m_infoLauncher->setTrkServerName(commDev.portName());
|
||||
|
||||
// Prompt user
|
||||
const trk::PromptStartCommunicationResult src =
|
||||
S60RunConfigBluetoothStarter::startCommunication(m_infoLauncher->trkDevice(),
|
||||
this, &message);
|
||||
switch (src) {
|
||||
case trk::PromptStartCommunicationConnected:
|
||||
break;
|
||||
case trk::PromptStartCommunicationCanceled:
|
||||
clearDeviceInfo();
|
||||
m_infoLauncher->deleteLater();
|
||||
return;
|
||||
case trk::PromptStartCommunicationError:
|
||||
setDeviceInfoLabel(message, true);
|
||||
m_infoLauncher->deleteLater();
|
||||
return;
|
||||
};
|
||||
if (!m_infoLauncher->startServer(&message)) {
|
||||
setDeviceInfoLabel(message, true);
|
||||
m_infoLauncher->deleteLater();
|
||||
return;
|
||||
}
|
||||
// Wait for either timeout or results
|
||||
m_deviceInfoButton->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qt4ProjectManager
|
@@ -0,0 +1,108 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef S60DEPLOYCONFIGURATIONWIDGET_H
|
||||
#define S60DEPLOYCONFIGURATIONWIDGET_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtCore/QPointer>
|
||||
|
||||
#include <projectexplorer/deployconfiguration.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QComboBox;
|
||||
class QToolButton;
|
||||
class QCheckBox;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils {
|
||||
class DetailsWidget;
|
||||
}
|
||||
|
||||
namespace trk {
|
||||
class Launcher;
|
||||
}
|
||||
|
||||
namespace SymbianUtils {
|
||||
class SymbianDevice;
|
||||
}
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class S60DeployConfiguration;
|
||||
|
||||
/* Configuration widget for S60 devices on serial ports that are
|
||||
* provided by the SerialDeviceLister class. Has an info/test
|
||||
* button connecting to the device and showing info. */
|
||||
class S60DeployConfigurationWidget : public ProjectExplorer::DeployConfigurationWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit S60DeployConfigurationWidget(QWidget *parent = 0);
|
||||
~S60DeployConfigurationWidget();
|
||||
|
||||
void init(ProjectExplorer::DeployConfiguration *dc);
|
||||
|
||||
private slots:
|
||||
void updateTargetInformation();
|
||||
void updateInstallationDrives();
|
||||
void updateSerialDevices();
|
||||
void setInstallationDrive(int index);
|
||||
void setSerialPort(int index);
|
||||
void updateDeviceInfo();
|
||||
void clearDeviceInfo();
|
||||
void slotLauncherStateChanged(int);
|
||||
void slotWaitingForTrkClosed();
|
||||
void silentInstallChanged(int);
|
||||
|
||||
private:
|
||||
inline SymbianUtils::SymbianDevice device(int i) const;
|
||||
inline SymbianUtils::SymbianDevice currentDevice() const;
|
||||
|
||||
void setDeviceInfoLabel(const QString &message, bool isError = false);
|
||||
|
||||
S60DeployConfiguration *m_deployConfiguration;
|
||||
Utils::DetailsWidget *m_detailsWidget;
|
||||
QComboBox *m_serialPortsCombo;
|
||||
QLabel *m_sisFileLabel;
|
||||
QToolButton *m_deviceInfoButton;
|
||||
QLabel *m_deviceInfoDescriptionLabel;
|
||||
QLabel *m_deviceInfoLabel;
|
||||
QPointer<trk::Launcher> m_infoLauncher;
|
||||
QComboBox *m_installationDriveCombo;
|
||||
QCheckBox *m_silentInstallCheckBox;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qt4ProjectManager
|
||||
|
||||
#endif // S60DEPLOYCONFIGURATIONWIDGET_H
|
@@ -30,6 +30,7 @@
|
||||
#include "s60deploystep.h"
|
||||
|
||||
#include "qt4buildconfiguration.h"
|
||||
#include "s60deployconfiguration.h"
|
||||
#include "s60devicerunconfiguration.h"
|
||||
#include "symbiandevicemanager.h"
|
||||
#include "s60runconfigbluetoothstarter.h"
|
||||
@@ -112,18 +113,15 @@ S60DeployStep::~S60DeployStep()
|
||||
bool S60DeployStep::init()
|
||||
{
|
||||
Qt4BuildConfiguration *bc = static_cast<Qt4BuildConfiguration *>(buildConfiguration());
|
||||
S60DeviceRunConfiguration* runConfiguration = static_cast<S60DeviceRunConfiguration *>(bc->target()->activeRunConfiguration());
|
||||
|
||||
if(!runConfiguration) {
|
||||
S60DeployConfiguration* deployConfiguration = static_cast<S60DeployConfiguration *>(bc->target()->activeDeployConfiguration());
|
||||
if(!deployConfiguration)
|
||||
return false;
|
||||
}
|
||||
m_serialPortName = runConfiguration->serialPortName();
|
||||
m_serialPortName = deployConfiguration->serialPortName();
|
||||
m_serialPortFriendlyName = SymbianUtils::SymbianDeviceManager::instance()->friendlyNameForPort(m_serialPortName);
|
||||
m_packageFileNamesWithTarget = runConfiguration->packageFileNamesWithTargetInfo();
|
||||
m_signedPackages = runConfiguration->signedPackages();
|
||||
|
||||
m_installationDrive = runConfiguration->installationDrive();
|
||||
m_silentInstall = runConfiguration->silentInstall();
|
||||
m_packageFileNamesWithTarget = deployConfiguration->packageFileNamesWithTargetInfo();
|
||||
m_signedPackages = deployConfiguration->signedPackages();
|
||||
m_installationDrive = deployConfiguration->installationDrive();
|
||||
m_silentInstall = deployConfiguration->silentInstall();
|
||||
|
||||
setDisplayName(tr("Deploy", "Qt4 DeployStep display name."));
|
||||
QString message;
|
||||
|
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "s60devicerunconfiguration.h"
|
||||
#include "s60devicerunconfigurationwidget.h"
|
||||
#include "s60deployconfiguration.h"
|
||||
#include "qt4project.h"
|
||||
#include "qt4target.h"
|
||||
#include "qtversionmanager.h"
|
||||
@@ -70,11 +71,8 @@ const char * const S60_DEVICE_RC_ID("Qt4ProjectManager.S60DeviceRunConfiguration
|
||||
const char * const S60_DEVICE_RC_PREFIX("Qt4ProjectManager.S60DeviceRunConfiguration.");
|
||||
|
||||
const char * const PRO_FILE_KEY("Qt4ProjectManager.S60DeviceRunConfiguration.ProFile");
|
||||
const char * const SERIAL_PORT_NAME_KEY("Qt4ProjectManager.S60DeviceRunConfiguration.SerialPortName");
|
||||
const char * const COMMUNICATION_TYPE_KEY("Qt4ProjectManager.S60DeviceRunConfiguration.CommunicationType");
|
||||
const char * const COMMAND_LINE_ARGUMENTS_KEY("Qt4ProjectManager.S60DeviceRunConfiguration.CommandLineArguments");
|
||||
const char * const INSTALLATION_DRIVE_LETTER_KEY("Qt4ProjectManager.S60DeviceRunConfiguration.InstallationDriveLetter");
|
||||
const char * const SILENT_INSTALL_KEY("Qt4ProjectManager.S60DeviceRunConfiguration.SilentInstall");
|
||||
|
||||
const int PROGRESS_DEPLOYBASE = 0;
|
||||
const int PROGRESS_PACKAGEDEPLOYED = 100;
|
||||
@@ -115,14 +113,7 @@ QString pathToId(const QString &path)
|
||||
|
||||
S60DeviceRunConfiguration::S60DeviceRunConfiguration(Target *parent, const QString &proFilePath) :
|
||||
RunConfiguration(parent, QLatin1String(S60_DEVICE_RC_ID)),
|
||||
m_proFilePath(proFilePath),
|
||||
m_activeBuildConfiguration(0),
|
||||
#ifdef Q_OS_WIN
|
||||
m_serialPortName(QLatin1String("COM5")),
|
||||
#else
|
||||
m_serialPortName(QLatin1String(SymbianUtils::SymbianDeviceManager::linuxBlueToothDeviceRootC) + QLatin1Char('0')),
|
||||
#endif
|
||||
m_installationDrive('C')
|
||||
m_proFilePath(proFilePath)
|
||||
{
|
||||
ctor();
|
||||
}
|
||||
@@ -130,9 +121,7 @@ S60DeviceRunConfiguration::S60DeviceRunConfiguration(Target *parent, const QStri
|
||||
S60DeviceRunConfiguration::S60DeviceRunConfiguration(Target *target, S60DeviceRunConfiguration *source) :
|
||||
RunConfiguration(target, source),
|
||||
m_proFilePath(source->m_proFilePath),
|
||||
m_activeBuildConfiguration(0),
|
||||
m_serialPortName(source->m_serialPortName),
|
||||
m_installationDrive(source->m_installationDrive)
|
||||
m_commandLineArguments(source->m_commandLineArguments)
|
||||
{
|
||||
ctor();
|
||||
}
|
||||
@@ -143,12 +132,6 @@ void S60DeviceRunConfiguration::ctor()
|
||||
setDisplayName(tr("%1 on Symbian Device").arg(QFileInfo(m_proFilePath).completeBaseName()));
|
||||
else
|
||||
setDisplayName(tr("QtS60DeviceRunConfiguration"));
|
||||
|
||||
connect(qt4Target()->qt4Project(), SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*)),
|
||||
this, SLOT(proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode*)));
|
||||
connect(qt4Target(), SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
|
||||
this, SLOT(updateActiveBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
|
||||
updateActiveBuildConfiguration(qt4Target()->activeBuildConfiguration());
|
||||
}
|
||||
|
||||
void S60DeviceRunConfiguration::proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode *pro)
|
||||
@@ -157,17 +140,6 @@ void S60DeviceRunConfiguration::proFileUpdate(Qt4ProjectManager::Internal::Qt4Pr
|
||||
emit targetInformationChanged();
|
||||
}
|
||||
|
||||
void S60DeviceRunConfiguration::updateActiveBuildConfiguration(ProjectExplorer::BuildConfiguration *buildConfiguration)
|
||||
{
|
||||
if (m_activeBuildConfiguration)
|
||||
disconnect(m_activeBuildConfiguration, SIGNAL(s60CreatesSmartInstallerChanged()),
|
||||
this, SIGNAL(targetInformationChanged()));
|
||||
m_activeBuildConfiguration = buildConfiguration;
|
||||
if (m_activeBuildConfiguration)
|
||||
connect(m_activeBuildConfiguration, SIGNAL(s60CreatesSmartInstallerChanged()),
|
||||
this, SIGNAL(targetInformationChanged()));
|
||||
}
|
||||
|
||||
S60DeviceRunConfiguration::~S60DeviceRunConfiguration()
|
||||
{
|
||||
}
|
||||
@@ -224,10 +196,7 @@ QVariantMap S60DeviceRunConfiguration::toMap() const
|
||||
const QDir projectDir = QDir(target()->project()->projectDirectory());
|
||||
|
||||
map.insert(QLatin1String(PRO_FILE_KEY), projectDir.relativeFilePath(m_proFilePath));
|
||||
map.insert(QLatin1String(SERIAL_PORT_NAME_KEY), m_serialPortName);
|
||||
map.insert(QLatin1String(COMMAND_LINE_ARGUMENTS_KEY), m_commandLineArguments);
|
||||
map.insert(QLatin1String(INSTALLATION_DRIVE_LETTER_KEY), QChar(m_installationDrive));
|
||||
map.insert(QLatin1String(SILENT_INSTALL_KEY), QVariant(m_silentInstall));
|
||||
|
||||
return map;
|
||||
}
|
||||
@@ -237,46 +206,11 @@ bool S60DeviceRunConfiguration::fromMap(const QVariantMap &map)
|
||||
const QDir projectDir = QDir(target()->project()->projectDirectory());
|
||||
|
||||
m_proFilePath = projectDir.filePath(map.value(QLatin1String(PRO_FILE_KEY)).toString());
|
||||
m_serialPortName = map.value(QLatin1String(SERIAL_PORT_NAME_KEY)).toString().trimmed();
|
||||
m_commandLineArguments = map.value(QLatin1String(COMMAND_LINE_ARGUMENTS_KEY)).toStringList();
|
||||
m_installationDrive = map.value(QLatin1String(INSTALLATION_DRIVE_LETTER_KEY), QChar('C'))
|
||||
.toChar().toAscii();
|
||||
m_silentInstall = map.value(QLatin1String(SILENT_INSTALL_KEY), QVariant(true)).toBool();
|
||||
|
||||
return RunConfiguration::fromMap(map);
|
||||
}
|
||||
|
||||
QString S60DeviceRunConfiguration::serialPortName() const
|
||||
{
|
||||
return m_serialPortName;
|
||||
}
|
||||
|
||||
void S60DeviceRunConfiguration::setSerialPortName(const QString &name)
|
||||
{
|
||||
const QString &candidate = name.trimmed();
|
||||
if (m_serialPortName == candidate)
|
||||
return;
|
||||
m_serialPortName = candidate;
|
||||
emit serialPortNameChanged();
|
||||
}
|
||||
|
||||
char S60DeviceRunConfiguration::installationDrive() const
|
||||
{
|
||||
return m_installationDrive;
|
||||
}
|
||||
|
||||
void S60DeviceRunConfiguration::setInstallationDrive(char drive)
|
||||
{
|
||||
m_installationDrive = drive;
|
||||
}
|
||||
|
||||
QString S60DeviceRunConfiguration::targetName() const
|
||||
{
|
||||
TargetInformation ti = qt4Target()->qt4Project()->rootProjectNode()->targetInformation(m_proFilePath);
|
||||
if (!ti.valid)
|
||||
return QString();
|
||||
return ti.target;
|
||||
}
|
||||
|
||||
static inline QString fixBaseNameTarget(const QString &in)
|
||||
{
|
||||
@@ -287,166 +221,9 @@ static inline QString fixBaseNameTarget(const QString &in)
|
||||
return in;
|
||||
}
|
||||
|
||||
QStringList S60DeviceRunConfiguration::packageFileNamesWithTargetInfo() const
|
||||
QString S60DeviceRunConfiguration::projectFilePath() const
|
||||
{
|
||||
QList<Qt4ProFileNode *> leafs = qt4Target()->qt4Project()->leafProFiles();
|
||||
|
||||
QStringList result;
|
||||
foreach (Qt4ProFileNode *qt4ProFileNode, leafs) {
|
||||
TargetInformation ti = qt4ProFileNode->targetInformation();
|
||||
if (!ti.valid)
|
||||
continue;
|
||||
QString baseFileName = ti.buildDir + QLatin1Char('/') + ti.target;
|
||||
baseFileName += QLatin1Char('_')
|
||||
+ (isDebug() ? QLatin1String("debug") : QLatin1String("release"))
|
||||
+ QLatin1Char('-') + symbianPlatform() + QLatin1String(".sis");
|
||||
result << baseFileName;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QString S60DeviceRunConfiguration::symbianPlatform() const
|
||||
{
|
||||
Qt4BuildConfiguration *qt4bc = qt4Target()->qt4Project()->activeTarget()->activeBuildConfiguration();
|
||||
switch (qt4bc->toolChainType()) {
|
||||
case ToolChain::GCCE:
|
||||
case ToolChain::GCCE_GNUPOC:
|
||||
return QLatin1String("gcce");
|
||||
case ToolChain::RVCT_ARMV5:
|
||||
return QLatin1String("armv5");
|
||||
default: // including ToolChain::RVCT_ARMV6_GNUPOC:
|
||||
return QLatin1String("armv6");
|
||||
}
|
||||
}
|
||||
|
||||
bool S60DeviceRunConfiguration::isDebug() const
|
||||
{
|
||||
const Qt4BuildConfiguration *qt4bc = qt4Target()->qt4Project()->activeTarget()->activeBuildConfiguration();
|
||||
return (qt4bc->qmakeBuildConfiguration() & QtVersion::DebugBuild);
|
||||
}
|
||||
|
||||
QString S60DeviceRunConfiguration::symbianTarget() const
|
||||
{
|
||||
return isDebug() ? QLatin1String("udeb") : QLatin1String("urel");
|
||||
}
|
||||
|
||||
QStringList S60DeviceRunConfiguration::packageTemplateFileNames() const
|
||||
{
|
||||
QList<Qt4ProFileNode *> list = qt4Target()->qt4Project()->leafProFiles();
|
||||
QStringList result;
|
||||
foreach (Qt4ProFileNode *node, list) {
|
||||
TargetInformation ti = node->targetInformation();
|
||||
if (ti.valid)
|
||||
result << ti.buildDir + QLatin1Char('/') + ti.target + QLatin1String("_template.pkg");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QString S60DeviceRunConfiguration::appPackageTemplateFileName() const
|
||||
{
|
||||
TargetInformation ti = qt4Target()->qt4Project()->rootProjectNode()->targetInformation(m_proFilePath);
|
||||
if (!ti.valid)
|
||||
return QString();
|
||||
return ti.buildDir + QLatin1Char('/') + ti.target + QLatin1String("_template.pkg");
|
||||
}
|
||||
|
||||
|
||||
/* Grep a package file for the '.exe' file. Curently for use on Linux only
|
||||
* as the '.pkg'-files on Windows do not contain drive letters, which is not
|
||||
* handled here. \code
|
||||
; Executable and default resource files
|
||||
"./foo.exe" - "!:\sys\bin\foo.exe"
|
||||
\endcode */
|
||||
|
||||
static inline QString executableFromPackageUnix(const QString &packageFileName)
|
||||
{
|
||||
QFile packageFile(packageFileName);
|
||||
if (!packageFile.open(QIODevice::ReadOnly|QIODevice::Text))
|
||||
return QString();
|
||||
QRegExp pattern(QLatin1String("^\"(.*.exe)\" *- \"!:.*.exe\"$"));
|
||||
QTC_ASSERT(pattern.isValid(), return QString());
|
||||
foreach(const QString &line, QString::fromLocal8Bit(packageFile.readAll()).split(QLatin1Char('\n')))
|
||||
if (pattern.exactMatch(line)) {
|
||||
// Expand relative paths by package file paths
|
||||
QString rc = pattern.cap(1);
|
||||
if (rc.startsWith(QLatin1String("./")))
|
||||
rc.remove(0, 2);
|
||||
const QFileInfo fi(rc);
|
||||
if (fi.isAbsolute())
|
||||
return rc;
|
||||
return QFileInfo(packageFileName).absolutePath() + QLatin1Char('/') + rc;
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
const QtVersion *S60DeviceRunConfiguration::qtVersion() const
|
||||
{
|
||||
if (const BuildConfiguration *bc = target()->activeBuildConfiguration())
|
||||
if (const Qt4BuildConfiguration *qt4bc = qobject_cast<const Qt4BuildConfiguration *>(bc))
|
||||
return qt4bc->qtVersion();
|
||||
return 0;
|
||||
}
|
||||
|
||||
QString S60DeviceRunConfiguration::localExecutableFileName() const
|
||||
{
|
||||
QString localExecutable;
|
||||
switch (toolChainType()) {
|
||||
case ToolChain::GCCE_GNUPOC:
|
||||
case ToolChain::RVCT_ARMV5_GNUPOC:
|
||||
localExecutable = executableFromPackageUnix(appPackageTemplateFileName());
|
||||
break;
|
||||
default: {
|
||||
const QtVersion *qtv = qtVersion();
|
||||
QTC_ASSERT(qtv, return QString());
|
||||
const S60Devices::Device device = S60Manager::instance()->deviceForQtVersion(qtv);
|
||||
QTextStream(&localExecutable) << device.epocRoot << "/epoc32/release/"
|
||||
<< symbianPlatform() << '/' << symbianTarget() << '/' << targetName()
|
||||
<< ".exe";
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (debug)
|
||||
qDebug() << "Local executable" << localExecutable;
|
||||
return QDir::toNativeSeparators(localExecutable);
|
||||
}
|
||||
|
||||
bool S60DeviceRunConfiguration::runSmartInstaller() const
|
||||
{
|
||||
DeployConfiguration *dc = target()->activeDeployConfiguration();
|
||||
QTC_ASSERT(dc, return false);
|
||||
BuildStepList *bsl = dc->stepList();
|
||||
QTC_ASSERT(bsl, return false);
|
||||
QList<BuildStep *> steps = bsl->steps();
|
||||
foreach (const BuildStep *step, steps) {
|
||||
if (const S60CreatePackageStep *packageStep = qobject_cast<const S60CreatePackageStep *>(step)) {
|
||||
return packageStep->createsSmartInstaller();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
QStringList S60DeviceRunConfiguration::signedPackages() const
|
||||
{
|
||||
QList<Qt4ProFileNode *> list = qt4Target()->qt4Project()->leafProFiles();
|
||||
QStringList result;
|
||||
foreach (Qt4ProFileNode *node, list) {
|
||||
TargetInformation ti = node->targetInformation();
|
||||
if (ti.valid)
|
||||
result << ti.buildDir + QLatin1Char('/') + ti.target
|
||||
+ (runSmartInstaller() ? QLatin1String("_installer") : QLatin1String(""))
|
||||
+ QLatin1String(".sis");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QString S60DeviceRunConfiguration::appSignedPackage() const
|
||||
{
|
||||
TargetInformation ti = qt4Target()->qt4Project()->rootProjectNode()->targetInformation(m_proFilePath);
|
||||
if (!ti.valid)
|
||||
return QString();
|
||||
return ti.buildDir + QLatin1Char('/') + ti.target
|
||||
+ (runSmartInstaller() ? QLatin1String("_installer") : QLatin1String(""))
|
||||
+ QLatin1String(".sis");
|
||||
return m_proFilePath;
|
||||
}
|
||||
|
||||
QStringList S60DeviceRunConfiguration::commandLineArguments() const
|
||||
@@ -459,16 +236,6 @@ void S60DeviceRunConfiguration::setCommandLineArguments(const QStringList &args)
|
||||
m_commandLineArguments = args;
|
||||
}
|
||||
|
||||
bool S60DeviceRunConfiguration::silentInstall() const
|
||||
{
|
||||
return m_silentInstall;
|
||||
}
|
||||
|
||||
void S60DeviceRunConfiguration::setSilentInstall(bool v)
|
||||
{
|
||||
m_silentInstall = v;
|
||||
}
|
||||
|
||||
// ======== S60DeviceRunConfigurationFactory
|
||||
|
||||
S60DeviceRunConfigurationFactory::S60DeviceRunConfigurationFactory(QObject *parent) :
|
||||
@@ -568,19 +335,20 @@ S60DeviceRunControlBase::S60DeviceRunControlBase(RunConfiguration *runConfigurat
|
||||
|
||||
S60DeviceRunConfiguration *s60runConfig = qobject_cast<S60DeviceRunConfiguration *>(runConfiguration);
|
||||
const Qt4BuildConfiguration *activeBuildConf = s60runConfig->qt4Target()->activeBuildConfiguration();
|
||||
S60DeployConfiguration *activeDeployConf = qobject_cast<S60DeployConfiguration *>(s60runConfig->qt4Target()->activeDeployConfiguration());
|
||||
|
||||
QTC_ASSERT(s60runConfig, return);
|
||||
m_toolChain = s60runConfig->toolChainType();
|
||||
m_serialPortName = s60runConfig->serialPortName();
|
||||
m_serialPortName = activeDeployConf->serialPortName();
|
||||
m_serialPortFriendlyName = SymbianUtils::SymbianDeviceManager::instance()->friendlyNameForPort(m_serialPortName);
|
||||
m_targetName = s60runConfig->targetName();
|
||||
m_targetName = activeDeployConf->targetName();
|
||||
m_commandLineArguments = s60runConfig->commandLineArguments();
|
||||
m_qtDir = activeBuildConf->qtVersion()->versionInfo().value("QT_INSTALL_DATA");
|
||||
m_installationDrive = s60runConfig->installationDrive();
|
||||
if (const QtVersion *qtv = s60runConfig->qtVersion())
|
||||
m_installationDrive = activeDeployConf->installationDrive();
|
||||
if (const QtVersion *qtv = activeDeployConf->qtVersion())
|
||||
m_qtBinPath = qtv->versionInfo().value(QLatin1String("QT_INSTALL_BINS"));
|
||||
QTC_ASSERT(!m_qtBinPath.isEmpty(), return);
|
||||
m_executableFileName = s60runConfig->localExecutableFileName();
|
||||
m_executableFileName = activeDeployConf->localExecutableFileName();
|
||||
if (debug)
|
||||
qDebug() << "S60DeviceRunControlBase::CT" << m_targetName << ProjectExplorer::ToolChain::toolChainName(m_toolChain)
|
||||
<< m_serialPortName;
|
||||
@@ -844,12 +612,14 @@ S60DeviceDebugRunControl::S60DeviceDebugRunControl(S60DeviceRunConfiguration *rc
|
||||
setReleaseDeviceAfterLauncherFinish(true); // Debugger controls device after install
|
||||
QTC_ASSERT(rc, return);
|
||||
|
||||
m_startParams->remoteChannel = rc->serialPortName();
|
||||
S60DeployConfiguration *activeDeployConf = qobject_cast<S60DeployConfiguration *>(rc->qt4Target()->activeDeployConfiguration());
|
||||
|
||||
m_startParams->remoteChannel = activeDeployConf->serialPortName();
|
||||
m_startParams->processArgs = rc->commandLineArguments();
|
||||
m_startParams->startMode = Debugger::StartInternal;
|
||||
m_startParams->toolChainType = rc->toolChainType();
|
||||
|
||||
m_localExecutableFileName = rc->localExecutableFileName();
|
||||
m_localExecutableFileName = activeDeployConf->localExecutableFileName();
|
||||
const int lastDotPos = m_localExecutableFileName.lastIndexOf(QLatin1Char('.'));
|
||||
if (lastDotPos != -1) {
|
||||
m_startParams->symbolFileName = m_localExecutableFileName.mid(0, lastDotPos) + QLatin1String(".sym");
|
||||
|
@@ -76,61 +76,30 @@ public:
|
||||
|
||||
ProjectExplorer::OutputFormatter *createOutputFormatter() const;
|
||||
|
||||
QString serialPortName() const;
|
||||
void setSerialPortName(const QString &name);
|
||||
|
||||
char installationDrive() const;
|
||||
void setInstallationDrive(char drive);
|
||||
|
||||
QStringList packageFileNamesWithTargetInfo() const;
|
||||
QStringList packageTemplateFileNames() const;
|
||||
QString appPackageTemplateFileName() const;
|
||||
QString targetName() const;
|
||||
|
||||
QString localExecutableFileName() const;
|
||||
QStringList signedPackages() const;
|
||||
QString appSignedPackage() const;
|
||||
const QtVersion *qtVersion() const;
|
||||
|
||||
QStringList commandLineArguments() const;
|
||||
void setCommandLineArguments(const QStringList &args);
|
||||
|
||||
bool silentInstall() const;
|
||||
void setSilentInstall(bool v);
|
||||
QString projectFilePath() const;
|
||||
|
||||
ProjectExplorer::ToolChain::ToolChainType toolChainType() const;
|
||||
|
||||
QVariantMap toMap() const;
|
||||
|
||||
void proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode *pro);
|
||||
|
||||
signals:
|
||||
void targetInformationChanged();
|
||||
void serialPortNameChanged();
|
||||
|
||||
|
||||
private slots:
|
||||
void proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode *pro);
|
||||
void updateActiveBuildConfiguration(ProjectExplorer::BuildConfiguration *buildConfiguration);
|
||||
|
||||
protected:
|
||||
S60DeviceRunConfiguration(ProjectExplorer::Target *parent, S60DeviceRunConfiguration *source);
|
||||
virtual bool fromMap(const QVariantMap &map);
|
||||
|
||||
private:
|
||||
QString symbianPlatform() const;
|
||||
QString symbianTarget() const;
|
||||
bool isDebug() const;
|
||||
ProjectExplorer::ToolChain::ToolChainType toolChainType(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
void ctor();
|
||||
|
||||
bool runSmartInstaller() const;
|
||||
|
||||
QString m_proFilePath;
|
||||
ProjectExplorer::BuildConfiguration *m_activeBuildConfiguration;
|
||||
QString m_serialPortName;
|
||||
QStringList m_commandLineArguments;
|
||||
|
||||
char m_installationDrive;
|
||||
bool m_silentInstall;
|
||||
};
|
||||
|
||||
class S60DeviceRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory
|
||||
|
@@ -29,67 +29,33 @@
|
||||
|
||||
#include "s60devicerunconfigurationwidget.h"
|
||||
#include "s60devicerunconfiguration.h"
|
||||
#include "s60runconfigbluetoothstarter.h"
|
||||
#include "bluetoothlistener_gui.h"
|
||||
#include "s60manager.h"
|
||||
#include "launcher.h"
|
||||
#include "bluetoothlistener.h"
|
||||
#include "symbiandevicemanager.h"
|
||||
|
||||
#include <utils/detailswidget.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/pathchooser.h>
|
||||
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtGui/QRadioButton>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QLineEdit>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
#include <QtGui/QHBoxLayout>
|
||||
#include <QtGui/QFormLayout>
|
||||
#include <QtGui/QToolButton>
|
||||
#include <QtGui/QStyle>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QSpacerItem>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QCheckBox>
|
||||
|
||||
Q_DECLARE_METATYPE(SymbianUtils::SymbianDevice)
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
enum { wantUpdateSerialDevicesButton = 0 };
|
||||
#else
|
||||
enum { wantUpdateSerialDevicesButton = 1 };
|
||||
#endif
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
const char STARTING_DRIVE_LETTER = 'C';
|
||||
const char LAST_DRIVE_LETTER = 'Z';
|
||||
|
||||
S60DeviceRunConfigurationWidget::S60DeviceRunConfigurationWidget(
|
||||
S60DeviceRunConfiguration *runConfiguration,
|
||||
QWidget *parent)
|
||||
: QWidget(parent),
|
||||
m_runConfiguration(runConfiguration),
|
||||
m_detailsWidget(new Utils::DetailsWidget),
|
||||
m_serialPortsCombo(new QComboBox),
|
||||
m_nameLineEdit(new QLineEdit(m_runConfiguration->displayName())),
|
||||
m_argumentsLineEdit(new QLineEdit(m_runConfiguration->commandLineArguments().join(QString(QLatin1Char(' '))))),
|
||||
m_sisFileLabel(new QLabel),
|
||||
m_deviceInfoButton(new QToolButton),
|
||||
m_deviceInfoDescriptionLabel(new QLabel(tr("Device:"))),
|
||||
m_deviceInfoLabel(new QLabel),
|
||||
m_infoTimeOutTimer(0),
|
||||
m_installationDriveCombo(new QComboBox),
|
||||
m_silentInstallCheckBox(new QCheckBox(tr("Silent installation")))
|
||||
m_argumentsLineEdit(new QLineEdit(m_runConfiguration->commandLineArguments().join(QString(QLatin1Char(' ')))))
|
||||
{
|
||||
m_detailsWidget->setState(Utils::DetailsWidget::NoSummary);
|
||||
updateTargetInformation();
|
||||
QVBoxLayout *mainBoxLayout = new QVBoxLayout();
|
||||
mainBoxLayout->setMargin(0);
|
||||
setLayout(mainBoxLayout);
|
||||
@@ -109,124 +75,11 @@ S60DeviceRunConfigurationWidget::S60DeviceRunConfigurationWidget(
|
||||
nameLabel->setBuddy(m_nameLineEdit);
|
||||
formLayout->addRow(nameLabel, m_nameLineEdit);
|
||||
formLayout->addRow(tr("Arguments:"), m_argumentsLineEdit);
|
||||
formLayout->addRow(tr("Installation file:"), m_sisFileLabel);
|
||||
|
||||
// Installation Drive control
|
||||
updateInstallationDrives();
|
||||
m_installationDriveCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
connect(m_installationDriveCombo, SIGNAL(activated(int)), this, SLOT(setInstallationDrive(int)));
|
||||
QHBoxLayout *installationDriveHBoxLayout = new QHBoxLayout;
|
||||
installationDriveHBoxLayout->addWidget(m_installationDriveCombo);
|
||||
installationDriveHBoxLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored));
|
||||
formLayout->addRow(tr("Installation drive:"), installationDriveHBoxLayout);
|
||||
|
||||
// Non-silent installs are a fallback if one wants to override missing dependencies.
|
||||
m_silentInstallCheckBox->setChecked(m_runConfiguration->silentInstall());
|
||||
m_silentInstallCheckBox->setToolTip(tr("Silent installation is an installation mode "
|
||||
"that does not require user's intervention. "
|
||||
"In case it fails the non silent installation is launched."));
|
||||
connect(m_silentInstallCheckBox, SIGNAL(stateChanged(int)), this, SLOT(silentInstallChanged(int)));
|
||||
formLayout->addRow(m_silentInstallCheckBox);
|
||||
|
||||
updateSerialDevices();
|
||||
connect(SymbianUtils::SymbianDeviceManager::instance(), SIGNAL(updated()),
|
||||
this, SLOT(updateSerialDevices()));
|
||||
// Serial devices control
|
||||
m_serialPortsCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
connect(m_serialPortsCombo, SIGNAL(activated(int)), this, SLOT(setSerialPort(int)));
|
||||
QHBoxLayout *serialPortHBoxLayout = new QHBoxLayout;
|
||||
serialPortHBoxLayout->addWidget(m_serialPortsCombo);
|
||||
serialPortHBoxLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored));
|
||||
// Update device list: on Linux only.
|
||||
if (wantUpdateSerialDevicesButton) {
|
||||
QToolButton *updateSerialDevicesButton(new QToolButton);
|
||||
updateSerialDevicesButton->setIcon(qApp->style()->standardIcon(QStyle::SP_BrowserReload));
|
||||
connect(updateSerialDevicesButton, SIGNAL(clicked()),
|
||||
SymbianUtils::SymbianDeviceManager::instance(), SLOT(update()));
|
||||
serialPortHBoxLayout->addWidget(updateSerialDevicesButton);
|
||||
}
|
||||
|
||||
formLayout->addRow(tr("Device on serial port:"), serialPortHBoxLayout);
|
||||
|
||||
// Device Info with button. Widgets are enabled in above call to updateSerialDevices()
|
||||
QHBoxLayout *infoHBoxLayout = new QHBoxLayout;
|
||||
m_deviceInfoLabel->setWordWrap(true);
|
||||
m_deviceInfoLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
|
||||
infoHBoxLayout->addWidget(m_deviceInfoLabel);
|
||||
infoHBoxLayout->addWidget(m_deviceInfoButton);
|
||||
m_deviceInfoButton->setIcon(qApp->style()->standardIcon(QStyle::SP_MessageBoxInformation));
|
||||
m_deviceInfoButton->setToolTip(tr("Queries the device for information"));
|
||||
connect(m_deviceInfoButton, SIGNAL(clicked()), this, SLOT(updateDeviceInfo()));
|
||||
formLayout->addRow(m_deviceInfoDescriptionLabel, infoHBoxLayout);
|
||||
|
||||
connect(m_nameLineEdit, SIGNAL(textEdited(QString)),
|
||||
this, SLOT(displayNameEdited(QString)));
|
||||
connect(m_argumentsLineEdit, SIGNAL(textEdited(QString)),
|
||||
this, SLOT(argumentsEdited(QString)));
|
||||
connect(m_runConfiguration, SIGNAL(targetInformationChanged()),
|
||||
this, SLOT(updateTargetInformation()));
|
||||
}
|
||||
|
||||
void S60DeviceRunConfigurationWidget::updateInstallationDrives()
|
||||
{
|
||||
m_installationDriveCombo->clear();
|
||||
for (int i = STARTING_DRIVE_LETTER; i <= LAST_DRIVE_LETTER; ++i) {
|
||||
m_installationDriveCombo->addItem(QString("%1:").arg((char)i), qVariantFromValue(i));
|
||||
}
|
||||
int index = (char)QChar::toUpper((uint)m_runConfiguration->installationDrive())-STARTING_DRIVE_LETTER;
|
||||
|
||||
Q_ASSERT(index>= 0 && index <= LAST_DRIVE_LETTER-STARTING_DRIVE_LETTER);
|
||||
|
||||
m_installationDriveCombo->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
void S60DeviceRunConfigurationWidget::silentInstallChanged(int state)
|
||||
{
|
||||
bool isSilent = state == Qt::Checked;
|
||||
m_runConfiguration->setSilentInstall(isSilent);
|
||||
}
|
||||
|
||||
void S60DeviceRunConfigurationWidget::updateSerialDevices()
|
||||
{
|
||||
m_serialPortsCombo->clear();
|
||||
clearDeviceInfo();
|
||||
const QString previousRunConfigurationPortName = m_runConfiguration->serialPortName();
|
||||
const QList<SymbianUtils::SymbianDevice> devices = SymbianUtils::SymbianDeviceManager::instance()->devices();
|
||||
int newIndex = -1;
|
||||
for (int i = 0; i < devices.size(); ++i) {
|
||||
const SymbianUtils::SymbianDevice &device = devices.at(i);
|
||||
m_serialPortsCombo->addItem(device.friendlyName(), qVariantFromValue(device));
|
||||
if (device.portName() == previousRunConfigurationPortName)
|
||||
newIndex = i;
|
||||
}
|
||||
// Set new index: prefer to keep old or set to 0, if available.
|
||||
if (newIndex == -1 && !devices.empty())
|
||||
newIndex = 0;
|
||||
m_serialPortsCombo->setCurrentIndex(newIndex);
|
||||
if (newIndex == -1) {
|
||||
m_deviceInfoButton->setEnabled(false);
|
||||
m_runConfiguration->setSerialPortName(QString());
|
||||
} else {
|
||||
m_deviceInfoButton->setEnabled(true);
|
||||
const QString newPortName = device(newIndex).portName();
|
||||
if (newPortName != previousRunConfigurationPortName)
|
||||
m_runConfiguration->setSerialPortName(newPortName);
|
||||
}
|
||||
}
|
||||
|
||||
SymbianUtils::SymbianDevice S60DeviceRunConfigurationWidget::device(int i) const
|
||||
{
|
||||
if (i >= 0) {
|
||||
const QVariant data = m_serialPortsCombo->itemData(i);
|
||||
if (qVariantCanConvert<SymbianUtils::SymbianDevice>(data))
|
||||
return qVariantValue<SymbianUtils::SymbianDevice>(data);
|
||||
}
|
||||
return SymbianUtils::SymbianDevice();
|
||||
}
|
||||
|
||||
SymbianUtils::SymbianDevice S60DeviceRunConfigurationWidget::currentDevice() const
|
||||
{
|
||||
return device(m_serialPortsCombo->currentIndex());
|
||||
}
|
||||
|
||||
void S60DeviceRunConfigurationWidget::displayNameEdited(const QString &text)
|
||||
@@ -245,110 +98,5 @@ void S60DeviceRunConfigurationWidget::argumentsEdited(const QString &text)
|
||||
}
|
||||
}
|
||||
|
||||
void S60DeviceRunConfigurationWidget::updateTargetInformation()
|
||||
{
|
||||
m_sisFileLabel->setText(QDir::toNativeSeparators(m_runConfiguration->appPackageTemplateFileName()));
|
||||
}
|
||||
|
||||
void S60DeviceRunConfigurationWidget::setInstallationDrive(int index)
|
||||
{
|
||||
m_runConfiguration->setInstallationDrive((char)(STARTING_DRIVE_LETTER + index));
|
||||
}
|
||||
|
||||
void S60DeviceRunConfigurationWidget::setSerialPort(int index)
|
||||
{
|
||||
const SymbianUtils::SymbianDevice d = device(index);
|
||||
m_runConfiguration->setSerialPortName(d.portName());
|
||||
m_deviceInfoButton->setEnabled(index >= 0);
|
||||
clearDeviceInfo();
|
||||
}
|
||||
|
||||
void S60DeviceRunConfigurationWidget::clearDeviceInfo()
|
||||
{
|
||||
// Restore text & color
|
||||
m_deviceInfoLabel->clear();
|
||||
m_deviceInfoLabel->setStyleSheet(QString());
|
||||
}
|
||||
|
||||
void S60DeviceRunConfigurationWidget::setDeviceInfoLabel(const QString &message, bool isError)
|
||||
{
|
||||
m_deviceInfoLabel->setStyleSheet(isError ?
|
||||
QString(QLatin1String("background-color: red;")) :
|
||||
QString());
|
||||
m_deviceInfoLabel->setText(message);
|
||||
m_deviceInfoLabel->adjustSize();
|
||||
}
|
||||
|
||||
void S60DeviceRunConfigurationWidget::slotLauncherStateChanged(int s)
|
||||
{
|
||||
switch (s) {
|
||||
case trk::Launcher::WaitingForTrk: {
|
||||
// Entered trk wait state..open message box
|
||||
QMessageBox *mb = S60DeviceRunControlBase::createTrkWaitingMessageBox(m_infoLauncher->trkServerName(), this);
|
||||
connect(m_infoLauncher, SIGNAL(stateChanged(int)), mb, SLOT(close()));
|
||||
connect(mb, SIGNAL(finished(int)), this, SLOT(slotWaitingForTrkClosed()));
|
||||
mb->open();
|
||||
}
|
||||
break;
|
||||
case trk::Launcher::DeviceDescriptionReceived: // All ok, done
|
||||
setDeviceInfoLabel(m_infoLauncher->deviceDescription());
|
||||
m_deviceInfoButton->setEnabled(true);
|
||||
m_infoLauncher->deleteLater();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void S60DeviceRunConfigurationWidget::slotWaitingForTrkClosed()
|
||||
{
|
||||
if (m_infoLauncher && m_infoLauncher->state() == trk::Launcher::WaitingForTrk) {
|
||||
m_infoLauncher->deleteLater();
|
||||
clearDeviceInfo();
|
||||
m_deviceInfoButton->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void S60DeviceRunConfigurationWidget::updateDeviceInfo()
|
||||
{
|
||||
QTC_ASSERT(!m_infoLauncher, return)
|
||||
setDeviceInfoLabel(tr("Connecting..."));
|
||||
// Do a launcher run with the ping protocol. Prompt to connect and
|
||||
// go asynchronous afterwards to pop up launch trk box if a timeout occurs.
|
||||
QString message;
|
||||
const SymbianUtils::SymbianDevice commDev = currentDevice();
|
||||
m_infoLauncher = trk::Launcher::acquireFromDeviceManager(commDev.portName(), this, &message);
|
||||
if (!m_infoLauncher) {
|
||||
setDeviceInfoLabel(message, true);
|
||||
return;
|
||||
}
|
||||
connect(m_infoLauncher, SIGNAL(stateChanged(int)), this, SLOT(slotLauncherStateChanged(int)));
|
||||
|
||||
m_infoLauncher->setSerialFrame(commDev.type() == SymbianUtils::SerialPortCommunication);
|
||||
m_infoLauncher->setTrkServerName(commDev.portName());
|
||||
// Prompt user
|
||||
const trk::PromptStartCommunicationResult src =
|
||||
S60RunConfigBluetoothStarter::startCommunication(m_infoLauncher->trkDevice(),
|
||||
this, &message);
|
||||
switch (src) {
|
||||
case trk::PromptStartCommunicationConnected:
|
||||
break;
|
||||
case trk::PromptStartCommunicationCanceled:
|
||||
clearDeviceInfo();
|
||||
m_infoLauncher->deleteLater();
|
||||
return;
|
||||
case trk::PromptStartCommunicationError:
|
||||
setDeviceInfoLabel(message, true);
|
||||
m_infoLauncher->deleteLater();
|
||||
return;
|
||||
};
|
||||
if (!m_infoLauncher->startServer(&message)) {
|
||||
setDeviceInfoLabel(message, true);
|
||||
m_infoLauncher->deleteLater();
|
||||
return;
|
||||
}
|
||||
// Wait for either timeout or results
|
||||
m_deviceInfoButton->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qt4ProjectManager
|
||||
|
@@ -31,37 +31,20 @@
|
||||
#define S60DEVICERUNCONFIGURATIONWIDGET_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtCore/QPointer>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLabel;
|
||||
class QTimer;
|
||||
class QLineEdit;
|
||||
class QComboBox;
|
||||
class QToolButton;
|
||||
class QCheckBox;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils {
|
||||
class DetailsWidget;
|
||||
}
|
||||
|
||||
namespace trk {
|
||||
class Launcher;
|
||||
}
|
||||
|
||||
namespace SymbianUtils {
|
||||
class SymbianDevice;
|
||||
}
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class S60DeviceRunConfiguration;
|
||||
|
||||
/* Configuration widget for S60 devices on serial ports that are
|
||||
* provided by the SerialDeviceLister class. Has an info/test
|
||||
* button connecting to the device and showing info. */
|
||||
class S60DeviceRunConfigurationWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -72,36 +55,12 @@ public:
|
||||
private slots:
|
||||
void displayNameEdited(const QString &text);
|
||||
void argumentsEdited(const QString &text);
|
||||
void updateTargetInformation();
|
||||
void updateInstallationDrives();
|
||||
void updateSerialDevices();
|
||||
void setInstallationDrive(int index);
|
||||
void setSerialPort(int index);
|
||||
void updateDeviceInfo();
|
||||
void clearDeviceInfo();
|
||||
void slotLauncherStateChanged(int);
|
||||
void slotWaitingForTrkClosed();
|
||||
void silentInstallChanged(int);
|
||||
|
||||
private:
|
||||
inline SymbianUtils::SymbianDevice device(int i) const;
|
||||
inline SymbianUtils::SymbianDevice currentDevice() const;
|
||||
|
||||
void setDeviceInfoLabel(const QString &message, bool isError = false);
|
||||
|
||||
S60DeviceRunConfiguration *m_runConfiguration;
|
||||
Utils::DetailsWidget *m_detailsWidget;
|
||||
QComboBox *m_serialPortsCombo;
|
||||
QLineEdit *m_nameLineEdit;
|
||||
QLineEdit *m_argumentsLineEdit;
|
||||
QLabel *m_sisFileLabel;
|
||||
QToolButton *m_deviceInfoButton;
|
||||
QLabel *m_deviceInfoDescriptionLabel;
|
||||
QLabel *m_deviceInfoLabel;
|
||||
QTimer *m_infoTimeOutTimer;
|
||||
QPointer<trk::Launcher> m_infoLauncher;
|
||||
QComboBox *m_installationDriveCombo;
|
||||
QCheckBox *m_silentInstallCheckBox;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -35,19 +35,27 @@
|
||||
#include "qt-maemo/maemopackagecreationstep.h"
|
||||
#include "qt-s60/s60createpackagestep.h"
|
||||
#include "qt-s60/s60deploystep.h"
|
||||
#include "qt-s60/s60deployconfiguration.h"
|
||||
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
using namespace Qt4ProjectManager;
|
||||
using namespace Qt4ProjectManager::Internal;
|
||||
|
||||
Qt4DeployConfigurationFactory::Qt4DeployConfigurationFactory(QObject *parent) :
|
||||
ProjectExplorer::DeployConfigurationFactory(parent)
|
||||
ProjectExplorer::DeployConfigurationFactory(parent),
|
||||
m_s60DeployConfigurationFactory(new S60DeployConfigurationFactory(this))
|
||||
{ }
|
||||
|
||||
ProjectExplorer::DeployConfiguration *Qt4DeployConfigurationFactory::create(ProjectExplorer::Target *parent, const QString &id)
|
||||
{
|
||||
ProjectExplorer::DeployConfiguration *dc = ProjectExplorer::DeployConfigurationFactory::create(parent, id);
|
||||
ProjectExplorer::DeployConfiguration *dc = 0;
|
||||
if (parent->id() == QLatin1String(Constants::S60_DEVICE_TARGET_ID))
|
||||
dc = m_s60DeployConfigurationFactory->create(parent, id);
|
||||
else
|
||||
dc = ProjectExplorer::DeployConfigurationFactory::create(parent, id);
|
||||
|
||||
if (!dc)
|
||||
return 0;
|
||||
|
||||
@@ -63,3 +71,35 @@ ProjectExplorer::DeployConfiguration *Qt4DeployConfigurationFactory::create(Proj
|
||||
|
||||
return dc;
|
||||
}
|
||||
|
||||
bool Qt4DeployConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const
|
||||
{
|
||||
if (parent->id() == Constants::S60_DEVICE_TARGET_ID)
|
||||
return m_s60DeployConfigurationFactory->canRestore(parent, map);
|
||||
else
|
||||
return ProjectExplorer::DeployConfigurationFactory::canRestore(parent, map);
|
||||
}
|
||||
|
||||
ProjectExplorer::DeployConfiguration *Qt4DeployConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map)
|
||||
{
|
||||
if (parent->id() == Constants::S60_DEVICE_TARGET_ID)
|
||||
return m_s60DeployConfigurationFactory->restore(parent, map);
|
||||
else
|
||||
return ProjectExplorer::DeployConfigurationFactory::restore(parent, map);
|
||||
}
|
||||
|
||||
bool Qt4DeployConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::DeployConfiguration *product) const
|
||||
{
|
||||
if (parent->id() == Constants::S60_DEVICE_TARGET_ID)
|
||||
return m_s60DeployConfigurationFactory->canClone(parent, product);
|
||||
else
|
||||
return ProjectExplorer::DeployConfigurationFactory::canClone(parent, product);
|
||||
}
|
||||
|
||||
ProjectExplorer::DeployConfiguration *Qt4DeployConfigurationFactory::clone(ProjectExplorer::Target *parent, ProjectExplorer::DeployConfiguration *product)
|
||||
{
|
||||
if (parent->id() == Constants::S60_DEVICE_TARGET_ID)
|
||||
return m_s60DeployConfigurationFactory->clone(parent, product);
|
||||
else
|
||||
return ProjectExplorer::DeployConfigurationFactory::clone(parent, product);
|
||||
}
|
||||
|
@@ -35,6 +35,9 @@
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class Target;
|
||||
class S60DeployConfigurationFactory;
|
||||
|
||||
class Qt4DeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -43,6 +46,14 @@ public:
|
||||
explicit Qt4DeployConfigurationFactory(QObject *parent = 0);
|
||||
|
||||
ProjectExplorer::DeployConfiguration *create(ProjectExplorer::Target *parent, const QString &id);
|
||||
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
|
||||
ProjectExplorer::DeployConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
|
||||
bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::DeployConfiguration *product) const;
|
||||
ProjectExplorer::DeployConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::DeployConfiguration *product);
|
||||
|
||||
private:
|
||||
S60DeployConfigurationFactory *m_s60DeployConfigurationFactory;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -39,6 +39,7 @@
|
||||
#include "qt-maemo/maemodeploystep.h"
|
||||
#include "qt-maemo/maemopackagecreationstep.h"
|
||||
#include "qt-maemo/maemorunconfiguration.h"
|
||||
#include "qt-s60/s60deployconfiguration.h"
|
||||
#include "qt-s60/s60devicerunconfiguration.h"
|
||||
#include "qt-s60/s60emulatorrunconfiguration.h"
|
||||
#include "qt-s60/s60createpackagestep.h"
|
||||
@@ -246,10 +247,10 @@ Qt4Target::Qt4Target(Qt4Project *parent, const QString &id) :
|
||||
this, SLOT(emitProFileEvaluateNeeded()));
|
||||
connect(this, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
|
||||
this, SIGNAL(environmentChanged()));
|
||||
connect(this, SIGNAL(addedRunConfiguration(ProjectExplorer::RunConfiguration*)),
|
||||
this, SLOT(onAddedRunConfiguration(ProjectExplorer::RunConfiguration*)));
|
||||
connect(this, SIGNAL(addedBuildConfiguration(ProjectExplorer::BuildConfiguration*)),
|
||||
this, SLOT(onAddedBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
|
||||
connect(this, SIGNAL(addedDeployConfiguration(ProjectExplorer::DeployConfiguration*)),
|
||||
this, SLOT(onAddedDeployConfiguration(ProjectExplorer::DeployConfiguration*)));
|
||||
connect(this, SIGNAL(activeRunConfigurationChanged(ProjectExplorer::RunConfiguration*)),
|
||||
this, SLOT(updateToolTipAndIcon()));
|
||||
|
||||
@@ -417,16 +418,6 @@ void Qt4Target::updateQtVersion()
|
||||
setEnabled(project()->supportedTargetIds().contains(id()));
|
||||
}
|
||||
|
||||
void Qt4Target::onAddedRunConfiguration(ProjectExplorer::RunConfiguration *rc)
|
||||
{
|
||||
Q_ASSERT(rc);
|
||||
S60DeviceRunConfiguration *deviceRc(qobject_cast<S60DeviceRunConfiguration *>(rc));
|
||||
if (!deviceRc)
|
||||
return;
|
||||
connect(deviceRc, SIGNAL(serialPortNameChanged()),
|
||||
this, SLOT(slotUpdateDeviceInformation()));
|
||||
}
|
||||
|
||||
void Qt4Target::onAddedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc)
|
||||
{
|
||||
Q_ASSERT(bc);
|
||||
@@ -438,10 +429,20 @@ void Qt4Target::onAddedBuildConfiguration(ProjectExplorer::BuildConfiguration *b
|
||||
this, SLOT(onProFileEvaluateNeeded(Qt4ProjectManager::Internal::Qt4BuildConfiguration *)));
|
||||
}
|
||||
|
||||
void Qt4Target::onAddedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc)
|
||||
{
|
||||
Q_ASSERT(dc);
|
||||
S60DeployConfiguration *deployConf(qobject_cast<S60DeployConfiguration *>(dc));
|
||||
if (!deployConf)
|
||||
return;
|
||||
connect(deployConf, SIGNAL(serialPortNameChanged()),
|
||||
this, SLOT(slotUpdateDeviceInformation()));
|
||||
}
|
||||
|
||||
void Qt4Target::slotUpdateDeviceInformation()
|
||||
{
|
||||
S60DeviceRunConfiguration *deviceRc(qobject_cast<S60DeviceRunConfiguration *>(sender()));
|
||||
if (deviceRc && deviceRc == activeRunConfiguration()) {
|
||||
S60DeployConfiguration *dc(qobject_cast<S60DeployConfiguration *>(sender()));
|
||||
if (dc && dc == activeDeployConfiguration()) {
|
||||
updateToolTipAndIcon();
|
||||
}
|
||||
}
|
||||
@@ -460,9 +461,9 @@ void Qt4Target::emitProFileEvaluateNeeded()
|
||||
void Qt4Target::updateToolTipAndIcon()
|
||||
{
|
||||
static const int TARGET_OVERLAY_ORIGINAL_SIZE = 32;
|
||||
if (const S60DeviceRunConfiguration *s60DeviceRc = qobject_cast<S60DeviceRunConfiguration *>(activeRunConfiguration())) {
|
||||
if (const S60DeployConfiguration *s60DeployConf = qobject_cast<S60DeployConfiguration *>(activeDeployConfiguration())) {
|
||||
const SymbianUtils::SymbianDeviceManager *sdm = SymbianUtils::SymbianDeviceManager::instance();
|
||||
const int deviceIndex = sdm->findByPortName(s60DeviceRc->serialPortName());
|
||||
const int deviceIndex = sdm->findByPortName(s60DeployConf->serialPortName());
|
||||
QPixmap overlay;
|
||||
if (deviceIndex == -1) {
|
||||
setToolTip(tr("<b>Device:</b> Not connected"));
|
||||
|
@@ -95,8 +95,8 @@ protected:
|
||||
|
||||
private slots:
|
||||
void updateQtVersion();
|
||||
void onAddedRunConfiguration(ProjectExplorer::RunConfiguration *rc);
|
||||
void onAddedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc);
|
||||
void onAddedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc);
|
||||
void slotUpdateDeviceInformation();
|
||||
void onProFileEvaluateNeeded(Qt4ProjectManager::Internal::Qt4BuildConfiguration *bc);
|
||||
void emitProFileEvaluateNeeded();
|
||||
|
Reference in New Issue
Block a user