Commit graph

3445 commits

Author SHA1 Message Date
Tomaz Canabrava
0f85243cf3 Fixes the correct sizes of the tables when first open.
This patch fixes the correct sizes of the tables when first opened. It was
defaulting to 'resizeToContents', but most of the cases when first opened
we got no content, and this was bad. Now I'm defaulting to 30 when on the
'REMOVE' column and 80 on other columns.

Fixes #189

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-22 07:32:53 -08:00
Anton Lundin
891892cde4 Cleanup and bugfix gaschange event printing
When a gaschange to air happened, the code did
name += name=+ tr("air") which probably was due to the block being just
confusing with all the ?:
Unrolls to proper if statements, and fixes the bug.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 15:54:34 -08:00
Anton Lundin
26656310ab Add optional support for stopdepth import from csv
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 15:54:28 -08:00
Anton Lundin
5eccd73a30 Add optional support for cns import from csv files
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 15:54:21 -08:00
Anton Lundin
8dde12fa35 Add optional support for po2 import from csv files
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 15:54:16 -08:00
Anton Lundin
907a22f37e Simplify params numbering in parse_csv_file
When we add more fields, we don't need to renumber the whole thing.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 15:54:10 -08:00
Anton Lundin
8e60f3bb44 Give room for more options in csv dialog
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 15:54:00 -08:00
Anton Lundin
cf06f78892 Make temperature optional in csv import
This adds a checkbox to be able to import csv files without temperature.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 15:53:54 -08:00
Anton Lundin
1a0adea0cc Rework csvimportdialog to make room for features
This rewires things a bit to make room for new features coming.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 15:53:49 -08:00
Dirk Hohndel
d4563e54a9 Try to get Windwos to find the plugins
This way the application path (i.e., install directory) will be searched
for plugin DLLs.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 15:51:41 -08:00
Dirk Hohndel
60a5d1d070 Fix a couple of warnings
Removing unused variables.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 15:50:56 -08:00
Patrick Valsecchi
fe2eabf375 Added a configuration option to have gf_low apply at max depth instead of at deepest ceiling.
Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 08:11:40 -08:00
Patrick Valsecchi
4c4a7a6d96 Refactoring of the configuration handling.
Before, when clicking the OK button on the preferences GUI, we were
updating in-memory preferences from the GUI, saving them to the
configuration file from the GUI, reloading from the file to the
in-memory preferences. Then, to add to the ducplication, when the
application was exiting, some fields were saved again.
Basically the first step and the last step were useless appart from
the fact the the other steps where missing a few fields here and there.

This patch removes the first step and fixes the missing fields.

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
ACKed-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 08:11:40 -08:00
Henrik Brautaset Aronsen
e0b376622c Fix typo
All hail the groub!

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 08:11:40 -08:00
Dirk Hohndel
a24eb8ac12 Hack to make tank selection work on Mac
This is an ugly hack as it partially breaks the ability to abort a selection
(so if you click outside of the combobox, the last value you hovered over is
selected). But this seems much better than not being able to select a different
tank at all.

Fixes #275

(and by 'Fixes' I mean "hacks to sort of make work"... but the trac automation
is rather inflexible in which words it understands...)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 08:08:04 -08:00
Dirk Hohndel
58088d5897 Complete add bookmark for the profile context menu
This (together with the commits fixing the QMessageBox title) should
finally close all the issues in bug 250.

