Commit graph

5575 commits

Author SHA1 Message Date
Dirk Hohndel
a8a8bcd86a Add helper functions to ensure we have sane tag lists
There should never be empty or duplicate tags on those lists.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 09:42:28 -07:00
Dirk Hohndel
634df1a337 Tags can never include a comma
And no, I don't want "\," to be legal in our tag, either. Way too much
pain for way too little gain.

Fixes #560

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 09:25:49 -07:00
Miika Turkia
38403f6c98 Fix exporting all dives in Subsurface format
Exporting in Subsurface format saved only selected dives even if user
attempted to save all dives.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 08:15:48 -07:00
Joakim Bygdell
ac2bcc8e16 Place holder icon for network prefs
Until we can get a proper one.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 07:44:39 -07:00
Anton Lundin
c7df6df8cd Fix bug in Seabear Quirks
By mistake i used memcpy to "fix" the samples, but the sample list was
overlapping so i needed to use memmove.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 07:39:20 -07:00
Anton Lundin
2ff2daebd7 Move drop_stone_mode setting to prefs
There is no reason to treat drop_stone_mode different from the rest of
the planner settings, so move it to our prefs structure.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 14:40:36 -07:00
Anton Lundin
f940ebcf74 Add quirk for Seabear CSV settings
The Seabear software stores its settings as two csv-rows in the same
file as its samples. These settings got read as two bogus samples in the
beginning of the dive.

This kills those off and repairs the temperature damage they done.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 14:22:48 -07:00
Lubomir I. Ivanov
c1d63f32d6 Print: make the profile table font size 7px
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 13:48:16 -07:00
Anton Lundin
ffb441aa84 Add quirk for Seabear CSV NDL/TTS in minutes
In the Seabear CSV the NDL and TTS fields are in minutes, not seconds as
their time field. This is an ugly quirk but it gets the job done.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 13:22:06 -07:00
Anton Lundin
6cd0928487 Add support for importing TTS from CSV files
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 13:22:00 -07:00
Anton Lundin
d5991800ee Add support for importing NDL from CSV files
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 13:22:00 -07:00
Anton Lundin
848a5352c7 Add support divecomputer based TTS
Since earlier have we had support for our own calculated TTS. This adds
support for holding TTS values reported by a dive computer.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 13:22:00 -07:00
Anton Lundin
72aeb53e19 Align CSVUnits with the other QComboBoxes
The CSVUnits QComboBox wasn't in a layout and that made it look a bit
weird. This adds a layout around it.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 13:19:09 -07:00
Anton Lundin
b1d7ba9f63 Initial stab at Seabear CSV imports
This adds a preconfigured import setting for Seabear CSV files.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 13:18:58 -07:00
Dirk Hohndel
76a8e83a54 Printing: scale fonts when printing
This seem to work better, but it misses a couple of items at times (for
example the highest label on some of the axis).

Needs lots more testing.

See #590

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 13:12:29 -07:00
Dirk Hohndel
2d77788cb2 Printing: force redrawing of the profile
If the first dive we end up rendering is the dive currently shown, the
info overlay would end up being printed which looks really silly.

See #590

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 11:19:08 -07:00
Dirk Hohndel
99859d9a07 Updated the transation files
Authors are tracked at transifex

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 10:47:50 -07:00
Dirk Hohndel
d818dc1a84 Remove HTML from translated strings
In some strings that won't be possible as the translation needs to be
aware of line breaks, etc. But for these strings it seems like the right
thing to do.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 10:34:51 -07:00
Dirk Hohndel
dae02d5fd2 Translations: force UTF-8 encoding
This seems to fix transifex issues with strings containing ₂ (subscript 2)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 10:06:00 -07:00
Gaetan Bisson
35121e1147 Complete GPS coordinates on location focusout.
Introduce on_location_editingFinished() and move the GPS coordinates
completion logic there. This simplifies acceptChanges(), but replaces
the clever code for multidive completion by something a little more
straightforward.

Note the call to on_location_editingFinished() from acceptChanges();
without it, completion only happens *after* the dive has been saved.

[Dirk Hohndel: trivial merge, minor changes for consistency]

