Commit graph

5516 commits

Author SHA1 Message Date
Dirk Hohndel
b3e662a895 Pick the correct timezoneoffset for the day in question
Calculating the timezoneoffset for the current date really makes no sense
whatsoever when displaying a time that isn't "now".

Fixes #605

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 20:24:56 -07:00
Tomaz Canabrava
bebcbfe92a Desselects the trip before dive add / plan, and reselects it on cancel
When we had a trip selected, we ignored that and simply called
the DiveAdd functions, but the mainTab code that deal with selections
to show one or more dives or trips asked how many trips were selected
to the DiveList, and since a trip was selected things go kabum.

Fixes #606

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 16:08:22 -07:00
Tomaz Canabrava
9d4b8c8218 Force replot of selected_dive when canceling plan
The profile was still the planner one, so we need to force
a replot.

Fixes #621

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 16:07:31 -07:00
Tomaz Canabrava
c34ee894ab Use 'this' instead of ::instance() when iside of same class.
Do not use MainWindow::instance() inside of a non-static
mainWindow method, that's just bogus.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 16:07:01 -07:00
Tomaz Canabrava
e5b06bf6c8 Fixed creating recursion on the connections
Ugh. Each time you wanted to change a cylinder, a new connection was
being created on this object, delaying the correctly setup of the item.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 15:53:55 -07:00
Tomaz Canabrava
b66f679d64 Complete the name of the first Cylinder on edit
When you entered part of the name of a cylinder this was
being treated as a new cylinder, and not selecting the first
one.

Fixes #628

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 15:53:21 -07:00
Tomaz Canabrava
1b6144350d Added a 'use default file' button on preferences.
Added a 'Use default file' button on preferences in a way
that doesn't clutters the interface.

Fixes #630

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 15:52:29 -07:00
Tomaz Canabrava
bf7fc97b50 Fix saving and storing the dive plan notes when there's html on it
We save an HTML table-based plan, so we need to get the text as html,
not plaintext.

Fixes #634

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 15:51:13 -07:00
Dirk Hohndel
a5c9bc1ef2 Pull latest translations
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 14:24:27 -07:00
Sergey Starosek
14cc59898a Date picker l10n for profile and planner
- set application-wide locale from preferences
- use custom date format for display

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 13:58:06 -07:00
Tomaz Canabrava
0dd40b7a51 Rely on QNetworkReply finished() signal instead of AccessManager one
The access manager is only one, while we can make requests from
different parts of the application, so relying on the manager
finished() signal to see if something was done or not was a
not very good move.

The QNetworkReply is created when a get() is invocked on the
AccessManager and that's unique. connect it's finished()
signal instead.

bonus: code cleanup.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 13:56:46 -07:00
Dirk Hohndel
bbbb4ced24 More source string updates for translations
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 13:28:03 -07:00
Sergey Starosek
dcca755343 More strings to translate for statistics tab
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 13:26:41 -07:00
Henrik Brautaset Aronsen
f0e17e6fff pN2 » pN₂, pO2 » pO₂
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 13:17:09 -07:00
Dirk Hohndel
a0a0bb5247 Add latest text strings for translations
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:59:18 -07:00
Dirk Hohndel
789a04bd70 Translations: get hemisphere letters translated again
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:56:46 -07:00
Dirk Hohndel
598102c351 Convert ternary "?:" into if for translation tools to work
It seems the translation tools don't like the ?: in the argument - can't
blame them. So use an explicit if clause instead.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:35:48 -07:00
Dirk Hohndel
138da489c8 Run convert -strip against all .png files
Just in case...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:30:43 -07:00
Sergey Starosek
9d35864eab Fix libpng warning about unrecognized profile
During Subsurface startup there are several warnings reported:
libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
The reason is explained at https://wiki.archlinux.org/index.php/Libpng_errors

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:26:11 -07:00
Miika Turkia
cd4dc503fc Set proper gas type on UDDF import
Use type 25 on UDDF import when the gas mix contains some helium.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:22:33 -07:00
Willem Ferguson
004b9d72c5 Replacement figures for user manual
Replacement figures for user manual

     Here are 12 replacement figures for the user manual to bring the
figures
     in line with the current UI. This relates to the updated profile
toolbar
     and manual dive profile entry. I did not change any text of the manual.
     That will happen tomorrow evening.

     Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>

From 85413b967c02738d47f0b7779613f33cc7898c17 Mon Sep 17 00:00:00 2001
From: Willem Ferguson <willemferguson@zoology.up.ac.za>
Date: Wed, 16 Jul 2014 07:26:43 +0200
Subject: [PATCH 4/4] Replacement figures for user manual

