Commit graph

30 commits

Author SHA1 Message Date
Berthold Stoeger
f542dc4030 Import: add trip_table argument to DiveImportedModel::repopulate()
In the future we want to download trips into a distinct trip-table
instead of the global trip-table to allow for undo of import.

Therefore add a trip_table argument to DiveImportedModel::repopulate()
and a trip_table member to DiveImportedModel. To correctly set these,
add a DownloadThread::trips() function, which currently simply returns
the global trip table.

Finally, make "struct trip_table *" a Q_METATYPE, so that the corresponding
arguments can be passed from QML.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-09 20:58:04 -08:00
Berthold Stoeger
bfe69239df Import: unglobalize downloadTable
To make data flow more clear, unglobalize the downloadTable object.
Make it a subobject of DownloadThread. The difficult part was making
this compatible with QML, because somehow the pointer to the
download-table has to be passed to the DiveImportedModel. Desktop would
simply pass it to the constructor. But with objects generated in QML
this is not possible. Instead, pass the table in the repopulate()
function. This seems to make sense, but for this to work, we have to
declare pointer-to-dive-table as a Q_METATYPE. And this only works
if we use a typedef, because MOC removes the "struct" from "struct
dive_table". This leads to compilation errors, because dive_table is
the symbol-name of the global dive table! Sigh.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-12-17 07:37:32 -08:00
Berthold Stoeger
abf942f303 Cleanup: make DCDeviceData a "normal" singleton
DCDeviceData was using that weird pattern where the instance
variable was set in the constructor. There is no apparent
reason to do so, therefore convert to a "normal" singleton.

Access that directly in QMLManager instead of saving it in
a member variable first.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-12-17 07:37:32 -08:00
Berthold Stoeger
574065b314 Cleanup: reinstate override modifiers
This reverts commit 1c4a859c8d,
where the override modifiers were removed owing to the noisy
"inconsistent override modifiers" which is default-on in clang.

This warning was disabled in 77577f717f,
so we can reinstate the overrides.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-29 15:23:25 -07:00
Linus Torvalds
270e9eccad Make device enumeration use the device transport data
This removes some special-case code for Uemis, replacing it with simply
passing in the device transport information.

This makes device enumeration work for the Garmin Descent (if it is
listed by libdivecomputer as a USB storage device, that is).

I don't actually do any of the libdivecomputer parsing yet, and only
have a stub for the Garmin Descent, but now the directory selection
works with that stub. The actual download obviously does not.

[Dirk Hohndel: removed obsolete FIXME from code]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-27 22:10:38 -07:00
Berthold Stoeger
1c4a859c8d Cleanup: remove all override modifiers
Commit df156a56c0 replaced "virtual"
by "override" where appropriate. Unfortunately, this had the
unintended consequence of producing numerous clang warnings. If
clang finds a override-modified function in a class definition,
it warns for *all* overriden virtual functions without the override
modifier.

To solve this, go the easy route and remove all overrides. At least
it is consistent.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-01 06:30:00 -07:00
jan Iversen
470c218b79 core: remove qml properties from downloadfromcthread
Remove Q_OBJECT and qml properties from DCDeviceData class
Remove DCDeviceData register from mobile-helper.cpp
Change DCDeviceData constructor to be without parameters

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-09 21:19:46 +02:00
jan Iversen
682e1b63f5 mobile: add DCDeviceData properties to qmlmanager
add DCDeviceData qml properties etc. to qmlmanager

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-09 21:19:46 +02:00
jan Iversen
acc9784fd9 core: remove qml properties from desktop compile
add #ifdef SUBSURFACE_MOBILE to secure qml macros are not
compiled with desktop

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-09 21:19:46 +02:00
jan Iversen
efab7e3357 core: remove unused function getDetectedDeviceAddress()
getDetectedDeviceAddress is not used in mobile or desktop version

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-04 10:27:13 -07:00
Dirk Hohndel
ea83b5ed37 Core: remove dive.h from files that don't need it
Of course, quite a few of them indirectly get it through other header
files.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-05-14 10:13:39 -07:00
Dirk Hohndel
ea7a7c6b24 QML UI: add supported dive computers to log file
In a more compact format than before.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-27 11:52:48 -07:00
Berthold Stoeger
de81effb25 Make Bluetooth naming consistent
Currently, on Linux, after selecting a Bluetooth device the name of the
device is shown. On reopening the download dialog, on the other hand,
the address is shown. In the device selection dialog both are shown.

