Commit graph

364 commits

Author SHA1 Message Date
Dirk Hohndel
f9ceff009b 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-18 21:25:59 +12:00
Dirk Hohndel
abddb3ecb9 Make Facebook support a config option
By default it is turned off, turn on by calling qmake with
CONFIG+=FBSUPPORT.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-17 08:43:49 +13:00
Robert C. Helling
f2939dd991 Minor PSCR fixes
Update O2 metabolsim rate and adopt default gas switch depths to
pSCR oxygen drop.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-17 08:17:29 +13:00
Dirk Hohndel
bccbdf8264 Don't use current_dc unless you know there's a current_dive
This will crash if for some reason current_dive is invalid.

And in general, when displaying information, we want to use the correct dc
in the displayed_dive, not the current_dc, which references the
current_dive...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-11 07:29:29 -08:00
Robert C. Helling
e219bc70f8 Refactor dctype -> divemode
... and repair a failed rebase (sorry).

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-10 17:27:25 -08:00
Robert C. Helling
bfe05b4340 Replot after changing divetype
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-10 17:27:24 -08:00
Robert C. Helling
0f7f2195d5 Add setpoint events according to divetype
When changing to a CCR dive, add a setpoint change to the default setpoint
at the beginning of the dive. Otherwise add an explicit setpoint change to 0
.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-10 17:27:24 -08:00
Robert C. Helling
a478eb5711 Maintab combobox to set dive type
still needs some work

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-10 17:27:24 -08:00
Miika Turkia
9e2e62ec4f Initialize edit hack variable
The accepting mode variable must be initialized to false to allow
editing of dive data.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-04 23:19:52 -08:00
Miika Turkia
fdd152af71 Make sure we do not fall back to edit mode on accept
On Ubuntu 14.04 the edit mode does not exit successfully when applying
the changes. It instead jumps back to edit mode (even though hiding the
option to apply/discard changes again). So let's just have a flag to
prevent faulty behavior.

Fixes #786

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-04 10:53:10 -08:00
Dirk Hohndel
71f3a29819 Trip editing: zero out potential previous edits
This was silly; if we rely on this to be zero to indicate no change then
we better zero it out when we start editing.

Fixes #805

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-04 06:43:36 -08:00
Dirk Hohndel
ccfea0872d When editing trip data, only copy actual changes
We zero out the displayedTrip and only copy changed data into it; so a
NULL value is not deleted text, it means there was no change.

Fixes #805

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-03 16:06:00 -08:00
Dirk Hohndel
57b49a7833 Fine tune some spacing
Now that we set the margins everywhere, the manual corrections here aren't
needed. At the same time, the spacing for the labels looks better if it is
a tiny bit more generous.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-02 22:24:50 -08:00
Tomaz Canabrava
ed903c42b9 Facebook integration: Always ask for a folder before sending the photo
This way we are sure that the upload was made in the correct folder.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-29 09:05:53 -08:00
Tomaz Canabrava
571f86485d Move the Facebook send profile button
Move from the Dive List context menu to the Dive Info tab, it will only
appear when connected to Facebook.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-29 09:05:08 -08:00
Dirk Hohndel
87febd33be Carefully create some forced margins
We don't want to waste space, but we don't want things to be too crammed
together, either. Especially not having horizontal margins for text can
look very awkward.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-23 10:16:11 -08:00
Tim Wootton
93d59c22d7 Match agreed captalisation style
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-25 07:57:33 -08:00
Dirk Hohndel
bf14d31804 Make the button labels for apply / cancel of edits more consistent
Before you could 'Cancel' the edit and then would be asked if you wanted
to 'Discard' your changes or 'Cancel'. So clicking 'Cancel' cancelled the
action of having clicked 'Cancel'. That's so confusing, it's even hard to
explain. Yes, it uses "typical" language for user interaction and kind of
makes sense, but it's not easy to understand for the non-technical user.

With the new labels the user is asked to whether they want to 'Apply' the
changes or 'Discard' them. And when they choose 'Discard' the verification
question is still 'Discard' or 'Cancel'. That seems much more consistent.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-23 07:45:17 -08:00
Dirk Hohndel
3ddbab6847 Clarify the meaning of the values in the stats tab
Extend the tooltips to be shown both on the labels and the values and add
tooltips for all min/avg/max elements.

To avoid confusion when only one dive is selected, no longer show min SAC
or max SAC or min duration or max duration.

Fixes #694

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-17 18:44:51 +00:00
Dirk Hohndel
0c3f13d128 Add the ability to modify the cylinder use in the UI
Thanks to Tomaz for writing a first draft of the delegate.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-17 14:03:37 +00:00
Dirk Hohndel
44a154f7da When editing cylinders, copy all relevant data
Maybe it would be better to just copy the whole structure and then clear
the things we don't want to copy? This seems fragile.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-17 10:45:14 +00:00
Dirk Hohndel
7196176fa0 Correctly copy weight systems on edit
We copied the string pointers instead of copying the strings. Once those
got freed, things went downhill.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-17 10:41:02 +00:00
Tomaz Canabrava
82a946152b 727 fixed
--047d7b8737f87ede8e050803e6b2
Content-Type: text/plain; charset=UTF-8

