Commit graph

10826 commits

Author SHA1 Message Date
Robert C. Helling
2c715542fd Unify handling of QDateTime time zone information
Subsurface uses "local time" which in particular means we never
display time zone information to the user. The user (and our file
format) only sees times like 5pm or 17:00. A better name than
local time (which could mean "local at the dive spot) would
be "watch time", the time displayed by the diver's watch when
she entered the water.

Internally, we store times as time_t, seconds since Jan 1 1970 0:00
UTC. Our convention for conversion between 5pm and time_t as always
been to treat 5pm as if it were UTC.

Then confusion arose since Qt's QDateTime (which is tied to UI elements
like QTimeEdit and similar) is time zone aware and by default assumes
the system time zone. So when we set a QDateTime to 5pm and then later
convert it to time_t we have to take care about the difference between
UTC and the system time zone.

This patch unifies our solution to this problem: With it, we set all
QDateTime's time zone to UTC. This means we don't have to correct for
a time zone anymore when converting to time_t (note, however, the
signedness issue: Qt's idea of time_t is broken since it assumes it
to be unsigned thus not allowing for dates before 1970. Better use the
millisecont variants).

We only need to be careful about time zones when using the current time.
With this convention, when assigning the current time to a QDateTime, we
need to shift for the time zone since its value in UTC should actually be
the watch time of the user who is most likely used to the system time zone.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-10 15:04:39 -07:00
Tim Wootton
bd40ef7f42 Adds Cylinder helper class for cylinder info access in grantlee templates
to allow grantlee to access individual fields of the cylinder_t struct
rather than a string representation of the whole cylinder info using a
grantlee structure like this one:
	<table class="table_class">
		<tr>
			<td>Cylinder</td>
			<td>Start press.</td>
			<td>End press.</td>
			<td>Gas mix</td>
		</tr>
		{% for cylinderObject in dive.cylinderObjects %}
		<tr>
			<td>{{ cylinderObject.description }}</td>
			<td>{{ cylinderObject.startPressure }}</td>
			<td>{{ cylinderObject.endPressure }}</td>
			<td>{{ cylinderObject.gasMix }}</td>
		</tr>
		{% endfor %}
	</table>

Signed-off-by: Tim Wootton <tim@tee-jay.org.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-10 15:00:33 -07:00
Dirk Hohndel
430f5b77c5 Add menu entry to remove the offline state
If an attempt to contact the cloud storage fails, Subsurface switches into
offline mode. This allows us to go back online again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-30 13:29:06 -07:00
Dirk Hohndel
677bbb77d9 Send the appropriate signal when gitLocalOnly changes
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-30 13:06:36 -07:00
Miika Turkia
0e31171087 Fix cylinder pressure for UDDF export
Fixes #1086

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-28 04:55:39 -07:00
Miika Turkia
e80b03699d Shrink the minimum size for preferences window
Let's have the preferences window as small as possible with the current
data in it. This should allow people with vertical resolution of 600 to
use the preferences window.

Fixes #1083

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-28 04:54:51 -07:00
Miika Turkia
49cbb8308e Shrink the size of export dialog
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-28 04:54:10 -07:00
Dirk Hohndel
8c2668a6b1 Event name heuristics to show better event icons
This matches the strings for a couple of generic events from
libdivecomputer that should obviously info or violation events, and
matches quite a few more from the Uemis downloader (as those are much more
specific).

Everything else is still shown as a yellow warning triangle.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-24 09:53:24 +09:00
Dirk Hohndel
dcf94bef56 Add new helper for case insensitive string comparison
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-24 09:53:24 +09:00
Dirk Hohndel
70e1938aa7 Avoid compile time warning
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-24 09:53:24 +09:00
Dirk Hohndel
c1f9cfe9a8 Show different icons based on event severity
So far this is only supported in the Suunto EON Steel backend, but we
should try to add this to others where we have such a distinction (and
maybe assign different values to the predefined libdivecomputer events).

