diff options
author | Alex Blasche <alexander.blasche@qt.io> | 2018-09-25 11:10:13 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@qt.io> | 2018-09-26 06:21:33 +0000 |
commit | 343eea046cda781a224b94d1620f9325574837f7 (patch) | |
tree | c6aa5c3a0477e539c3cb2f2c918989c3b5a2ff0c | |
parent | a48a19d9db855973f7f0d89ca0759fd7f6856f55 (diff) |
Minor code cleanup for QBluetoothLocalDevice implementation on Android
Change-Id: I22da03879c23f6b6842cb832cea0cfee6e016445
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r-- | src/bluetooth/qbluetoothlocaldevice_android.cpp | 24 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothlocaldevice_p.h | 4 |
2 files changed, 12 insertions, 16 deletions
diff --git a/src/bluetooth/qbluetoothlocaldevice_android.cpp b/src/bluetooth/qbluetoothlocaldevice_android.cpp index 0144a5ef..b46923eb 100644 --- a/src/bluetooth/qbluetoothlocaldevice_android.cpp +++ b/src/bluetooth/qbluetoothlocaldevice_android.cpp @@ -54,25 +54,21 @@ Q_DECLARE_LOGGING_CATEGORY(QT_BT_ANDROID) QBluetoothLocalDevicePrivate::QBluetoothLocalDevicePrivate( QBluetoothLocalDevice *q, const QBluetoothAddress &address) : - q_ptr(q), - obj(0), - pendingHostModeTransition(false) + q_ptr(q) { registerQBluetoothLocalDeviceMetaType(); initialize(address); receiver = new LocalDeviceBroadcastReceiver(q_ptr); - connect(receiver, SIGNAL(hostModeStateChanged(QBluetoothLocalDevice::HostMode)), - this, SLOT(processHostModeChange(QBluetoothLocalDevice::HostMode))); - connect(receiver, SIGNAL(pairingStateChanged(QBluetoothAddress, - QBluetoothLocalDevice::Pairing)), - this, SLOT(processPairingStateChanged(QBluetoothAddress, - QBluetoothLocalDevice::Pairing))); - connect(receiver, SIGNAL(connectDeviceChanges(QBluetoothAddress, bool)), - this, SLOT(processConnectDeviceChanges(QBluetoothAddress, bool))); - connect(receiver, SIGNAL(pairingDisplayConfirmation(QBluetoothAddress, QString)), - this, SLOT(processDisplayConfirmation(QBluetoothAddress, QString))); + connect(receiver, &LocalDeviceBroadcastReceiver::hostModeStateChanged, + this, &QBluetoothLocalDevicePrivate::processHostModeChange); + connect(receiver, &LocalDeviceBroadcastReceiver::pairingStateChanged, + this, &QBluetoothLocalDevicePrivate::processPairingStateChanged); + connect(receiver, &LocalDeviceBroadcastReceiver::connectDeviceChanges, + this, &QBluetoothLocalDevicePrivate::processConnectDeviceChanges); + connect(receiver, &LocalDeviceBroadcastReceiver::pairingDisplayConfirmation, + this, &QBluetoothLocalDevicePrivate::processDisplayConfirmation); connect(receiver, &LocalDeviceBroadcastReceiver::pairingDisplayPinCode, this, &QBluetoothLocalDevicePrivate::processDisplayPinCode); } @@ -130,7 +126,7 @@ void QBluetoothLocalDevicePrivate::initialize(const QBluetoothAddress &address) if (localAddress != address.toString()) { // passed address not local one -> invalid delete obj; - obj = 0; + obj = nullptr; } } } diff --git a/src/bluetooth/qbluetoothlocaldevice_p.h b/src/bluetooth/qbluetoothlocaldevice_p.h index 8752504d..89dbf9a3 100644 --- a/src/bluetooth/qbluetoothlocaldevice_p.h +++ b/src/bluetooth/qbluetoothlocaldevice_p.h @@ -117,13 +117,13 @@ private slots: private: QBluetoothLocalDevice *q_ptr; - QAndroidJniObject *obj; + QAndroidJniObject *obj = nullptr; int pendingPairing(const QBluetoothAddress &address); public: LocalDeviceBroadcastReceiver *receiver; - bool pendingHostModeTransition; + bool pendingHostModeTransition = false; QList<QPair<QBluetoothAddress, bool> > pendingPairings; QList<QBluetoothAddress> connectedDevices; |