RemoteLinux: Separate generic and MADDE-specific deploy configurations.

Change-Id: If06ee9fbf91a50bcb6c7b79a824f3f74f92b98d2
Reviewed-on: http://codereview.qt.nokia.com/1671
Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
This commit is contained in:
Christian Kandeler
2011-07-14 15:38:16 +02:00
parent 82bbac7f90
commit 2bdc5c79c6
24 changed files with 509 additions and 225 deletions

View File

@@ -52,7 +52,6 @@ class LinuxDeviceConfiguration;
namespace Internal {
class AbstractRemoteLinuxDeployServicePrivate;
class Qt4MaemoDeployConfiguration;
}
class REMOTELINUX_EXPORT AbstractRemoteLinuxDeployService : public QObject

View File

@@ -38,8 +38,6 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <QtCore/QTimer>
using namespace ProjectExplorer;
namespace RemoteLinux {
@@ -118,9 +116,9 @@ BuildStepConfigWidget *AbstractRemoteLinuxDeployStep::createConfigWidget()
return new Internal::MaemoDeployStepBaseWidget(this);
}
Internal::Qt4MaemoDeployConfiguration *AbstractRemoteLinuxDeployStep::deployConfiguration() const
RemoteLinuxDeployConfiguration *AbstractRemoteLinuxDeployStep::deployConfiguration() const
{
return qobject_cast<Internal::Qt4MaemoDeployConfiguration *>(BuildStep::deployConfiguration());
return qobject_cast<RemoteLinuxDeployConfiguration *>(BuildStep::deployConfiguration());
}
void AbstractRemoteLinuxDeployStep::handleProgressMessage(const QString &message)

View File

