Commit graph

12 commits

Author SHA1 Message Date
Dirk Hohndel
34ebaf6599 core/bt: ensure that BT/BLE addresses with name sort first
We don't order the list of addresses alphabetically, but we want to ensure
that devices that offer us a name are listed before those that don't. This
should only be relevant if the user selects the option to show all BT/BLE
devices, not just recognized dive computer, because if we recognize a computer
we always have the product name prepended to the address.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-15 04:05:06 +03:00
Dirk Hohndel
b241d09694 mobile/models: correctly reset the connection model
Qt hates empty ranges, and even for a non-empty range, this is better
implemented as a reset than a remove.

This fixes a crash that I have been able to create on iOS by rescanning
for devices on the download page.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-10 17:18:17 -07:00
Berthold Stoeger
15b2dbede4 Mobile: reinstate roleNames function in ConnectionListModel
Commit c69ca4df80 removed the roleNames
function, which is not needed according to the docs, as a default function
is provided. For unknown reasons this broke the QML combo box.

Reinstate the function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-16 23:43:14 +12:00
Rolf Eike Beer
bf9a526d63 slightly optimize ConnectionListModel
-avoid object copies
-use some more bullet proof C++11 constructs
-avoid using a QRegExp, simple string matches are faster

Signed-off-by: Rolf Eike Beer <eike@sf-mail.de>
2019-03-27 07:36:33 -07:00
Dirk Hohndel
c69ca4df80 Core: simplify ConnectionListModel
The complicated setup with the AddressRole is unnecessary. All we want to be
able to do is get the index of a specific text in the list. In hindsight I am
puzzled why I implemented this in such a complex fashion.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-03-20 09:07:17 -07:00
Jocke
0f588f5227 Substring match BT address
Since a known DC will have the name prepended to the BT/BLE addresss
we need to substring match the BT address.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-10-09 21:04:23 -07:00
Dirk Hohndel
0ae57cfe92 Mobile/remember DCs: try to match device names
We only store the address part of the connection name, so don't try to find an
exact match, try to find the sub-string.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-23 11:49:30 -07:00
Dirk Hohndel
1bbbc07dd5 core: add indexOf member to ConnectionListModel
This will allow us to programatically set the connection in the QML UI.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
jan Iversen
a312e53f0c core: Change Q_UNUSED to no parameter name
C++ permits use of parameters without name, which signals unused

Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-21 12:48:04 -07:00
Jan Mulder
2c8693f468 Do not add double ConnectionList items
Refuse to add a ConnectionList row, when the row is already
there. This, obviously, prevents double items.

Fixes: #1069

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-24 16:19:09 +01:00
Jan Mulder
8b8863b640 Add function to clear connectionModel data
Preparation primarily for mobile. When we want to switch in
one session from BT to cable connection and vise versa, we
need a way to clear the model data containing the possible
connections in use.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-12 09:32:12 +02:00
Dirk Hohndel
7aacaf60da Move ConnectionListModel into its own source file
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07 10:06:47 -07:00