<div dir="ltr"><br></div>

From 3db4a422485374801ca2f6233ec23b8671a8656d Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabrava@intel.com>
Date: Sun, 16 Nov 2014 23:22:58 -0200
Subject: [PATCH] fix 727 - position correctly the popup.

When the user entered a tag and that made the message box display
the popup with the possible choices was still in the old position
hidding the line edit.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-17 06:02:21 +00:00
Lubomir I. Ivanov
200699706e maintab.cpp: use copy_string() instead of strdup()
The .location and .notes fields can end up being NULL,
in which case copy_string() is safer.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-11 11:59:35 -08:00
Anton Lundin
0b0e5d834f Reorder initializers to be more c++-strict
c++ have some idea about in what order things should be initialized.
This makes us comply with that order.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-08 11:17:11 -08:00
Dirk Hohndel
45251ec724 Show extra data in separate tab on MainTab
This way any extra data probided by the dive computer is visible to the
user (without other processing). This data cannot be edited by the user as
it reflects the information given by the dive computer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-07 13:00:58 -08:00
Dirk Hohndel
d643bde61a Always copy data in copy and paste mode
While in a multi dive edit we want to apply our usual semantics (only edit
things that are the same as in the current dive), when doing an explicit
copy and paste that doesn't seem to make sense. So we manually override
that behavior.

Fixes #753

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-05 07:13:20 -08:00
Dirk Hohndel
c9e7528370 Change tank editing behavior for multi dive edit
Previously we only applied the type of tank (description, volume, working
pressure) to all selected dives where the tank description matched.

With this patch we also copy the gas mix into all matching cylinders.

Additionally this addresses the issue that we should have a separate copy
of the cylinder description string for each dive.

Fixes #754

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-04 15:05:16 -08:00
Dirk Hohndel
dfc7ee0b29 Delay replot of dive so changes aren't overwritten too early
When changing tanks we triggered a replot - but that overwrote the
displayed_dive with the current_dive before the remaining data from the
displayed_dive was used to edit the current_dive.

So now we delay this until later in the function, this way copy of paste
of both tanks and weights works.

Fixes #753

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-03 09:47:24 -08:00
Dirk Hohndel
6ce0afb99c Don't call strdup on NULL by mistake
Hunting down a different issue I managed to cause a crash here when trying
to copy a string that ended up being NULL.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-01 22:36:42 -07:00
Dirk Hohndel
fa5c713f73 After editing tags, get the right tags into the displayed dive
We forgot to clear out the pre-existing tags. We did this for the actual
selected dives that were being edited, but not for the displayed_dive, so
deleted tags showed up again on screen (even though they were correctly
deleted from the selected dives in the dive list).

Fixes #732

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-30 13:03:50 -07:00
Dirk Hohndel
71d21c375c Recalculate the decompression if the date / time of a dive changes
The pre-existing tissue load going into a dive can change if the start
time of a dive changes. Therefore we need to recalculate the ceiling when
editing start time (or date) of a dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-20 17:40:11 -07:00
Dirk Hohndel
e1db94ea0c Correctly edit dive date/time when editing manually entered dives
While the existing code worked fine for editing that start date or time of
dives downloaded from a dive computer or imported from some other source,
for manually entered dives this did not work and the date or time was
always reset to the original time once the changes were saved.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-20 17:34:53 -07:00
Gaetan Bisson
ae6b0468b1 Report CNS in dive info tab
This adds a maxcnsText widget under infoTab and populates it.

Note that I manually edited maintab.ui to display CNS and OTU
next to each other and right after gas data.

Signed-off-by: Gaetan Bisson <bisson@archlinux.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-18 06:16:44 -07:00
Tomaz Canabrava
214bd0ed6e Re-enable the edition of the Date after editing a trip.
Since we can't edit the trip date, we need to remember to
re-enable it after we disable it.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-23 08:10:47 -07:00
Dirk Hohndel
4a04fc2a1b Fix selection logic when manually adding a dive
This was an interesting bug. When adding a dive that would end up in the
middle of the dive list, the newest dive in the dive list would end up
marked in the dive structure as selected - even though it wasn't
visualized as selected by Qt. Bad things happen if the user then made
changes to that dive without selecting something else first, for example
by either editing the dive or doing things to it like removing it from or
adding it to a trip. The same operation would also be applied to the
newest dive in the dive list.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-21 17:58:15 -07:00
Dirk Hohndel
0f1381f160 Planner: assign a dive number if the right number seems obvious
Use the same logic as we do for newly added dives.
As a side effect this patch appears to fix the issues with getting the
newly planned dive selected.

