Madde: Introduce new class MaddeDevice.

This is needed for an upcoming change that will move a number of virtual
functions from IDeviceFactory to IDevice.

Change-Id: I3658c057583853359b3f0e901f5db78502e1a993
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
Christian Kandeler
2012-04-05 16:55:14 +02:00
parent 88e6448ff8
commit 014ceb58b0
6 changed files with 141 additions and 6 deletions

View File

@@ -53,6 +53,7 @@ HEADERS += \
maemodeploybymountsteps.h \
maddedevicetester.h \
maddedeviceconfigurationfactory.h \
maddedevice.h
SOURCES += \
maddeplugin.cpp \
@@ -98,7 +99,8 @@ SOURCES += \
maddeuploadandinstallpackagesteps.cpp \
maemodeploybymountsteps.cpp \
maddedevicetester.cpp \
maemorunconfiguration.cpp
maemorunconfiguration.cpp \
maddedevice.cpp
FORMS += \
maemopackagecreationwidget.ui \

View File

@@ -125,6 +125,8 @@ QtcPlugin {
"qt4maemotarget.h",
"qt4maemotargetfactory.cpp",
"qt4maemotargetfactory.h",
"maddedevice.cpp",
"maddedevice.h"
]
}

View File

@@ -0,0 +1,68 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@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 "maddedevice.h"
namespace Madde {
namespace Internal {
MaddeDevice::Ptr MaddeDevice::create()
{
return Ptr(new MaddeDevice);
}
MaddeDevice::Ptr MaddeDevice::create(const QString &name, const QString &type,
MachineType machineType, Origin origin, const QString &fingerprint)
{
return Ptr(new MaddeDevice(name, type, machineType, origin, fingerprint));
}
MaddeDevice::MaddeDevice()
{
}
MaddeDevice::MaddeDevice(const QString &name, const QString &type, MachineType machineType,
Origin origin, const QString &fingerprint)
: LinuxDeviceConfiguration(name, type, machineType, origin, fingerprint)
{
}
MaddeDevice::MaddeDevice(const MaddeDevice &other) : LinuxDeviceConfiguration(other)
{
}
ProjectExplorer::IDevice::Ptr MaddeDevice::clone() const
{
return Ptr(new MaddeDevice(*this));
}
} // namespace Internal
} // namespace Madde

View File

@@ -0,0 +1,63 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@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 MADDEDEVICE_H
#define MADDEDEVICE_H
#include <remotelinux/linuxdeviceconfiguration.h>
namespace Madde {
namespace Internal {
class MaddeDevice : public RemoteLinux::LinuxDeviceConfiguration
{
public:
typedef QSharedPointer<MaddeDevice> Ptr;
typedef QSharedPointer<const MaddeDevice> ConstPtr;
static Ptr create();
static Ptr create(const QString &name, const QString &type, MachineType machineType,
Origin origin = ManuallyAdded, const QString &fingerprint = QString());
ProjectExplorer::IDevice::Ptr clone() const;
private:
MaddeDevice();
MaddeDevice(const QString &name, const QString &type, MachineType machineType,
Origin origin, const QString &fingerprint);
MaddeDevice(const MaddeDevice &other);
};
} // namespace Internal
} // namespace Madde
#endif // MADDEDEVICE_H

View File

@@ -31,6 +31,7 @@
**************************************************************************/
#include "maddedeviceconfigurationfactory.h"
#include "maddedevice.h"
#include "maddedevicetester.h"
#include "maemoconstants.h"
#include "maemodeviceconfigwizard.h"
@@ -77,9 +78,8 @@ IDeviceWidget *MaddeDeviceConfigurationFactory::createWidget(const IDevice::Ptr
IDevice::Ptr MaddeDeviceConfigurationFactory::loadDevice(const QVariantMap &map) const
{
QTC_ASSERT(supportsDeviceType(IDevice::typeFromMap(map)),
return LinuxDeviceConfiguration::Ptr());
LinuxDeviceConfiguration::Ptr device = LinuxDeviceConfiguration::create();
QTC_ASSERT(supportsDeviceType(IDevice::typeFromMap(map)), return MaddeDevice::Ptr());
MaddeDevice::Ptr device = MaddeDevice::create();
device->fromMap(map);
return device;
}

View File

@@ -36,13 +36,13 @@
#include "ui_maemodeviceconfigwizardreusekeyscheckpage.h"
#include "ui_maemodeviceconfigwizardstartpage.h"
#include "maddedevice.h"
#include "maddedevicetester.h"
#include "maemoconstants.h"
#include "maemoglobal.h"
#include <projectexplorer/devicesupport/devicemanager.h>
#include <remotelinux/genericlinuxdeviceconfigurationwizardpages.h>
#include <remotelinux/linuxdeviceconfiguration.h>
#include <remotelinux/linuxdevicetestdialog.h>
#include <remotelinux/sshkeydeployer.h>
#include <utils/fileutils.h>
@@ -579,7 +579,7 @@ IDevice::Ptr MaemoDeviceConfigWizard::device()
freePortsSpec = QLatin1String("10000-10100");
doTest = true;
}
const LinuxDeviceConfiguration::Ptr devConf = LinuxDeviceConfiguration::create(d->wizardData.configName,
const MaddeDevice::Ptr devConf = MaddeDevice::create(d->wizardData.configName,
d->wizardData.deviceType, d->wizardData.machineType);
devConf->setFreePorts(PortList::fromString(freePortsSpec));
devConf->setSshParameters(sshParams);