This also adds three new icons for info, warning, and violation. The
warning icon we had already, but I drew a new one from scratch to have it
match the violation icon.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-24 09:53:24 +09:00
Linus Torvalds
f718fdab80 Event flags should be checked as bits, not values
This becomes obvious with the new severity bits introduced in the Suunto
EON Steel parser.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-23 16:01:26 +09:00
Dirk Hohndel
177e21076b Allow the user to give longer cloud timeout on the command line
When stuck in areas with really bad internet 5 seconds may not be enough,
but making the timeout longer in general seems the wrong way to go. So
keep the default 5 seconds but allow the user to override that with
subsurface --cloud-timeout=NN

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-23 12:54:30 +09:00
Dirk Hohndel
9815eaf1ed Use preferences object to correctly store cloud status
There are a lot more places all over Subsurface where this needs to be
cleaned up. The converstion of the preferences system has been a complete
mess.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-23 12:53:37 +09:00
Tim Wootton
0b5a1719a1 Only add non-blank cylinder strings to the cylinder list
Signed-off-by: Tim Wootton <tim@tee-jay.org.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-23 10:55:17 +09:00
Rick Walsh
b0ad1aa969 Remove another unused variable
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-23 10:54:56 +09:00
Rick Walsh
b78e6525eb Remove unnecessary DivePlannerPointsModel functions and variables
Commit b1ed04a means that DivePlannerPointsModel::rememberTanks() and related
functions and variables are no longer required

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-23 10:54:51 +09:00
Guillaume GARDET
8b35defa48 Fix build (link) on openSUSE builds (maybe due to recent cmake version)
Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-23 10:54:36 +09:00
Guillaume GARDET
493fefef71 Update OBS spec file to fix build
Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-23 10:54:20 +09:00
Guillaume GARDET
0b5ef8b73f Documentation: update french translation of user-manual and mobile-manual
Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-23 10:54:07 +09:00
Rick Walsh
f96f3abcdc Relabel cylindermodel "Deco MOD" column to "Deco switch at"
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-23 10:53:39 +09:00
Tim Wootton
e34bf95718 Only add non-blank weights to the weight list
Signed-off-by: Tim Wootton <tim@tee-jay.org.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-23 10:52:55 +09:00
Willem Ferguson
b66b387215 Remove unused image from mobile user manual
Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-23 10:51:44 +09:00
Tim Wootton
d0e2ff578a Let cns and otu return ints rather than QStrings
This way they display correctly when accessed from grantlee template

Fixes #1085

Signed-off-by: Tim Wootton <tim@tee-jay.org.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-23 10:50:15 +09:00
Tim Wootton
2cffb77d19 Adds missing visibility to DiveObjectHelper, so it too can be used in print templates.
Signed-off-by: Tim Wootton <tim@tee-jay.org.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-23 10:49:19 +09:00
Dirk Hohndel
aa404b3469 Undefine both macros
There really is not need to do this, but at least do it symmetrically.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-22 09:00:35 +09:00
Linus Torvalds
a0aaadd50b Add support for SAMPLE_EVENT_STRING event type
Instead of having fixed numbers and trying to translate them into
strings, a dive computer could just give us the string directly.  Like
the new EON Steel backend does.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-21 20:00:04 +09:00
Linus Torvalds
c27ad52be4 Properly pick cylinder use when merging dives
The cylinder use field was not merged when dives were merged.  This is
normally not noticeable, since hopefully the cylinder use should be the
same anyway, but when re-downloading the dives from the EON Steel after
updating it to also get cylinder use data, the dive merging threw the
data away again since the original dive lacked it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-21 20:00:04 +09:00
Linus Torvalds
b2f2a865eb Get the cylinder use data from libdivecomputer if provided
This uses the extended tank type information to fill in the cylinder use
(OC gas, CC Diluent or CC O2) from libdivecomputer when available.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-21 20:00:04 +09:00
Linus Torvalds
7c8073e7ea Add proper line ending for unit line in git save format
The imperial and metric unit formats already had this, but the
personalized one missed the newline at the end.

