Commit graph

111 commits

Author SHA1 Message Date
Dirk Hohndel
5810aedeac Uemis downloader: clean up the path for Windows mount point
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>
2015-04-30 16:35:46 -07:00
Dirk Hohndel
8bbb3dfe42 Uemis downloader: allow continuing download by clicking Retry
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>
2015-04-30 07:42:42 -07:00
Dirk Hohndel
e9ba8f0ff6 Download dialog: we can accept a partial download after an error
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>
2015-04-30 07:41:41 -07:00
Miika Turkia
6edc458e83 Fix crash when no dives were selected for downloading
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-26 21:33:09 -08:00
Miika Turkia
d5d42982b8 Fix (un)selecting of downloaded dives
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>
2015-01-26 21:33:05 -08:00
Dirk Hohndel
02d8dd5d13 Clean up the header files
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>
2015-01-17 23:00:43 +13:00
Dirk Hohndel
a0c52237ea Dive download UI: sort the dive computer dropdown
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>
2015-01-13 22:05:55 +13:00
Dirk Hohndel
af3dd1e835 Attempt a better layout for the download dialog
This seems to work well and provides a lot less wasted space.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-13 21:58:28 +13:00
Dirk Hohndel
578e9c22af Dive d/l selection UI: clear table when retrying
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>
2015-01-11 07:46:21 -08:00
Dirk Hohndel
762f33bd13 Dive d/l UI: redo the states, the flow, the buttons
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>
2015-01-09 15:06:25 -08:00
Dirk Hohndel
7357633905 Now use our table when downloading from the dive computer
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>
2015-01-09 15:06:25 -08:00
Dirk Hohndel
e43ea018fa Add a private table for downloaded dives
This still isn't actually used, just puts it in place.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-09 15:06:25 -08:00
Dirk Hohndel
a92484e4ed Dive d/l selection UI: remove setData() method
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>
2015-01-09 12:42:09 -08:00
Dirk Hohndel
4d26e3a0cb Dive d/l selection UI: fix the row count ranges
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>
2015-01-09 12:42:09 -08:00
Dirk Hohndel
80af8e7fa2 Dive d/l selection UI: update checkmark state correctly
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>
2015-01-09 12:42:09 -08:00
Dirk Hohndel
15fb6158bc Dive d/l selection UI: the indices are inclusive, allocate enough space
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>
2015-01-09 12:41:38 -08:00
Dirk Hohndel
cd2cee4974 Dive d/l selection UI: only allow one download for now
We may reconsider this as this might replace the Retry function that's
currently completely broken.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-09 12:00:34 -08:00
Dirk Hohndel
e9e6e75feb Dive d/l selection UI: don't setup the model if there are no dives
Setting things up for zero dives will cause all kinds of weird corner
cases. Just don't do it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-09 11:28:15 -08:00
Dirk Hohndel
562f88d2b7 Use setEnabled() instead of setDisabled()
I don't like mixing setEnabled() and setDisabled()... let's just always
use setEnabled().

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 12:56:17 -08:00
Dirk Hohndel
0dd8d11a18 Dive d/l selection UI: hook up select / unselect all
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 12:54:53 -08:00
Dirk Hohndel
e6b5a00e35 Dive d/l selection UI: allow clicking anywhere in a row
It seemed silly to only be allowed to click the tiny checkbox.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 11:39:34 -08:00
Dirk Hohndel
d16bff13bb Dive d/l selection UI: fix more array access errors
The checked array is zero based, reflecting the rows shown.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 11:27:47 -08:00
Dirk Hohndel
32824e8db8 Dive d/l selection UI: brute force size optimizations
This is horrible, but it gets something in place and hopefully we can
clean this up soon.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 11:19:01 -08:00
Dirk Hohndel
d143527732 Dive d/l selection UI: show reasonable column headers
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 10:12:43 -08:00
Dirk Hohndel
1ce2d42e8d Random whitespace cleanup
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 10:02:28 -08:00
Dirk Hohndel
17b9597f3e Dive d/l selection UI: fix check if things were checked
Math is hard.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 10:00:30 -08:00
Dirk Hohndel
847289605b Dive d/l selection UI: close the dialog when done
This is where we need to call accept()

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 09:59:01 -08:00
Dirk Hohndel
cb6f04f16c Dive d/l selection UI: Only show checkbox on the first column
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 09:43:29 -08:00
Dirk Hohndel
9d38ceb95d Dive d/l selection UI: disable OK until things are downloaded
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 09:39:47 -08:00
Dirk Hohndel
a20040a561 Fix missing return value
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 09:33:52 -08:00
Dirk Hohndel
c1bc29bd4b Dive d/l selection UI: show useful data in a useful format
We don't get location data from the dive computer (at least not from
99.99% of the dive computers today). And we really need to show the data
in a human readable format.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 09:33:47 -08:00
Dirk Hohndel
a3ea1d51f9 Dive d/l selection UI: don't close the dialog when we're done downloading
The whole point is that we then want to pick and choose which dives to add
to the divelist.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 09:33:40 -08:00
Tomaz Canabrava
6b11f94996 Dive d/l selection UI: Only try to get the dive list if d/l succeeded
This fixes a crash where we tried to get the data without actually having
downloaded anything.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 07:47:22 -08:00
Tomaz Canabrava
afafbb3a3e Dive d/l selection UI: Remove unused variable
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 07:47:11 -08:00
Tomaz Canabrava
f5f0938d8c Dive d/l selection UI: Add method to remove unused dives
This tries to relete from the dive list the dives that shouldn't be
imported.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 07:46:41 -08:00
Tomaz Canabrava
25323c2717 Dive d/l selection UI: Hook up OK button
Create an on_ok_clicked that will do the actuall parsing of choosen dives.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 07:45:58 -08:00
Tomaz Canabrava
09d6d4f5de Dive d/l selection UI: Create a button to download the data from DC
Now, ok should close the dialog, and not download the dives from the DC,
this way the user can choose what happens.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 07:45:30 -08:00
Tomaz Canabrava
f8e86b2f4b Dive d/l selection UI: Fill the checked vector as true
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 07:44:29 -08:00
Tomaz Canabrava
f8af0239ce Dive d/l selection UI: Set the item flags
Now the user can click on the dives that they want to keep.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 07:43:38 -08:00
Tomaz Canabrava
797bf49129 Dive d/l selection UI: Add the setData method
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 07:43:01 -08:00
Tomaz Canabrava
55cc16d77d Dive d/l selection UI: Add the check states
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 07:42:25 -08:00
Tomaz Canabrava
76725265fc Dive d/l selection UI: Display the downloaded dives in a table
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 07:41:51 -08:00
Tomaz Canabrava
f7abde84af Dive d/l selection UI: setImportedDivesIndexes implementation
Here we list in the model what are our dives, inside the dive_table.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 07:41:17 -08:00
Tomaz Canabrava
9ee615bca3 Dive d/l selection UI:: Constructor, rowCount and ColumnCount
Add importedDivesIndexes and Data.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 07:40:51 -08:00
Tomaz Canabrava
db367ae0a2 Dive d/l selection UI:: Add skeleton for the dialog
So the user can remove the ones they don't like.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 07:40:33 -08:00
Anton Lundin
221b5f0ff7 Only check for update after successfull download
We check that the logbook download didn't error out before checking if
we should remind the user to upgrade the firmware. Otherwise we will
check if whatever the current firmware version is, is greater than zero
and always remind the user to upgrade the fw.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-29 16:27:44 -08:00
Anton Lundin
95461830bb Initialize members in the declared order
This closes a compiler warning.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-29 16:22:20 -08:00
Dirk Hohndel
003f5d18b6 Automatic OSTC firmware update: download file and try to install
This successfully downloads the hex file.
The actuall update of the OSTC fails before it gets started with a crash
when the ConfigureDiveComputer object is created.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-28 10:22:46 -08:00
Dirk Hohndel
0be0cdb046 OSTC firmware update prompt: use the stable changelog files
Heinrichs Weikamp is giving us stable URLs from which we can get the
latest stable version. The parsing is a bit simplistic, but it seems to
work.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-28 07:37:11 -08:00
Dirk Hohndel
2461a731fc Progress towards automatic OSTC firmware updates
Better parsing of the website data, a simpe dialog that informs the user
that they should upgrade their firmware.

Still doen't call the right code path to DO the upgrade.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-28 06:39:30 -08:00