1
0
Fork 0
mirror of https://github.com/subsurface/subsurface.git synced 2025-02-19 22:16:15 +00:00

Trivial: Replace a QSharedPointer by a QScopedPointer

Since the QSharedPointer is never passed or copied, reference counting
is certainly not needed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2017-11-11 22:12:21 +01:00 committed by Lubomir I. Ivanov
parent b32251a5a8
commit 6addfe1660
2 changed files with 3 additions and 4 deletions

View file

@ -152,7 +152,7 @@ void BtDeviceSelectionDialog::on_save_clicked()
QBluetoothDeviceInfo remoteDeviceInfo = currentItem->data(Qt::UserRole).value<QBluetoothDeviceInfo>(); QBluetoothDeviceInfo remoteDeviceInfo = currentItem->data(Qt::UserRole).value<QBluetoothDeviceInfo>();
// Save the selected device // Save the selected device
selectedRemoteDeviceInfo = QSharedPointer<QBluetoothDeviceInfo>(new QBluetoothDeviceInfo(remoteDeviceInfo)); selectedRemoteDeviceInfo.reset(new QBluetoothDeviceInfo(remoteDeviceInfo));
QString address = remoteDeviceInfo.address().isNull() ? remoteDeviceInfo.deviceUuid().toString() : QString address = remoteDeviceInfo.address().isNull() ? remoteDeviceInfo.deviceUuid().toString() :
remoteDeviceInfo.address().toString(); remoteDeviceInfo.address().toString();
saveBtDeviceInfo(address.toUtf8().constData(), remoteDeviceInfo); saveBtDeviceInfo(address.toUtf8().constData(), remoteDeviceInfo);
@ -460,9 +460,8 @@ QString BtDeviceSelectionDialog::getSelectedDeviceAddress()
QString BtDeviceSelectionDialog::getSelectedDeviceName() QString BtDeviceSelectionDialog::getSelectedDeviceName()
{ {
if (selectedRemoteDeviceInfo) { if (selectedRemoteDeviceInfo)
return selectedRemoteDeviceInfo.data()->name(); return selectedRemoteDeviceInfo.data()->name();
}
return QString(); return QString();
} }

View file

@ -83,7 +83,7 @@ private:
QBluetoothLocalDevice *localDevice; QBluetoothLocalDevice *localDevice;
QBluetoothDeviceDiscoveryAgent *remoteDeviceDiscoveryAgent; QBluetoothDeviceDiscoveryAgent *remoteDeviceDiscoveryAgent;
#endif #endif
QSharedPointer<QBluetoothDeviceInfo> selectedRemoteDeviceInfo; QScopedPointer<QBluetoothDeviceInfo> selectedRemoteDeviceInfo;
void updateLocalDeviceInformation(); void updateLocalDeviceInformation();
void initializeDeviceDiscoveryAgent(); void initializeDeviceDiscoveryAgent();