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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
When the application launches, the oldModel is null.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
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>
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>
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>
A nonexisting temperature (mkelvin==0) was displayed as -273°C.
Weight was always displayed with an extra 500 grams/0.5 lbs.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Cosmetic commit to clean up some of the annoying typos in qt-ui
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
And rip out all the code that Dirk put there to do that.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Figure out what is our first selected element (in case we start out from a
multiple selection) and then move to the next logical element. So the code
traverses an expanded tree (from a trip 'down' to its first dive or 'up'
to the last dive of the previous trip - and similar from a first dive in a
trip 'up' to its trip and from a last dive in a trip 'down' to the next
trip.
This does not take 'shift-cursor-up/down' into account (i.e. manual
selection extension). Instead with just cursor up and down a single dive
(or single trip) is selected.
My guess is that the code will make someone's eyes bleed. Be warned.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If a user clicks on a trip, all the dives in a trip should be selected.
But if a user selects a range of dives that happens to have a trip header
in it, then only the range of dives should be selected (the trip header is
marked as 'selected' for visual consistency, even though not all dives in
this trip are selected).
This also changes the code to scrollTo the first selected dive instead of
just expanding the parent. This seems to give us a more pleasant visual
appearance (trying to keep the selected dive centered in the dive list)
and as a side effect no longer hides the first dive trip at program start
(before this change the first dive in the first trip would be the top
entry in the dive list, with its trip just out of sight above).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
That threshold is of course ridiculous and arbitrary - but it seems like a
good assumption to make that anything below that is DEFINITELY not valid
data.
Because of the way the scene grows automatically in Qt, printing these
texts would squish the profile into one thin line.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The string we print is lame, but it keeps things consistent (and prevents
us from dereferencing functions in uninitialized objects).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
A left click in the treeview header leads to a call to createIndex which
results in a null pointer dereference.
Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Align statistics tab labels as per infotab.
Amend helper function to show degree symbol for temp measurements.
Change order of member initialisation list to match order of decl
(ProfileGraphicsView::ProfileGraphicsView)
Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>