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"
|
|
|
|
|
|
2012-02-07 14:13:56 +01:00
|
|
|
#include "abstractembeddedlinuxtarget.h"
|
2011-07-14 15:38:16 +02:00
|
|
|
#include "deploymentinfo.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
|
|
|
|
2012-04-12 14:34:45 +02:00
|
|
|
#include <coreplugin/id.h>
|
2012-03-06 12:31:42 +01:00
|
|
|
#include <projectexplorer/devicesupport/devicemanager.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<const LinuxDeviceConfiguration> deviceConfiguration;
|
|
|
|
|
};
|
|
|
|
|
|
2011-07-14 15:38:16 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
|
|
|
|
|
using namespace Internal;
|
|
|
|
|
|
|
|
|
|
RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target,
|
2012-03-15 17:17:40 +01:00
|
|
|
const Core::Id id, const QString &defaultDisplayName)
|
2011-09-15 09:10:10 +02:00
|
|
|
: DeployConfiguration(target, id), d(new RemoteLinuxDeployConfigurationPrivate)
|
2011-07-14 15:38:16 +02:00
|
|
|
{
|
|
|
|
|
setDefaultDisplayName(defaultDisplayName);
|
|
|
|
|
|
|
|
|
|
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
|
|
|
{
|
|
|
|
|
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()
|
|
|
|
|
{
|
2012-02-07 14:13:56 +01:00
|
|
|
d->deviceConfiguration = target()->deviceConfigModel()->defaultDeviceConfig();
|
2012-03-19 17:35:44 +01:00
|
|
|
connect(target()->deviceConfigModel(), SIGNAL(modelReset()),
|
2011-07-14 15:38:16 +02:00
|
|
|
SLOT(handleDeviceConfigurationListUpdated()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RemoteLinuxDeployConfiguration::handleDeviceConfigurationListUpdated()
|
|
|
|
|
{
|
2012-04-12 16:54:04 +02:00
|
|
|
setDeviceConfig(DeviceManager::instance()->deviceId(d->deviceConfiguration));
|
2011-07-14 15:38:16 +02:00
|
|
|
}
|
|
|
|
|
|
2012-04-25 09:54:31 +02:00
|
|
|
void RemoteLinuxDeployConfiguration::setDeviceConfig(Core::Id id)
|
2011-07-14 15:38:16 +02:00
|
|
|
{
|
2012-04-25 09:54:31 +02:00
|
|
|
d->deviceConfiguration = target()->deviceConfigModel()->find(id);
|
2011-07-14 15:38:16 +02:00
|
|
|
emit deviceConfigurationListChanged();
|
|
|
|
|
emit currentDeviceConfigurationChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool RemoteLinuxDeployConfiguration::fromMap(const QVariantMap &map)
|
|
|
|
|
{
|
|
|
|
|
if (!DeployConfiguration::fromMap(map))
|
|
|
|
|
return false;
|
2012-04-27 17:19:00 +02:00
|
|
|
const QString idString = map.value(QLatin1String(DeviceIdKey)).toString();
|
|
|
|
|
setDeviceConfig(!idString.isEmpty() ? Core::Id(idString) : IDevice::invalidId());
|
2011-07-14 15:38:16 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap RemoteLinuxDeployConfiguration::toMap() const
|
|
|
|
|
{
|
|
|
|
|
QVariantMap map = DeployConfiguration::toMap();
|
|
|
|
|
map.insert(QLatin1String(DeviceIdKey),
|
2012-04-12 16:54:04 +02:00
|
|
|
DeviceManager::instance()->deviceId(d->deviceConfiguration).toString());
|
2011-07-14 15:38:16 +02:00
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RemoteLinuxDeployConfiguration::setDeviceConfiguration(int index)
|
|
|
|
|
{
|
2012-02-07 14:13:56 +01:00
|
|
|
const LinuxDeviceConfiguration::ConstPtr &newDevConf
|
|
|
|
|
= target()->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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-07 14:13:56 +01:00
|
|
|
AbstractEmbeddedLinuxTarget *RemoteLinuxDeployConfiguration::target() const
|
2011-07-14 15:38:16 +02:00
|
|
|
{
|
2012-02-07 14:13:56 +01:00
|
|
|
return qobject_cast<AbstractEmbeddedLinuxTarget *>(DeployConfiguration::target());
|
2011-07-14 15:38:16 +02:00
|
|
|
}
|
|
|
|
|
|
2012-02-07 14:13:56 +01:00
|
|
|
DeploymentInfo *RemoteLinuxDeployConfiguration::deploymentInfo() const
|
2011-07-14 15:38:16 +02:00
|
|
|
{
|
2012-02-07 14:13:56 +01:00
|
|
|
return target()->deploymentInfo();
|
2011-07-14 15:38:16 +02:00
|
|
|
}
|
|
|
|
|
|
2012-02-07 14:13:56 +01:00
|
|
|
DeployConfigurationWidget *RemoteLinuxDeployConfiguration::configurationWidget() const
|
2011-07-14 15:38:16 +02:00
|
|
|
{
|
2012-02-07 14:13:56 +01:00
|
|
|
return new RemoteLinuxDeployConfigurationWidget;
|
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
|
|
|
}
|
|
|
|
|
|
2011-07-14 15:38:16 +02:00
|
|
|
} // namespace RemoteLinux
|