Here are 12 replacement figures for the user manual to bring the figures
in line with the current UI. This relates to the updated profile toolbar
and manual dive profile entry. I did not change any text of the manual.
That will happen tomorrow evening.

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:22:02 -07:00
Miika Turkia
796df27273 Index used cylinder properly on divelogs.de export
The wrong O2 percentage was due to not referring to the correct cylinder
but grabbing any o2 value in any cylinder. While fixing this, I noticed
that also end pressure was missing the cylinder selection, so fixing
that as well.

Fixes #626

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:21:01 -07:00
Dirk Hohndel
45acec0e25 Small update to CodingStyle document
Mention variable declarations (they should be at the beginning of code
blocks).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:16:47 -07:00
Sergey Starosek
42e8e6406b Disable DC shortcuts on closing data file
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:14:39 -07:00
Sergey Starosek
b87a602265 Suppress XML preamble in CSV export
To obey <xsl:output omit-xml-declaration="yes"/> element
one should rely on libxslt to do its job instead of writing
document himself.

Discussion on this subject can be found at
http://comments.gmane.org/gmane.comp.gnome.lib.xslt/3839

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:14:27 -07:00
Sergey Starosek
32a76671ed Fix SearchBar growing vertically on window resize
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:11:14 -07:00
Sergey Starosek
b2a3e46184 Fix layout for User Survey
- 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>
2014-07-16 09:11:04 -07:00
Salvador Cuñat
7eb422d988 Change in logic while aplying gps fixes to dives
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>
2014-07-16 07:38:31 -07:00
Miika Turkia
5a34261fec Try to detect first cylinder on divelogs.de export
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>
2014-07-15 20:46:19 -07:00
Miika Turkia
c02cc33fc8 Fix the description of test dive cylinders
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>
2014-07-15 20:46:02 -07:00
Dirk Hohndel
10e66823b0 Improve handling of cylinders with identical gasmix
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>
2014-07-15 20:36:49 -07:00
Dirk Hohndel
0cf55d7e39 Correctly track the 'changed' status of the equipment widgets
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>
2014-07-15 20:36:25 -07:00
Dirk Hohndel
327ea3aca4 Dive equipment edit - fix logic for applying changes
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>
2014-07-15 20:29:14 -07:00
Dirk Hohndel
5440d0c39f Don't ignore equipment just because the dive list is empty
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 #614
Fixes #601

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-15 19:52:05 -07:00
Dirk Hohndel
3860c3eaa1 Planner: limit altitude and pressure
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>
2014-07-15 17:19:49 -07:00
Tomaz Canabrava
4c8e9615e4 Remove uneeded function
This method was being unused, rip it off.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-15 17:05:46 -07:00
Tomaz Canabrava
e38595f684 Use QObject::tr instead of OurClasses::tr for functions
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>
2014-07-15 17:05:46 -07:00
Tomaz Canabrava
887f9e63c3 Save and restore Dive Planner Settings
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>
2014-07-15 17:05:38 -07:00
Tomaz Canabrava
a502958a66 Selects the delegate text on Cylinder edition
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>
2014-07-15 17:05:30 -07:00
Tomaz Canabrava
d993684fec Do not create a backup for Q_FOREACH container
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>
2014-07-15 16:55:10 -07:00
Sergey Starosek
eaacac3217 Fix segfault in world map export
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>
2014-07-15 05:48:07 -07:00
Gaetan Bisson
d652268655 Planner: Report CNS and OTU
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>
2014-07-15 04:05:53 -07:00
Dirk Hohndel
dff92f188a Planner: don't allow the user to remove the last point
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>
2014-07-15 03:33:48 -07:00
Dirk Hohndel
133e104393 Planner: when adding new waypoint at the end, use previous gas
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>
2014-07-15 03:20:23 -07:00
Dirk Hohndel
4eec911d3a Planner: even with broken plans, don't divide by 0
This fixes the crash in #623, but not the other oddities.

See #623

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-15 03:14:15 -07:00
Dirk Hohndel
95dbfc22ac Try to avoid inconsistent selection state after divecomputer download
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>
2014-07-14 21:44:57 -07:00
Lakshman Anumolu
74bfa1b170 Shrink YAxis when heart rate is on display
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>
2014-07-14 21:38:34 -07:00
Miika Turkia
3bbac30c1b Terminate named character references properly
&nbsp; 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>
2014-07-14 21:38:22 -07:00
Miika Turkia
5723cfc1d0 Removing extra commas from array initialization
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>
2014-07-14 21:38:22 -07:00
Miika Turkia
a50631e026 Fix string continuation
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>
2014-07-14 21:38:22 -07:00