Fixes #250

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 05:13:18 -08:00
Dirk Hohndel
33b15ea906 Silence some warnings when building on Mac
The *-clang* selector doesn't appear to work correctly in my build environment
(or I just don't understand how it is supposed to work). Either way, making
this conditional on !mac works.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 05:03:56 -08:00
Miika Turkia
cd0475fe96 Improve UDDF export to include more dive data
Basic information like buddy, location and visibility is included in
UDDF export. Also attempt to grab temperature information from both
temperature and divetemperature tags.

This partially fixes bug #224. However, at least divemaster and tags are
not exported (as the UDDF spec either does not have these or has hidden
the information of these fields somewhere between so many seemingly
unnecessary other fields).

See #224

Signed-off-by: Miika Turkia <miika.turkia@nixu.fi>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 04:25:01 -08:00
Miika Turkia
5b0162d9d4 Improve UDDF import
Some improvements on importing different versions of UDDF logs. Also
include rating, gps coordinates and gas mixture in the import.

Signed-off-by: Miika Turkia <miika.turkia@nixu.fi>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 04:24:20 -08:00
Dirk Hohndel
995192c5fb Work around QMessageBox not showing its title on Mac
This is a bit hacky and simply adds the title to the message text when
compiling on a Mac, but hopefully this will be enough.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 04:23:10 -08:00
Anton Lundin
8aadd4d372 Quiet down warning about return in non-void
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 03:35:02 -08:00
Anton Lundin
27d6b2be6e Quiet down warning about duplicate name
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 03:34:46 -08:00
Anton Lundin
ea9b179933 Don't interpolate gas consumption when at surface
Don't calculate pressure-track for depth above SURFACE_THRESHOLD,
because then we would guess that were actually at surface breathing.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-20 14:36:12 -08:00
Anton Lundin
a31499de88 Use the get_o2/get_he helpers
We have helpers that take care of O2_IN_AIR and so on.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-20 11:31:23 -08:00
Anton Lundin
ef06afde14 Remove duplicate of add_gas_switch_event in dive.c
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-20 11:29:48 -08:00
Anton Lundin
746e6da75a Use add_gas_switch_event in instead of duplicate
There is a add_gas_switch_event, so don't duplicate the code.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-20 11:22:40 -08:00
Anton Lundin
f6b29d093f Use get_cylinder_index in per_cylinder_mean_depth
Use get_cylinder_index that handles SAMPLE_EVENT_GASCHANGE and
SAMPLE_EVENT_GASCHANGE2.

This also removes the need for a special case where get_gasidx returns
-1, because get_cylinder_index always returns the "closest" gas that it
finds.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-20 11:21:48 -08:00
Dirk Hohndel
51345e4ad8 Fix potential crash in the per tank sac calculation
In an inconsistant XML file (like our own dives/test20.xml) it is possible
that a gas change event refers to a non-existing gas. In that case
get_gasidx returns -1 - which we shouldn't use as index into the arrays.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-20 07:44:45 -08:00
Dirk Hohndel
9c5e037a61 Trigger redraw of the Dive Info pane on preferences change
If we change the units we need to redraw the info on this pane.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 23:08:20 -08:00
Dirk Hohndel
0ca12c3601 Collect per tank SAC rate
This is a bit painful, but we basically walk the samples and pick the
valid tank from the events. And then we do a simple discrete integration
to figure out the mean depth per tank and duration per tank. And then we
assemble all that into per tank statistics.

Strangely the value calculated here seems slightly higher than one would
expect from the overall SAC rate. This inconsistency should be
investigated a bit further, but my guess it it's based on the assumption
that the DC provided mean depth is possibly more accurate than what we can
calculate from the profile.

Fixes #284

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 23:07:04 -08:00
Dirk Hohndel
36cb50fb37 Add gas change event from profile context menu
This allows to add missing gas change events to the currently shown dive
computer. Only gases defined in the Equipment section are offered.

Fixes: #250

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 20:35:15 -08:00
Dirk Hohndel
28ad26e878 Use the correct dive to create the gas list
If we are adding a dive, it's the stagingDive, otherwise it's the
current_dive that we need to look at.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 18:23:14 -08:00
Dirk Hohndel
c1f936f288 Hiding events doesn't change the dive_table
So let's not mark it as changed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 18:22:40 -08:00
Dirk Hohndel
0d512b2dd9 Small whitespace cleanup
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 18:17:50 -08:00
Tomaz Canabrava
df6a80fb37 Hooked up 'Hide Events'
With this commit one can hide all events of the selected type through a
context menu on the profile.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 18:17:41 -08:00
Tomaz Canabrava
e8d1f14c90 Enable the 'Remove Event' callback.
Based on the code in the Gtk branch.

[Dirk Hohndel: whitespace cleanup and changed the message text]

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 17:58:18 -08:00
Tomaz Canabrava
4c2e6c4658 Adds half of the support for the menu on the profile.
This adds the menu, it just doesn't do anything, yet.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 17:04:25 -08:00
Anton Lundin
eb027f2a4b Do per cylinder statistics
This shows how much gas form each cylinder was used. I would like to add
SAC to that list too but it became a mess trying to calculate average
depth per cylinder.

Design based on idea in #284

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 15:46:19 -08:00
Tomaz Canabrava
732f7a69b0 Better handle the mouse movements on the Add Dive profile
Better handle the mouse movements on the add dive profile,
when outside of the canvas boundaries. It had bugged me for
quite a while, but this is so much better.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 15:43:12 -08:00
Tomaz Canabrava
82ac9ef9c6 Enable gas selection through a context menu
This patch re-enables gas selection through in the add dive profile.
Good thing ( and I really didn't think of that before ) is that
it is less than half of the code of the other implementation.
:D

Fixes #265

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 15:41:34 -08:00
Tomaz Canabrava
25a52056c6 Fixes positioning the first Gas Label on the add dive profile.
We didn't take into account that last == first when checking for
the first item on the list. Now the gas is correctly placed on screen.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 15:41:11 -08:00
Tomaz Canabrava
f5be24609a Removed obsolete Code ( gaslist on text click )
This commit removes obsolete code, there was a
gaslist selection when user clicked on the buttons, but
this shouldn't be anymore, since the next commit will
add a menu to select the gas for that particular point.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 15:38:58 -08:00
Anton Lundin
c7941f66b4 Print bailout on separate row from SP change
It looked kinda weird without a separator between the SP change and the
bailout.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 15:34:40 -08:00
Dirk Hohndel
6acff53735 Fix trip summary line in dive list
Two errors fixed.

- With no location set, the summary line would start with a ','.
- When auto creating a trip for a manually added dive or when editing the
  dates of dives in a trip, the timestamp for the trip was not updated
  after editing the dive.

Fixes #293

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 14:20:18 -08:00
Maximilian Güntner
65e980d483 Only translate default tags
We translate only tags we know since possible
translations of custom tags (provided by the user)
may be out of context and therefore wrong.

Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 10:42:58 -08:00
Willem Ferguson
5948aa5650 A first update of subsurface V4.0 manual
This starts mostly from scratch. It removes big chunkgs of the old manual,
the old pictures and starts with new visuals and new descriptions. A lot
more work is needed, but it's a good start.

Signed-off-by: Willem Ferguson <willem@willem-Precision-M4700.(none)>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 09:40:14 -08:00
Dirk Hohndel
33f7c6bb28 Clear selected trips after restoring selection
The rememberSelection() / restoreSelection() functions ONLY handle
selected dives, not selected trips. This is a bit of a misfeature, but
because of that we need to make sure we clear our notion of selected trips
when we use restoreSelection()

Fixes #285

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 06:05:43 -08:00
Dirk Hohndel
1a876a85b9 Hook up MOD in the preferences dialog
For some reason this was never connected. Oops.

Fixes #267

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 05:32:24 -08:00
Dirk Hohndel
1a5e94006c Sanity check on gas percentages
O2 + He + N2 = 100%
(well, there are some other gases, but this is close enough)

Since N2 can't be negative that means we should refuse any change where
O2 + He > 100% (or o2.permille + he.permille > 1000).

Fixes #280

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 05:02:08 -08:00
Dirk Hohndel
4619bfd9ca Immediately update the dive flag label when editing location text
This seems like a much nicer user experience. Editing a location's name is
immediately reflected on the globe label, the moment it happens.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 04:32:24 -08:00