From 38181b23286ed154c2e9c2e563a48304286566cb Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Tue, 16 Sep 2014 14:14:10 +0200 Subject: Remove not needed invokeMethod() calls when emitting finished() signal Internally the transfer reply starts via QueuedConnection. Therefore the finished signal doesn't have to be delayed even further. In addition document the tight restriction when being interested in signals from QBluetoothtransferReply. Change-Id: I0358140e96e1e9709158310c493f34ea5e40582a Reviewed-by: Timur Pocheptsov Reviewed-by: Alex Blasche --- src/bluetooth/qbluetoothtransferreply.cpp | 10 ++++++++++ src/bluetooth/qbluetoothtransferreply_bluez.cpp | 18 +++++++----------- src/bluetooth/qbluetoothtransferreply_qnx.cpp | 4 ++-- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/bluetooth/qbluetoothtransferreply.cpp b/src/bluetooth/qbluetoothtransferreply.cpp index 44f2f6f8..4ef27bf4 100644 --- a/src/bluetooth/qbluetoothtransferreply.cpp +++ b/src/bluetooth/qbluetoothtransferreply.cpp @@ -80,6 +80,9 @@ void QBluetoothTransferReply::abort() \fn void QBluetoothTransferReply::finished(QBluetoothTransferReply *reply) This signal is emitted when the transfer is complete for \a reply. + + To avoid the loss of signal emissions it is recommend to immidiately connect + to this signal once a \c QBluetoothTransferReply instance has been created. */ /*! @@ -87,6 +90,10 @@ void QBluetoothTransferReply::abort() This signal is emitted whenever data is transferred. The \a bytesTransferred parameter contains the total number of bytes transferred so far out of \a bytesTotal. + + + To avoid the loss of signal emissions it is recommend to immidiately connect + to this signal once a QBluetoothTransferReply instance has been created. */ /*! @@ -96,6 +103,9 @@ void QBluetoothTransferReply::abort() This signal is emitted whenever an error has occurred. The \a errorType parameter indicates the type of error. + To avoid the loss of signal emissions it is recommend to immidiately connect + to this signal once a QBluetoothTransferReply instance has been created. + \sa error(), errorString() */ diff --git a/src/bluetooth/qbluetoothtransferreply_bluez.cpp b/src/bluetooth/qbluetoothtransferreply_bluez.cpp index 066cab7c..ae29ce37 100644 --- a/src/bluetooth/qbluetoothtransferreply_bluez.cpp +++ b/src/bluetooth/qbluetoothtransferreply_bluez.cpp @@ -121,7 +121,7 @@ bool QBluetoothTransferReplyBluez::start() m_running = false; emit QBluetoothTransferReply::error(m_error); - QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection, Q_ARG(QBluetoothTransferReply*, this)); + emit finished(this); return false; } @@ -139,7 +139,7 @@ bool QBluetoothTransferReplyBluez::start() m_running = false; emit QBluetoothTransferReply::error(m_error); - QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection, Q_ARG(QBluetoothTransferReply*, this)); + emit finished(this); return false; } if (request().address().isNull()) { @@ -149,7 +149,7 @@ bool QBluetoothTransferReplyBluez::start() m_running = false; emit QBluetoothTransferReply::error(m_error); - QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection, Q_ARG(QBluetoothTransferReply*, this)); + emit finished(this); return false; } m_size = file->size(); @@ -207,8 +207,7 @@ void QBluetoothTransferReplyBluez::sessionCreated(QDBusPendingCallWatcher *watch m_running = false; emit QBluetoothTransferReply::error(m_error); - QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection, - Q_ARG(QBluetoothTransferReply*, this)); + emit finished(this); watcher->deleteLater(); return; @@ -239,8 +238,7 @@ void QBluetoothTransferReplyBluez::sessionStarted(QDBusPendingCallWatcher *watch cleanupSession(); emit QBluetoothTransferReply::error(m_error); - QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection, - Q_ARG(QBluetoothTransferReply *, this)); + emit finished(this); watcher->deleteLater(); return; @@ -292,8 +290,7 @@ void QBluetoothTransferReplyBluez::sessionChanged(const QString &interface, cleanupSession(); - QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection, - Q_ARG(QBluetoothTransferReply*, this)); + emit finished(this); } // ignore "active", "queued" & "suspended" status } qCDebug(QT_BT_BLUEZ) << "Transfer update:" << interface << changed_properties; @@ -346,8 +343,7 @@ void QBluetoothTransferReplyBluez::sendReturned(QDBusPendingCallWatcher *watcher } emit QBluetoothTransferReply::error(m_error); - // allow time for the developer to connect to the signal - QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection, Q_ARG(QBluetoothTransferReply*, this)); + emit finished(this); } } diff --git a/src/bluetooth/qbluetoothtransferreply_qnx.cpp b/src/bluetooth/qbluetoothtransferreply_qnx.cpp index acd60894..4c378065 100644 --- a/src/bluetooth/qbluetoothtransferreply_qnx.cpp +++ b/src/bluetooth/qbluetoothtransferreply_qnx.cpp @@ -137,7 +137,7 @@ bool QBluetoothTransferReplyQnx::start() m_finished = true; m_running = false; emit QBluetoothTransferReply::error(m_error); - QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection, Q_ARG(QBluetoothTransferReply*, this)); + emit finished(this); return false; } if (request().address().isNull()) { @@ -146,7 +146,7 @@ bool QBluetoothTransferReplyQnx::start() m_finished = true; m_running = false; emit QBluetoothTransferReply::error(m_error); - QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection, Q_ARG(QBluetoothTransferReply*, this)); + emit finished(this); return false; } startOPP(file->fileName()); -- cgit v1.2.3