From 014ceb58b0ab139d82b3195f6d3fa8dfa026f988 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 5 Apr 2012 16:55:14 +0200 Subject: [PATCH] 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 --- src/plugins/madde/madde.pro | 4 +- src/plugins/madde/madde.qbs | 2 + src/plugins/madde/maddedevice.cpp | 68 +++++++++++++++++++ src/plugins/madde/maddedevice.h | 63 +++++++++++++++++ .../madde/maddedeviceconfigurationfactory.cpp | 6 +- src/plugins/madde/maemodeviceconfigwizard.cpp | 4 +- 6 files changed, 141 insertions(+), 6 deletions(-) create mode 100644 src/plugins/madde/maddedevice.cpp create mode 100644 src/plugins/madde/maddedevice.h diff --git a/src/plugins/madde/madde.pro b/src/plugins/madde/madde.pro index 04b79afce3e..7e1d9cd8b50 100644 --- a/src/plugins/madde/madde.pro +++ b/src/plugins/madde/madde.pro @@ -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 \ diff --git a/src/plugins/madde/madde.qbs b/src/plugins/madde/madde.qbs index f1d8220d071..6d69c3e7dec 100644 --- a/src/plugins/madde/madde.qbs +++ b/src/plugins/madde/madde.qbs @@ -125,6 +125,8 @@ QtcPlugin { "qt4maemotarget.h", "qt4maemotargetfactory.cpp", "qt4maemotargetfactory.h", + "maddedevice.cpp", + "maddedevice.h" ] } diff --git a/src/plugins/madde/maddedevice.cpp b/src/plugins/madde/maddedevice.cpp new file mode 100644 index 00000000000..6a6b6062a1c --- /dev/null +++ b/src/plugins/madde/maddedevice.cpp @@ -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 diff --git a/src/plugins/madde/maddedevice.h b/src/plugins/madde/maddedevice.h new file mode 100644 index 00000000000..3b41168ddcb --- /dev/null +++ b/src/plugins/madde/maddedevice.h @@ -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 + +namespace Madde { +namespace Internal { + +class MaddeDevice : public RemoteLinux::LinuxDeviceConfiguration +{ +public: + typedef QSharedPointer Ptr; + typedef QSharedPointer 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 diff --git a/src/plugins/madde/maddedeviceconfigurationfactory.cpp b/src/plugins/madde/maddedeviceconfigurationfactory.cpp index dbde15a5fbb..1087c0fd765 100644 --- a/src/plugins/madde/maddedeviceconfigurationfactory.cpp +++ b/src/plugins/madde/maddedeviceconfigurationfactory.cpp @@ -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; } diff --git a/src/plugins/madde/maemodeviceconfigwizard.cpp b/src/plugins/madde/maemodeviceconfigwizard.cpp index c8619f7a075..b33d2a03ba0 100644 --- a/src/plugins/madde/maemodeviceconfigwizard.cpp +++ b/src/plugins/madde/maemodeviceconfigwizard.cpp @@ -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 #include -#include #include #include #include @@ -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);