Fixes #692

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-18 14:12:05 -05:00
Dirk Hohndel
29f50c6aee Cut'n'paste for dive data: implement paste side
This should correctly set all the values and puts us in edit mode.
Testing so far looks good for both single dive and multiple dives selected
(i.e., you can paste into multiple dives).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-17 11:58:11 -06:00
Dirk Hohndel
c58d136d33 Dive edit: allow the user to explicitly clear a GPS location
If the GPS coordinates for a dive were incorrect for some reason and the
user wanted to clear them in order to then re-download / apply GPS
information from the Subsurface webservice, prior to this patch we would
always match the location name and re-populate the GPS coordinates, making
it impossible to clear a GPS location without also changing the location
name.

This patch fixes this - but if you have multiple dives with the incorrect
name / GPS location pair, the next edit to a dive that had the GPS
coordinates cleared will re-populate the GPS coordinates (at that point
Subsurface can no longer tell that this was intentional).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-16 07:09:11 -06:00
Dirk Hohndel
ee77398eb8 Reload the dive list after accepting changes
So far we only did it when we added a dive or modified a manually added
dive. But the reality is that an edit of any dive could cause changes that
require the dive list to be reloaded.

Fixes #698

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-07 10:23:08 -07:00
Tomaz Canabrava
68af9f0afb Delete pictures from the Widget by pressing delete
Select the picture, press delete, profit.

[Dirk Hohndel: removed the stray hunk that snuck into this patch]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-06 18:32:28 -07:00
Linus Torvalds
3aaf8b1f5a Make gas use statistics be coherent and more complete
The gas use logic in the dive statistics page is confused.

The SAC case had a special case for "unknown", but only for
the first gas. Other gases had the normal empty case.

Also, the logic was really odd - if you had gases that weren't used (or
pressures not known) intermixed with gases you *did* have pressure for,
the statistics got really confused.

The list of gases showed all gases that we know about during the dive,
but then the gas use and SAC-rate lists wouldn't necessarily match,
because the loops that computed those stopped after the first gas that
didn't have any pressure change.

To make things worse, the first cylinder was special-cased again, so it
all lined up for the single-cylinder case.

This makes all the cylinders act the same way, leaving unknown gas use
(and thus SAC) just empty for that gas.

It also fixes the SAC calculation case where we don't have real samples,
and the profile is a fake profile - possibly with gas changes in between
the fake points. We now make the SAC calculations match what we show -
which is admittedly not at all necessarily what the dive was, but at
least we're consistent.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-06 09:14:34 -07:00
Dirk Hohndel
74e7b8e879 Don't show a SAC of 0.0l/min (or cuft/min)
When we have no data about the gas consumption it makes no sense to show a
SAC of 0. Instead we should show either "unknown" or nothing.

Fixes #693

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-06 07:39:19 -07:00
Tomaz Canabrava
f9d38100c4 Hide Depth Column
We were showing everything, always.

Fixes #639

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-05 14:42:56 -07:00
Dirk Hohndel
78fee70450 Correctly remove the Close button from most message widgets
The only time we want the close button is when showing an error at the
bottom of the main window.

In the other cases (maintab, globe) we need to explicitly hide it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-04 22:45:17 -07:00
Tomaz Canabrava
e95fa6c6dc Disable the Toolbox when in edit mode.
Some of the toolbox icons will trigger a recalculation of the dive,
triggering then a replot, that will copy the dive to the displayed_dive
again, but in the case of a edit this would discard the edition (
that would still be shown on the UI ) leaving the dive in an
unconsistent state.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-04 09:48:35 -07:00
Robert C. Helling
1508f95775 Update pictures when entering/exiting planner
This fixes the problem I pointed out im my comment to #667 and hopefully also
the original problem although I cannot confirm since i cannot reproduce the
problem in the first place.

See #677

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-02 15:13:51 -07:00
Dirk Hohndel
13d922aef7 Keep edited profile after editing a manually added dive
This is yet another unintended side effect of the UI restructure changes.
I stared at this code for so long - I can't believe I kept missing this.

Fixes #668

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-31 14:41:30 -07:00
Dirk Hohndel
1a978a0345 Maintab: fix trip location / notes editing
Reusing the displayed_dive for this caused all kind of odd problems that
were hard to reproduce, because the behavior depended on what was in the
corresponding fields of the current_dive. Worse: the GPS location handling
prevented us from reliably removing the location of a trip.

The solution isn't ideal and certainly isn't elegant. Maybe we simply
shouldn't reuse the widget here. But I think what I have now works - I
tried hard to make it break again and couldn't.

Fixes #659

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-30 08:52:11 -07:00
Dirk Hohndel
d262886a2d Fix time zone conversions
I know I tested this - no idea how I missed this.
Anyway, this was of course utterly bogus. Whenever we get a time from a
time_t into a Qt Date or Time datastructure, we need to adjust it by the
timezone offset as otherwise Qt will assume it's in local time and
helpfully change it to the wrong values for us.

See #655

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29 13:01:46 -07:00