Commit graph

17 commits

Author SHA1 Message Date
Berthold Stoeger
a70597b903 Leak fix: make ostcFirmwareCheck a unique_ptr
ostcFirmwareCheck in DownloadFromDCWidget was neither freed
in the destructor, not freed if a new object was allocated.

Simply make it a unique_ptr<> to do all the work for us.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-03-18 09:06:32 -07:00
Dirk Hohndel
38cda08819 Bluetooth: run a discovery agent for BT/BLE dive computers on macOS
This way the scan time will be shorter (which on macOS can be 25+ seconds).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-12 08:22:44 -07:00
Dirk Hohndel
ebb3fc8a0c Desktop/remember DCs: insert the remember connection into dropdown
This still doesn't do the right thing for BT/BLE connections on a Mac, but it
should work on Linux and possibly Mac.

We definitely need to figure out how to get the Mac to successfully connect back
to a BT/BLE device.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-24 18:51:21 +02:00
Dirk Hohndel
413b05ab89 Desktop/remember DCs: move non-UI-specific code into the core layer
This way we can use the same functionality from the mobile UI as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-23 11:49:30 -07:00
Dirk Hohndel
4eb8ed1b29 Desktop/remember DCs: hook up the shortcut buttons
The straight forward code to update the currentIndex of the combobox doesn't
appear to work on macOS (but works fine on Linux). Calling the event loop and
then calling update afterwards seems very unintuitive, but it appears to fix
the issue in my testing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-23 11:49:30 -07:00
Dirk Hohndel
99261775ce Desktop/remember DCs: remember dive computers that were used
The algorithm tries to keep the order of the buttons the same. So if a dive
computer was used that's already remembered, don't reorder the buttons. But if
a new dive computer is used, add it as the first one and move the others back,
potentially dropping the oldest one.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-23 11:49:30 -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
efabf0a55c Fix memory leak in download-from-dive-computer widget
Instead of (re)allocating the vendor and product models, use the
setStringList method on sub objects.

Even though only a theoretical problem, the model objects are moved
in front of the ui object, so that the widgets referencing the models
are destroyed first.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-11 21:01:42 +01:00
Berthold Stoeger
d23bd46a1b Reset device field in DownloadFromDCWidget according to dive computer
Fixes minor interface inconsistency: The device field in the
download-from-dive-computer widget is disabled when selecting
a non-serial-transport dive computer. In contrast, post-download
the field was reset to enabled for all dive computers.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-01 07:13:47 -07:00
Tomaz Canabrava
c370b876b2 Reduce the scope of variables
Those variables should have local scope, not class scope.
We are using it only inside of pickDump/LogFile metohds.

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
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
Tomaz Canabrava
3c3f91dcb2 Move model code to models
This makes it easery to use it on Qml.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-27 07:46:01 -07:00
Dirk Hohndel
9021a44ccc Add SPDX header to desktop widgets
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-29 13:32:55 -07:00
Dirk Hohndel
7be962bfc2 Move subsurface-core to core and qt-mobile to mobile-widgets
Having subsurface-core as a directory name really messes with
autocomplete and is obviously redundant. Simmilarly, qt-mobile caused an
autocomplete conflict and also was inconsistent with the desktop-widget
name for the directory containing the "other" UI.

And while cleaning up the resulting change in the path name for include
files, I decided to clean up those even more to make them consistent
overall.

This could have been handled in more commits, but since this requires a
make clean before the build, it seemed more sensible to do it all in one.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04 22:33:58 -07:00
Tomaz Canabrava
e49d6213ad Move qt-ui to desktop-widgets
Since we have now destkop and mobile versions, 'qt-ui' was a very
poor name choice for a folder that contains only destkop-enabled
widgets.

Also, move the graphicsview-common.h/cpp to subsurface-core because
it doesn't depend on qgraphicsview, it merely implements all the
colors that we use throughout Subsurface, and we will use colors on both
desktop and mobile versions

Same thing applies for metrics.h/cpp

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:49 -07:00
Renamed from qt-ui/downloadfromdivecomputer.h (Browse further)