From 76872c6ed8a1477f1914266d6917ee4aad6ff7e9 Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Date: Fri, 5 Feb 2010 17:34:02 +0100
Subject: [PATCH] S60: Move serialdevicelister.cpp to
 symbianutils/symbiandevicemanager.cpp

---
 .../qt4projectmanager/qt-s60/qt-s60.pri       |  2 --
 .../qt-s60/s60devicerunconfiguration.cpp      | 12 ++++-----
 .../s60devicerunconfigurationwidget.cpp       | 26 +++++++++----------
 .../qt-s60/s60devicerunconfigurationwidget.h  |  9 ++++---
 .../qt4projectmanager/qt-s60/s60manager.cpp   |  4 +--
 .../qt-s60/s60runconfigbluetoothstarter.cpp   |  4 +--
 .../symbianutils/symbiandevicemanager.cpp}    |  8 +++---
 .../symbianutils/symbiandevicemanager.h}      | 18 ++++++-------
 src/shared/symbianutils/symbianutils.pri      |  6 +++--
 9 files changed, 45 insertions(+), 44 deletions(-)
 rename src/{plugins/qt4projectmanager/qt-s60/serialdevicelister.cpp => shared/symbianutils/symbiandevicemanager.cpp} (98%)
 rename src/{plugins/qt4projectmanager/qt-s60/serialdevicelister.h => shared/symbianutils/symbiandevicemanager.h} (92%)

diff --git a/src/plugins/qt4projectmanager/qt-s60/qt-s60.pri b/src/plugins/qt4projectmanager/qt-s60/qt-s60.pri
index 0ea427366d0..85349af71c2 100644
--- a/src/plugins/qt4projectmanager/qt-s60/qt-s60.pri
+++ b/src/plugins/qt4projectmanager/qt-s60/qt-s60.pri
@@ -10,7 +10,6 @@ SOURCES += $$PWD/s60devices.cpp \
     $$PWD/s60emulatorrunconfiguration.cpp \
     $$PWD/s60devicerunconfiguration.cpp \
     $$PWD/s60devicerunconfigurationwidget.cpp \
-    $$PWD/serialdevicelister.cpp \
     $$PWD/rvcttoolchain.cpp \
     $$PWD/s60runconfigbluetoothstarter.cpp \
     $$PWD/abldparser.cpp \
@@ -24,7 +23,6 @@ HEADERS += $$PWD/s60devices.h \
     $$PWD/s60emulatorrunconfiguration.h \
     $$PWD/s60devicerunconfiguration.h \
     $$PWD/s60devicerunconfigurationwidget.h \
-    $$PWD/serialdevicelister.h \
     $$PWD/rvcttoolchain.h \
     $$PWD/s60runconfigbluetoothstarter.h \
     $$PWD/abldparser.h \
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp
index d60ac111ab1..e33867b5285 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp
@@ -36,7 +36,7 @@
 #include "s60devices.h"
 #include "s60runconfigbluetoothstarter.h"
 #include "bluetoothlistener_gui.h"
-#include "serialdevicelister.h"
+#include "symbiandevicemanager.h"
 #include "qt4buildconfiguration.h"
 
 #include <coreplugin/icore.h>
