Commit graph

203 commits

Author SHA1 Message Date
Dirk Hohndel
1752257fbb Correctly restore the column sizes in the dive list
Ordering here is important - we can't resize the columns before they are
created. On the other hand this now means that we explicitly need to
expand to the first dive shown.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-21 18:29:23 -07:00
Dirk Hohndel
ace8b4f2ea Merge branch 'microFixes' of https://github.com/tcanabrava/subsurface 2013-05-21 13:24:32 -07:00
Tomaz Canabrava
37ada91000 Added code for handling of show / hide of columns.
The code also remembers to save in the config file.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-21 16:51:49 -03:00
Dirk Hohndel
3009930aee Correctly format the values shown for cylinders and weights
Make use of all the nice helpers that we have...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-21 12:03:05 -07:00
Dirk Hohndel
19586081ed Correctly use the weightsystem_none / cylinder_none helpers
Plus a couple of minor formatting changes

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-21 11:29:21 -07:00
Tomaz Canabrava
e7b84233af Fixed memory leak
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-21 10:07:41 -03:00
Tomaz Canabrava
be31a53b0d Added support for visualization the Weigthssystems on the Equipment Tab.
This patch adds support showing and  for editing weigthsystems in the equipment tab,

so, now the two things that are missing are 'edit' and 'delete', wich are quite easy to do.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-21 09:59:41 -03:00
Tomaz Canabrava
126bc8cfa3 Added the code to show the cylinders from a dive.
i
Added the code to show the cylinders from a dive,
this code also already permits additions from the
interface, so the user can click 'add' and insert
what he wants there.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-21 09:33:55 -03:00
Dirk Hohndel
246fbd0333 Implement rudimentary divecomputer download
Small changes to the names of elements the divecomputer download UI and
very simplistic first stab at populating the device_data_t structure.

This is lacking lots of things
- it should remember the last vendor / product used
- it should figure out which device (mount point) to offer
- it needs proper error handling

But it's a step in the right direction.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-20 21:55:56 -07:00
Tomaz Canabrava
f4acbb02e4 Populate the Vendor && Dive computer information.
This uses the QStringListModel to populate the items
of the QComboBoxes. I used a QHash to hold every Computer
of a particular Vendor. so, products[vendor] gives me
the full list of products from each vendor.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-20 17:58:06 -03:00
Tomaz Canabrava
a542b25bde Added code to cancel the thread.
I think it's self explanatory - When user clicks on
'Cancel', the interface will wait for the trhead to quit
then will close itself.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-20 17:02:17 -03:00
Tomaz Canabrava
c7a5d0490f Skeleton code for a non-blocking UI thread for downloading dives from the DC
This is the skeleton code for a non-blocking ui-thread
It already creates the first-thread ( 'do not block the ui' )
and the second thread ('download from the dive computer')
We can in the future merge both in the same place - I didn't
want to do that now because the download function is written
in the libdivecomputer.c code, and I cant just transform that
to a QThread and use signals, so I used two threads for that.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-20 16:43:33 -03:00
Dirk Hohndel
0d370ba108 Integrate visibility Star widget into editing flow
This also removes some incorrect code from the clear() function for the
DiveInfo tab. Putting the readOnly() calls for the DiveNotes tab there was
wrong.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-20 06:25:16 -07:00
Dirk Hohndel
f548195761 Move visibility Star widget to the DiveNotes tab
This looks much better and seems much more contextual.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-20 06:15:30 -07:00
Dirk Hohndel
11a6b18690 Display the statistics
This would be correct if the current selection code wasn't broken. Right
now we only add to our internal notion of what is selected - we never
deselect anything.

