forked from qt-creator/qt-creator
RemoteLinux: Overhaul deployment infrastructure.
- Introduce generic and Madde-specific deploy configuration widgets. - Move project file update logic into dedicated class. - Generic deploy configuration widget no longer has the ability to change deployment settings via the GUI, because we cannot know which qmake scope to use for that. Change-Id: Ie542a0852c8aa1c6b416cd7aece4e48c1cc2de7c Reviewed-on: http://codereview.qt.nokia.com/2445 Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
|
||||
#include "deploymentinfo.h"
|
||||
#include "linuxdeviceconfigurations.h"
|
||||
#include "maemodeployconfigurationwidget.h"
|
||||
#include "remotelinuxdeployconfigurationwidget.h"
|
||||
#include "typespecificdeviceconfigurationlistmodel.h"
|
||||
|
||||
#include <qt4projectmanager/qt4target.h>
|
||||
@@ -46,19 +46,30 @@ namespace Internal {
|
||||
namespace {
|
||||
const char DeviceIdKey[] = "Qt4ProjectManager.MaemoRunConfiguration.DeviceId";
|
||||
} // anonymous namespace
|
||||
|
||||
class RemoteLinuxDeployConfigurationPrivate
|
||||
{
|
||||
public:
|
||||
QSharedPointer<DeploymentInfo> deploymentInfo;
|
||||
QSharedPointer<Internal::TypeSpecificDeviceConfigurationListModel> devConfModel;
|
||||
QSharedPointer<const LinuxDeviceConfiguration> deviceConfiguration;
|
||||
QString supportedOsType;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
using namespace Internal;
|
||||
|
||||
RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target,
|
||||
const QString &id, const QString &defaultDisplayName, const QString &supportedOsType)
|
||||
: DeployConfiguration(target, id)
|
||||
: DeployConfiguration(target, id), m_d(new RemoteLinuxDeployConfigurationPrivate)
|
||||
{
|
||||
m_d->supportedOsType = supportedOsType;
|
||||
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
|
||||
// deploy configurations. The per-target device configurations model is
|
||||
// similarly only dependent on the target.
|
||||
const QList<DeployConfiguration *> &deployConfigs
|
||||
= this->target()->deployConfigurations();
|
||||
@@ -66,45 +77,50 @@ RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::
|
||||
const RemoteLinuxDeployConfiguration * const mdc
|
||||
= qobject_cast<const RemoteLinuxDeployConfiguration *>(dc);
|
||||
if (mdc) {
|
||||
m_deploymentInfo = mdc->deploymentInfo();
|
||||
m_devConfModel = mdc->m_devConfModel;
|
||||
m_d->deploymentInfo = mdc->deploymentInfo();
|
||||
m_d->devConfModel = mdc->m_d->devConfModel;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!m_deploymentInfo) {
|
||||
m_deploymentInfo = QSharedPointer<DeploymentInfo>(new DeploymentInfo(qobject_cast<Qt4BaseTarget *>(target)));
|
||||
m_devConfModel = QSharedPointer<TypeSpecificDeviceConfigurationListModel>
|
||||
(new TypeSpecificDeviceConfigurationListModel(0, supportedOsType));
|
||||
if (!m_d->deploymentInfo) {
|
||||
m_d->deploymentInfo = QSharedPointer<DeploymentInfo>(new DeploymentInfo(qobject_cast<Qt4BaseTarget *>(target)));
|
||||
m_d->devConfModel = QSharedPointer<TypeSpecificDeviceConfigurationListModel>
|
||||
(new TypeSpecificDeviceConfigurationListModel(supportedOsType));
|
||||
}
|
||||
|
||||
initialize();
|
||||
}
|
||||
|
||||
RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target,
|
||||
RemoteLinuxDeployConfiguration *source) : DeployConfiguration(target, source)
|
||||
RemoteLinuxDeployConfiguration *source)
|
||||
: DeployConfiguration(target, source), m_d(new RemoteLinuxDeployConfigurationPrivate)
|
||||
{
|
||||
m_deploymentInfo = source->deploymentInfo();
|
||||
m_devConfModel = source->deviceConfigModel();
|
||||
m_d->supportedOsType = source->supportedOsType();
|
||||
m_d->deploymentInfo = source->deploymentInfo();
|
||||
m_d->devConfModel = source->deviceConfigModel();
|
||||
initialize();
|
||||
}
|
||||
|
||||
RemoteLinuxDeployConfiguration::~RemoteLinuxDeployConfiguration() {}
|
||||
RemoteLinuxDeployConfiguration::~RemoteLinuxDeployConfiguration()
|
||||
{
|
||||
delete m_d;
|
||||
}
|
||||
|
||||
void RemoteLinuxDeployConfiguration::initialize()
|
||||
{
|
||||
m_deviceConfiguration = deviceConfigModel()->defaultDeviceConfig();
|
||||
m_d->deviceConfiguration = deviceConfigModel()->defaultDeviceConfig();
|
||||
connect(deviceConfigModel().data(), SIGNAL(updated()),
|
||||
SLOT(handleDeviceConfigurationListUpdated()));
|
||||
}
|
||||
|
||||
void RemoteLinuxDeployConfiguration::handleDeviceConfigurationListUpdated()
|
||||
{
|
||||
setDeviceConfig(LinuxDeviceConfigurations::instance()->internalId(m_deviceConfiguration));
|
||||
setDeviceConfig(LinuxDeviceConfigurations::instance()->internalId(m_d->deviceConfiguration));
|
||||
}
|
||||
|
||||
void RemoteLinuxDeployConfiguration::setDeviceConfig(LinuxDeviceConfiguration::Id internalId)
|
||||
{
|
||||
m_deviceConfiguration = deviceConfigModel()->find(internalId);
|
||||
m_d->deviceConfiguration = deviceConfigModel()->find(internalId);
|
||||
emit deviceConfigurationListChanged();
|
||||
emit currentDeviceConfigurationChanged();
|
||||
}
|
||||
@@ -122,37 +138,42 @@ QVariantMap RemoteLinuxDeployConfiguration::toMap() const
|
||||
{
|
||||
QVariantMap map = DeployConfiguration::toMap();
|
||||
map.insert(QLatin1String(DeviceIdKey),
|
||||
LinuxDeviceConfigurations::instance()->internalId(m_deviceConfiguration));
|
||||
LinuxDeviceConfigurations::instance()->internalId(m_d->deviceConfiguration));
|
||||
return map;
|
||||
}
|
||||
|
||||
void RemoteLinuxDeployConfiguration::setDeviceConfiguration(int index)
|
||||
{
|
||||
const LinuxDeviceConfiguration::ConstPtr &newDevConf = deviceConfigModel()->deviceAt(index);
|
||||
if (m_deviceConfiguration != newDevConf) {
|
||||
m_deviceConfiguration = newDevConf;
|
||||
if (m_d->deviceConfiguration != newDevConf) {
|
||||
m_d->deviceConfiguration = newDevConf;
|
||||
emit currentDeviceConfigurationChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DeployConfigurationWidget *RemoteLinuxDeployConfiguration::configurationWidget() const
|
||||
{
|
||||
return new MaemoDeployConfigurationWidget;
|
||||
return new RemoteLinuxDeployConfigurationWidget;
|
||||
}
|
||||
|
||||
QSharedPointer<DeploymentInfo> RemoteLinuxDeployConfiguration::deploymentInfo() const
|
||||
{
|
||||
return m_deploymentInfo;
|
||||
return m_d->deploymentInfo;
|
||||
}
|
||||
|
||||
QSharedPointer<TypeSpecificDeviceConfigurationListModel> RemoteLinuxDeployConfiguration::deviceConfigModel() const
|
||||
{
|
||||
return m_devConfModel;
|
||||
return m_d->devConfModel;
|
||||
}
|
||||
|
||||
LinuxDeviceConfiguration::ConstPtr RemoteLinuxDeployConfiguration::deviceConfiguration() const
|
||||
{
|
||||
return m_deviceConfiguration;
|
||||
return m_d->deviceConfiguration;
|
||||
}
|
||||
|
||||
QString RemoteLinuxDeployConfiguration::supportedOsType() const
|
||||
{
|
||||
return m_d->supportedOsType;
|
||||
}
|
||||
|
||||
} // namespace RemoteLinux
|
||||
|
||||
Reference in New Issue
Block a user