Commit graph

2921 commits

Author SHA1 Message Date
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
747afa314a Dive d/l selection UI: Rename button
Fix the name of a button so the download from dc actually works.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 07:48:07 -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
acb5168254 Dive d/l selection UI: Add a table for the new dives from DC dialog
It will show the model that I just created.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08 07:44:50 -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
Dirk Hohndel
5f4770a5bd CSV import: make predefined imports work again
We need to reparse the file when the known type changes and want to make
sure that we only try to guess the separator and the columns if the user
hasn't told us otherwise.

For the predefined imports this then looks up the correct columns and
places the correct headings there - and then allows the user to modify
them if needed.

This has been lightly tested, there may be dragons.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07 17:02:42 -08:00
Dirk Hohndel
db988aa62b CSV import: first steps to enable the preset types again
With the new infrastructure colum numbers are 0 based, so the indices had
to change.
This commit also adds the column names for sample based formats (and ends
up re-indenting parts of that code).

This doesn't make things work, yet, but it's a step in the right
direction.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07 16:59:42 -08:00
Dirk Hohndel
a51110b0d0 CSV input UI: if we detect columns, set type to "manual" for now
We still need to re-implement the other presets.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07 15:11:54 -08:00
Dirk Hohndel
e3aebfdd66 CSV import UI: Minor update to strings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07 15:09:24 -08:00
Dirk Hohndel
b08b32af2c CVS import UI: mark the column names in blue as well
And make the bubbles slightly larger.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07 13:00:16 -08:00
Dirk Hohndel
02103978ec CVS import UI: mark the drop row in blue
That way it is distinct from the rest.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07 13:00:06 -08:00
Dirk Hohndel
2f5d4720e9 CVS import UI: better message if some columns were matched
If we automatically matched the columns this might already be correct. So
the standard text is confusing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07 12:41:06 -08:00
Joseph W. Joshua
810840ddb1 Better resizing in the divelog import dialog
Resize the components of the divelog import dialog neatly, with the
table view expanding to fill most of the available space.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07 12:34:45 -08:00
Tomaz Canabrava
c4b7ed5444 CSV Import UI: Prettifications, hide headers, code cleanup.
Just a few cleanups.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07 12:33:30 -08:00
Tomaz Canabrava
11fc888cdc Fix moving columns around when one of the columns is empty
I used to compare strings, but since there can be more than one empty
column, this was a very sad choice, now I'm comparing indexes.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07 12:33:12 -08:00
Tomaz Canabrava
3b654438b6 Draw a nice rounded rect around the avaliable column names
This drawns a nice rounded rect around the avaliable column names, using
antialiasing.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07 12:32:15 -08:00
Tomaz Canabrava
ce9d972ffa Give the items a bit more spacing / enable the delegate
Enable the new delegate on the view, and give the items a bit more
spacing, so we can draw things around them.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07 12:31:52 -08:00
Tomaz Canabrava
8531cec100 Add delegate skeleton for the drag columns
This new class is the responsible to draw the columns that can be dragged
from the top bar to the bottom one.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07 12:30:25 -08:00
Lubomir I. Ivanov
2b311b1c2c profile: don't show instantMeanDepth for printMode
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07 12:29:59 -08:00
Dirk Hohndel
1c06252c00 CVS import UI: use my own match function
This makes the code simpler and allows us to do a much better job matching
the column names.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07 12:27:20 -08:00
Dirk Hohndel
816367eb06 CSV import UI: First step towards recognizing column headers
This doesn't do a good job of matching the titles, but it works for some
of them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07 11:24:57 -08:00
Dirk Hohndel
481de7da74 CSV import dialog: try to guess the separator based on the file
This is taking a very simplistic approach. It picks the predominant
potential separator. If there is no clear winner, it uses the UI default
and makes the user pick (and either way, this can always be overwritten by
the user).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07 08:57:08 -08:00
Dirk Hohndel
925bb019c7 Fix potential crash
Commits 0de3bc8452 ("Display CCR setpoint values on the po2 graph") and
65eed80e37 ("Don't always show the setpoint graph") didn't take into
account that current_dive could be NULL and therefore accessing current_dc
could crash.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 20:35:57 -08:00
Dirk Hohndel
f42b986474 Adjust capitalization to our style
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 20:21:51 -08:00
Dirk Hohndel
e544796199 Add missing divemaster field to the manual import
No idea why I didn't notice earlier that this was missing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 20:19:45 -08:00
Dirk Hohndel
5a4d85bf7c Fix crash when importing CSV that requires change of separator
The dialog defaults to tab; if a file is indeed comma separated and one
switches to that, data() could be called on a higher index before the
model is re-populated.

I'm a bit surprised why index.isValid() doesn't catch this, but the manual
check appears to work.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:53:49 -08:00
Tomaz Canabrava
9511ee0294 Do not allow the drop target to erase an old column
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:38:56 -08:00
Tomaz Canabrava
a96e0e1ec1 Fix moving columns
Qt has a very bad habit of getting the inner widget instead of the outer
one.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:38:50 -08:00
Tomaz Canabrava
6746b73d85 Remove data if it was correctly moved to the upper model
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:38:42 -08:00
Tomaz Canabrava
1ba08e2fec Make it possible to move from top to bottom
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:38:40 -08:00
Tomaz Canabrava
59fc5cecb7 Add the code to actually make it possible to move columns
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:38:38 -08:00
Tomaz Canabrava
fd41ff4ab9 Start to make it possible to move columns around
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:38:37 -08:00
Tomaz Canabrava
325f47c8d8 Add missing returns
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:38:35 -08:00