From 02a74dcea028f42d481774134a8b5915212e4c17 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Mon, 6 Jan 2014 13:10:38 +0100 Subject: Use QLoggingCategory in Bluetooth QML import plugin. Add some minor include cleanups as well. Task-number: QTBUG-32253 Change-Id: I2ccb813a9dd85ca16c1ed8aab962418df8157890 Reviewed-by: Fabian Bumberger --- src/imports/bluetooth/plugin.cpp | 4 +++- .../bluetooth/qdeclarativebluetoothdiscoverymodel.cpp | 11 +++++++---- src/imports/bluetooth/qdeclarativebluetoothservice.cpp | 16 ++++++++++------ src/imports/bluetooth/qdeclarativebluetoothsocket.cpp | 18 ++++++++++-------- 4 files changed, 30 insertions(+), 19 deletions(-) (limited to 'src/imports') diff --git a/src/imports/bluetooth/plugin.cpp b/src/imports/bluetooth/plugin.cpp index 2311d6b8..6b509c43 100644 --- a/src/imports/bluetooth/plugin.cpp +++ b/src/imports/bluetooth/plugin.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ - +#include #include #include @@ -78,4 +78,6 @@ public: } }; +Q_LOGGING_CATEGORY(QT_BT_QML, "qt.bluetooth.qml") + #include "plugin.moc" diff --git a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp index 67b71902..6689d663 100644 --- a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp +++ b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp @@ -44,7 +44,8 @@ #include -#include +#include +#include #include #include "qdeclarativebluetoothservice_p.h" @@ -91,6 +92,8 @@ \sa QBluetoothServiceDiscoveryAgent */ +Q_DECLARE_LOGGING_CATEGORY(QT_BT_QML) + class QDeclarativeBluetoothDiscoveryModelPrivate { public: @@ -214,7 +217,7 @@ QVariant QDeclarativeBluetoothDiscoveryModel::data(const QModelIndex &index, int if (discoveryMode() != DeviceDiscovery) { if (index.row() >= d->m_services.count()){ - qWarning() << "index out of bounds"; + qCWarning(QT_BT_QML) << "index out of bounds"; return QVariant(); } @@ -239,7 +242,7 @@ QVariant QDeclarativeBluetoothDiscoveryModel::data(const QModelIndex &index, int } } else { if (index.row() >= d->m_devices.count()) { - qWarning() << "index out of bounds"; + qCWarning(QT_BT_QML) << "index out of bounds"; return QVariant(); } @@ -432,7 +435,7 @@ void QDeclarativeBluetoothDiscoveryModel::setUuidFilter(QString uuid) QBluetoothUuid qbuuid(uuid); if (qbuuid.isNull()) { - qWarning() << "Invalid UUID providded " << uuid; + qCWarning(QT_BT_QML) << "Invalid UUID providded " << uuid; return; } d->m_uuid = uuid; diff --git a/src/imports/bluetooth/qdeclarativebluetoothservice.cpp b/src/imports/bluetooth/qdeclarativebluetoothservice.cpp index 7559968d..6d4e3dc0 100644 --- a/src/imports/bluetooth/qdeclarativebluetoothservice.cpp +++ b/src/imports/bluetooth/qdeclarativebluetoothservice.cpp @@ -41,7 +41,9 @@ #include "qdeclarativebluetoothservice_p.h" -#include +#include + +#include #include #include #include @@ -80,6 +82,8 @@ \endlist */ +Q_DECLARE_LOGGING_CATEGORY(QT_BT_QML) + class QDeclarativeBluetoothServicePrivate { public: @@ -269,7 +273,7 @@ bool QDeclarativeBluetoothService::isRegistered() const int QDeclarativeBluetoothServicePrivate::listen() { if (m_service->socketProtocol() == QBluetoothServiceInfo::UnknownProtocol) { - qWarning() << "Unknown protocol, can't make service" << m_protocol; + qCWarning(QT_BT_QML) << "Unknown protocol, can't make service" << m_protocol; return -1; } QBluetoothServiceInfo::Protocol serverType = QBluetoothServiceInfo::UnknownProtocol; @@ -331,7 +335,7 @@ void QDeclarativeBluetoothService::setRegistered(bool registered) protocolDescriptorList.append(QVariant::fromValue(protocol)); } else { - qWarning() << "No protocol specified for bluetooth service"; + qCWarning(QT_BT_QML) << "No protocol specified for bluetooth service"; } d->m_service->setAttribute(QBluetoothServiceInfo::ProtocolDescriptorList, protocolDescriptorList); @@ -340,7 +344,7 @@ void QDeclarativeBluetoothService::setRegistered(bool registered) emit registeredChanged(); } else { - qWarning() << "Register service failed"; + qCWarning(QT_BT_QML) << "Register service failed"; //TODO propaget this error to the user } } @@ -364,7 +368,7 @@ QDeclarativeBluetoothSocket *QDeclarativeBluetoothService::nextClient() return new QDeclarativeBluetoothSocket(socket, this, 0); } else { - qWarning() << "Socket has no pending connection, failing"; + qCWarning(QT_BT_QML) << "Socket has no pending connection, failing"; return 0; } } @@ -381,7 +385,7 @@ void QDeclarativeBluetoothService::assignNextClient(QDeclarativeBluetoothSocket return; } else { - qWarning() << "Socket has no pending connection, failing"; + qCWarning(QT_BT_QML) << "Socket has no pending connection, failing"; return; } } diff --git a/src/imports/bluetooth/qdeclarativebluetoothsocket.cpp b/src/imports/bluetooth/qdeclarativebluetoothsocket.cpp index a1329182..75a1b85c 100644 --- a/src/imports/bluetooth/qdeclarativebluetoothsocket.cpp +++ b/src/imports/bluetooth/qdeclarativebluetoothsocket.cpp @@ -41,13 +41,13 @@ #include "qdeclarativebluetoothsocket_p.h" -#include -#include -#include -#include +#include +#include +#include +#include +#include - -#include +#include #include #include @@ -75,6 +75,8 @@ or passing in the service return from BluetoothDiscoveryModel. */ +Q_DECLARE_LOGGING_CATEGORY(QT_BT_QML) + class QDeclarativeBluetoothSocketPrivate { public: @@ -224,7 +226,7 @@ void QDeclarativeBluetoothSocket::setConnected(bool connected) d->connect(); } else { - qWarning() << "BluetoothSocket::setConnected called before a service was set"; + qCWarning(QT_BT_QML) << "BluetoothSocket::setConnected called before a service was set"; } } @@ -341,7 +343,7 @@ QString QDeclarativeBluetoothSocket::stringData() void QDeclarativeBluetoothSocket::sendStringData(const QString &data) { if (!d->m_connected || !d->m_socket){ - qWarning() << "Writing data to unconnected socket"; + qCWarning(QT_BT_QML) << "Writing data to unconnected socket"; return; } -- cgit v1.2.3