Once that is fixed, thestatistics should be correctly displayed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 22:48:31 -07:00
Dirk Hohndel
e818f0352b Try to add a StarWidget for visibility
It's not editable. And of course it continues to look like utter crap -
even more so now since this is left aligned and everything else is
centered.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 21:44:21 -07:00
Dirk Hohndel
1d10289796 Close needs to clear the Globe and the DiveNotes
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 20:47:10 -07:00
Dirk Hohndel
adc7654816 When no dive is displayed, the DiveNotes field should not be editable
This also fixes a potential crash if no dives were loaded and the user
started editing the fields and clicked OK.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 17:38:20 -07:00
Dirk Hohndel
f67d3d4bbc Replace glib file/directory handling with equivalent Qt code
I hope this is indeed equivalent...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 17:18:44 -07:00
Dirk Hohndel
25b8092c03 Implenent file_save and file_save_as
This allows us to do the right thing at exit (and also connects to more of
the menu actions to actually do something).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 15:29:54 -07:00
Dirk Hohndel
af2354c1f3 Show the correct question at exit when there are unsaved changes
We want to give the user the option to 'cancel' and not exit the program,
to 'save' the file, or to say I'm 'OK' with losing the unsaved data.

This does NOT implement the actual save / save-as, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 14:48:25 -07:00
Dirk Hohndel
920a2069b0 Figure out if the user changed anything when editing
And mark the divelist changed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 14:13:04 -07:00
Dirk Hohndel
9ffa37ab6f Rename buttons for dive edit
The old names made sense in the initial model (where you'd click on the
edit button to start an edit). The new names seem much more natural given
what we do now.

Also a tiny code cleanup removing a redundant if statement.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 12:59:36 -07:00
Dirk Hohndel
a4f243dfac Make direct edit the style of choice
Plus minor coding style fixes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 09:00:57 -07:00
Dirk Hohndel
9b1a3e09d1 Fix edit behavior
Commit 7b00668b400b ("Improve the Dirk edit mode.") had what looks like an
"autocomplete" typo. This also stops us from changing the text on the
button that in this edit mode is always just the "OK" button.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 08:42:58 -07:00
Dirk Hohndel
ae05498d94 Merge branch 'chooseEditMode' of https://github.com/tcanabrava/subsurface 2013-05-19 08:09:48 -07:00
Dirk Hohndel
1298aa87e5 Continue populating the DiveInfo tab
Pulled one more helper from statistics-gtk.c (but didn't modify the code
there to use it as that code is no longer being compiled).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 08:08:29 -07:00
Tomaz Canabrava
55b998d528 Improve the Dirk edit mode.
The dirk edit mode will be triggered as soon as the user
clicks on the field that he wants to edit. then he can
edit all fields, till he press ok / reset.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-19 11:45:01 -03:00
Tomaz Canabrava
206a148e07 Made possible to choose the edit style on compile time
This is just a for choosing the default edit style in the
future.  I prefer the new edit style as the user is sure
what the hell is going on ( ie - if he chooses to edit,
he is editing, there's a message warning him that he is
editing and everything else is blocked till he finishes
editing. ) and the GTK version is 'edit whenever I feel like',
wich I think is more unsafe but dirk asked me to put an option
and let the others choose.
e

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-19 11:19:57 -03:00
Tomaz Canabrava
0cb9b9ccfb Removed unused GTK calls onto the Qt version
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 07:19:20 -07:00
Tomaz Canabrava
d853e9bcff Make the Text on the DiveList be 30% smaller than other text
This makes the DiveList be similiar to the GTK one, comparing
the size of the text. The current code makes text on the
table be 30% smaller.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-19 10:46:49 -03:00
Dirk Hohndel
ba30d070c9 While editing the left button is renamed to "OK" to accept the changes
This seemed more logical than keeping it as "edit" and basically having to
hit "edit" a second time in order to save a change.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-18 21:33:04 -07:00
Tomaz Canabrava
046eacabe5 Make impossible to change dives while editing one.
This is to prevent loss of data, so if the user is editing something,
either cancel the edition or save it, to continue moving around on
the Dive List.  - Only the dive list is affected, user can still
play with the globe and the profile.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-18 21:30:54 -07:00
Tomaz Canabrava
c5e7a025e4 Added option to edit the selected dive.
Added option to edit the selected dive.
Now the user can click on 'Edit', and a nice box will
appear stating that the dive is in edit mode, and the user
can edit all of the 'Notes' tab fields, including the
rating. When the edition is finished, the user needs to
click on 'edit' again to mark as accepted, or in
reset to reset the fields to it's original state

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-18 17:06:48 -07:00
Dirk Hohndel
de50f66257 Work around broken Marble on Debian
This is a major hack. Debian appears to be missing a necessary header file
for Marble to work correctly. We include this header file for now and hack
the Configure process to recognize that we are on Debian and force using
our local copy of the header file in that case.

