diff options
author | Alex Blasche <alexander.blasche@theqtcompany.com> | 2015-01-16 16:07:18 +0100 |
---|---|---|
committer | Alex Blasche <alexander.blasche@theqtcompany.com> | 2015-01-28 07:48:13 +0000 |
commit | fd88da6bf12c7c8edfd6c3d44cc641aed7477f0b (patch) | |
tree | da59011c858baa683ba4594c6cab8807c5f219df /src | |
parent | 769a597083a60dc530b9a28fe606dae6d1b02369 (diff) | |
download | qtconnectivity-fd88da6bf12c7c8edfd6c3d44cc641aed7477f0b.tar.gz |
Convert qRegisterMetaType<T>(const char*) to qRegisterMetaType<T>()
This is much safer and cleaner.
[ChangeLog][QtBluetooth][Important Behavior Changes] Q_DECLARE_METATYPE
added for QBluetoothServiceDiscoveryAgent::Error,
QBluetoothSocket::SocketState, QBluetoothSocket::SocketError and
QBluetoothDeviceInfo. This breaks source compatibility if application
code has defined the above metatypes already. The applications
Q_DECLARE_METATYPE must be removed to fix the compile error.
Change-Id: I1c7cb1ee25832b7e5337c9aca6f36b21e8caf22e
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/bluetooth/android/serveracceptancethread.cpp | 4 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothaddress.cpp | 2 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp | 2 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothdeviceinfo.h | 5 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothlocaldevice.cpp | 6 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothservicediscoveryagent.h | 2 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothservicediscoveryagent_android.cpp | 2 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp | 4 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp | 4 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothsocket.h | 3 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothsocket_android.cpp | 5 | ||||
-rw-r--r-- | src/bluetooth/qlowenergyservice.cpp | 4 | ||||
-rw-r--r-- | src/bluetooth/qlowenergyservice.h | 3 | ||||
-rw-r--r-- | src/bluetooth/qlowenergyservice_osx.mm | 4 | ||||
-rw-r--r-- | src/nfc/qnearfieldtarget.cpp | 6 | ||||
-rw-r--r-- | src/nfc/qnearfieldtarget_emulator.cpp | 2 |
16 files changed, 35 insertions, 23 deletions
diff --git a/src/bluetooth/android/serveracceptancethread.cpp b/src/bluetooth/android/serveracceptancethread.cpp index cc639135..185cfa54 100644 --- a/src/bluetooth/android/serveracceptancethread.cpp +++ b/src/bluetooth/android/serveracceptancethread.cpp @@ -38,10 +38,12 @@ Q_DECLARE_LOGGING_CATEGORY(QT_BT_ANDROID) +Q_DECLARE_METATYPE(QBluetoothServer::Error) + ServerAcceptanceThread::ServerAcceptanceThread(QObject *parent) : QObject(parent), maxPendingConnections(1) { - qRegisterMetaType<QBluetoothServer::Error>("QBluetoothServer::Error"); + qRegisterMetaType<QBluetoothServer::Error>(); } ServerAcceptanceThread::~ServerAcceptanceThread() diff --git a/src/bluetooth/qbluetoothaddress.cpp b/src/bluetooth/qbluetoothaddress.cpp index 53ac7881..481bcc0d 100644 --- a/src/bluetooth/qbluetoothaddress.cpp +++ b/src/bluetooth/qbluetoothaddress.cpp @@ -65,7 +65,7 @@ class BluetoothAddressRegisterMetaTypes public: BluetoothAddressRegisterMetaTypes() { - qRegisterMetaType<QBluetoothAddress>("QBluetoothAddress"); + qRegisterMetaType<QBluetoothAddress>(); } } _registerBluetoothAddressMetaTypes; } diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp index 93b7c7d4..d2fba203 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp @@ -126,7 +126,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start() if (!receiver) { // SDP based device discovery receiver = new DeviceDiscoveryBroadcastReceiver(); - qRegisterMetaType<QBluetoothDeviceInfo>("QBluetoothDeviceInfo"); + qRegisterMetaType<QBluetoothDeviceInfo>(); QObject::connect(receiver, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo,bool)), this, SLOT(processDiscoveredDevices(QBluetoothDeviceInfo,bool))); QObject::connect(receiver, SIGNAL(finished()), this, SLOT(processSdpDiscoveryFinished())); diff --git a/src/bluetooth/qbluetoothdeviceinfo.h b/src/bluetooth/qbluetoothdeviceinfo.h index e86ea62e..c9822193 100644 --- a/src/bluetooth/qbluetoothdeviceinfo.h +++ b/src/bluetooth/qbluetoothdeviceinfo.h @@ -36,7 +36,8 @@ #include <QtBluetooth/qbluetoothglobal.h> -#include <QString> +#include <QtCore/qstring.h> +#include <QtCore/qmetatype.h> QT_BEGIN_NAMESPACE @@ -242,4 +243,6 @@ private: QT_END_NAMESPACE +Q_DECLARE_METATYPE(QBluetoothDeviceInfo) + #endif diff --git a/src/bluetooth/qbluetoothlocaldevice.cpp b/src/bluetooth/qbluetoothlocaldevice.cpp index c76ace95..87e1e521 100644 --- a/src/bluetooth/qbluetoothlocaldevice.cpp +++ b/src/bluetooth/qbluetoothlocaldevice.cpp @@ -103,9 +103,9 @@ class LocalDeviceRegisterMetaTypes public: LocalDeviceRegisterMetaTypes() { - qRegisterMetaType<QBluetoothLocalDevice::HostMode>("QBluetoothLocalDevice::HostMode"); - qRegisterMetaType<QBluetoothLocalDevice::Pairing>("QBluetoothLocalDevice::Pairing"); - qRegisterMetaType<QBluetoothLocalDevice::Error>("QBluetoothLocalDevice::Error"); + qRegisterMetaType<QBluetoothLocalDevice::HostMode>(); + qRegisterMetaType<QBluetoothLocalDevice::Pairing>(); + qRegisterMetaType<QBluetoothLocalDevice::Error>(); } } _registerLocalDeviceMetaTypes; } diff --git a/src/bluetooth/qbluetoothservicediscoveryagent.h b/src/bluetooth/qbluetoothservicediscoveryagent.h index 02be2f5b..787d58e3 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent.h +++ b/src/bluetooth/qbluetoothservicediscoveryagent.h @@ -120,4 +120,6 @@ private: QT_END_NAMESPACE +Q_DECLARE_METATYPE(QBluetoothServiceDiscoveryAgent::Error) + #endif diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp index e10d2ffe..92a67caa 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent_android.cpp @@ -81,7 +81,7 @@ QBluetoothServiceDiscoveryAgentPrivate::QBluetoothServiceDiscoveryAgentPrivate( if (!btAdapter.isValid()) qCWarning(QT_BT_ANDROID) << "Platform does not support Bluetooth"; - qRegisterMetaType<QList<QBluetoothUuid> >("QList<QBluetoothUuid>"); + qRegisterMetaType<QList<QBluetoothUuid> >(); } QBluetoothServiceDiscoveryAgentPrivate::~QBluetoothServiceDiscoveryAgentPrivate() diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp index d82a73a8..6958e1b2 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp @@ -71,9 +71,9 @@ QBluetoothServiceDiscoveryAgentPrivate::QBluetoothServiceDiscoveryAgentPrivate(c managerBluez5 = new OrgFreedesktopDBusObjectManagerInterface( QStringLiteral("org.bluez"), QStringLiteral("/"), QDBusConnection::systemBus()); - qRegisterMetaType<QBluetoothServiceDiscoveryAgent::Error>("QBluetoothServiceDiscoveryAgent::Error"); + qRegisterMetaType<QBluetoothServiceDiscoveryAgent::Error>(); } else { - qRegisterMetaType<ServiceMap>("ServiceMap"); + qRegisterMetaType<ServiceMap>(); qDBusRegisterMetaType<ServiceMap>(); manager = new OrgBluezManagerInterface(QStringLiteral("org.bluez"), QStringLiteral("/"), diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp index d8a03105..4b7108be 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp @@ -132,8 +132,8 @@ QBluetoothServiceDiscoveryAgentPrivate::QBluetoothServiceDiscoveryAgentPrivate(c connect(&m_queryTimer, SIGNAL(timeout()), this, SLOT(queryTimeout())); ppsRegisterForEvent(QStringLiteral("service_updated"), this); //Needed for connecting signals and slots from static function - qRegisterMetaType<QBluetoothServiceInfo>("QBluetoothServiceInfo"); - qRegisterMetaType<QBluetoothServiceDiscoveryAgent::Error>("QBluetoothServiceDiscoveryAgent::Error"); + qRegisterMetaType<QBluetoothServiceInfo>(); + qRegisterMetaType<QBluetoothServiceDiscoveryAgent::Error>(); } QBluetoothServiceDiscoveryAgentPrivate::~QBluetoothServiceDiscoveryAgentPrivate() diff --git a/src/bluetooth/qbluetoothsocket.h b/src/bluetooth/qbluetoothsocket.h index 5b4d3c5b..e68c2bc3 100644 --- a/src/bluetooth/qbluetoothsocket.h +++ b/src/bluetooth/qbluetoothsocket.h @@ -161,4 +161,7 @@ Q_BLUETOOTH_EXPORT QDebug operator<<(QDebug, QBluetoothSocket::SocketState); QT_END_NAMESPACE +Q_DECLARE_METATYPE(QBluetoothSocket::SocketError) +Q_DECLARE_METATYPE(QBluetoothSocket::SocketState) + #endif diff --git a/src/bluetooth/qbluetoothsocket_android.cpp b/src/bluetooth/qbluetoothsocket_android.cpp index e8d7d028..02440abc 100644 --- a/src/bluetooth/qbluetoothsocket_android.cpp +++ b/src/bluetooth/qbluetoothsocket_android.cpp @@ -40,7 +40,6 @@ #include <QtConcurrent/QtConcurrentRun> #include <QtAndroidExtras/QAndroidJniEnvironment> - QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(QT_BT_ANDROID) @@ -57,8 +56,8 @@ QBluetoothSocketPrivate::QBluetoothSocketPrivate() adapter = QAndroidJniObject::callStaticObjectMethod("android/bluetooth/BluetoothAdapter", "getDefaultAdapter", "()Landroid/bluetooth/BluetoothAdapter;"); - qRegisterMetaType<QBluetoothSocket::SocketError>("QBluetoothSocket::SocketError"); - qRegisterMetaType<QBluetoothSocket::SocketState>("QBluetoothSocket::SocketState"); + qRegisterMetaType<QBluetoothSocket::SocketError>(); + qRegisterMetaType<QBluetoothSocket::SocketState>(); } QBluetoothSocketPrivate::~QBluetoothSocketPrivate() diff --git a/src/bluetooth/qlowenergyservice.cpp b/src/bluetooth/qlowenergyservice.cpp index cfb1a599..c33de8d5 100644 --- a/src/bluetooth/qlowenergyservice.cpp +++ b/src/bluetooth/qlowenergyservice.cpp @@ -296,8 +296,8 @@ QLowEnergyService::QLowEnergyService(QSharedPointer<QLowEnergyServicePrivate> p, : QObject(parent), d_ptr(p) { - qRegisterMetaType<QLowEnergyService::ServiceState>("QLowEnergyService::ServiceState"); - qRegisterMetaType<QLowEnergyService::ServiceError>("QLowEnergyService::ServiceError"); + qRegisterMetaType<QLowEnergyService::ServiceState>(); + qRegisterMetaType<QLowEnergyService::ServiceError>(); connect(p.data(), SIGNAL(error(QLowEnergyService::ServiceError)), this, SIGNAL(error(QLowEnergyService::ServiceError))); diff --git a/src/bluetooth/qlowenergyservice.h b/src/bluetooth/qlowenergyservice.h index 136f85ee..2c86d380 100644 --- a/src/bluetooth/qlowenergyservice.h +++ b/src/bluetooth/qlowenergyservice.h @@ -120,4 +120,7 @@ private: QT_END_NAMESPACE +Q_DECLARE_METATYPE(QLowEnergyService::ServiceState) +Q_DECLARE_METATYPE(QLowEnergyService::ServiceError) + #endif // QLOWENERGYSERVICE_H diff --git a/src/bluetooth/qlowenergyservice_osx.mm b/src/bluetooth/qlowenergyservice_osx.mm index 2e961c0c..c6284bbd 100644 --- a/src/bluetooth/qlowenergyservice_osx.mm +++ b/src/bluetooth/qlowenergyservice_osx.mm @@ -63,8 +63,8 @@ QLowEnergyService::QLowEnergyService(QSharedPointer<QLowEnergyServicePrivate> d, : QObject(parent), d_ptr(d) { - qRegisterMetaType<QLowEnergyService::ServiceState>("QLowEnergyService::ServiceState"); - qRegisterMetaType<QLowEnergyService::ServiceError>("QLowEnergyService::ServiceError"); + qRegisterMetaType<QLowEnergyService::ServiceState>(); + qRegisterMetaType<QLowEnergyService::ServiceError>(); connect(d.data(), SIGNAL(error(QLowEnergyService::ServiceError)), this, SIGNAL(error(QLowEnergyService::ServiceError))); diff --git a/src/nfc/qnearfieldtarget.cpp b/src/nfc/qnearfieldtarget.cpp index cbf5bd42..6374c8fb 100644 --- a/src/nfc/qnearfieldtarget.cpp +++ b/src/nfc/qnearfieldtarget.cpp @@ -272,9 +272,9 @@ QNearFieldTarget::RequestId &QNearFieldTarget::RequestId::operator=(const Reques QNearFieldTarget::QNearFieldTarget(QObject *parent) : QObject(parent), d_ptr(new QNearFieldTargetPrivate) { - qRegisterMetaType<RequestId>("QNearFieldTarget::RequestId"); - qRegisterMetaType<Error>("QNearFieldTarget::Error"); - qRegisterMetaType<QNdefMessage>("QNdefMessage::QNdefMessage"); + qRegisterMetaType<QNearFieldTarget::RequestId>(); + qRegisterMetaType<QNearFieldTarget::Error>(); + qRegisterMetaType<QNdefMessage>(); } /*! diff --git a/src/nfc/qnearfieldtarget_emulator.cpp b/src/nfc/qnearfieldtarget_emulator.cpp index ee0c6188..a483fe4b 100644 --- a/src/nfc/qnearfieldtarget_emulator.cpp +++ b/src/nfc/qnearfieldtarget_emulator.cpp @@ -187,7 +187,7 @@ bool TagType2::waitForRequestCompleted(const RequestId &id, int msecs) TagActivator::TagActivator() : timerId(-1) { - qRegisterMetaType<QNearFieldTarget::Error>("QNearFieldTarget::Error"); + qRegisterMetaType<QNearFieldTarget::Error>(); } TagActivator::~TagActivator() |