From 21c545fa62e2bf5bd72f226751cfad9f273426bd Mon Sep 17 00:00:00 2001 From: Jozef Mlich Date: Fri, 13 Dec 2024 10:00:55 +0100 Subject: [PATCH] Remove unused btdiscoverymodel.* --- daemon/src/btdiscoverymodel.cpp | 42 --------------------------------- daemon/src/btdiscoverymodel.h | 29 ----------------------- 2 files changed, 71 deletions(-) delete mode 100644 daemon/src/btdiscoverymodel.cpp delete mode 100644 daemon/src/btdiscoverymodel.h diff --git a/daemon/src/btdiscoverymodel.cpp b/daemon/src/btdiscoverymodel.cpp deleted file mode 100644 index 11cc9eb7..00000000 --- a/daemon/src/btdiscoverymodel.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "btdiscoverymodel.h" - -BTDiscoveryModel::BTDiscoveryModel() -{ - -} - -int BTDiscoveryModel::rowCount(const QModelIndex &parent) const -{ - return m_devices.count(); -} - -QVariant BTDiscoveryModel::data(const QModelIndex &index, int role) const -{ - if (index.row() >= rowCount(index)) { - return QVariant(); - } - - if (role == NameRole) { - return m_devices[index.row()].name(); - } else if (role == AddressRole) { - return m_devices[index.row()].address().toString(); - } else { - return QVariant(); - } -} - -QHash BTDiscoveryModel::roleNames() const -{ - QHash roles; - roles[NameRole] = "name"; - roles[AddressRole] = "address"; - roles[ClassRole] = "class"; - return roles; -} - -void BTDiscoveryModel::foundDevice(const QBluetoothDeviceInfo &device) -{ - beginResetModel(); - m_devices << device; - endResetModel(); -} diff --git a/daemon/src/btdiscoverymodel.h b/daemon/src/btdiscoverymodel.h deleted file mode 100644 index 187dbfe0..00000000 --- a/daemon/src/btdiscoverymodel.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef BTDISCOVERYMODEL_H -#define BTDISCOVERYMODEL_H - -#include -#include - -class BTDiscoveryModel : public QAbstractListModel -{ -public: - BTDiscoveryModel(); - - int rowCount(const QModelIndex &parent) const override; - QVariant data(const QModelIndex &index, int role) const override; - QHash roleNames() const override; - - enum BTRoles { - NameRole = Qt::UserRole + 1, - AddressRole, - ClassRole - }; - -private: - QBluetoothDeviceDiscoveryAgent m_agent; - QList m_devices; - - Q_SLOT void foundDevice(const QBluetoothDeviceInfo &device); -}; - -#endif // BTDISCOVERYMODEL_H