forked from qt-creator/qt-creator
Maemo: Introduce abstract base class for deploy steps targeting devices.
This will make it possible for a MaemoRunConfiguration to work with deploy steps that do not use Utils::SshConnection, but still want to make use of our device configurations.
This commit is contained in:
@@ -0,0 +1,110 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
**
|
||||||
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
**
|
||||||
|
** 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.
|
||||||
|
**
|
||||||
|
** Other Usage
|
||||||
|
**
|
||||||
|
** Alternatively, this file may be used in accordance with the terms and
|
||||||
|
** conditions contained in a signed written agreement between you and Nokia.
|
||||||
|
**
|
||||||
|
** If you have questions regarding the use of this file, please contact
|
||||||
|
** Nokia at qt-info@nokia.com.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
#include "abstractlinuxdevicedeploystep.h"
|
||||||
|
|
||||||
|
#include "maemoconstants.h"
|
||||||
|
#include "maemodeploystepwidget.h"
|
||||||
|
#include "maemopertargetdeviceconfigurationlistmodel.h"
|
||||||
|
#include "qt4maemodeployconfiguration.h"
|
||||||
|
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
|
namespace Qt4ProjectManager {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
|
||||||
|
AbstractLinuxDeviceDeployStep::AbstractLinuxDeviceDeployStep(DeployConfiguration *dc)
|
||||||
|
: m_helper(qobject_cast<Qt4MaemoDeployConfiguration *>(dc))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AbstractLinuxDeviceDeployStep::isDeploymentPossible(QString &whyNot) const
|
||||||
|
{
|
||||||
|
if (!m_helper.deviceConfig()) {
|
||||||
|
whyNot = tr("No valid device set.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return isDeploymentPossibleInternal(whyNot);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AbstractLinuxDeviceDeployStep::initialize(QString &errorMsg)
|
||||||
|
{
|
||||||
|
if (!isDeploymentPossible(errorMsg))
|
||||||
|
return false;
|
||||||
|
m_helper.prepareDeployment();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LinuxDeviceDeployStepHelper::LinuxDeviceDeployStepHelper(Qt4MaemoDeployConfiguration *dc)
|
||||||
|
: m_deployConfiguration(dc)
|
||||||
|
{
|
||||||
|
m_deviceConfig = dc->deviceConfigModel()->defaultDeviceConfig();
|
||||||
|
connect(dc->deviceConfigModel(), SIGNAL(updated()),
|
||||||
|
SLOT(handleDeviceConfigurationsUpdated()));
|
||||||
|
}
|
||||||
|
|
||||||
|
LinuxDeviceDeployStepHelper::~LinuxDeviceDeployStepHelper() {}
|
||||||
|
|
||||||
|
void LinuxDeviceDeployStepHelper::handleDeviceConfigurationsUpdated()
|
||||||
|
{
|
||||||
|
setDeviceConfig(MaemoDeviceConfigurations::instance()->internalId(m_deviceConfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
void LinuxDeviceDeployStepHelper::setDeviceConfig(MaemoDeviceConfig::Id internalId)
|
||||||
|
{
|
||||||
|
m_deviceConfig = deployConfiguration()->deviceConfigModel()->find(internalId);
|
||||||
|
emit deviceConfigChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LinuxDeviceDeployStepHelper::setDeviceConfig(int i)
|
||||||
|
{
|
||||||
|
m_deviceConfig = deployConfiguration()->deviceConfigModel()->deviceAt(i);
|
||||||
|
emit deviceConfigChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantMap LinuxDeviceDeployStepHelper::toMap() const
|
||||||
|
{
|
||||||
|
QVariantMap map;
|
||||||
|
map.insert(DeviceIdKey,
|
||||||
|
MaemoDeviceConfigurations::instance()->internalId(m_deviceConfig));
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LinuxDeviceDeployStepHelper::fromMap(const QVariantMap &map)
|
||||||
|
{
|
||||||
|
setDeviceConfig(map.value(DeviceIdKey, MaemoDeviceConfig::InvalidId).toULongLong());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Qt4ProjectManager
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
**
|
||||||
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
**
|
||||||
|
** 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.
|
||||||
|
**
|
||||||
|
** Other Usage
|
||||||
|
**
|
||||||
|
** Alternatively, this file may be used in accordance with the terms and
|
||||||
|
** conditions contained in a signed written agreement between you and Nokia.
|
||||||
|
**
|
||||||
|
** If you have questions regarding the use of this file, please contact
|
||||||
|
** Nokia at qt-info@nokia.com.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
#ifndef ABSTRACTLINUXDEVICEDEPLOYSTEP_H
|
||||||
|
#define ABSTRACTLINUXDEVICEDEPLOYSTEP_H
|
||||||
|
|
||||||
|
#include "maemodeviceconfigurations.h"
|
||||||
|
|
||||||
|
#include <QtCore/QCoreApplication>
|
||||||
|
#include <QtCore/QSharedPointer>
|
||||||
|
#include <QtCore/QVariantMap>
|
||||||
|
|
||||||
|
namespace ProjectExplorer { class DeployConfiguration; }
|
||||||
|
|
||||||
|
namespace Qt4ProjectManager {
|
||||||
|
namespace Internal {
|
||||||
|
class Qt4MaemoDeployConfiguration;
|
||||||
|
|
||||||
|
|
||||||
|
class LinuxDeviceDeployStepHelper : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
LinuxDeviceDeployStepHelper(Qt4MaemoDeployConfiguration *dc);
|
||||||
|
~LinuxDeviceDeployStepHelper();
|
||||||
|
|
||||||
|
QSharedPointer<const MaemoDeviceConfig> deviceConfig() const { return m_deviceConfig; }
|
||||||
|
QSharedPointer<const MaemoDeviceConfig> cachedDeviceConfig() const { return m_cachedDeviceConfig; }
|
||||||
|
Qt4MaemoDeployConfiguration *deployConfiguration() const { return m_deployConfiguration; }
|
||||||
|
|
||||||
|
void setDeviceConfig(int i);
|
||||||
|
void prepareDeployment() { m_cachedDeviceConfig = m_deviceConfig; }
|
||||||
|
|
||||||
|
QVariantMap toMap() const;
|
||||||
|
bool fromMap(const QVariantMap &map);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void deviceConfigChanged();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setDeviceConfig(MaemoDeviceConfig::Id internalId);
|
||||||
|
Q_SLOT void handleDeviceConfigurationsUpdated();
|
||||||
|
|
||||||
|
QSharedPointer<const MaemoDeviceConfig> m_deviceConfig;
|
||||||
|
QSharedPointer<const MaemoDeviceConfig> m_cachedDeviceConfig;
|
||||||
|
Qt4MaemoDeployConfiguration * const m_deployConfiguration;
|
||||||
|
};
|
||||||
|
|
||||||
|
class AbstractLinuxDeviceDeployStep
|
||||||
|
{
|
||||||
|
Q_DECLARE_TR_FUNCTIONS(AbstractLinuxDeviceDeployStep)
|
||||||
|
public:
|
||||||
|
virtual ~AbstractLinuxDeviceDeployStep() {}
|
||||||
|
|
||||||
|
Qt4MaemoDeployConfiguration *maemoDeployConfig() const { return m_helper.deployConfiguration(); }
|
||||||
|
bool isDeploymentPossible(QString &whyNot) const;
|
||||||
|
LinuxDeviceDeployStepHelper &helper() { return m_helper; }
|
||||||
|
const LinuxDeviceDeployStepHelper &helper() const { return m_helper; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
AbstractLinuxDeviceDeployStep(ProjectExplorer::DeployConfiguration *dc);
|
||||||
|
|
||||||
|
bool initialize(QString &errorMsg);
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual bool isDeploymentPossibleInternal(QString &whynot) const=0;
|
||||||
|
|
||||||
|
LinuxDeviceDeployStepHelper m_helper;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Qt4ProjectManager
|
||||||
|
|
||||||
|
#endif // ABSTRACTLINUXDEVICEDEPLOYSTEP_H
|
||||||
@@ -87,14 +87,18 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
AbstractMaemoDeployStep::AbstractMaemoDeployStep(BuildStepList *parent,
|
AbstractMaemoDeployStep::AbstractMaemoDeployStep(BuildStepList *parent,
|
||||||
const QString &id) : BuildStep(parent, id)
|
const QString &id)
|
||||||
|
: BuildStep(parent, id),
|
||||||
|
AbstractLinuxDeviceDeployStep(deployConfiguration())
|
||||||
{
|
{
|
||||||
baseCtor();
|
baseCtor();
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractMaemoDeployStep::AbstractMaemoDeployStep(BuildStepList *parent,
|
AbstractMaemoDeployStep::AbstractMaemoDeployStep(BuildStepList *parent,
|
||||||
AbstractMaemoDeployStep *other)
|
AbstractMaemoDeployStep *other)
|
||||||
: BuildStep(parent, other), m_lastDeployed(other->m_lastDeployed)
|
: BuildStep(parent, other),
|
||||||
|
AbstractLinuxDeviceDeployStep(deployConfiguration()),
|
||||||
|
m_lastDeployed(other->m_lastDeployed)
|
||||||
{
|
{
|
||||||
baseCtor();
|
baseCtor();
|
||||||
}
|
}
|
||||||
@@ -104,9 +108,16 @@ AbstractMaemoDeployStep::~AbstractMaemoDeployStep() { }
|
|||||||
void AbstractMaemoDeployStep::baseCtor()
|
void AbstractMaemoDeployStep::baseCtor()
|
||||||
{
|
{
|
||||||
m_baseState = BaseInactive;
|
m_baseState = BaseInactive;
|
||||||
m_deviceConfig = maemoDeployConfig()->deviceConfigModel()->defaultDeviceConfig();
|
}
|
||||||
connect(maemoDeployConfig()->deviceConfigModel(), SIGNAL(updated()),
|
|
||||||
SLOT(handleDeviceConfigurationsUpdated()));
|
bool AbstractMaemoDeployStep::init()
|
||||||
|
{
|
||||||
|
QString errorMsg;
|
||||||
|
if (!initialize(errorMsg)) {
|
||||||
|
writeOutput(errorMsg, ErrorMessageOutput);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractMaemoDeployStep::run(QFutureInterface<bool> &fi)
|
void AbstractMaemoDeployStep::run(QFutureInterface<bool> &fi)
|
||||||
@@ -126,8 +137,7 @@ QVariantMap AbstractMaemoDeployStep::toMap() const
|
|||||||
{
|
{
|
||||||
QVariantMap map(BuildStep::toMap());
|
QVariantMap map(BuildStep::toMap());
|
||||||
addDeployTimesToMap(map);
|
addDeployTimesToMap(map);
|
||||||
map.insert(DeviceIdKey,
|
map.unite(helper().toMap());
|
||||||
MaemoDeviceConfigurations::instance()->internalId(m_deviceConfig));
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,8 +164,9 @@ bool AbstractMaemoDeployStep::fromMap(const QVariantMap &map)
|
|||||||
{
|
{
|
||||||
if (!BuildStep::fromMap(map))
|
if (!BuildStep::fromMap(map))
|
||||||
return false;
|
return false;
|
||||||
|
if (!helper().fromMap(map))
|
||||||
|
return false;
|
||||||
getDeployTimesFromMap(map);
|
getDeployTimesFromMap(map);
|
||||||
setDeviceConfig(map.value(DeviceIdKey, MaemoDeviceConfig::InvalidId).toULongLong());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,32 +239,6 @@ void AbstractMaemoDeployStep::setDeployed(const QString &host,
|
|||||||
QDateTime::currentDateTime());
|
QDateTime::currentDateTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractMaemoDeployStep::handleDeviceConfigurationsUpdated()
|
|
||||||
{
|
|
||||||
setDeviceConfig(MaemoDeviceConfigurations::instance()->internalId(m_deviceConfig));
|
|
||||||
}
|
|
||||||
|
|
||||||
void AbstractMaemoDeployStep::setDeviceConfig(MaemoDeviceConfig::Id internalId)
|
|
||||||
{
|
|
||||||
m_deviceConfig = maemoDeployConfig()->deviceConfigModel()->find(internalId);
|
|
||||||
emit deviceConfigChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AbstractMaemoDeployStep::setDeviceConfig(int i)
|
|
||||||
{
|
|
||||||
m_deviceConfig = maemoDeployConfig()->deviceConfigModel()->deviceAt(i);
|
|
||||||
emit deviceConfigChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AbstractMaemoDeployStep::isDeploymentPossible(QString &whyNot) const
|
|
||||||
{
|
|
||||||
if (!m_deviceConfig) {
|
|
||||||
whyNot = tr("No valid device set.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return isDeploymentPossibleInternal(whyNot);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AbstractMaemoDeployStep::start()
|
void AbstractMaemoDeployStep::start()
|
||||||
{
|
{
|
||||||
if (m_baseState != BaseInactive) {
|
if (m_baseState != BaseInactive) {
|
||||||
@@ -262,18 +247,9 @@ void AbstractMaemoDeployStep::start()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_cachedDeviceConfig = m_deviceConfig;
|
|
||||||
|
|
||||||
QString message;
|
|
||||||
if (!isDeploymentPossible(message)) {
|
|
||||||
raiseError(tr("Cannot deploy: %1").arg(message));
|
|
||||||
emit done();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_hasError = false;
|
m_hasError = false;
|
||||||
if (isDeploymentNeeded(m_cachedDeviceConfig->sshParameters().host)) {
|
if (isDeploymentNeeded(helper().cachedDeviceConfig()->sshParameters().host)) {
|
||||||
if (m_cachedDeviceConfig->type() == MaemoDeviceConfig::Emulator
|
if (helper().cachedDeviceConfig()->type() == MaemoDeviceConfig::Emulator
|
||||||
&& !MaemoQemuManager::instance().qemuIsRunning()) {
|
&& !MaemoQemuManager::instance().qemuIsRunning()) {
|
||||||
MaemoQemuManager::instance().startRuntime();
|
MaemoQemuManager::instance().startRuntime();
|
||||||
raiseError(tr("Cannot deploy: Qemu was not running. "
|
raiseError(tr("Cannot deploy: Qemu was not running. "
|
||||||
@@ -296,7 +272,7 @@ void AbstractMaemoDeployStep::handleConnectionFailure()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
const QString errorMsg = m_baseState == Connecting
|
const QString errorMsg = m_baseState == Connecting
|
||||||
? MaemoGlobal::failedToConnectToServerMessage(m_connection, m_cachedDeviceConfig)
|
? MaemoGlobal::failedToConnectToServerMessage(m_connection, helper().cachedDeviceConfig())
|
||||||
: tr("Connection error: %1").arg(m_connection->errorString());
|
: tr("Connection error: %1").arg(m_connection->errorString());
|
||||||
raiseError(errorMsg);
|
raiseError(errorMsg);
|
||||||
setDeploymentFinished();
|
setDeploymentFinished();
|
||||||
@@ -307,7 +283,7 @@ void AbstractMaemoDeployStep::connectToDevice()
|
|||||||
ASSERT_STATE(QList<BaseState>() << BaseInactive);
|
ASSERT_STATE(QList<BaseState>() << BaseInactive);
|
||||||
setBaseState(Connecting);
|
setBaseState(Connecting);
|
||||||
|
|
||||||
m_connection = SshConnectionManager::instance().acquireConnection(m_cachedDeviceConfig->sshParameters());
|
m_connection = SshConnectionManager::instance().acquireConnection(helper().cachedDeviceConfig()->sshParameters());
|
||||||
connect(m_connection.data(), SIGNAL(error(Utils::SshError)), this,
|
connect(m_connection.data(), SIGNAL(error(Utils::SshError)), this,
|
||||||
SLOT(handleConnectionFailure()));
|
SLOT(handleConnectionFailure()));
|
||||||
if (m_connection->state() == SshConnection::Connected) {
|
if (m_connection->state() == SshConnection::Connected) {
|
||||||
@@ -407,11 +383,6 @@ const Qt4BuildConfiguration *AbstractMaemoDeployStep::qt4BuildConfiguration() co
|
|||||||
return static_cast<Qt4BuildConfiguration *>(buildConfiguration());
|
return static_cast<Qt4BuildConfiguration *>(buildConfiguration());
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt4MaemoDeployConfiguration *AbstractMaemoDeployStep::maemoDeployConfig() const
|
|
||||||
{
|
|
||||||
return qobject_cast<Qt4MaemoDeployConfiguration *>(deployConfiguration());
|
|
||||||
}
|
|
||||||
|
|
||||||
MaemoDeployEventHandler::MaemoDeployEventHandler(AbstractMaemoDeployStep *deployStep,
|
MaemoDeployEventHandler::MaemoDeployEventHandler(AbstractMaemoDeployStep *deployStep,
|
||||||
QFutureInterface<bool> &future)
|
QFutureInterface<bool> &future)
|
||||||
: m_deployStep(deployStep), m_future(future), m_eventLoop(new QEventLoop),
|
: m_deployStep(deployStep), m_future(future), m_eventLoop(new QEventLoop),
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#ifndef ABSTRACTMAEMODEPLOYSTEP_H
|
#ifndef ABSTRACTMAEMODEPLOYSTEP_H
|
||||||
#define ABSTRACTMAEMODEPLOYSTEP_H
|
#define ABSTRACTMAEMODEPLOYSTEP_H
|
||||||
|
|
||||||
|
#include "abstractlinuxdevicedeploystep.h"
|
||||||
#include "maemodeployable.h"
|
#include "maemodeployable.h"
|
||||||
#include "maemodeployables.h"
|
#include "maemodeployables.h"
|
||||||
#include "maemodeviceconfigurations.h"
|
#include "maemodeviceconfigurations.h"
|
||||||
@@ -58,22 +59,18 @@ class AbstractMaemoPackageCreationStep;
|
|||||||
class MaemoDeviceConfig;
|
class MaemoDeviceConfig;
|
||||||
class Qt4MaemoDeployConfiguration;
|
class Qt4MaemoDeployConfiguration;
|
||||||
|
|
||||||
class AbstractMaemoDeployStep : public ProjectExplorer::BuildStep
|
class AbstractMaemoDeployStep
|
||||||
|
: public ProjectExplorer::BuildStep, public AbstractLinuxDeviceDeployStep
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
virtual ~AbstractMaemoDeployStep();
|
virtual ~AbstractMaemoDeployStep();
|
||||||
QSharedPointer<const MaemoDeviceConfig> deviceConfig() const { return m_deviceConfig; }
|
|
||||||
void setDeviceConfig(int i);
|
|
||||||
Qt4MaemoDeployConfiguration *maemoDeployConfig() const;
|
|
||||||
bool isDeploymentPossible(QString &whyNot) const;
|
|
||||||
|
|
||||||
Q_INVOKABLE void stop();
|
Q_INVOKABLE void stop();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void done();
|
void done();
|
||||||
void error();
|
void error();
|
||||||
void deviceConfigChanged();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
AbstractMaemoDeployStep(ProjectExplorer::BuildStepList *bc,
|
AbstractMaemoDeployStep(ProjectExplorer::BuildStepList *bc,
|
||||||
@@ -98,7 +95,6 @@ protected:
|
|||||||
const Qt4BuildConfiguration *qt4BuildConfiguration() const;
|
const Qt4BuildConfiguration *qt4BuildConfiguration() const;
|
||||||
MaemoPortList freePorts(const QSharedPointer<const MaemoDeviceConfig> &devConfig) const;
|
MaemoPortList freePorts(const QSharedPointer<const MaemoDeviceConfig> &devConfig) const;
|
||||||
QSharedPointer<Utils::SshConnection> connection() const { return m_connection; }
|
QSharedPointer<Utils::SshConnection> connection() const { return m_connection; }
|
||||||
QSharedPointer<const MaemoDeviceConfig> cachedDeviceConfig() const { return m_cachedDeviceConfig; }
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void start();
|
void start();
|
||||||
@@ -107,16 +103,14 @@ private slots:
|
|||||||
void handleProgressReport(const QString &progressMsg);
|
void handleProgressReport(const QString &progressMsg);
|
||||||
void handleRemoteStdout(const QString &output);
|
void handleRemoteStdout(const QString &output);
|
||||||
void handleRemoteStderr(const QString &output);
|
void handleRemoteStderr(const QString &output);
|
||||||
void handleDeviceConfigurationsUpdated();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool init() { return true; }
|
virtual bool init();
|
||||||
virtual void run(QFutureInterface<bool> &fi);
|
virtual void run(QFutureInterface<bool> &fi);
|
||||||
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
||||||
virtual QVariantMap toMap() const;
|
virtual QVariantMap toMap() const;
|
||||||
virtual bool fromMap(const QVariantMap &map);
|
virtual bool fromMap(const QVariantMap &map);
|
||||||
|
|
||||||
virtual bool isDeploymentPossibleInternal(QString &whynot) const=0;
|
|
||||||
virtual bool isDeploymentNeeded(const QString &hostName) const=0;
|
virtual bool isDeploymentNeeded(const QString &hostName) const=0;
|
||||||
virtual void startInternal()=0;
|
virtual void startInternal()=0;
|
||||||
virtual void stopInternal()=0;
|
virtual void stopInternal()=0;
|
||||||
@@ -126,13 +120,10 @@ private:
|
|||||||
void getDeployTimesFromMap(const QVariantMap &map);
|
void getDeployTimesFromMap(const QVariantMap &map);
|
||||||
void connectToDevice();
|
void connectToDevice();
|
||||||
void setBaseState(BaseState newState);
|
void setBaseState(BaseState newState);
|
||||||
void setDeviceConfig(MaemoDeviceConfig::Id internalId);
|
|
||||||
|
|
||||||
QSharedPointer<Utils::SshConnection> m_connection;
|
QSharedPointer<Utils::SshConnection> m_connection;
|
||||||
typedef QPair<MaemoDeployable, QString> DeployablePerHost;
|
typedef QPair<MaemoDeployable, QString> DeployablePerHost;
|
||||||
QHash<DeployablePerHost, QDateTime> m_lastDeployed;
|
QHash<DeployablePerHost, QDateTime> m_lastDeployed;
|
||||||
QSharedPointer<const MaemoDeviceConfig> m_deviceConfig;
|
|
||||||
QSharedPointer<const MaemoDeviceConfig> m_cachedDeviceConfig;
|
|
||||||
BaseState m_baseState;
|
BaseState m_baseState;
|
||||||
bool m_hasError;
|
bool m_hasError;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
#include "maemodebugsupport.h"
|
#include "maemodebugsupport.h"
|
||||||
|
|
||||||
#include "abstractmaemodeploystep.h"
|
|
||||||
#include "maemodeployables.h"
|
#include "maemodeployables.h"
|
||||||
#include "maemoglobal.h"
|
#include "maemoglobal.h"
|
||||||
#include "maemosshrunner.h"
|
#include "maemosshrunner.h"
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ void AbstractMaemoDeployByMountStep::mount()
|
|||||||
{
|
{
|
||||||
m_extendedState = Mounting;
|
m_extendedState = Mounting;
|
||||||
m_mounter->setupMounts(connection(), mountSpecifications(),
|
m_mounter->setupMounts(connection(), mountSpecifications(),
|
||||||
freePorts(cachedDeviceConfig()), qt4BuildConfiguration());
|
freePorts(helper().cachedDeviceConfig()), qt4BuildConfiguration());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AbstractMaemoDeployByMountStep::deployMountPoint() const
|
QString AbstractMaemoDeployByMountStep::deployMountPoint() const
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#include "maemodeploystepwidget.h"
|
#include "maemodeploystepwidget.h"
|
||||||
#include "ui_maemodeploystepwidget.h"
|
#include "ui_maemodeploystepwidget.h"
|
||||||
|
|
||||||
#include "abstractmaemodeploystep.h"
|
#include "abstractlinuxdevicedeploystep.h"
|
||||||
#include "maemodeviceconfigurations.h"
|
#include "maemodeviceconfigurations.h"
|
||||||
#include "maemosettingspages.h"
|
#include "maemosettingspages.h"
|
||||||
#include "maemoglobal.h"
|
#include "maemoglobal.h"
|
||||||
@@ -51,14 +51,14 @@
|
|||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
MaemoDeployStepWidget::MaemoDeployStepWidget(AbstractMaemoDeployStep *step) :
|
MaemoDeployStepWidget::MaemoDeployStepWidget(AbstractLinuxDeviceDeployStep *step) :
|
||||||
ProjectExplorer::BuildStepConfigWidget(),
|
ProjectExplorer::BuildStepConfigWidget(),
|
||||||
ui(new Ui::MaemoDeployStepWidget),
|
ui(new Ui::MaemoDeployStepWidget),
|
||||||
m_step(step)
|
m_step(step)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ProjectExplorer::BuildStepList * const list
|
ProjectExplorer::BuildStepList * const list
|
||||||
= qobject_cast<ProjectExplorer::BuildStepList *>(step->parent());
|
= step->maemoDeployConfig()->stepList();
|
||||||
connect(list, SIGNAL(stepInserted(int)), SIGNAL(updateSummary()));
|
connect(list, SIGNAL(stepInserted(int)), SIGNAL(updateSummary()));
|
||||||
connect(list, SIGNAL(stepMoved(int,int)), SIGNAL(updateSummary()));
|
connect(list, SIGNAL(stepMoved(int,int)), SIGNAL(updateSummary()));
|
||||||
connect(list, SIGNAL(stepRemoved(int)), SIGNAL(updateSummary()));
|
connect(list, SIGNAL(stepRemoved(int)), SIGNAL(updateSummary()));
|
||||||
@@ -74,7 +74,8 @@ MaemoDeployStepWidget::~MaemoDeployStepWidget()
|
|||||||
void MaemoDeployStepWidget::init()
|
void MaemoDeployStepWidget::init()
|
||||||
{
|
{
|
||||||
ui->deviceConfigComboBox->setModel(m_step->maemoDeployConfig()->deviceConfigModel());
|
ui->deviceConfigComboBox->setModel(m_step->maemoDeployConfig()->deviceConfigModel());
|
||||||
connect(m_step, SIGNAL(deviceConfigChanged()), SLOT(handleDeviceUpdate()));
|
connect(&m_step->helper(), SIGNAL(deviceConfigChanged()),
|
||||||
|
SLOT(handleDeviceUpdate()));
|
||||||
handleDeviceUpdate();
|
handleDeviceUpdate();
|
||||||
connect(ui->deviceConfigComboBox, SIGNAL(activated(int)), this,
|
connect(ui->deviceConfigComboBox, SIGNAL(activated(int)), this,
|
||||||
SLOT(setCurrentDeviceConfig(int)));
|
SLOT(setCurrentDeviceConfig(int)));
|
||||||
@@ -84,7 +85,7 @@ void MaemoDeployStepWidget::init()
|
|||||||
|
|
||||||
void MaemoDeployStepWidget::handleDeviceUpdate()
|
void MaemoDeployStepWidget::handleDeviceUpdate()
|
||||||
{
|
{
|
||||||
const MaemoDeviceConfig::ConstPtr &devConf = m_step->deviceConfig();
|
const MaemoDeviceConfig::ConstPtr &devConf = m_step->helper().deviceConfig();
|
||||||
const MaemoDeviceConfig::Id internalId
|
const MaemoDeviceConfig::Id internalId
|
||||||
= MaemoDeviceConfigurations::instance()->internalId(devConf);
|
= MaemoDeviceConfigurations::instance()->internalId(devConf);
|
||||||
const int newIndex = m_step->maemoDeployConfig()->deviceConfigModel()
|
const int newIndex = m_step->maemoDeployConfig()->deviceConfigModel()
|
||||||
@@ -96,8 +97,10 @@ void MaemoDeployStepWidget::handleDeviceUpdate()
|
|||||||
void MaemoDeployStepWidget::handleStepToBeRemoved(int step)
|
void MaemoDeployStepWidget::handleStepToBeRemoved(int step)
|
||||||
{
|
{
|
||||||
ProjectExplorer::BuildStepList * const list
|
ProjectExplorer::BuildStepList * const list
|
||||||
= qobject_cast<ProjectExplorer::BuildStepList *>(m_step->parent());
|
= m_step->maemoDeployConfig()->stepList();
|
||||||
if (list->steps().at(step) == m_step)
|
const AbstractLinuxDeviceDeployStep * const alds
|
||||||
|
= dynamic_cast<AbstractLinuxDeviceDeployStep *>(list->steps().at(step));
|
||||||
|
if (alds && alds == m_step)
|
||||||
disconnect(list, 0, this, 0);
|
disconnect(list, 0, this, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,7 +113,7 @@ QString MaemoDeployStepWidget::summaryText() const
|
|||||||
+ QLatin1String("</font>");
|
+ QLatin1String("</font>");
|
||||||
}
|
}
|
||||||
return tr("<b>Deploy to device</b>: %1")
|
return tr("<b>Deploy to device</b>: %1")
|
||||||
.arg(MaemoGlobal::deviceConfigurationName(m_step->deviceConfig()));
|
.arg(MaemoGlobal::deviceConfigurationName(m_step->helper().deviceConfig()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MaemoDeployStepWidget::displayName() const
|
QString MaemoDeployStepWidget::displayName() const
|
||||||
@@ -120,10 +123,11 @@ QString MaemoDeployStepWidget::displayName() const
|
|||||||
|
|
||||||
void MaemoDeployStepWidget::setCurrentDeviceConfig(int index)
|
void MaemoDeployStepWidget::setCurrentDeviceConfig(int index)
|
||||||
{
|
{
|
||||||
disconnect(m_step, SIGNAL(deviceConfigChanged()), this,
|
disconnect(&m_step->helper(), SIGNAL(deviceConfigChanged()), this,
|
||||||
|
SLOT(handleDeviceUpdate()));
|
||||||
|
m_step->helper().setDeviceConfig(index);
|
||||||
|
connect(&m_step->helper(), SIGNAL(deviceConfigChanged()),
|
||||||
SLOT(handleDeviceUpdate()));
|
SLOT(handleDeviceUpdate()));
|
||||||
m_step->setDeviceConfig(index);
|
|
||||||
connect(m_step, SIGNAL(deviceConfigChanged()), SLOT(handleDeviceUpdate()));
|
|
||||||
updateSummary();
|
updateSummary();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,14 +43,14 @@ QT_END_NAMESPACE
|
|||||||
|
|
||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
class AbstractMaemoDeployStep;
|
class AbstractLinuxDeviceDeployStep;
|
||||||
|
|
||||||
class MaemoDeployStepWidget : public ProjectExplorer::BuildStepConfigWidget
|
class MaemoDeployStepWidget : public ProjectExplorer::BuildStepConfigWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MaemoDeployStepWidget(AbstractMaemoDeployStep *step);
|
MaemoDeployStepWidget(AbstractLinuxDeviceDeployStep *step);
|
||||||
~MaemoDeployStepWidget();
|
~MaemoDeployStepWidget();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -64,7 +64,7 @@ private:
|
|||||||
virtual QString displayName() const;
|
virtual QString displayName() const;
|
||||||
|
|
||||||
Ui::MaemoDeployStepWidget *ui;
|
Ui::MaemoDeployStepWidget *ui;
|
||||||
AbstractMaemoDeployStep * const m_step;
|
AbstractLinuxDeviceDeployStep *const m_step;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ void MaemoDirectDeviceUploadStep::handleMkdirFinished(int exitStatus)
|
|||||||
raiseError(tr("Failed to upload file '%1'.").arg(nativePath));
|
raiseError(tr("Failed to upload file '%1'.").arg(nativePath));
|
||||||
setFinished();
|
setFinished();
|
||||||
} else if (fi.isDir()) {
|
} else if (fi.isDir()) {
|
||||||
setDeployed(cachedDeviceConfig()->sshParameters().host, d);
|
setDeployed(helper().cachedDeviceConfig()->sshParameters().host, d);
|
||||||
m_filesToUpload.removeFirst();
|
m_filesToUpload.removeFirst();
|
||||||
uploadNextFile();
|
uploadNextFile();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ public:
|
|||||||
for (int i = 0; i < buildSteps.count(); ++i) {
|
for (int i = 0; i < buildSteps.count(); ++i) {
|
||||||
if (buildSteps.at(i) == laterBuildStep)
|
if (buildSteps.at(i) == laterBuildStep)
|
||||||
return 0;
|
return 0;
|
||||||
if (T * const step = qobject_cast<T *>(buildSteps.at(i)))
|
if (T * const step = dynamic_cast<T *>(buildSteps.at(i)))
|
||||||
return step;
|
return step;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include "maemorunconfiguration.h"
|
#include "maemorunconfiguration.h"
|
||||||
|
|
||||||
#include "abstractmaemodeploystep.h"
|
#include "abstractlinuxdevicedeploystep.h"
|
||||||
#include "maemodeployables.h"
|
#include "maemodeployables.h"
|
||||||
#include "maemoglobal.h"
|
#include "maemoglobal.h"
|
||||||
#include "maemoqemumanager.h"
|
#include "maemoqemumanager.h"
|
||||||
@@ -213,8 +213,8 @@ QString MaemoRunConfiguration::defaultDisplayName()
|
|||||||
|
|
||||||
MaemoDeviceConfig::ConstPtr MaemoRunConfiguration::deviceConfig() const
|
MaemoDeviceConfig::ConstPtr MaemoRunConfiguration::deviceConfig() const
|
||||||
{
|
{
|
||||||
const AbstractMaemoDeployStep * const step = deployStep();
|
const AbstractLinuxDeviceDeployStep * const step = deployStep();
|
||||||
return step ? step->deviceConfig() : MaemoDeviceConfig::ConstPtr();
|
return step ? step->helper().deviceConfig() : MaemoDeviceConfig::ConstPtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
const MaemoToolChain *MaemoRunConfiguration::toolchain() const
|
const MaemoToolChain *MaemoRunConfiguration::toolchain() const
|
||||||
@@ -236,9 +236,9 @@ Qt4MaemoDeployConfiguration *MaemoRunConfiguration::deployConfig() const
|
|||||||
return qobject_cast<Qt4MaemoDeployConfiguration *>(target()->activeDeployConfiguration());
|
return qobject_cast<Qt4MaemoDeployConfiguration *>(target()->activeDeployConfiguration());
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractMaemoDeployStep *MaemoRunConfiguration::deployStep() const
|
AbstractLinuxDeviceDeployStep *MaemoRunConfiguration::deployStep() const
|
||||||
{
|
{
|
||||||
return MaemoGlobal::earlierBuildStep<AbstractMaemoDeployStep>(deployConfig(), 0);
|
return MaemoGlobal::earlierBuildStep<AbstractLinuxDeviceDeployStep>(deployConfig(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString MaemoRunConfiguration::sysRoot() const
|
const QString MaemoRunConfiguration::sysRoot() const
|
||||||
@@ -303,8 +303,9 @@ QString MaemoRunConfiguration::remoteExecutableFilePath() const
|
|||||||
MaemoPortList MaemoRunConfiguration::freePorts() const
|
MaemoPortList MaemoRunConfiguration::freePorts() const
|
||||||
{
|
{
|
||||||
const Qt4BuildConfiguration * const bc = activeQt4BuildConfiguration();
|
const Qt4BuildConfiguration * const bc = activeQt4BuildConfiguration();
|
||||||
return bc
|
const AbstractLinuxDeviceDeployStep * const step = deployStep();
|
||||||
? MaemoGlobal::freePorts(deployStep()->deviceConfig(), bc->qtVersion())
|
return bc && step
|
||||||
|
? MaemoGlobal::freePorts(deployStep()->helper().deviceConfig(), bc->qtVersion())
|
||||||
: MaemoPortList();
|
: MaemoPortList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,10 +361,10 @@ void MaemoRunConfiguration::handleDeployConfigChanged()
|
|||||||
SLOT(handleDeployConfigChanged()), Qt::UniqueConnection);
|
SLOT(handleDeployConfigChanged()), Qt::UniqueConnection);
|
||||||
connect(activeDeployConf->stepList(), SIGNAL(stepRemoved(int)),
|
connect(activeDeployConf->stepList(), SIGNAL(stepRemoved(int)),
|
||||||
SLOT(handleDeployConfigChanged()), Qt::UniqueConnection);
|
SLOT(handleDeployConfigChanged()), Qt::UniqueConnection);
|
||||||
AbstractMaemoDeployStep * const step
|
AbstractLinuxDeviceDeployStep * const step
|
||||||
= MaemoGlobal::earlierBuildStep<AbstractMaemoDeployStep>(activeDeployConf, 0);
|
= MaemoGlobal::earlierBuildStep<AbstractLinuxDeviceDeployStep>(activeDeployConf, 0);
|
||||||
if (step) {
|
if (step) {
|
||||||
connect(step, SIGNAL(deviceConfigChanged()),
|
connect(&step->helper(), SIGNAL(deviceConfigChanged()),
|
||||||
SLOT(updateDeviceConfigurations()), Qt::UniqueConnection);
|
SLOT(updateDeviceConfigurations()), Qt::UniqueConnection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace Internal {
|
|||||||
class Qt4ProFileNode;
|
class Qt4ProFileNode;
|
||||||
|
|
||||||
class AbstractQt4MaemoTarget;
|
class AbstractQt4MaemoTarget;
|
||||||
class AbstractMaemoDeployStep;
|
class AbstractLinuxDeviceDeployStep;
|
||||||
class MaemoDeviceConfigListModel;
|
class MaemoDeviceConfigListModel;
|
||||||
class MaemoManager;
|
class MaemoManager;
|
||||||
class MaemoRemoteMountsModel;
|
class MaemoRemoteMountsModel;
|
||||||
@@ -89,7 +89,6 @@ public:
|
|||||||
Qt4BuildConfiguration *activeQt4BuildConfiguration() const;
|
Qt4BuildConfiguration *activeQt4BuildConfiguration() const;
|
||||||
|
|
||||||
Qt4MaemoDeployConfiguration *deployConfig() const;
|
Qt4MaemoDeployConfiguration *deployConfig() const;
|
||||||
AbstractMaemoDeployStep *deployStep() const;
|
|
||||||
MaemoRemoteMountsModel *remoteMounts() const { return m_remoteMounts; }
|
MaemoRemoteMountsModel *remoteMounts() const { return m_remoteMounts; }
|
||||||
|
|
||||||
const MaemoToolChain *toolchain() const;
|
const MaemoToolChain *toolchain() const;
|
||||||
@@ -151,6 +150,7 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
void handleParseState(bool success);
|
void handleParseState(bool success);
|
||||||
|
AbstractLinuxDeviceDeployStep *deployStep() const;
|
||||||
|
|
||||||
QString m_proFilePath;
|
QString m_proFilePath;
|
||||||
mutable QString m_gdbPath;
|
mutable QString m_gdbPath;
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ HEADERS += \
|
|||||||
$$PWD/abstractmaemodeploystep.h \
|
$$PWD/abstractmaemodeploystep.h \
|
||||||
$$PWD/maemodeploybymountstep.h \
|
$$PWD/maemodeploybymountstep.h \
|
||||||
$$PWD/maemouploadandinstalldeploystep.h \
|
$$PWD/maemouploadandinstalldeploystep.h \
|
||||||
$$PWD/maemodirectdeviceuploadstep.h
|
$$PWD/maemodirectdeviceuploadstep.h \
|
||||||
|
$$PWD/abstractlinuxdevicedeploystep.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/maemoconfigtestdialog.cpp \
|
$$PWD/maemoconfigtestdialog.cpp \
|
||||||
@@ -119,7 +120,8 @@ SOURCES += \
|
|||||||
$$PWD/abstractmaemodeploystep.cpp \
|
$$PWD/abstractmaemodeploystep.cpp \
|
||||||
$$PWD/maemodeploybymountstep.cpp \
|
$$PWD/maemodeploybymountstep.cpp \
|
||||||
$$PWD/maemouploadandinstalldeploystep.cpp \
|
$$PWD/maemouploadandinstalldeploystep.cpp \
|
||||||
$$PWD/maemodirectdeviceuploadstep.cpp
|
$$PWD/maemodirectdeviceuploadstep.cpp \
|
||||||
|
$$PWD/abstractlinuxdevicedeploystep.cpp
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
$$PWD/maemoconfigtestdialog.ui \
|
$$PWD/maemoconfigtestdialog.ui \
|
||||||
|
|||||||
Reference in New Issue
Block a user