It shouldn't really matter, since it's the last line of the file, but it
is not right.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-21 20:00:04 +09:00
Dirk Hohndel
b25d1c04c4 Show SAC rate when using the ruler
This way it's really easy to see the SAC rate during a segment of a dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-18 16:27:38 +09:00
Dirk Hohndel
8f4e649c68 If cloud storage is offline, show that in title bar
Not sure if "local cache" is the best text, but it's accurate.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-17 12:27:01 +09:00
Dirk Hohndel
0a58e6d117 Stay offline if the cloud server is unreachable
It makes no sense to keep trying. Maybe we need a UI to force it online
again, but for now this works much better when using cloud storage while
actually offline.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-17 09:15:10 +09:00
Dirk Hohndel
eaed18ba40 Fix fix for filters
Commit aa1446bed2 ("Make filters work again in master") makes filters
work again for the desktop app, but breaks building Subsurface-mobile.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:45:55 -07:00
Dirk Hohndel
5de89e036d Prevent using an uninitialized value
This could otherwise lead to crashes if you start a plan with a dive
selected that has no cylinders.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:37:05 -07:00
Dirk Hohndel
9762b72b7d Remove two unused variables
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:36:54 -07:00
Salvador Cuñat
aa1446bed2 Make filters work again in master
Since 6cd711a1 filters don't work. This went unnoticed because the
commit wasn't applied on v4.5-branch.
Partially reverting it makes filters work again.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:09:57 -07:00
Rick Walsh
54871debfb Planner: update maxdepth and best mixes when profile changed by mouse
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:08:52 -07:00
Rick Walsh
bb31517951 Planner: update cylinder mixes and MND and MOD when prefs are changed
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:08:48 -07:00
Rick Walsh
ffca5674bf Fixup: don't capitalise best_He
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:08:41 -07:00
Rick Walsh
f08b0e0e3e Planner: automate calculation of best mix for max depth
Add option to calculate the best mix portion of O2 and He for the dive's max
depth if the user enters * in the MOD and MND cylinder fields. Gas portions
are automatically recalculated if the max depth of the dive changes.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:08:25 -07:00
Rick Walsh
ae9e147314 Validate O2 in best mix
We can't have >100% O2

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:08:20 -07:00
Rick Walsh
274ff270d8 Be more clear about deco MOD / switch depth and bottom MOD
The switch depth of a decompression gas is its MOD. By renaming the heading to
"Deco MOD", it is more clearly distinguished from the  bottom MOD, and it is
more obvious how they relate to the Bottom pO2 and Deco pO2 preferences.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:08:16 -07:00
Rick Walsh
6ed5e0d621 Add MOD and MND fields to cylindermodel
Adds fields to the planner cylinder model for maximum operating depth (MOD)
for a bottom mix gas, and maximum narcotic depth (MND). Fields are read/write,
so changing MOD changes %O2 and vice-versa. Changing MND changes %He and
vice-versa.

When setting MOD directly, the %O2 is truncated (rounded down) to an integer,
which re-calculates the MOD, which is sometimes a few metres greater than the
input depth. This is desireable behaviour, as the rounding is conservative.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:08:10 -07:00
Rick Walsh
9fbd11744f Add function to calculate gas maximum narcotic depth
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:08:06 -07:00
Rick Walsh
1ba61d7ad5 Update gas deco MOD when deco pO2 is changed
This fix is reasonably straightforward when the divedatapoint structure stores
the cylinder rather than gasmix.

Fixes #970

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:08:01 -07:00
Rick Walsh
b827107619 Update TestPlan for divedatapoint storing cylinder id instead of gasmix
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:07:55 -07:00
Rick Walsh
b1ed04a7f4 Have divedatapoint store cylinder id instead of gasmix
Determining the correct cylinder index from a known gas mix can be
complicated, but it is trivial to look up the gasmix from the cylinder_t
structure.

It makes sense to remember which cylinder is being used. This simplifies
handling changing a cylinder's gas mix, either directly by the user, or
indirectly in the planner. It also permits tracking of multiple cylinders of
the same mix, e.g. independent twins / sidemount.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:07:25 -07:00
Anton Lundin
066f79223c Treat minified JavaScript as binary
The minified JavaScript is effectively a binary artifact that we carry in
the repo.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:07:25 -07:00
Anton Lundin
4ed6101c5c android: Fix typo in patching of libssh2
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:07:09 -07:00