Bug was due to incorrect use of QAbstractItemModel::index.
The arguments should be in (row, col) sequence but we were
mistakenly passing in (col, row).
Fixes#820
Signed-off-by: K. Heller <pestophagous@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The logic to pick the initial dive ID for the uemis downloader was very
confused, and did not work at all when restarting a download when the
Uemis filled up, and the "Force download all dives" flag was set. It
also required a rather odd Uemis-specific callback from the download UI
because of how it picked the initial ID.
This changes the logic to just look at the list of downloaded dives when
restarting, which simplifies the logic a lot, gets rid of the odd
special callback, and also means that the whole "Force download" issue
just goes away. It seems to work now.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This if'defs DC_TRANSPORT_* use with SSRF_CUSTOM_SERIAL, because the
enum doesn't exist when building against stock libdivecomputer.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The Bluetooth implementation doesn't work if SSRF_CUSTOM_SERIAL
is undefined. Therefore it is a good idea to remove it from
the UI if the libdivecomputer version is wrong.
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If the Bluetooth download mode was disabled then remove
the Bth address from the device or mount point section and
reset the index.
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Save the dive computer download mode flag. In this way,
if the user used Bluetooth mode to download its dives on
his last session he doesn't need to open the Bth selection
dialog if he wants to use the same device.
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Changes to capitalisation to comply with coding style
Changes to make some blocks of english sound a bit better
Signed-off-by: Tim Wootton <tim@tee-jay.org.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There are moments when the name of the device is not collected
properly and it is unavailable. Instead of showing an empty string
then print the address of the device.
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Also remove the quick hack from commit 947fda14c5 ("Bluetooth support:
quick build fix for Qt5.2"). I should have thought this through before
pushing that commit, but oh well.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Implement a dialog which can be used for remote Bluetooth devices
selection and to control the local Bluetooth device.
Functionalities of the widget:
- expose information about the local BT device
- scan for remote BT devices
- pair/unpair with a remote BT device
- turn on/off the local BT device
- logging
- save the selected BT device
The selection dialog is created when the bluetoothMode checkbox
is enabled.
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The checkbox will be used to enable the Bluetooth
downloading mode. The button will be used to create
a dialog selection where the user will be able to
scan and select remote devices.
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Models.h now is quite minimal, I'll keep it like that for now, until it
grows huge again. I've also cleaned a bit the headers that are using it so
only the ones that actually need the stuff that I've left behind will
actually include this file.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Oops, we left the (UEMISSDA) in the path. This can never have worked
without the user manually correcting it to just show the drive letter.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When we run out of space in the Uemis filesystem we return an error. The
user could reasonably unplug the SDA, insert it again and then retry to
continue the download (that's what we tell them to do). In that case we
need to make sure we start at the correct dive otherwise the same dives
keep getting downloaded over and over again.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The dialog didn't accept "OK" and store the dives downloaded / selected so
far if there had been an error. Especially with partial downloads from the
Uemis SDA this is something that is quite reasonable to want to do, so
allow exiting the dialog with OK even after an error.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When we run out of space in the Uemis filesystem we return an error. The
user could reasonably unplug the SDA, insert it again and then retry to
continue the download (that's what we tell them to do). In that case we
need to make sure we start at the correct dive otherwise the same dives
keep getting downloaded over and over again.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The dialog didn't accept "OK" and store the dives downloaded / selected so
far if there had been an error. Especially with partial downloads from the
Uemis SDA this is something that is quite reasonable to want to do, so
allow exiting the dialog with OK even after an error.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It's now set up from the mainwindow.cpp file.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Last index was not included in the selecting or unselecting the
downloaded dives.
Fixes#819
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Lots and lots and lots of header files were being included without being
needed. This attempts to clean some of that crud up.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I could have sworn we did this at some point. The vendors are already
sorted, but the products for each vendor should be sorted, too.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
After a partial download (because the user hits cancel or because there
was an error, if the user hits Retry the list of dives downloaded so far
should be cleared because we will simply try to re-download the same dives
again.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is bigger and more invasive then I wanted, but it's hard to break it
down into smaller pieces. Here's what it does:
The former "Download" button becomes the "Download", "Cancel download" and
"Retry" button. So this button controls your interaction with the dive
computer.
The other two buttons are now purely "OK" and "Cancel" for the dialog.
"Cancel" discards what happened (much easier now that we download into a
different table), and "OK" adds the dives that were selected in our
selection UI (by default all downloaded dives) to the real dive_table.
And while redoing all this, I also redid some of the state machine
underlying the dialog. The biggest change that the user will see is that
partial downloads (after canceling or after an error) will still offer the
dives that were completely downloaded up to that point in the selection
menu.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We pass a different table to libdivecomputer (and the uemis code) and have
that table filled. And then we simply copy the dives from that table into
the real dive_table when the user accepts the download.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since we now track all clicks on the row, having the setData() actually
neutralized the action that we took on the clicked() signal.
Now you can select / deselect a dive, regardless where in the row you
click.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Yet another bug because the indices are inclusive. We need to start off
with the last being smaller than first and we need to adjust the row
count. It might be easier to just fix thing to make last be exclusive...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This fixes the issue where there was no visual feedback when clicking on
the second or third column in the grid. It would actually change the
checked state of the checkmark internally (and you would see the new state
once you clicked on another dive), but it wouldn't give immediate visual
feedback.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The array we allocated was one entry too small.
On the flip side, let's just make sure we cannot call this with a negative
range. That would be bad, too.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>