diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-11-24 10:33:41 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2014-11-26 16:22:43 +0100 |
commit | 421f78a65fd2f0d39612a394c7ad579195ac16da (patch) | |
tree | 3046ec317b76b310b45f172906ad65c7fd13e841 /src/platformsupport/devicediscovery/qdevicediscovery_static.cpp | |
parent | a7dcc661d59851ca93f56a57131563e86d531773 (diff) |
Reorganize devicediscovery header
As pointed out in 13b939c7f41bceb2061e549923eab242326e9bb5 the approach
qdevicediscovery_p.h takes is just wrong. The defines it relies on will
often be missing when the header is included from random places in qtbase.
This results in different class layouts. It was working only because the
interface of the class is very limited and the public part was matching
regardless of having the macro defined.
This is now corrected by introducing subclasses and a common, non-variated
base class. QDEVICEDISCOVERY_UDEV is removed completely.
Change-Id: I9c83b5b041440a3a6ea3a604eee4a325d4d74439
Reviewed-by: Louai Al-Khanji <louai.al-khanji@theqtcompany.com>
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
Diffstat (limited to 'src/platformsupport/devicediscovery/qdevicediscovery_static.cpp')
-rw-r--r-- | src/platformsupport/devicediscovery/qdevicediscovery_static.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_static.cpp b/src/platformsupport/devicediscovery/qdevicediscovery_static.cpp index eb7c17d59e..660d3760fb 100644 --- a/src/platformsupport/devicediscovery/qdevicediscovery_static.cpp +++ b/src/platformsupport/devicediscovery/qdevicediscovery_static.cpp @@ -31,7 +31,7 @@ ** ****************************************************************************/ -#include "qdevicediscovery_p.h" +#include "qdevicediscovery_static_p.h" #include <QStringList> #include <QCoreApplication> @@ -75,23 +75,18 @@ QT_BEGIN_NAMESPACE QDeviceDiscovery *QDeviceDiscovery::create(QDeviceTypes types, QObject *parent) { - return new QDeviceDiscovery(types, parent); + return new QDeviceDiscoveryStatic(types, parent); } -QDeviceDiscovery::QDeviceDiscovery(QDeviceTypes types, QObject *parent) : - QObject(parent), - m_types(types) +QDeviceDiscoveryStatic::QDeviceDiscoveryStatic(QDeviceTypes types, QObject *parent) + : QDeviceDiscovery(types, parent) { #ifdef QT_QPA_DEVICE_DISCOVERY_DEBUG qWarning() << "New DeviceDiscovery created for type" << types; #endif } -QDeviceDiscovery::~QDeviceDiscovery() -{ -} - -QStringList QDeviceDiscovery::scanConnectedDevices() +QStringList QDeviceDiscoveryStatic::scanConnectedDevices() { QStringList devices; QDir dir; @@ -124,7 +119,7 @@ QStringList QDeviceDiscovery::scanConnectedDevices() return devices; } -bool QDeviceDiscovery::checkDeviceType(const QString &device) +bool QDeviceDiscoveryStatic::checkDeviceType(const QString &device) { bool ret = false; int fd = QT_OPEN(device.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0); |