Signed-off-by: Gaetan Bisson <bisson@archlinux.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 09:40:44 -07:00
Anton Lundin
a2f47485d4 Don't try to set a layout on PlannerSettingsWidget
It already got one from its ui-file, and this causes a warning when
starting the application.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 08:55:12 -07:00
Salvador Cuñat
8066334070 Translation update as of 29f19c37b0.
Updates translation and correct some typpos.
Includes Planner, Photographs and HTML export.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 08:55:12 -07:00
Robert C. Helling
b509eeda1d Refresh display after toggling backgas breaks.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 08:55:12 -07:00
Tomaz Canabrava
6480a91756 Put a copy of the tags in the displayed dive upon save.
I don't think this is the right approach, but it makes things work. The
reason that it was not working before it's because upon save we are not
copying the edited dive against the displayed dive for some reason, and I
didn't find the place that should deal with that.

This fixes one of the various issues around tags, but others remain.

Fixes #587

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 08:53:06 -07:00
Tomaz Canabrava
dbc33cb81a Correctly save the tags on the dive.
Very good patch, lots of removed lines. :)
Only try to add the tags when user accepts, discards the
test to see if the tags were changed or not, delete the
old list and copy the new one always.

only bug that's appearing now: taglist is still empty after save
we need to reselect the dive to make it appear, fixing that
on the next patch.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 08:34:00 -07:00
Tomaz Canabrava
0054304cc8 Remove if to save or not save the tags.
The way that we work with tags is a bit weird, we have a global
tag_list pointer and every dive copy the tags from there. the problem
is that the tags_changed() function looks at those two places ( the
global and the dive-local lists ) to see if something was changed,
but we shouldn't add anything at the global taglist untill a tag
is really added, so that function is bogus.

The correct way to check if something changed is to check all the
strings in tags against the strings in the QLineEdit and see if they
are the same, then we can add things to the tag_list.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 08:33:21 -07:00
Robert C. Helling
954d401483 Considering previous dives for tissue loading
This (hopefully) gets the logic to find dives in the previous 48h for
tissue pre-loading right. In particular it handles the case of a planned
dive which has a number of -1.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-08 13:01:34 -07:00
Dirk Hohndel
c7e8042fbd Picture handling: make sure pictures are shown after they were added
We need to first replot() to get displayed_dive updated, then call
refreshDisplay() so the picture model gets repopulated which triggers the
pictures to show up.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-08 12:55:54 -07:00
Dirk Hohndel
15720837d3 replot() needs to really force a replot
So let's set forceReplot to true to make sure that happens.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-08 12:34:26 -07:00
Dirk Hohndel
f297d9f91e Fix picture loading
Signed vs unsigned comparisons are such a pain. Since we want offsets to
be +/- 30 minutes around the dive we need to allow negative offsets - but
duration_t was defined as uint32_t.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-08 12:29:06 -07:00
Gaetan Bisson
c054b18b70 make GPS coordinates autofilling really work
Move the gpsHasChanged() call on selected dive when coordinates have
changed *before* autofilling, otherwise it erases the autofilled values.

Also update displayed_dive when autofilling, otherwise values are stored
but not displayed immediately after saving.

Signed-off-by: Gaetan Bisson <bisson@archlinux.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-08 10:02:17 -07:00
Robert C. Helling
f79c659b10 Planner: Show gas consumption in pressure units as well and warn if not enough reserve.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-07 13:59:52 -07:00
Robert C. Helling
a7969d1083 Planner: don't allow negative depths
This patch allows only non-negative depths in the divepoints table as
negative depths confuse the planenr/deco algortihm. The spinbox appearing
in the table should get a setMinimum(0) but I was not able to find the
correct way to implement that.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-07 09:18:07 -07:00
Dirk Hohndel
3d511fe26b UI restructure: remove the backupDive we no longer need
Since we have a dedicated dive that we use to display things, we can
simply get the information from the current dive and use it to setup said
displayed_dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-06 12:56:37 -07:00
Dirk Hohndel
cd5b2a372f UI restructure: cleanup the code when canceling an edit
This was way too complicated because we used to edit a "live" dive that
was on the dive list. All we really need to do is systematically make
sure that all the widgets are in the correct state.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-06 12:50:30 -07:00
Dirk Hohndel
d97c49ba39 When copying dives, make copies of samples/events in first DC
We carefully copied the dive computers and their samples and events, but
only for the second and later DCs. For the first DC we simply copied the
pointers but not what they were pointing at. So when the copied dive was
freed, those pointers in the original went to freed memory.