@@ -112,10 +112,10 @@ S60DeviceRunConfiguration::S60DeviceRunConfiguration(Project *project, const QSt
     m_cachedTargetInformationValid(false),
 #ifdef Q_OS_WIN
     m_serialPortName(QLatin1String("COM5")),
-    m_communicationType(SerialPortCommunication),
+    m_communicationType(SymbianUtils::SerialPortCommunication),
 #else
-    m_serialPortName(QLatin1String(SymbianDeviceManager::linuxBlueToothDeviceRootC) + QLatin1Char('0')),
-    m_communicationType(BlueToothCommunication),
+    m_serialPortName(QLatin1String(SymbianUtils::SymbianDeviceManager::linuxBlueToothDeviceRootC) + QLatin1Char('0')),
+    m_communicationType(SymbianUtils::BlueToothCommunication),
 #endif
     m_signingMode(SignSelf)
 {
@@ -498,7 +498,7 @@ S60DeviceRunControlBase::S60DeviceRunControlBase(RunConfiguration *runConfigurat
     QTC_ASSERT(s60runConfig, return);
     m_toolChain = s60runConfig->toolChainType();
     m_serialPortName = s60runConfig->serialPortName();
-    m_serialPortFriendlyName = SymbianDeviceManager::instance()->friendlyNameForPort(m_serialPortName);
+    m_serialPortFriendlyName = SymbianUtils::SymbianDeviceManager::instance()->friendlyNameForPort(m_serialPortName);
     m_communicationType = s60runConfig->communicationType();
     m_targetName = s60runConfig->targetName();
     m_baseFileName = s60runConfig->basePackageFilePath();
@@ -750,7 +750,7 @@ void S60DeviceRunControlBase::startDeployment()
 
     //TODO sisx destination and file path user definable
     m_launcher->setTrkServerName(m_serialPortName);
-    m_launcher->setSerialFrame(m_communicationType == SerialPortCommunication);
+    m_launcher->setSerialFrame(m_communicationType == SymbianUtils::SerialPortCommunication);
     if (!m_commandLineArguments.isEmpty())
         m_launcher->setCommandLineArgs(m_commandLineArguments);
     const QString copySrc(m_baseFileName + ".sisx");
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.cpp
index a64d1dd5535..9c82b77d90b 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.cpp
@@ -34,7 +34,7 @@
 #include "s60manager.h"
 #include "launcher.h"
 #include "bluetoothlistener.h"
-#include "serialdevicelister.h"
+#include "symbiandevicemanager.h"
 
 #include <utils/detailswidget.h>
 #include <utils/qtcassert.h>
@@ -56,7 +56,7 @@
 #include <QtGui/QMainWindow>
 #include <QtGui/QMessageBox>
 
-Q_DECLARE_METATYPE(Qt4ProjectManager::Internal::SymbianDevice)
+Q_DECLARE_METATYPE(SymbianUtils::SymbianDevice)
 
 namespace Qt4ProjectManager {
 namespace Internal {
@@ -100,7 +100,7 @@ S60DeviceRunConfigurationWidget::S60DeviceRunConfigurationWidget(
     formLayout->addRow(tr("Install File:"), m_sisxFileLabel);
 
     updateSerialDevices();
-    connect(SymbianDeviceManager::instance(), SIGNAL(updated()),
+    connect(SymbianUtils::SymbianDeviceManager::instance(), SIGNAL(updated()),
             this, SLOT(updateSerialDevices()));
     // Serial devices control
     connect(m_serialPortsCombo, SIGNAL(activated(int)), this, SLOT(setSerialPort(int)));
@@ -180,10 +180,10 @@ void S60DeviceRunConfigurationWidget::updateSerialDevices()
     m_serialPortsCombo->clear();
     clearDeviceInfo();
     const QString previousRunConfigurationPortName = m_runConfiguration->serialPortName();
-    const QList<SymbianDevice> devices = SymbianDeviceManager::instance()->devices();
+    const QList<SymbianUtils::SymbianDevice> devices = SymbianUtils::SymbianDeviceManager::instance()->devices();
     int newIndex = -1;
     for (int i = 0; i < devices.size(); ++i) {
-        const SymbianDevice &device = devices.at(i);
+        const SymbianUtils::SymbianDevice &device = devices.at(i);
         m_serialPortsCombo->addItem(device.friendlyName(), qVariantFromValue(device));
         if (device.portName() == previousRunConfigurationPortName)
             newIndex = i;
@@ -203,17 +203,17 @@ void S60DeviceRunConfigurationWidget::updateSerialDevices()
     }
 }
 
-SymbianDevice S60DeviceRunConfigurationWidget::device(int i) const
+SymbianUtils::SymbianDevice S60DeviceRunConfigurationWidget::device(int i) const
 {
     if (i >= 0) {
         const QVariant data = m_serialPortsCombo->itemData(i);
-        if (qVariantCanConvert<Qt4ProjectManager::Internal::SymbianDevice>(data))
-            return qVariantValue<Qt4ProjectManager::Internal::SymbianDevice>(data);
+        if (qVariantCanConvert<SymbianUtils::SymbianDevice>(data))
+            return qVariantValue<SymbianUtils::SymbianDevice>(data);
     }
-    return SymbianDevice();
+    return SymbianUtils::SymbianDevice();
 }
 
-SymbianDevice S60DeviceRunConfigurationWidget::currentDevice() const
+SymbianUtils::SymbianDevice S60DeviceRunConfigurationWidget::currentDevice() const
 {
     return device(m_serialPortsCombo->currentIndex());
 }
@@ -242,7 +242,7 @@ void S60DeviceRunConfigurationWidget::updateTargetInformation()
 
 void S60DeviceRunConfigurationWidget::setSerialPort(int index)
 {
-    const SymbianDevice d = device(index);
+    const SymbianUtils::SymbianDevice d = device(index);
     m_runConfiguration->setSerialPortName(d.portName());
     m_runConfiguration->setCommunicationType(d.type());
     m_deviceInfoButton->setEnabled(index >= 0);
@@ -323,8 +323,8 @@ void S60DeviceRunConfigurationWidget::updateDeviceInfo()
     // go asynchronous afterwards to pop up launch trk box if a timeout occurs.
     m_infoLauncher = new trk::Launcher(trk::Launcher::ActionPingOnly, QSharedPointer<trk::TrkDevice>(), this);
     connect(m_infoLauncher, SIGNAL(stateChanged(int)), this, SLOT(slotLauncherStateChanged(int)));
-    const SymbianDevice commDev = currentDevice();
-    m_infoLauncher->setSerialFrame(commDev.type() == SerialPortCommunication);
+    const SymbianUtils::SymbianDevice commDev = currentDevice();
+    m_infoLauncher->setSerialFrame(commDev.type() == SymbianUtils::SerialPortCommunication);
     m_infoLauncher->setTrkServerName(commDev.portName());
     // Prompt user
     QString message;
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.h b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.h
index 191f837ae31..c1b1841df8d 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.h
+++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfigurationwidget.h
@@ -49,10 +49,13 @@ namespace trk {
     class Launcher;
 }
 
+namespace SymbianUtils {
+class SymbianDevice;
+}
+
 namespace Qt4ProjectManager {
 namespace Internal {
 
-class SymbianDevice;
 class S60DeviceRunConfiguration;
 
 /* Configuration widget for S60 devices on serial ports that are
@@ -81,8 +84,8 @@ private slots:
     void slotWaitingForTrkClosed();
 
 private:
-    inline SymbianDevice device(int i) const;
-    inline SymbianDevice currentDevice() const;
+    inline SymbianUtils::SymbianDevice device(int i) const;
+    inline SymbianUtils::SymbianDevice currentDevice() const;
 
     void setDeviceInfoLabel(const QString &message, bool isError = false);
 
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp b/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp
index b1d67c3209c..7caa8a1089c 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp
@@ -30,7 +30,7 @@
 #include "s60manager.h"
 
 #include "s60devicespreferencepane.h"
-#include "serialdevicelister.h"
+#include "symbiandevicemanager.h"
 #include "winscwtoolchain.h"
 #include "gccetoolchain.h"
 #include "rvcttoolchain.h"
@@ -126,7 +126,7 @@ S60Manager::S60Manager(QObject *parent)
     connect(m_devices, SIGNAL(qtVersionsChanged()),
             this, SLOT(updateQtVersions()));
     connect(Core::ICore::instance()->mainWindow(), SIGNAL(deviceChange()),
-            SymbianDeviceManager::instance(), SLOT(update()));
+            SymbianUtils::SymbianDeviceManager::instance(), SLOT(update()));
 }
 
 S60Manager::~S60Manager()
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60runconfigbluetoothstarter.cpp b/src/plugins/qt4projectmanager/qt-s60/s60runconfigbluetoothstarter.cpp
index b12aa0f1d29..593c85c0d2e 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60runconfigbluetoothstarter.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60runconfigbluetoothstarter.cpp
@@ -29,7 +29,7 @@
 
 #include "s60runconfigbluetoothstarter.h"
 #include "bluetoothlistener.h"
-#include "serialdevicelister.h"
+#include "symbiandevicemanager.h"
 
 #include <coreplugin/icore.h>
 #include <coreplugin/messagemanager.h>
@@ -59,7 +59,7 @@ S60RunConfigBluetoothStarter::startCommunication(const TrkDevicePtr &trkDevice,
                                                  QString *errorMessage)
 {
     // Bluetooth?
-    if (communicationType == BlueToothCommunication) {
+    if (communicationType == SymbianUtils::BlueToothCommunication) {
         S60RunConfigBluetoothStarter bluetoothStarter(trkDevice);
         bluetoothStarter.setDevice(device);
         return trk::promptStartBluetooth(bluetoothStarter, msgBoxParent, errorMessage);
diff --git a/src/plugins/qt4projectmanager/qt-s60/serialdevicelister.cpp b/src/shared/symbianutils/symbiandevicemanager.cpp
similarity index 98%
rename from src/plugins/qt4projectmanager/qt-s60/serialdevicelister.cpp
rename to src/shared/symbianutils/symbiandevicemanager.cpp
index 495aa5366e9..81cc02ed36f 100644
--- a/src/plugins/qt4projectmanager/qt-s60/serialdevicelister.cpp
+++ b/src/shared/symbianutils/symbiandevicemanager.cpp
@@ -27,7 +27,7 @@
 **
 **************************************************************************/
 
-#include "serialdevicelister.h"
+#include "symbiandevicemanager.h"
 
 #include <QtCore/QSettings>
 #include <QtCore/QStringList>
@@ -37,8 +37,7 @@
 #include <QtCore/QSharedData>
 #include <QtCore/QScopedPointer>
 
-namespace Qt4ProjectManager {
-namespace Internal {
+namespace SymbianUtils {
 
 enum { debug = 0 };
 
@@ -317,5 +316,4 @@ QDebug operator<<(QDebug d, const SymbianDeviceManager &sdm)
     return d;
 }
 
-} // namespace Internal
-} // namespace Qt4ProjectManager
+} // namespace SymbianUtilsInternal
diff --git a/src/plugins/qt4projectmanager/qt-s60/serialdevicelister.h b/src/shared/symbianutils/symbiandevicemanager.h
similarity index 92%
rename from src/plugins/qt4projectmanager/qt-s60/serialdevicelister.h
rename to src/shared/symbianutils/symbiandevicemanager.h
index 6abcf045c33..27305b5cb9b 100644
--- a/src/plugins/qt4projectmanager/qt-s60/serialdevicelister.h
+++ b/src/shared/symbianutils/symbiandevicemanager.h
@@ -27,8 +27,10 @@
 **
 **************************************************************************/
 
-#ifndef SERIALDEVICELISTER_H
-#define SERIALDEVICELISTER_H
+#ifndef SYMBIANDEVICEMANAGER_H
+#define SYMBIANDEVICEMANAGER_H
+
+#include "symbianutils_global.h"
 
 #include <QtCore/QObject>
 #include <QtCore/QExplicitlySharedDataPointer>
@@ -38,8 +40,7 @@ class QDebug;
 class QTextStream;
 QT_END_NAMESPACE
 
-namespace Qt4ProjectManager {
-namespace Internal {
+namespace SymbianUtils {
 
 struct SymbianDeviceManagerPrivate;
 class SymbianDeviceData;
@@ -50,7 +51,7 @@ enum DeviceCommunicationType {
 };
 
 // SymbianDevice, explicitly shared.
-class SymbianDevice {
+class SYMBIANUTILS_EXPORT SymbianDevice {
     explicit SymbianDevice(SymbianDeviceData *data);
     friend class SymbianDeviceManager;
 public:
@@ -89,7 +90,7 @@ inline bool operator<(const SymbianDevice &d1, const SymbianDevice &d2)
  * and emits change signals.
  * On Windows, the update slot must be connected to a signal
  * emitted from an event handler listening for WM_DEVICECHANGE. */
-class SymbianDeviceManager : public QObject
+class SYMBIANUTILS_EXPORT SymbianDeviceManager : public QObject
 {
     Q_OBJECT
 public:
@@ -127,7 +128,6 @@ private:
 
 QDebug operator<<(QDebug d, const SymbianDeviceManager &);
 
-} // Internal
-} // Qt4ProjectManager
+} // namespace SymbianUtils
 
-#endif // SERIALDEVICELISTER_H
+#endif // SYMBIANDEVICEMANAGER_H
diff --git a/src/shared/symbianutils/symbianutils.pri b/src/shared/symbianutils/symbianutils.pri
index a54df76968e..6309517b183 100644
--- a/src/shared/symbianutils/symbianutils.pri
+++ b/src/shared/symbianutils/symbianutils.pri
@@ -8,13 +8,15 @@ HEADERS += $$PWD/symbianutils_global.h \
     $$PWD/trkdevice.h \
     $$PWD/launcher.h \
     $$PWD/bluetoothlistener.h \
-    $$PWD/communicationstarter.h
+    $$PWD/communicationstarter.h \
+    $$PWD/symbiandevicemanager.h
 
 SOURCES += $$PWD/trkutils.cpp \
     $$PWD/trkdevice.cpp \
     $$PWD/launcher.cpp \
     $$PWD/bluetoothlistener.cpp \
-    $$PWD/communicationstarter.cpp
+    $$PWD/communicationstarter.cpp \
+    $$PWD/symbiandevicemanager.cpp
 
 # Tests/trklauncher is a console application
 contains(QT, gui) {
-- 
GitLab