2011-07-14 15:38:16 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2012-01-26 18:33:46 +01:00
|
|
|
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
2011-07-14 15:38:16 +02:00
|
|
|
**
|
2011-11-02 15:59:12 +01:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2011-07-14 15:38:16 +02:00
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** 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
|
2011-11-02 15:59:12 +01:00
|
|
|
** Nokia at qt-info@nokia.com.
|
2011-07-14 15:38:16 +02:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
#include "remotelinuxdeployconfiguration.h"
|
|
|
|
|
|
|
|
|
|
#include "deploymentinfo.h"
|
|
|
|
|
#include "linuxdeviceconfigurations.h"
|
2011-08-01 16:44:59 +02:00
|
|
|
#include "remotelinuxdeployconfigurationwidget.h"
|
2011-07-22 12:38:57 +02:00
|
|
|
#include "typespecificdeviceconfigurationlistmodel.h"
|
2011-07-14 15:38:16 +02:00
|
|
|
|
|
|
|
|
#include <qt4projectmanager/qt4target.h>
|
|
|
|
|
|
|
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
using namespace Qt4ProjectManager;
|
|
|
|
|
|
|
|
|
|
namespace RemoteLinux {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
namespace {
|
|
|
|
|
const char DeviceIdKey[] = "Qt4ProjectManager.MaemoRunConfiguration.DeviceId";
|
|
|
|
|
} // anonymous namespace
|
2011-08-01 16:44:59 +02:00
|
|
|
|
|
|
|
|
class RemoteLinuxDeployConfigurationPrivate
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QSharedPointer<DeploymentInfo> deploymentInfo;
|
|
|
|
|
QSharedPointer<Internal::TypeSpecificDeviceConfigurationListModel> devConfModel;
|
|
|
|
|
QSharedPointer<const LinuxDeviceConfiguration> deviceConfiguration;
|
|
|
|
|
QString supportedOsType;
|
|
|
|
|
};
|
|
|
|
|
|
2011-07-14 15:38:16 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
|
|
|
|
|
using namespace Internal;
|
|
|
|
|
|
|
|
|
|
RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target,
|
|
|
|
|
const QString &id, const QString &defaultDisplayName, const QString &supportedOsType)
|
2011-09-15 09:10:10 +02:00
|
|
|
: DeployConfiguration(target, id), d(new RemoteLinuxDeployConfigurationPrivate)
|
2011-07-14 15:38:16 +02:00
|
|
|
{
|
2011-09-15 09:10:10 +02:00
|
|
|
d->supportedOsType = supportedOsType;
|
2011-07-14 15:38:16 +02:00
|
|
|
setDefaultDisplayName(defaultDisplayName);
|
|
|
|
|
|
|
|
|
|
// A DeploymentInfo object is only dependent on the active build
|
|
|
|
|
// configuration and therefore can (and should) be shared among all
|
2011-08-01 16:44:59 +02:00
|
|
|
// deploy configurations. The per-target device configurations model is
|
2011-07-14 15:38:16 +02:00
|
|
|
// 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) {
|
2011-09-15 09:10:10 +02:00
|
|
|
d->deploymentInfo = mdc->deploymentInfo();
|
|
|
|
|
d->devConfModel = mdc->d->devConfModel;
|
2011-07-14 15:38:16 +02:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-09-15 09:10:10 +02:00
|
|
|
if (!d->deploymentInfo) {
|
|
|
|
|
d->deploymentInfo = QSharedPointer<DeploymentInfo>(new DeploymentInfo(qobject_cast<Qt4BaseTarget *>(target)));
|
|
|
|
|
d->devConfModel = QSharedPointer<TypeSpecificDeviceConfigurationListModel>
|
2011-08-01 16:44:59 +02:00
|
|
|
(new TypeSpecificDeviceConfigurationListModel(supportedOsType));
|
2011-07-14 15:38:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
initialize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target,
|
2011-08-01 16:44:59 +02:00
|
|
|
RemoteLinuxDeployConfiguration *source)
|
2011-09-15 09:10:10 +02:00
|
|
|
: DeployConfiguration(target, source), d(new RemoteLinuxDeployConfigurationPrivate)
|
2011-07-14 15:38:16 +02:00
|
|
|
{
|
2011-09-15 09:10:10 +02:00
|
|
|
d->supportedOsType = source->supportedOsType();
|
|
|
|
|
d->deploymentInfo = source->deploymentInfo();
|
|
|
|
|
d->devConfModel = source->deviceConfigModel();
|
2011-07-14 15:38:16 +02:00
|
|
|
initialize();
|
|
|
|
|
}
|
|
|
|
|
|
2011-08-01 16:44:59 +02:00
|
|
|
RemoteLinuxDeployConfiguration::~RemoteLinuxDeployConfiguration()
|
|
|
|
|
{
|
2011-09-15 09:10:10 +02:00
|
|
|
delete d;
|
2011-08-01 16:44:59 +02:00
|
|
|
}
|
2011-07-14 15:38:16 +02:00
|
|
|
|
|
|
|
|
void RemoteLinuxDeployConfiguration::initialize()
|
|
|
|
|
{
|
2011-09-15 09:10:10 +02:00
|
|
|
d->deviceConfiguration = deviceConfigModel()->defaultDeviceConfig();
|
2011-07-14 15:38:16 +02:00
|
|
|
connect(deviceConfigModel().data(), SIGNAL(updated()),
|
|
|
|
|
SLOT(handleDeviceConfigurationListUpdated()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RemoteLinuxDeployConfiguration::handleDeviceConfigurationListUpdated()
|
|
|
|
|
{
|
2011-09-15 09:10:10 +02:00
|
|
|
setDeviceConfig(LinuxDeviceConfigurations::instance()->internalId(d->deviceConfiguration));
|
2011-07-14 15:38:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RemoteLinuxDeployConfiguration::setDeviceConfig(LinuxDeviceConfiguration::Id internalId)
|
|
|
|
|
{
|
2011-09-15 09:10:10 +02:00
|
|
|
d->deviceConfiguration = deviceConfigModel()->find(internalId);
|
2011-07-14 15:38:16 +02:00
|
|
|
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),
|
2011-09-15 09:10:10 +02:00
|
|
|
LinuxDeviceConfigurations::instance()->internalId(d->deviceConfiguration));
|
2011-07-14 15:38:16 +02:00
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RemoteLinuxDeployConfiguration::setDeviceConfiguration(int index)
|
|
|
|
|
{
|
|
|
|
|
const LinuxDeviceConfiguration::ConstPtr &newDevConf = deviceConfigModel()->deviceAt(index);
|
2011-09-15 09:10:10 +02:00
|
|
|
if (d->deviceConfiguration != newDevConf) {
|
|
|
|
|
d->deviceConfiguration = newDevConf;
|
2011-07-14 15:38:16 +02:00
|
|
|
emit currentDeviceConfigurationChanged();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DeployConfigurationWidget *RemoteLinuxDeployConfiguration::configurationWidget() const
|
|
|
|
|
{
|
2011-08-01 16:44:59 +02:00
|
|
|
return new RemoteLinuxDeployConfigurationWidget;
|
2011-07-14 15:38:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QSharedPointer<DeploymentInfo> RemoteLinuxDeployConfiguration::deploymentInfo() const
|
|
|
|
|
{
|
2011-09-15 09:10:10 +02:00
|
|
|
return d->deploymentInfo;
|
2011-07-14 15:38:16 +02:00
|
|
|
}
|
|
|
|
|
|
2011-07-22 12:38:57 +02:00
|
|
|
QSharedPointer<TypeSpecificDeviceConfigurationListModel> RemoteLinuxDeployConfiguration::deviceConfigModel() const
|
2011-07-14 15:38:16 +02:00
|
|
|
{
|
2011-09-15 09:10:10 +02:00
|
|
|
return d->devConfModel;
|
2011-07-14 15:38:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LinuxDeviceConfiguration::ConstPtr RemoteLinuxDeployConfiguration::deviceConfiguration() const
|
|
|
|
|
{
|
2011-09-15 09:10:10 +02:00
|
|
|
return d->deviceConfiguration;
|
2011-08-01 16:44:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString RemoteLinuxDeployConfiguration::supportedOsType() const
|
|
|
|
|
{
|
2011-09-15 09:10:10 +02:00
|
|
|
return d->supportedOsType;
|
2011-07-14 15:38:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace RemoteLinux
|