@@ -40,9 +40,10 @@
namespace RemoteLinux {
class AbstractRemoteLinuxDeployService;
class RemoteLinuxDeployConfiguration;
namespace Internal {
class AbstractRemoteLinuxDeployStepPrivate;
class Qt4MaemoDeployConfiguration;
}
class REMOTELINUX_EXPORT AbstractRemoteLinuxDeployStep : public ProjectExplorer::BuildStep
@@ -57,7 +58,7 @@ public:
bool runInGuiThread() const { return true; }
void cancel();
ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
Internal::Qt4MaemoDeployConfiguration *deployConfiguration() const;
RemoteLinuxDeployConfiguration *deployConfiguration() const;
virtual AbstractRemoteLinuxDeployService *deployService() const=0;
virtual bool isDeploymentPossible(QString *whyNot = 0) const;

View File

@@ -49,7 +49,6 @@ static const QLatin1String MAEMO_RC_ID(PREFIX);
static const QLatin1String MAEMO_RC_ID_PREFIX(PREFIX ".");
static const QLatin1String ArgumentsKey(PREFIX ".Arguments");
static const QLatin1String DeviceIdKey(PREFIX ".DeviceId");
static const QLatin1String LastDeployedHostsKey(PREFIX ".LastDeployedHosts");
static const QLatin1String LastDeployedFilesKey(PREFIX ".LastDeployedFiles");
static const QLatin1String LastDeployedRemotePathsKey(PREFIX ".LastDeployedRemotePaths");

View File

@@ -39,7 +39,7 @@
#include "maemoglobal.h"
#include "maemopertargetdeviceconfigurationlistmodel.h"
#include "maemosettingspages.h"
#include "qt4maemodeployconfiguration.h"
#include "remotelinuxdeployconfiguration.h"
#include <coreplugin/icore.h>
#include <utils/qtcassert.h>
@@ -67,7 +67,7 @@ MaemoDeployConfigurationWidget::~MaemoDeployConfigurationWidget()
void MaemoDeployConfigurationWidget::init(DeployConfiguration *dc)
{
m_deployConfig = qobject_cast<Qt4MaemoDeployConfiguration *>(dc);
m_deployConfig = qobject_cast<RemoteLinuxDeployConfiguration *>(dc);
Q_ASSERT(m_deployConfig);
connect(ui->manageDevConfsLabel, SIGNAL(linkActivated(QString)),

View File

@@ -42,8 +42,9 @@ namespace Ui {
QT_END_NAMESPACE
namespace RemoteLinux {
class RemoteLinuxDeployConfiguration;
namespace Internal {
class Qt4MaemoDeployConfiguration;
class MaemoDeployConfigurationWidget : public ProjectExplorer::DeployConfigurationWidget
{
@@ -66,7 +67,7 @@ private:
Q_SLOT void showDeviceConfigurations();
Ui::MaemoDeployConfigurationWidget *ui;
Qt4MaemoDeployConfiguration * m_deployConfig;
RemoteLinuxDeployConfiguration *m_deployConfig;
};
} // namespace Internal

View File

@@ -37,8 +37,8 @@
#include "maemodeploybymountsteps.h"
#include "maemoglobal.h"
#include "maemoinstalltosysrootstep.h"
#include "qt4maemodeployconfiguration.h"
#include "qt4maemotarget.h"
#include "remotelinuxdeployconfiguration.h"
#include "uploadandinstalltarpackagestep.h"
#include <projectexplorer/buildconfiguration.h>
@@ -64,7 +64,7 @@ MaemoDeployStepFactory::MaemoDeployStepFactory(QObject *parent)
QStringList MaemoDeployStepFactory::availableCreationIds(BuildStepList *parent) const
{
QStringList ids;
if (!qobject_cast<Qt4MaemoDeployConfiguration *>(parent->parent()))
if (!qobject_cast<RemoteLinuxDeployConfiguration *>(parent->parent()))
return ids;
AbstractQt4MaemoTarget * const maemoTarget

View File

@@ -36,7 +36,7 @@
#include "maemoglobal.h"
#include "maemopackagecreationstep.h"
#include "maemoqtversion.h"
#include "qt4maemodeployconfiguration.h"
#include "remotelinuxdeployconfiguration.h"
#include <utils/fileutils.h>
@@ -316,7 +316,7 @@ void MaemoCopyToSysrootStep::run(QFutureInterface<bool> &fi)
emit addOutput(tr("Copying files to sysroot ..."), MessageOutput);
QDir sysrootDir(qtVersion->systemRoot());
const QSharedPointer<DeploymentInfo> deploymentInfo
= qobject_cast<Qt4MaemoDeployConfiguration *>(deployConfiguration())->deploymentInfo();
= qobject_cast<RemoteLinuxDeployConfiguration *>(deployConfiguration())->deploymentInfo();
const QChar sep = QLatin1Char('/');
for (int i = 0; i < deploymentInfo->deployableCount(); ++i) {
const DeployableFile &deployable = deploymentInfo->deployableAt(i);

View File

@@ -33,8 +33,8 @@
#include "maemoglobal.h"
#include "maemopackagecreationstep.h"
#include "qt4maemodeployconfiguration.h"
#include "qt4maemotarget.h"
#include "remotelinuxdeployconfiguration.h"
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/buildsteplist.h>
@@ -63,7 +63,7 @@ QStringList MaemoPackageCreationFactory::availableCreationIds(ProjectExplorer::B
QStringList ids;
if (!MaemoGlobal::hasLinuxQt(parent->target()))
return ids;
if (!qobject_cast<Qt4MaemoDeployConfiguration *>(parent->parent()))
if (!qobject_cast<RemoteLinuxDeployConfiguration *>(parent->parent()))
return ids;
if (qobject_cast<AbstractDebBasedQt4MaemoTarget *>(parent->target())
&& !parent->contains(MaemoDebianPackageCreationStep::CreatePackageId)) {

View File

@@ -35,8 +35,8 @@
#include "maemoconstants.h"
#include "maemoglobal.h"
#include "maemopackagecreationwidget.h"
#include "qt4maemodeployconfiguration.h"
#include "qt4maemotarget.h"
#include "remotelinuxdeployconfiguration.h"
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorerconstants.h>
@@ -179,9 +179,9 @@ AbstractRpmBasedQt4MaemoTarget *AbstractMaemoPackageCreationStep::rpmBasedMaemoT
return qobject_cast<AbstractRpmBasedQt4MaemoTarget*>(buildConfiguration()->target());
}
Qt4MaemoDeployConfiguration *AbstractMaemoPackageCreationStep::deployConfig() const
RemoteLinuxDeployConfiguration *AbstractMaemoPackageCreationStep::deployConfig() const
{
return qobject_cast<Qt4MaemoDeployConfiguration *>(parent()->parent());
return qobject_cast<RemoteLinuxDeployConfiguration *>(parent()->parent());
}
QString AbstractMaemoPackageCreationStep::buildDirectory() const

View File

@@ -44,11 +44,12 @@ QT_END_NAMESPACE
namespace Qt4ProjectManager { class Qt4BuildConfiguration; }
namespace RemoteLinux {
class RemoteLinuxDeployConfiguration;
namespace Internal {
class AbstractQt4MaemoTarget;
class AbstractDebBasedQt4MaemoTarget;
class AbstractRpmBasedQt4MaemoTarget;
class Qt4MaemoDeployConfiguration;
class AbstractMaemoPackageCreationStep : public ProjectExplorer::BuildStep
{
@@ -70,7 +71,7 @@ public:
AbstractQt4MaemoTarget *maemoTarget() const;
AbstractDebBasedQt4MaemoTarget *debBasedMaemoTarget() const;
AbstractRpmBasedQt4MaemoTarget *rpmBasedMaemoTarget() const;
Qt4MaemoDeployConfiguration *deployConfig() const;
RemoteLinuxDeployConfiguration *deployConfig() const;
static const QLatin1String DefaultVersionNumber;

View File

@@ -32,24 +32,13 @@
#include "maemopertargetdeviceconfigurationlistmodel.h"
#include "linuxdeviceconfigurations.h"
#include "qt4maemotarget.h"
using namespace ProjectExplorer;
namespace RemoteLinux {
namespace Internal {
MaemoPerTargetDeviceConfigurationListModel::MaemoPerTargetDeviceConfigurationListModel(QObject *parent,
const Target *target) : QAbstractListModel(parent)
const QString &osType) : QAbstractListModel(parent), m_targetOsType(osType)
{
if (qobject_cast<const Qt4Maemo5Target *>(target))
m_targetOsType = LinuxDeviceConfiguration::Maemo5OsType;
else if (qobject_cast<const Qt4HarmattanTarget *>(target))
m_targetOsType = LinuxDeviceConfiguration::HarmattanOsType;
else if (qobject_cast<const Qt4MeegoTarget *>(target))
m_targetOsType = LinuxDeviceConfiguration::MeeGoOsType;
else
m_targetOsType = LinuxDeviceConfiguration::GenericLinuxOsType;
const LinuxDeviceConfigurations * const devConfs
= LinuxDeviceConfigurations::instance();
connect(devConfs, SIGNAL(modelReset()), this, SIGNAL(modelReset()));

View File

@@ -33,13 +33,10 @@
#define MAEMOPERTARGETDEVICECONFIGURATIONLISTMODEL_H
#include "linuxdeviceconfiguration.h"
#include "maemoglobal.h"
#include <QtCore/QAbstractListModel>
#include <QtCore/QSharedPointer>
namespace ProjectExplorer { class Target; }
namespace RemoteLinux {
namespace Internal {
@@ -47,8 +44,7 @@ class MaemoPerTargetDeviceConfigurationListModel : public QAbstractListModel
{
Q_OBJECT
public:
explicit MaemoPerTargetDeviceConfigurationListModel(QObject *parent, const
ProjectExplorer::Target *target);
explicit MaemoPerTargetDeviceConfigurationListModel(QObject *parent, const QString &osType);
~MaemoPerTargetDeviceConfigurationListModel();
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
@@ -64,7 +60,7 @@ signals:
void updated();
private:
QString m_targetOsType;
const QString m_targetOsType;
};
} // namespace Internal

View File

@@ -36,8 +36,8 @@
#include "maemoglobal.h"
#include "maemopackagecreationstep.h"
#include "maemopublishingfileselectiondialog.h"
#include "qt4maemodeployconfiguration.h"
#include "qt4maemotarget.h"
#include "remotelinuxdeployconfiguration.h"
#include <coreplugin/ifile.h>
#include <projectexplorer/project.h>
@@ -534,8 +534,8 @@ void MaemoPublisherFremantleFree::finishWithFailure(const QString &progressMsg,
bool MaemoPublisherFremantleFree::updateDesktopFiles(QString *error) const
{
bool success = true;
const Qt4MaemoDeployConfiguration * const deployConfig
= qobject_cast<Qt4MaemoDeployConfiguration *>(m_buildConfig->target()->activeDeployConfiguration());
const RemoteLinuxDeployConfiguration * const deployConfig
= qobject_cast<RemoteLinuxDeployConfiguration *>(m_buildConfig->target()->activeDeployConfiguration());
const QSharedPointer<DeploymentInfo> deploymentInfo
= deployConfig->deploymentInfo();
for (int i = 0; i < deploymentInfo->modelCount(); ++i) {

View File

@@ -32,25 +32,15 @@
#include "qt4maemodeployconfiguration.h"
#include "deploymentinfo.h"
#include "linuxdeviceconfigurations.h"
#include "maddeuploadandinstallpackagesteps.h"
#include "maemoconstants.h"
#include "maemodeploybymountsteps.h"
#include "maemodeployconfigurationwidget.h"
#include "maemoinstalltosysrootstep.h"
#include "maemopackagecreationstep.h"
#include "maemopertargetdeviceconfigurationlistmodel.h"
#include "qt4maemotarget.h"
#include "uploadandinstalltarpackagestep.h"
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <qt4projectmanager/qt4target.h>
using namespace ProjectExplorer;
using namespace Qt4ProjectManager;
namespace RemoteLinux {
namespace Internal {
@@ -58,109 +48,20 @@ namespace {
const QString OldDeployConfigId = QLatin1String("2.2MaemoDeployConfig");
} // namespace
Qt4MaemoDeployConfiguration::Qt4MaemoDeployConfiguration(Target *target,
const QString &id) : DeployConfiguration(target, id)
Qt4MaemoDeployConfiguration::Qt4MaemoDeployConfiguration(ProjectExplorer::Target *target,
const QString &id, const QString &displayName, const QString &supportedOsType)
: RemoteLinuxDeployConfiguration(target, id, displayName, supportedOsType)
{
// A DeploymentInfo object is only dependent on the active build
// configuration and therefore can (and should) be shared among all
// deploy steps. The per-target device configurations model is
// similarly only dependent on the target.
const QList<DeployConfiguration *> &deployConfigs
= this->target()->deployConfigurations();
foreach (const DeployConfiguration * const dc, deployConfigs) {
const Qt4MaemoDeployConfiguration * const mdc
= qobject_cast<const Qt4MaemoDeployConfiguration *>(dc);
if (mdc) {
m_deploymentInfo = mdc->deploymentInfo();
m_devConfModel = mdc->m_devConfModel;
break;
}
}
if (!m_deploymentInfo) {
m_deploymentInfo = QSharedPointer<DeploymentInfo>(new DeploymentInfo(qobject_cast<Qt4BaseTarget *>(target)));
m_devConfModel = QSharedPointer<MaemoPerTargetDeviceConfigurationListModel>
(new MaemoPerTargetDeviceConfigurationListModel(0, target));
}
initialize();
}
Qt4MaemoDeployConfiguration::Qt4MaemoDeployConfiguration(ProjectExplorer::Target *target,
DeployConfiguration *source) : DeployConfiguration(target, source)
Qt4MaemoDeployConfiguration *source)
: RemoteLinuxDeployConfiguration(target, source)
{
const Qt4MaemoDeployConfiguration * const mdc
= qobject_cast<Qt4MaemoDeployConfiguration *>(source);
m_deploymentInfo = mdc->deploymentInfo();
m_devConfModel = mdc->deviceConfigModel();
initialize();
}
void Qt4MaemoDeployConfiguration::initialize()
{
m_deviceConfiguration = deviceConfigModel()->defaultDeviceConfig();
connect(deviceConfigModel().data(), SIGNAL(updated()),
SLOT(handleDeviceConfigurationListUpdated()));
}
void Qt4MaemoDeployConfiguration::handleDeviceConfigurationListUpdated()
{
setDeviceConfig(LinuxDeviceConfigurations::instance()->internalId(m_deviceConfiguration));
}
void Qt4MaemoDeployConfiguration::setDeviceConfig(LinuxDeviceConfiguration::Id internalId)
{
m_deviceConfiguration = deviceConfigModel()->find(internalId);
emit deviceConfigurationListChanged();
emit currentDeviceConfigurationChanged();
}
bool Qt4MaemoDeployConfiguration::fromMap(const QVariantMap &map)
{
if (!DeployConfiguration::fromMap(map))
return false;
setDeviceConfig(map.value(DeviceIdKey, LinuxDeviceConfiguration::InvalidId).toULongLong());
return true;
}
QVariantMap Qt4MaemoDeployConfiguration::toMap() const
{
QVariantMap map = DeployConfiguration::toMap();
map.insert(DeviceIdKey,
LinuxDeviceConfigurations::instance()->internalId(m_deviceConfiguration));
return map;
}
void Qt4MaemoDeployConfiguration::setDeviceConfiguration(int index)
{
const LinuxDeviceConfiguration::ConstPtr &newDevConf = deviceConfigModel()->deviceAt(index);
if (m_deviceConfiguration != newDevConf) {
m_deviceConfiguration = newDevConf;
emit currentDeviceConfigurationChanged();
}
}
Qt4MaemoDeployConfiguration::~Qt4MaemoDeployConfiguration() {}
DeployConfigurationWidget *Qt4MaemoDeployConfiguration::configurationWidget() const
{
return new MaemoDeployConfigurationWidget;
}
QSharedPointer<DeploymentInfo> Qt4MaemoDeployConfiguration::deploymentInfo() const
{
return m_deploymentInfo;
}
QSharedPointer<MaemoPerTargetDeviceConfigurationListModel> Qt4MaemoDeployConfiguration::deviceConfigModel() const
{
return m_devConfModel;
}
LinuxDeviceConfiguration::ConstPtr Qt4MaemoDeployConfiguration::deviceConfiguration() const
{
return m_deviceConfiguration;
}
const QString Qt4MaemoDeployConfiguration::FremantleWithPackagingId
= QLatin1String("DeployToFremantleWithPackaging");
const QString Qt4MaemoDeployConfiguration::FremantleWithoutPackagingId
@@ -169,8 +70,6 @@ const QString Qt4MaemoDeployConfiguration::HarmattanId
= QLatin1String("DeployToHarmattan");
const QString Qt4MaemoDeployConfiguration::MeegoId
= QLatin1String("DeployToMeego");
const QString Qt4MaemoDeployConfiguration::GenericLinuxId
= QLatin1String("DeployToGenericLinux");
Qt4MaemoDeployConfigurationFactory::Qt4MaemoDeployConfigurationFactory(QObject *parent)
@@ -187,8 +86,6 @@ QStringList Qt4MaemoDeployConfigurationFactory::availableCreationIds(Target *par
ids << Qt4MaemoDeployConfiguration::HarmattanId;
} else if (qobject_cast<Qt4MeegoTarget *>(parent)) {
ids << Qt4MaemoDeployConfiguration::MeegoId;
} else if (MaemoGlobal::hasLinuxQt(parent)) {
ids << Qt4MaemoDeployConfiguration::GenericLinuxId;
}
return ids;
@@ -204,8 +101,6 @@ QString Qt4MaemoDeployConfigurationFactory::displayNameForId(const QString &id)
return tr("Build Debian Package and Install to Harmattan Device");
else if (id == Qt4MaemoDeployConfiguration::MeegoId)
return tr("Build RPM Package and Install to MeeGo Device");
else if (id == Qt4MaemoDeployConfiguration::GenericLinuxId)
return tr("Build Tarball and Install to Linux Host");
return QString();
}
@@ -220,28 +115,31 @@ DeployConfiguration *Qt4MaemoDeployConfigurationFactory::create(Target *parent,
{
Q_ASSERT(canCreate(parent, id));
DeployConfiguration * const dc
= new Qt4MaemoDeployConfiguration(parent, id);
dc->setDefaultDisplayName(displayNameForId(id));
DeployConfiguration *dc = 0;
const QString displayName = displayNameForId(id);
if (id == Qt4MaemoDeployConfiguration::FremantleWithoutPackagingId) {
dc = new Qt4MaemoDeployConfiguration(parent, id, displayName,
LinuxDeviceConfiguration::Maemo5OsType);
dc->stepList()->insertStep(0, new MaemoMakeInstallToSysrootStep(dc->stepList()));
dc->stepList()->insertStep(1, new MaemoCopyFilesViaMountStep(dc->stepList()));
} else if (id == Qt4MaemoDeployConfiguration::FremantleWithPackagingId) {
dc = new Qt4MaemoDeployConfiguration(parent, id, displayName,
LinuxDeviceConfiguration::Maemo5OsType);
dc->stepList()->insertStep(0, new MaemoDebianPackageCreationStep(dc->stepList()));
dc->stepList()->insertStep(1, new MaemoInstallDebianPackageToSysrootStep(dc->stepList()));
dc->stepList()->insertStep(2, new MaemoInstallPackageViaMountStep(dc->stepList()));
} else if (id == Qt4MaemoDeployConfiguration::HarmattanId) {
dc = new Qt4MaemoDeployConfiguration(parent, id, displayName,
LinuxDeviceConfiguration::HarmattanOsType);
dc->stepList()->insertStep(0, new MaemoDebianPackageCreationStep(dc->stepList()));
dc->stepList()->insertStep(1, new MaemoInstallDebianPackageToSysrootStep(dc->stepList()));
dc->stepList()->insertStep(2, new MaemoUploadAndInstallPackageStep(dc->stepList()));
} else if (id == Qt4MaemoDeployConfiguration::MeegoId) {
dc = new Qt4MaemoDeployConfiguration(parent, id, displayName,
LinuxDeviceConfiguration::MeeGoOsType);
dc->stepList()->insertStep(0, new MaemoRpmPackageCreationStep(dc->stepList()));
dc->stepList()->insertStep(1, new MaemoInstallRpmPackageToSysrootStep(dc->stepList()));
dc->stepList()->insertStep(2, new MeegoUploadAndInstallPackageStep(dc->stepList()));
} else if (id == Qt4MaemoDeployConfiguration::GenericLinuxId) {
dc->stepList()->insertStep(0, new MaemoTarPackageCreationStep(dc->stepList()));
dc->stepList()->insertStep(1, new UploadAndInstallTarPackageStep(dc->stepList()));
}
return dc;
}
@@ -269,7 +167,7 @@ DeployConfiguration *Qt4MaemoDeployConfigurationFactory::restore(Target *parent,
id = Qt4MaemoDeployConfiguration::MeegoId;
}
Qt4MaemoDeployConfiguration * const dc
= new Qt4MaemoDeployConfiguration(parent, id);
= qobject_cast<Qt4MaemoDeployConfiguration *>(create(parent, id));
if (!dc->fromMap(map)) {
delete dc;
return 0;
@@ -282,7 +180,8 @@ DeployConfiguration *Qt4MaemoDeployConfigurationFactory::clone(Target *parent,
{
if (!canClone(parent, product))
return 0;
return new Qt4MaemoDeployConfiguration(parent, product);
return new Qt4MaemoDeployConfiguration(parent,
qobject_cast<Qt4MaemoDeployConfiguration *>(product));
}
} // namespace Internal

View File

@@ -33,63 +33,10 @@
#ifndef QT4PROJECTMANAGER_QT4DEPLOYCONFIGURATION_H
#define QT4PROJECTMANAGER_QT4DEPLOYCONFIGURATION_H
#include "linuxdeviceconfiguration.h"
#include <projectexplorer/deployconfiguration.h>
#include <QtCore/QSharedPointer>
#include <remotelinux/remotelinuxdeployconfiguration.h>
namespace RemoteLinux {
class DeploymentInfo;
namespace Internal {
class MaemoDeployables;
class MaemoPerTargetDeviceConfigurationListModel;
class Qt4MaemoDeployConfiguration : public ProjectExplorer::DeployConfiguration
{
Q_OBJECT
public:
virtual ~Qt4MaemoDeployConfiguration();
virtual ProjectExplorer::DeployConfigurationWidget *configurationWidget() const;
void setDeviceConfiguration(int index);
QSharedPointer<DeploymentInfo> deploymentInfo() const;
QSharedPointer<MaemoPerTargetDeviceConfigurationListModel> deviceConfigModel() const;
QSharedPointer<const LinuxDeviceConfiguration> deviceConfiguration() const;
static const QString FremantleWithPackagingId;
static const QString FremantleWithoutPackagingId;
static const QString HarmattanId;
static const QString MeegoId;
static const QString GenericLinuxId;
signals:
void deviceConfigurationListChanged();
void currentDeviceConfigurationChanged();
private:
friend class Qt4MaemoDeployConfigurationFactory;
Qt4MaemoDeployConfiguration(ProjectExplorer::Target *target,
const QString &id);
Qt4MaemoDeployConfiguration(ProjectExplorer::Target *target,
ProjectExplorer::DeployConfiguration *source);
bool fromMap(const QVariantMap &map);
QVariantMap toMap() const;
void initialize();
void setDeviceConfig(LinuxDeviceConfiguration::Id internalId);
Q_SLOT void handleDeviceConfigurationListUpdated();
QSharedPointer<DeploymentInfo> m_deploymentInfo;
QSharedPointer<MaemoPerTargetDeviceConfigurationListModel> m_devConfModel;
QSharedPointer<const LinuxDeviceConfiguration> m_deviceConfiguration;
};
class Qt4MaemoDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory
{
@@ -110,6 +57,27 @@ public:
ProjectExplorer::DeployConfiguration *product);
};
class Qt4MaemoDeployConfiguration : public RemoteLinuxDeployConfiguration
{
Q_OBJECT
public:
~Qt4MaemoDeployConfiguration();
static const QString FremantleWithPackagingId;
static const QString FremantleWithoutPackagingId;
static const QString HarmattanId;
static const QString MeegoId;
private:
friend class Internal::Qt4MaemoDeployConfigurationFactory;
Qt4MaemoDeployConfiguration(ProjectExplorer::Target *target, const QString &id,
const QString &displayName, const QString &supportedOsType);
Qt4MaemoDeployConfiguration(ProjectExplorer::Target *target,
Qt4MaemoDeployConfiguration *source);
};
} // namespace Internal
} // namespace RemoteLinux

View File

@@ -86,7 +86,9 @@ HEADERS += \
maemodeploybymountsteps.h \
abstractremotelinuxdeployservice.h \
abstractuploadandinstallpackageservice.h \
genericdirectuploadservice.h
genericdirectuploadservice.h \
remotelinuxdeployconfiguration.h \
remotelinuxdeployconfigurationfactory.h
SOURCES += \
remotelinuxplugin.cpp \
@@ -166,7 +168,9 @@ SOURCES += \
maemodeploybymountsteps.cpp \
abstractremotelinuxdeployservice.cpp \
abstractuploadandinstallpackageservice.cpp \
genericdirectuploadservice.cpp
genericdirectuploadservice.cpp \
remotelinuxdeployconfiguration.cpp \
remotelinuxdeployconfigurationfactory.cpp
FORMS += \
maemoconfigtestdialog.ui \

View File

@@ -0,0 +1,158 @@
/**************************************************************************
**
** 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 info@qt.nokia.com.
**
**************************************************************************/
#include "remotelinuxdeployconfiguration.h"
#include "deploymentinfo.h"
#include "linuxdeviceconfigurations.h"
#include "maemodeployconfigurationwidget.h"
#include "maemopertargetdeviceconfigurationlistmodel.h"
#include <qt4projectmanager/qt4target.h>
using namespace ProjectExplorer;
using namespace Qt4ProjectManager;
namespace RemoteLinux {
namespace Internal {
namespace {
const char DeviceIdKey[] = "Qt4ProjectManager.MaemoRunConfiguration.DeviceId";
} // anonymous namespace
} // namespace Internal
using namespace Internal;
RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target,
const QString &id, const QString &defaultDisplayName, const QString &supportedOsType)
: DeployConfiguration(target, id)
{
setDefaultDisplayName(defaultDisplayName);
// A DeploymentInfo object is only dependent on the active build
// configuration and therefore can (and should) be shared among all
// deploy steps. The per-target device configurations model is
// similarly only dependent on the target.
const QList<DeployConfiguration *> &deployConfigs
= this->target()->deployConfigurations();
foreach (const DeployConfiguration * const dc, deployConfigs) {
const RemoteLinuxDeployConfiguration * const mdc
= qobject_cast<const RemoteLinuxDeployConfiguration *>(dc);
if (mdc) {
m_deploymentInfo = mdc->deploymentInfo();
m_devConfModel = mdc->m_devConfModel;
break;
}
}
if (!m_deploymentInfo) {
m_deploymentInfo = QSharedPointer<DeploymentInfo>(new DeploymentInfo(qobject_cast<Qt4BaseTarget *>(target)));
m_devConfModel = QSharedPointer<MaemoPerTargetDeviceConfigurationListModel>
(new MaemoPerTargetDeviceConfigurationListModel(0, supportedOsType));
}
initialize();
}
RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target,
RemoteLinuxDeployConfiguration *source) : DeployConfiguration(target, source)
{
m_deploymentInfo = source->deploymentInfo();
m_devConfModel = source->deviceConfigModel();
initialize();
}
RemoteLinuxDeployConfiguration::~RemoteLinuxDeployConfiguration() {}
void RemoteLinuxDeployConfiguration::initialize()
{
m_deviceConfiguration = deviceConfigModel()->defaultDeviceConfig();
connect(deviceConfigModel().data(), SIGNAL(updated()),
SLOT(handleDeviceConfigurationListUpdated()));
}
void RemoteLinuxDeployConfiguration::handleDeviceConfigurationListUpdated()
{
setDeviceConfig(LinuxDeviceConfigurations::instance()->internalId(m_deviceConfiguration));
}
void RemoteLinuxDeployConfiguration::setDeviceConfig(LinuxDeviceConfiguration::Id internalId)
{
m_deviceConfiguration = deviceConfigModel()->find(internalId);
emit deviceConfigurationListChanged();
emit currentDeviceConfigurationChanged();
}
bool RemoteLinuxDeployConfiguration::fromMap(const QVariantMap &map)
{
if (!DeployConfiguration::fromMap(map))
return false;
setDeviceConfig(map.value(QLatin1String(DeviceIdKey),
LinuxDeviceConfiguration::InvalidId).toULongLong());
return true;
}
QVariantMap RemoteLinuxDeployConfiguration::toMap() const
{
QVariantMap map = DeployConfiguration::toMap();
map.insert(QLatin1String(DeviceIdKey),
LinuxDeviceConfigurations::instance()->internalId(m_deviceConfiguration));
return map;
}
void RemoteLinuxDeployConfiguration::setDeviceConfiguration(int index)
{
const LinuxDeviceConfiguration::ConstPtr &newDevConf = deviceConfigModel()->deviceAt(index);
if (m_deviceConfiguration != newDevConf) {
m_deviceConfiguration = newDevConf;
emit currentDeviceConfigurationChanged();
}
}
DeployConfigurationWidget *RemoteLinuxDeployConfiguration::configurationWidget() const
{
return new MaemoDeployConfigurationWidget;
}
QSharedPointer<DeploymentInfo> RemoteLinuxDeployConfiguration::deploymentInfo() const
{
return m_deploymentInfo;
}
QSharedPointer<MaemoPerTargetDeviceConfigurationListModel> RemoteLinuxDeployConfiguration::deviceConfigModel() const
{
return m_devConfModel;
}
LinuxDeviceConfiguration::ConstPtr RemoteLinuxDeployConfiguration::deviceConfiguration() const
{
return m_deviceConfiguration;
}
} // namespace RemoteLinux

View File

@@ -0,0 +1,87 @@
/**************************************************************************
**
** 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 info@qt.nokia.com.
**
**************************************************************************/
#ifndef REMOTELINUXDEPLOYCONFIGURATION_H
#define REMOTELINUXDEPLOYCONFIGURATION_H
#include "linuxdeviceconfiguration.h"
#include "remotelinux_export.h"
#include <projectexplorer/deployconfiguration.h>
#include <QtCore/QSharedPointer>
namespace RemoteLinux {
class DeploymentInfo;
namespace Internal {
class MaemoPerTargetDeviceConfigurationListModel;
} // namespace Internal
class REMOTELINUX_EXPORT RemoteLinuxDeployConfiguration
: public ProjectExplorer::DeployConfiguration
{
Q_OBJECT
public:
RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target, const QString &id,
const QString &defaultDisplayName, const QString &supportedOsType);
RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target,
RemoteLinuxDeployConfiguration *source);
~RemoteLinuxDeployConfiguration();
bool fromMap(const QVariantMap &map);
ProjectExplorer::DeployConfigurationWidget *configurationWidget() const;
void setDeviceConfiguration(int index);
QSharedPointer<DeploymentInfo> deploymentInfo() const;
QSharedPointer<Internal::MaemoPerTargetDeviceConfigurationListModel> deviceConfigModel() const;
QSharedPointer<const LinuxDeviceConfiguration> deviceConfiguration() const;
signals:
void deviceConfigurationListChanged();
void currentDeviceConfigurationChanged();
private:
QVariantMap toMap() const;
void initialize();
void setDeviceConfig(LinuxDeviceConfiguration::Id internalId);
Q_SLOT void handleDeviceConfigurationListUpdated();
QSharedPointer<DeploymentInfo> m_deploymentInfo;
QSharedPointer<Internal::MaemoPerTargetDeviceConfigurationListModel> m_devConfModel;
QSharedPointer<const LinuxDeviceConfiguration> m_deviceConfiguration;
};
} // namespace RemoteLinux
#endif // REMOTELINUXDEPLOYCONFIGURATION_H

View File

@@ -0,0 +1,120 @@
/**************************************************************************
**
** 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 info@qt.nokia.com.
**
**************************************************************************/
#include "remotelinuxdeployconfigurationfactory.h"
#include "linuxdeviceconfiguration.h"
#include "maemoglobal.h"
#include "maemopackagecreationstep.h"
#include "remotelinuxdeployconfiguration.h"
#include "uploadandinstalltarpackagestep.h"
#include <QtCore/QCoreApplication>
using namespace ProjectExplorer;
namespace RemoteLinux {
namespace Internal {
namespace {
const char GenericLinuxId[] = "DeployToGenericLinux";
QString genericLinuxDisplayName() {
return QCoreApplication::translate("RemoteLinux", "Build Tarball and Install to Linux Host");
}
} // anonymous namespace
RemoteLinuxDeployConfigurationFactory::RemoteLinuxDeployConfigurationFactory(QObject *parent)
: DeployConfigurationFactory(parent)
{ }
QStringList RemoteLinuxDeployConfigurationFactory::availableCreationIds(Target *parent) const
{
QStringList ids;
if (MaemoGlobal::hasLinuxQt(parent))
ids << QLatin1String(GenericLinuxId);
return ids;
}
QString RemoteLinuxDeployConfigurationFactory::displayNameForId(const QString &id) const
{
if (id == QLatin1String(GenericLinuxId))
return genericLinuxDisplayName();
return QString();
}
bool RemoteLinuxDeployConfigurationFactory::canCreate(Target *parent, const QString &id) const
{
return availableCreationIds(parent).contains(id);
}
DeployConfiguration *RemoteLinuxDeployConfigurationFactory::create(Target *parent,
const QString &id)
{
Q_ASSERT(canCreate(parent, id));
DeployConfiguration * const dc = new RemoteLinuxDeployConfiguration(parent, id,
genericLinuxDisplayName(), LinuxDeviceConfiguration::GenericLinuxOsType);
dc->stepList()->insertStep(0, new MaemoTarPackageCreationStep(dc->stepList()));
dc->stepList()->insertStep(1, new UploadAndInstallTarPackageStep(dc->stepList()));
return dc;
}
bool RemoteLinuxDeployConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
{
return canCreate(parent, idFromMap(map));
}
DeployConfiguration *RemoteLinuxDeployConfigurationFactory::restore(Target *parent,
const QVariantMap &map)
{
if (!canRestore(parent, map))
return 0;
QString id = idFromMap(map);
RemoteLinuxDeployConfiguration * const dc = new RemoteLinuxDeployConfiguration(parent, id,
genericLinuxDisplayName(), LinuxDeviceConfiguration::GenericLinuxOsType);
if (!dc->fromMap(map)) {
delete dc;
return 0;
}
return dc;
}
DeployConfiguration *RemoteLinuxDeployConfigurationFactory::clone(Target *parent,
DeployConfiguration *product)
{
if (!canClone(parent, product))
return 0;
return new RemoteLinuxDeployConfiguration(parent,
qobject_cast<RemoteLinuxDeployConfiguration *>(product));
}
} // namespace Internal
} // namespace RemoteLinux

View File

@@ -0,0 +1,62 @@
/**************************************************************************
**
** 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 info@qt.nokia.com.
**
**************************************************************************/
#ifndef REMOTELINUXDEPLOYCONFIGURATIONFACTORY_H
#define REMOTELINUXDEPLOYCONFIGURATIONFACTORY_H
#include <projectexplorer/deployconfiguration.h>
namespace RemoteLinux {
namespace Internal {
class RemoteLinuxDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory
{
Q_OBJECT
public:
explicit RemoteLinuxDeployConfigurationFactory(QObject *parent = 0);
virtual QStringList availableCreationIds(ProjectExplorer::Target *parent) const;
virtual QString displayNameForId(const QString &id) const;
virtual bool canCreate(ProjectExplorer::Target *parent, const QString &id) const;
virtual ProjectExplorer::DeployConfiguration *create(ProjectExplorer::Target *parent, const QString &id);
virtual bool canRestore(ProjectExplorer::Target *parent,
const QVariantMap &map) const;
virtual ProjectExplorer::DeployConfiguration *restore(ProjectExplorer::Target *parent,
const QVariantMap &map);
virtual ProjectExplorer::DeployConfiguration *clone(ProjectExplorer::Target *parent,
ProjectExplorer::DeployConfiguration *product);
};
} // namespace Internal
} // namespace RemoteLinux
#endif // REMOTELINUXDEPLOYCONFIGURATIONFACTORY_H

View File

@@ -49,6 +49,7 @@
#include "maemoqtversionfactory.h"
#include "qt4maemotargetfactory.h"
#include "qt4projectmanager/qt4projectmanagerconstants.h"
#include "remotelinuxdeployconfigurationfactory.h"
#include "remotelinuxrunconfigurationfactory.h"
#include "remotelinuxruncontrolfactory.h"
@@ -89,6 +90,7 @@ bool RemoteLinuxPlugin::initialize(const QStringList &arguments,
addAutoReleasedObject(new MaddeDeviceConfigurationFactory);
addAutoReleasedObject(new RemoteLinuxRunConfigurationFactory);
addAutoReleasedObject(new RemoteLinuxRunControlFactory);
addAutoReleasedObject(new RemoteLinuxDeployConfigurationFactory);
qRegisterMetaType<DeployableFile>("DeployableFile");

View File

@@ -36,8 +36,8 @@
#include "maemoglobal.h"
#include "maemoqtversion.h"
#include "maemotoolchain.h"
#include "qt4maemodeployconfiguration.h"
#include "qt4maemotarget.h"
#include "remotelinuxdeployconfiguration.h"
#include "remotelinuxrunconfigurationwidget.h"
#include <projectexplorer/projectexplorer.h>
@@ -250,9 +250,9 @@ QString RemoteLinuxRunConfiguration::gdbCmd() const
return QDir::toNativeSeparators(activeBuildConfiguration()->toolChain()->debuggerCommand());
}
Qt4MaemoDeployConfiguration *RemoteLinuxRunConfiguration::deployConfig() const
RemoteLinuxDeployConfiguration *RemoteLinuxRunConfiguration::deployConfig() const
{
return qobject_cast<Qt4MaemoDeployConfiguration *>(target()->activeDeployConfiguration());
return qobject_cast<RemoteLinuxDeployConfiguration *>(target()->activeDeployConfiguration());
}
QString RemoteLinuxRunConfiguration::arguments() const
@@ -326,7 +326,7 @@ void RemoteLinuxRunConfiguration::updateDeviceConfigurations()
void RemoteLinuxRunConfiguration::handleDeployConfigChanged()
{
Qt4MaemoDeployConfiguration * const activeDeployConf = deployConfig();
RemoteLinuxDeployConfiguration * const activeDeployConf = deployConfig();
if (activeDeployConf) {
connect(activeDeployConf->deploymentInfo().data(), SIGNAL(modelReset()),
SLOT(handleDeployablesUpdated()), Qt::UniqueConnection);

View File

@@ -56,10 +56,10 @@ class Qt4ProFileNode;
namespace RemoteLinux {
class LinuxDeviceConfiguration;
class RemoteLinuxRunConfigurationWidget;
class RemoteLinuxDeployConfiguration;
namespace Internal {
class MaemoDeviceConfigListModel;
class Qt4MaemoDeployConfiguration;
class RemoteLinuxRunConfigurationPrivate;
class RemoteLinuxRunConfigurationFactory;
} // namespace Internal
@@ -89,7 +89,7 @@ public:
Qt4ProjectManager::Qt4BaseTarget *qt4Target() const;
Qt4ProjectManager::Qt4BuildConfiguration *activeQt4BuildConfiguration() const;
Internal::Qt4MaemoDeployConfiguration *deployConfig() const;
RemoteLinuxDeployConfiguration *deployConfig() const;
virtual QString commandPrefix() const;
virtual PortList freePorts() const;