This patch changes the download dialog such that both, name and address,
are shown. The bulk of the patch introduces the name of the device in
the preferences and DCDeviceData. It has to be noted that DCDeviceData
is an encapsulation of the libdivecomputer device_data_t. Nevertheless,
the new Bluetooth-name field is, at the moment, not passed through to
libdivecomputer.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-13 20:48:17 -08:00
Dirk Hohndel
56c82081a5 Make compile succeed without BT_SUPPORT
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07 10:06:47 -07: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
Dirk Hohndel
0c410aaf5d Adjust signature to match data we need
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26 12:27:12 -07:00
Dirk Hohndel
025efc12d4 QML UI: remove the Paired Bluetooth Devices virtual vendor
We now actually handle connections in a sane manner and don't need
that workaround anymore.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-18 00:49:31 -07:00
Dirk Hohndel
a4f045abaa Add the connections that we find to the model
So far this only deals with BT addresses. We also need to add other
connections that we detect.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-16 21:53:44 -07:00
Jan Mulder
db39f1a847 code cleanup: remove 2 unused structs
Luckily these 2 structs in this ugly code are not used. Remove them.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-06-16 05:31:41 +09:00
Jan Mulder
5142d7409f Mobile: add BT name to vendor/product capability
This adds a central function to convert a BT name to a vendor/product pair
known to Subsurface. This allows interfacing from a paired BT dive
computer, without actively selecting its type, but by selecting it
from the list of paired BT devices. So, after this, downloading from
multiple (paired) DCs is also possible.

And not the niced piece of code ...

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-12 10:59:05 -07:00
Jan Mulder
790c0dcfc8 QML UI: add internal admin for virtual vendor
Added a list of paired BT devices for the "Paired BT Devices" vendor. The
devices under this vendor represent all BT devces that can be found
from the local BT interface. Some special processing is required, as
the BT provided data is (obviously) missing the specific data needed
to open a BT device using libdc code. This processing is not in
this commit, but will follow. This commit is preparation for that.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-12 09:55:27 -07:00
Dirk Hohndel
b14a522f4f QML UI: move BT handling into core code
This shouldn't be part of the UI (qmlmanager), but part of our
overall handling of dive computers and BT devices.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-11 13:55:41 -07:00
Dirk Hohndel
a568562503 QML UI: try to match BT names to known dive computers
So far this just adds data to the log.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-29 12:25:21 -07:00
Dirk Hohndel
271b4caddc Fix build error
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-27 11:21:57 -07:00
Tomaz Canabrava
7858376727 QML UI: add the DownloadThread
For this I had to also make the DCDeviceData accessible,
and for that it needed to be a pointer.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-27 11:07:20 -07:00
Tomaz Canabrava
85e92597b5 Set descriptor when starting thread.
Set the descriptor when starting the thread, this removes
code from the desktop code and makes everything in sync always.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-27 11:07:19 -07:00
Tomaz Canabrava
09904ddff5 Extract the device_data_t into helper class
Keeping the Desktop and QML versions of Subsurface
using the same codebase will keep the code saner,
this change makes the Desktop version use the
DCDeviceData helper sturct that encapsulates
the device_data_t member for easy access on the
QML. This also helped move a bit of initializations
from the UI to the Core - and that's always good.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-27 11:07:19 -07:00
Tomaz Canabrava
acbe5de1cb New class DCDeviceData
this class encapsulates the device_data_t from libdivecomputer
in a way that permit us to use it on QML.
this will be needed to prepare the data for the download thread.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-27 11:07:19 -07:00
Tomaz Canabrava
a55efcf7d8 Move the fill_computer_list() out of widgets
fill_computer_list() creates a Qt friendly
structure that contains all of the necessary
information about dive computers and it's
devices, and it's needed both in Qml and Widgets
to allow the user to download their dives.

This patch makes it possible to use the code
in QML without duplication.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-27 08:07:35 -07:00
Tomaz Canabrava
dec47e11cd Separate the download thread from the widget logic
This is important to not duplicate code for the Qml
view. Now the DownloadFromDiveComputer widget is mostly
free from important code (that has been upgraded to the
core folder), and I can start coding the QML interface.

There are still a few functions on the desktop widget
that will die so I can call them via the QML code later.

I also touched the location of a few globals (please, let's
stop using those) - because it was declared on the
desktop code and being used in the core.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-27 07:53:14 -07:00