- apply vertical layout to top-level dialog. This solves label clipping
- call adjustSize() on dialog to fit all labels (translated text could
be longer than original)
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We were actually searching dives which match the dowloaded position
fixes. So we're also trying to take into account if the fix is automatic
or no based on a limited amount of predefined strings (bad idea, as the
user can change in companion app settings the predefined string).
This way, in actual implementation, if program concludes that a fix has
been manually got or, simply, the user is unlucky enough to have all the
position fixes out of the dive time, find_dive_n_near() function will
pair fix and dive in an ordered way (1st fix -> 1st dive; 2nd fix -> 2nd
dive ...) which is probably erroneous, except for manual position fixes.
BTW actual implementation can't pair the same gps position with more
than one dive, which would be the case, e.g. in repetitive dives while at
anchor in the same point.
The patch changes the logic:
- Search positions for defined dives (instead of dives for defined
positions) without care if position has manually or automatically been
set.
- Only take care of those dives that don't have a position yet.
- It makes two assumptions:
a.- If the position fix has been taken during the dive time, is
correct. If there are more than one inside the dive time, takes the
first one (closest to the DC's reported time).
b.- If not during diving time, the correct one is the nearest fix
before the dive begins (also the usual case if manually fixed from the
smartphone just before jump into the water). But will work too if there
is only one fix *in SAME_GROUP range* after the dive (another usual
case).
- Finally, as copy_gps_location() in dive.h is used only here, let it
take care of naming the dive if user hasn't named it yet.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Most dive computers start always with the first cylinder (and if not,
they give a gas switch in the first few seconds). Trying to follow this
principle on divelogs.de export.
The bug 626 sounds like a bit different case so a sample XML log would
be needed to ensure that use case gets fixed.
See #626
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It is really confusing when the size of the cylinder does not match the
description. Inconsistent data in will mean inconsistent data out and
validating that export works means I try to get consistent data out...
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In reality we have no concept for handling those, yet. But the UI doesn't
prevent the user from entering multiple cylinders with the same gasmix, so
we need to help the user to get rid of them as well.
If the user attempts to remove a cylinder we check if there's a second
cylinder with the same gas. If that's the case then we can proceed and
remove the cylinder the user wants to get rid of without losing that gas
for the dive. The only tricky issue is that we need to make sure that if
we remove the first cylinder that one is actually replaced with one with
the same gas.
Fixes#622
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
updateDive() cannot reset the changed status - this is called while the
dive is edited. Instead this status is reset when the user either accepts
or rejects the changes.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We keep getting this wrong. First you check all selected dives that are
not the current dive, make sure the equipment was the same before the edit
and then apply the changes. Then, when you are done with ALL of them, then
you change the current dive. Otherwise you cannot compare to the 'before'
state anymore.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This was a fun little bug. Tomaz pointed me in the right direction. The UI
restructure with the displayed_dive had another unintended side effect
here. It is not valid not to set up the widgets just because the dive_list
is empty. The displayed_dive isn't on the dive_list until it is saved - so
while the user is adding or planning a dive, we still need to show the
equipment widgets.
Fixes#614Fixes#601
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Oh boy, this should allow for altitude in 'ft' as well.
I set an arbitrary cutoff at 3000m (and switched things to increments of
10m for the altitude).
Fixes#629
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This will make more easy to move code around in the future.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds the code that saves and restores the dive planner
settings.
Fixes#608
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The text selection was not being set, bummer.
See #628
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Q_FOREACH will expand and already creates a copy of the
contained container, so this is just a waste of cpu cycles
and also increases a tiny bit the memory consumption.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Attempting to export to write-protected file/directory results in NULL
file reference and leads to segfault when writing/closing it.
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In add_plan_to_notes(), call update_cylinder_related_info() to compute
CNS and OTU data for the planned dive. Report their values in the notes.
Besides CNS and OTU, update_cylinder_related_info() also recomputes the
SAC, which is harmless. Note that both dive->cns and dive->maxcns need
to be zeroed out for the CNS value to actually be recomputed.
Signed-off-by: Gaetan Bisson <bisson@archlinux.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This causes all kinds of assumptions to go wrong - and it makes no sense.
Move the point to where you want it or cancel the plan.
Fixes#623
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In commit b0da8c2707 ("When adding a waypoint, use the gasmix of the
_next_ waypoint.") we default to air when adding a waypoint at the end of
the plan by double-clicking. That seems silly since we could instead
continue using the last gas.
I wasn't able to reproduce the "gas list disappears" problem in bug #623,
but I did get a silly air segment added which was equally wrong. Maybe I'm
lucky and this fixes the problem that Henrik sees as well...
See #623
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I cannot reproduce the problem, but adding one more call to
unselectDives() should ensure that all dives are marked as not selected
before selecting the last dive that was downloaded.
See #620
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch makes sure that YAxis is not expanded to cover heart rate
when it is displayed on profile panel.
Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
must be terminated with semicolon, just like any other named
character reference
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Comma should be used on array initialization only between elements, not
at the end.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Concatenated string should have the plus sign at the end of the cut
line.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Dive photos are copied to the photos directory on export. The photos
section appears only if photos exist.
C++ helper functions are added to copy images to the photos directory,
Additionally the photos directory must be passed as a parameter to the
write_one_dive function to save photos to it. Some options structure may
be needed instead of passing many arguments.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add dive status in the detailed dive view.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The filter menu wasn't connected to anything other than a debug print.
This removes that menu.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I assume the theme directory should be deleted on uninstall the same way
e.g. Documentation directory is deleted.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I prefer that we show the first tab by default. Everyone should remember
that Qt Creator changes the currently shown tab as default on save.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I don't like that the event structure includes the variable length array.
That really makes it a pain to change the name of an event (on the flip
side, freeing events is easier I guess).
Anyway, to correctly rename an event we need to actually remove the event
from the correct dc and then add a new event with the new name. The
previous code was insane (it only worked if the new name was of smaller or
equal length, otherwise it had a beautiful buffer overflow).
And of course we need to do this both for the current_dive and the
displayed_dive.
Fixes#616
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This used to work because we actually displayed the current_dive. Now with
displayed_dive the pointers are of course different! So we need to compare
the actual events instead.
See #616
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Select proper SAMPLE_EVENT_GASCHANGE "version" based on helium content
on the mix.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Subsurface has saved gas change events without type attribute at some
point. Thus we need to add the type when reading in log files, if it is
missing. (Gas change logic relies on the type field nowadays.)
Fixes#617Fixes#600
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Use a macro that works to get the current DC.
Fixes#613
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We signal a bailout to OC via setting the setpoint to zero. A setpoint
between 0.2 and 0 would be really wierd, but i couldn't figure out any
better way to keep the bailout deco planning.
Note:
The gas consumption of CCR dives are plain wrong, but this atleast lets
you plan your deco for a CCR bailout plan.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For the Set point spinbox, it was kinda hard just stepping by the
default 1.0, so setting it to step by 0.1 makes much more sense.
The int SpinBox got a step size parameter for consistency.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The previous code used qreals, but it feels clearer to use doubles when
the name of the class contains the word double. The performance loss of
using doubles instead of floats on arm is non-existent in this case.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This fixes simple copy-paste error that the DoubleSpinBoxDelegate range
was stored as int, thus rounding min value from 0.2 to 0.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When adding the method that includes the depth unit to the DiveItem class
I realized that this was yet another implementation of our depth unit
conversion. We should just call the existing helper instead.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>