Not good.

Fixes #599

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-06 11:23:25 -07:00
Miika Turkia
0c24d7d6bd Show the gas mixing information only when needed
Recreational divers, especially ones diving with air, do not need to be
shown that their gas can be mixed with 0 liters of O2 and He. And
similarly Nitrox diver does not need to know about 0 liters of He.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-05 22:55:52 -07:00
Dirk Hohndel
9d97426e8e Planner: reset deco gas used member
Otherwise every recalculation will continue to incorrectly increase the
deco gas used value.

Fixes #598

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-05 07:49:06 -07:00
Robert C. Helling
b0da8c2707 When adding a waypoint, use the gasmix of the _next_ waypoint.
This corrects the logic of adding a waypoint actually meaning that
a previous segment is subdivided into two. Both new segments should
by default use the gas of the old one. Since the gas is stored
in the waypoint (divedatapoint) at the end, we need to use the _next_
gas.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-05 07:43:41 -07:00
Robert C. Helling
79cd5ce835 Remove gasmix_is_null
The semantic of fo2==fhe==0 to mean "same gasmix as before" apparently
is not used anywhere and gets in the way of the semantic "this is air".

If there is really need for mix meaning "same as before", please use another
value, e.g. one with a specific negative percentage.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-05 07:43:10 -07:00
Dirk Hohndel
aafd918169 Add dive: don't throw away the pressure data entered
Previously we were trying to get rid of the tracked gas pressures that
were added when using the plan infrastructure to create a dive. Now that
this isn't the case anymore we can stop doing that which magically makes
setting start and end pressure while adding a dive work as expected.

Fixes #582
Fixes #553

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-04 11:48:02 -07:00
Dirk Hohndel
cc86d68c86 Planner: don't set cylinder start and end pressure when adding dive
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-04 11:40:02 -07:00
Dirk Hohndel
d4e3745370 Planner: only track gas when planning a dive
When adding a dive we don't have SAC data so we should simply have the
user manually enter their gas consumption. That still doesn't work, but
this is one required step to get it to work.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-04 11:26:31 -07:00
Dirk Hohndel
75c9bcd726 Don't add a close button to KMessageWidget
Commit 77a55db9d3 ("Use QDialogButtonBox in KMessageWidget") added a
close button to all our uses of that widget.

As much as I stare at the code I can't figure out why. For now I'll simply
brute-force disable them...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-04 07:46:35 -07:00
Anton Lundin
77a55db9d3 Use QDialogButtonBox in KMessageWidget
QDialogButtonBox can auto-choose the order of the actions based on the
current interfaces guidelines, but in this case its a guessing game.

It does a half-decent job off guessing.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-04 07:33:08 -07:00
Anton Lundin
c16d4ca5d5 Make planner buttons consistent with Maintab
Move the Save/Abort buttons in the planner to the top left and change
them to Save/Cancel to be consistent with where our Save/Cancel
buttons are in the Maintab.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-04 07:28:41 -07:00
Dirk Hohndel
3c4439ee27 UI restructure: simplify setup of add and plan mode
Recreate the helper function (which now does something fairly different)
to share the common code between the two modes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-04 07:24:52 -07:00
Dirk Hohndel
0cfea5205d UI restructure: correctly setup planning
I had tested this mostly with add dive and completely forgot to track the
same changes in the planning routine. Oops.

This allowed to get rid of a no longer useful helper as well.

Fixes #594

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-04 06:53:33 -07:00
Dirk Hohndel
9b4bd80e84 UI restructure
Don't clear out the model after we already set up the cylinders.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-04 06:52:50 -07:00
Dirk Hohndel
c728b4b7bb Remove unused label
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-04 06:39:38 -07:00