diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2017-10-06 07:51:30 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-10-07 10:06:47 -0700 |
commit | 7aacaf60da7e73b9c57012e1846f709acb4d0ac2 (patch) | |
tree | 5dd0515de3f0bfebcc9f22a976089f8f2555b0f9 /core/btdiscovery.cpp | |
parent | 030c094854aeab4aaade523d7126728d9ce98a5b (diff) | |
download | subsurface-7aacaf60da7e73b9c57012e1846f709acb4d0ac2.tar.gz |
Move ConnectionListModel into its own source file
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/btdiscovery.cpp')
-rw-r--r-- | core/btdiscovery.cpp | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/core/btdiscovery.cpp b/core/btdiscovery.cpp index 729ee9851..f9c6e8522 100644 --- a/core/btdiscovery.cpp +++ b/core/btdiscovery.cpp @@ -10,47 +10,6 @@ extern QMap<QString, dc_descriptor_t *> descriptorLookup; BTDiscovery *BTDiscovery::m_instance = NULL; -ConnectionListModel::ConnectionListModel(QObject *parent) : - QAbstractListModel(parent) -{ -} - -QHash <int, QByteArray> ConnectionListModel::roleNames() const -{ - QHash<int, QByteArray> roles; - roles[AddressRole] = "address"; - return roles; -} - -QVariant ConnectionListModel::data(const QModelIndex &index, int role) const -{ - if (index.row() < 0 || index.row() >= m_addresses.count()) - return QVariant(); - if (role != AddressRole) - return QVariant(); - return m_addresses[index.row()]; -} - -QString ConnectionListModel::address(int idx) const -{ - if (idx < 0 || idx >> m_addresses.count()) - return QString(); - return m_addresses[idx]; -} - -int ConnectionListModel::rowCount(const QModelIndex &parent) const -{ - Q_UNUSED(parent) - return m_addresses.count(); -} - -void ConnectionListModel::addAddress(const QString address) -{ - beginInsertRows(QModelIndex(), rowCount(), rowCount()); - m_addresses.append(address); - endInsertRows(); -} - static dc_descriptor_t *getDeviceType(QString btName) // central function to convert a BT name to a Subsurface known vendor/model pair { |