diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2014-01-06 13:10:38 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-08 13:56:24 +0100 |
commit | 02a74dcea028f42d481774134a8b5915212e4c17 (patch) | |
tree | 9c4fddd93c2bab10b027c9c3474bd68a95c59048 /src/imports | |
parent | 0abf615fe2f18dc2ebf66ca7874b40ed6ba126c9 (diff) |
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 <fbumberger@rim.com>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/bluetooth/plugin.cpp | 4 | ||||
-rw-r--r-- | src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp | 11 | ||||
-rw-r--r-- | src/imports/bluetooth/qdeclarativebluetoothservice.cpp | 16 | ||||
-rw-r--r-- | src/imports/bluetooth/qdeclarativebluetoothsocket.cpp | 18 |
4 files changed, 30 insertions, 19 deletions
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 <QtCore/QLoggingCategory> #include <QtQml/QQmlEngine> #include <QtQml/QQmlExtensionPlugin> @@ -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 <QPixmap> -#include <qbluetoothdeviceinfo.h> +#include <QtCore/QLoggingCategory> +#include <QtBluetooth/QBluetoothDeviceInfo> #include <QtBluetooth/QBluetoothAddress> #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 <qbluetoothdeviceinfo.h> +#include <QtCore/QLoggingCategory> + +#include <QtBluetooth/QBluetoothDeviceInfo> #include <QtBluetooth/QBluetoothSocket> #include <QtBluetooth/QBluetoothAddress> #include <QtBluetooth/QBluetoothServer> @@ -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 <QPointer> -#include <QStringList> -#include <QDataStream> -#include <QByteArray> +#include <QtCore/QLoggingCategory> +#include <QtCore/QPointer> +#include <QtCore/QStringList> +#include <QtCore/QDataStream> +#include <QtCore/QByteArray> - -#include <qbluetoothdeviceinfo.h> +#include <QtBluetooth/QBluetoothDeviceInfo> #include <QtBluetooth/QBluetoothAddress> #include <QtBluetooth/QBluetoothSocket> @@ -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; } |