This may be needed on Ubuntu as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-18 09:49:37 -07:00
Dirk Hohndel
b9f0bc84c2 Compile fix
Forgot to add this before pushing the previous commits

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-17 22:27:50 -07:00
Tomaz Canabrava
cffc66f45a Don't add a dive on the globe twice ( well, actually, different dives with same location )
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17 22:56:21 -03:00
Tomaz Canabrava
7509360173 Prettification of the map view.
Just some prettifications, better defaults, etc.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17 22:52:04 -03:00
Tomaz Canabrava
86021b24d9 Borrowed the KMessageWidget code to better show passive information.
Borrowed the code from KMessageWidget from Aurelian Gateau, Kdelibs,
to better show passive information and notifications. instead of a
popup blowing in the user's face, a nice, animated and well designed
widget will gracefully fade-in, show the notes, and fade out when
not needed anymore.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17 21:58:49 -03:00
Tomaz Canabrava
56dbb7c2ff Added the possibility to change the coordinates of a dive.
Added the possibility to change the coordinates of a dive.
it's too intrusive in the moment, but it was a proof
of concept. so I'll commit as is and try to find a better
way to warn the user what's going on in the future, using
something less terrible than a popup exploding in his face.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17 16:12:55 -03:00
Tomaz Canabrava
b89265c7f0 Adds rotation while selecting a dive.
This adds rotation, a very, very shinny feature.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17 14:09:10 -03:00
Tomaz Canabrava
3a1a4c1874 removed whitespace.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17 13:30:47 -03:00
Tomaz Canabrava
9038b3aa6e Added real support for the marble widget
The marble widget now shows the dive locations
and also will center on the dive that the user clicked
in the dive list.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17 13:28:02 -03:00
Tomaz Canabrava
4098922b55 Adds preliminary support for Marble Widget
Adds preliminary support for marble widget, alongside with the
dive list. my idea is to let the view stay there at the left of the
dive list since we got a lot of unused space and a globe is something
nice to have - so you can look around where did you dived, the
dives near the one that's currectly selected, and so on.

I'm not using OpenStreetMaps right now, but a good thing about
marble is that it is skinnable - so for instance, a dive school
could present a dive lesson using subsurface with a globe from the
1600, to make it feel like 'history'.

This version will only compile to Qt4.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17 08:14:10 -03:00
Tomaz Canabrava
2f35c94026 Fix loading a dive via command line.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-16 21:25:31 -03:00
Thiago Macieira
3024b2b83c Don't deleteLater a null pointer
When the application launches, the oldModel is null.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-16 14:13:22 -07:00
Tomaz Canabrava
d39b1aedcd Fix loading a second dive, after the first file was loaded.
This patch fixes loading a second dive-file after the first
one had been loaded. it simply clears some information and
makes sure that the current selected dive is invalid when
the file closes. I also did a bit of code cleanup on this one
to make things simpler in the future.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-16 12:23:38 -07:00
Tomaz Canabrava
e3cb36498d Fixed the loading of some maps
On some maps, the lack of setting up the dc before plotting
the dive-computer nick caused a division by zero, breaking
the correct visualization of the dive.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-16 15:43:38 -03:00
Tomaz Canabrava
30297ebd4b Correctly set the unselected dive.
The selected dive was being set to zero when the program
started, but zero is actually the first dive. There
were workarounds on the gtk code for that probably

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-16 15:42:20 -03:00
Henrik Brautaset Aronsen
a55a2e5d88 Don't add half a kilo/pound when adding weights
The weight management widget added 500 grams / 0.5 lbs
when a new entry was added.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-14 09:26:45 -04:00