Commit graph

286 commits

Author SHA1 Message Date
Jan Mulder
0d023068b3 mobile: icon size in profile
Size the event item icons in the profile a little bigger. Obviously, how
big is big enhough is upto personal taste, but on Github a screendump
is added to show the new size.

Fixes: #310

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-13 20:46:00 -08:00
Dirk Hohndel
e64dcd12bd desktop UI: no longer attempt to manually show error notifications
report_error() now does this automatically. So all these odd places in which we tried
to make sure that we show errors are no longer needed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-26 15:55:49 +02:00
Dirk Hohndel
27c49fe3ad Silence random warnings
None of these seem to point to actual issues, so let's quiet them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-20 17:25:18 -04:00
Stefan Fuchs
022b3e450b Translate dc text in profile also if string has suffix for > 1 DC
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-20 06:38:20 -04:00
Stefan Fuchs
c3274b0b9f When selecting icons for events don't misinterpret a gaschange
Don't misinterpret a gaschange as "useless internal of the dive computer"
when it has a higher flag value.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-19 19:00:55 -04:00
Robert C. Helling
a422957cd6 Use displayed_dc instead of current_dc
current_dc is a macro that determines the dive computer
based on the current dive number. When the planner is started
from an emtpy dive list, the dive number ends up being -1 and
that doesn't produce a valid dive computer. Use the divecomputer
of the displayed_dive instead. This is done via a macro that
can also be used in two other places. Without this patch, the
planner crashed when called on an empty dive list.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-10-19 14:57:02 -04:00
Stefan Fuchs
fcc4be6ea0 Add a icon for gaschange to Oxy with all green tank shoulder color
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-18 06:47:44 -04:00
Robert C. Helling
432110ac8f Find current gasmix for heatmap
To compute the heatmap value, we need the current gasmix but
the current cylinderindex is no longer available.

Fixes #562

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-10-18 06:34:15 -04:00
Stefan Fuchs
c3857db23b Hide outdated gas name strings in profile in planner
When deleting dive planner points in the planner we currently sometimes
miss to hide the outdated gas name strings printed close to the profile
legs.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-08 23:19:23 +02:00
Stefan Fuchs
8d8e694b0d End tankbar at the correct end of the dive plot
Go back to the old startegy of retrieving the correct end of the dive
plot by looking at the plot data instead of looking at dc->duration.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-09-15 09:01:10 -07:00
Dirk Hohndel
96ed09bf14 Update the tankbar code to work with the new gas handling
When Linus modified the gas handling code six weeks ago he pointed out
that that had broken the tankbar; with this patch we now simply walk the
gas changes of the displayed dive directly and create the tankbar
rectangles from that information.

See #562

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-09-14 05:36:52 +02:00
Dirk Hohndel
aabcff9c54 Move unused code into the disabled block
These varaiables are only used in the code that we currently
aren't compiling.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26 12:11:44 -07:00
Linus Torvalds
e04ef1df1e Fix the overprinting of gas name and pressure value on the profile
When I massaged the code to do multiple gas pressures in commit e1b880f4
("Profile support for multiple concurrent pressure sensors") some of the
Y offsetting code got cut out as being too specific to the old
o2pressure code.

But I removed a bit too much, leaving the label (gas name) and number
(gas pressure) overlapping.

This should fix it.

If we really care about multiple gas pressure labels overlapping each
other, we'll have to revisit this code, but the old two-gas case didn't
do a very good job either (both that old code - and this new version -
can look very good in particular cases, but there are cases where it
won't work so well).

So we may need to revisit this eventually, but this gets it looking fine
for the normal cases.

Reported-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-07 00:57:58 -07:00
Linus Torvalds
e1b880f444 Profile support for multiple concurrent pressure sensors
This finally handles multiple cylinder pressures, both overlapping and
consecutive, and it seems to work on the nasty cases I've thrown at it.

Want to just track five different cylinders all at once, without any
pesky gas switch events? Sure, you can do that.  It will show five
different gas pressures for your five cylinders, and they will go down
as you breathe down the cylinders.

I obviously don't have any real data for that case, but I do have a test
file with five actual cylinders that all have samples over the whole
course of the dive.  The end result looks messy as hell, but what did
you expect?

HOWEVER.

The only way to do this sanely was

 - actually make the "struct plot_info" have all the cylinder pressures
   (so no "sensor index and pressure" - every cylinder has a pressure for
   every plot info entry)

   This obviously makes the plot_info much bigger. We used to have
   MAX_CYLINDERS be a fairly generous 8, which seems sane. The planning
   code made that 8 be 20. That seems questionable. But whatever.

   The good news is that the plot-info should hopefully get freed, and
   only be allocated one dive at a time, so the fact that it is big and
   nasty shouldn't be a scaling issue, though.

 - the "populate_pressure_information()" function had to be rewritten
   quite a bit. The good news is that it's actually simpler now, although
   I would not go so far as to really call it simple. It's still
   complicated and suble, but now it explicitly just does one cylinder at
   a time.

   It *used* to have this insanely complicated "keep track of the pressure
   ranges for every cylinder at once". I just couldn't stand that model
   and keep my sanity, so it now just tracks one cylinder at a time, and
   doesn't have an array of live data, instead the caller will just call
   it for each cylinder.

 - get rid of some of our hackier stuff, like the code that populates the
   plot_info data code with the currently selected cylinder number, and
   clears out any other pressures. That obviously does *not* work when you
   may not have a single primary cylinder any more.

Now, the above sounds like all good things. Yeah, it mostly is.

BUT.

There's a few big downsides from the above:

 - there's no sane way to do this as a series of small changes.

   The change to make the plot_info take an array of cylinder pressures
   rather than the sensor+pressure model really isn't amenable to "fix up
   one use at a time". When you switch over to the new data structure
   model, you have to switch over to the new way of populating the
   pressure ranges. The two just go hand in hand.

 - Some of our code *depended* on the "sensor+pressure" model. I fixed all
   the ones I could sanely fix. There was one particular case that I just
   couldn't sanely fix, and I didn't care enough about it to do something
   insane.

   So the only _known_ breakage is the "TankItem" profile widget. That's
   the bar at the bottom of the profile that shows which cylinder is in
   use right now. You'd think that would be trivial to fix up, and yes it
   would be - I could just use the regular model of

     firstcyl = explicit_first_cylinder(dive, dc)
     .. then iterate over the gas change events to see the others ..

   but the problem with the "TankItem" widget is that it does its own
   model, and it has thrown away the dive and the dive computer
   information. It just doesn't even know. It only knows what cylinders
   there are, and the plot_info. And it just used to look at the sensor
   number in the plot_info, and be done with that. That number no longer
   exists.

 - I have tested it, and I think the code is better, but hey, it's a
   fairly large patch to some of the more complex code in our code base.
   That "interpolate missing pressure fields" code really isn't pretty. It
   may be prettier, but..

Anyway, without further ado, here's the patch. No sign-off yet, because I
do think people should look and comment. But I think the patch is fine,
and I'll fix anythign that anybody can find, *except* for that TankItem
thing that I will refuse to touch. That class is ugly. It needs to have
access to the actual dive.

Note how it actually does remove more lines than it adds, and that's
despite added comments etc. The code really is simpler, but there may be
cases in there that need more work.

Known missing pieces that don't currently take advantage of concurrent
cylinder pressure data:

 - the momentary SAC rate coloring for dives will need more work

 - dive merging (but we expect to generally normally not merge dive
   computers, which is the main source of sensor data)

 - actually taking advantage of different sensor data from different
   dive computers

But most of all: Testing.  Lots and lots of testing to find all the
corner cases.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-27 14:45:58 -07:00
Linus Torvalds
342391e0d1 Show multiple gas pressures in the profile even if the dive isn't CCR
Now that the cylinder pressures are more generalized, we should show
them even for non-CCR dives if we have them.  The most notable example
would be having separate pressure transmitters for both cylinders in a
sidemount setup. The code no longer really depends on any CCR logic.

NOTE! This is still preparatory work, in that this is one part of
supporting multiple simulataneous cylinder pressures, but we are still
lacking in other departments (eg properly filling those fields in when a
dive computer exports multiple pressure sensors etc).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-22 10:38:32 -07:00
Linus Torvalds
1e38d9239a Start cleaning up sensor indexing for multiple sensors
This is a very timid start at making us actually use multiple sensors
without the magical special case for just CCR oxygen tracking.

It mainly does:

 - turn the "sample->sensor" index into an array of two indexes, to
   match the pressures themselves.

 - get rid of dive->{oxygen_cylinder_index,diluent_cylinder_index},
   since a CCR dive should now simply set the sample->sensor[] indices
   correctly instead.

 - in a couple of places, start actually looping over the sensors rather
   than special-case the O2 case (although often the small "loops" are
   just unrolled, since it's just two cases.

but in many cases we still end up only covering the zero sensor case,
because the CCR O2 sensor code coverage was fairly limited.

It's entirely possible (even likely) that this migth break some existing
case: it tries to be a fairly direct ("stupid") translation of the old
code, but unlike the preparatory patch this does actually does change
some semantics.

For example, right now the git loader code assumes that if the git save
data contains a o2pressure entry, it just hardcodes the O2 sensor index
to 1.

In fact, one issue is going to simply be that our file formats do not
have that multiple sensor format, but instead had very clearly encoded
things as being the CCR O2 pressure sensor.

But this is hopefully close to usable, and I will need feedback (and
maybe test cases) from people who have existing CCR dives with pressure
data.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-21 16:33:19 -07:00
Stefan Fuchs
b8347d2387 Translate the strings "planned dive" and "manually added dive" in the profile
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-06-22 10:38:54 +09:00
Jan Mulder
26a0e741b8 code cleanup: remove unimplemented classes and structs
Remove forward declared but not implemented classes and structs.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-06-16 05:31:41 +09:00
Robert C. Helling
98a65b7157 Display gas density instead of SAC in planner
In the planner, the SAC is prescribed, so there is little
use in plotting it (as the color of the cylinder pressure
line). Rather use the color to show the density of breathing
gas.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-05-26 15:52:04 -07:00
Robert C. Helling
53a8075bd8 Fix right boundary when moving last handle in planner
There was a bug in the old code due to confusion between minutes
and seconds as the unit of the time axis. But rather than limiting
the time for the last handle in terms of the time axis (which
potentially includes long deco and allowing that for bottom time
quickly leads to dives many many hours long) limit it to 150%
of the previous bottom time.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-05-26 15:46:41 -07:00
Dirk Hohndel
49d0bb8406 Add SPDX header to profile widgets
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-29 13:32:55 -07:00
Jan Mulder
5a235aea12 minimal pO2 threshold: color the p02 graph also for minumum
Color the p02 graph also in red for going under the minumum p02 value as
set in the Preferences.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-03-28 11:17:03 -07:00
Jan Mulder
bb31c77597 minimal pO2 threshold: split max threshold into min and max
Nothing really special here. Just a split of the only p02 max threshold into
a min threshold and max threshold, and the adaptation of the UI. Change of
translatable strings included.

ref: https://github.com/Subsurface-divelog/subsurface/issues/259

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-03-28 11:17:03 -07:00
Joakim Bygdell
bd0c99dfb7 MOBILE: Display pO2 and Setpoint for CCR dives
For CCR dives we want to display the setpoint and pO2 information,
due to the limited screensize we have to remove the temperature graph or
the view will be to cluttered.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-03-26 21:57:57 -07:00
Jeremie Guichard
597539ce39 Fix double to int truncation in C++ code
Wfloat-conversion enabled for C++ part of the code
Fix warnings raised by the flag using lrint

Original issue reported on the mailing list:
The ascent/descent rates are sometimes not what is expected.
E.g. setting the ascent rate to 10m/min results in an actual
ascent rate of 9m/min.
This is due to truncating the ascent rate preference,
then effectively rounding up the time to reach each stop to 2s intervals.
The result being that setting the ascent rate to 10m/min
results in 20s to ascend 3m (9m/min), when it should be exactly 18s.

Reported-by: John Smith <noseygit@hotmail.com>
Reported-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-03-24 09:39:25 -07:00
Dirk Hohndel
08284275e7 Merge branch 'master' of https://github.com/dje29/subsurface 2017-03-11 08:41:41 -08:00
Martin Měřinský
95d5771513 We use 'setpoint' in UI. Use it also for documentation and comments. No semantic change. 2017-03-11 08:09:07 -08:00
Martin Měřinský
dcf2542215 Use abbreviations with dots. 2017-03-11 08:09:07 -08:00
Robert C. Helling
eae4bd82a5 Change type of divedatepoint.depth to depth_t
... for consistency, while we are at it.

There are still some internal depth variables which are ints
somebody might take a go at those.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-03-11 08:03:25 -08:00
Jeremie Guichard
406e4287eb Change calls to rint into lrint avoiding conversion warnings
Using gcc option "-Wfloat-conversion" is useful to catch
potential conversion errors (where lrint should be used).
rint returns double and still raises the same warning,
this is why this change updates all rint calls to lrint.
In few places, where input type is a float, corresponding
lrinf is used.

Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-03-08 14:04:17 +07:00
Martin Měřinský
b14301a84c heartrate, heartbeat > heart rate 2017-03-04 12:08:17 -08:00
Martin Měřinský
59d18a00db divecomputer > dive computer 2017-03-04 12:08:17 -08:00
Stefan Fuchs
7eda24d6b1 Correct "set-point" -> "setpoint" and window title setpoint change
Change 2x "set-point" to "setpoint".
Correct window title for "Add setpoint change" window.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-03-04 12:04:20 -08:00
Stefan Fuchs
508387b1e1 Add units and nicer formating for items in profile info box
"SP change" info format in info box: Added/changed formating and add "bar" unit.
"waypoint above ceiling" event in info box: Added formating, depth conversation to ft/m and depth unit.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-02-21 13:11:19 -08:00
Stefan Fuchs
b39b641a05 Translate names of additional dive events and nicer format info box text
Enable translation for a few additional internal dive events.
Ensure that all event names in datatrak.c are collected for translation.
Ensure that for gaschange in profile info box the "cyl." string is also translated.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-02-21 13:11:19 -08:00
Joakim Bygdell
12c33a038f Mobile: Do not show tankbar for CCR dives
If we are showing the setpoint and sensor pO2 we need the space.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-02-05 12:20:33 -08:00
Joakim Bygdell
11ccadbab5 MOBILE: Reposition objects in the profile
Add the tankbar to the profile and change the relative positions of the depth
and temperature curves to minimize overlap.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-02-05 11:59:47 -08:00
Robert C. Helling
2516ae7e5f Let cylinderid = -1 mean same gas as before
It's not too clever to give 0 a special meaning (as here:
use same gas as for previous leg) when 0 is a legitimate
value.

This should solve Willem's gas disappearance problem when
reediting a dive in the planner.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-02-04 07:09:35 -08:00
Dirk Hohndel
f5a4838519 Fix dive visual editor being too quick to rescale time
When moving the last handle of a dive (in the planner, in dive add, or
when editing a dive), we rescaled the time axis whenever our idea of the
maximum duration that we should show changed. That lead to the odd
situation that you couldn't get to certain dive durations with the
visual editor (e.g. 64 minutes) because just as you approach that time
the scale changes and the dive duration jumps past the desired value.

Fixes issue #174

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-01-28 21:04:50 -08:00
Joakim Bygdell
dd2791fa1e Fix tankbar offset at gas switch event
When painting the tankbar the function triggers on change in cylinder index,
as a result the new gascolour are changed at the next sample time point.
On a divecomputer with a reasonable fast sample rate the 2-3s offset are hardly
noticable, especially on a longer dive.
For divecomputers with slow sample rate the 10-30s offset are clearly visible.

This is fixed by start painting the new gascolour at the time point of the switch event rather than the time point of the next sample.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-01-21 06:07:31 -08:00
Joakim Bygdell
f7cecf506f Don't let the tankbar overlap the tissue heatmap
Shift the position of the tankbar to prevent it from overlapping the tissue heatmap

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-01-21 06:07:31 -08:00
Robert C. Helling
fedadc65db Prevent the heatmap form overlapping at the ends
...by making the pen start at its first position rather
than first position minus half width.

Sorry for my first attempt to solve this in a totally
differen (read: wrong) way.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-15 11:37:26 -08:00
Robert C. Helling
bb4bf639c3 Fix deco_mode confusion
We have two prefernces determining the deco_mode (BUEHLMANN vs VPMB
vs RECREATIONAL): One for the planner (deco_mode) and one for
displaying dives (display_deco_mode). The former is set in the planner
settings while the latter is set in the preferences.

This patch clears up a confusion which of the two to use by introducing
a helper function that selects the correct variable.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-06 20:43:23 -08:00
Tomaz Canabrava
37e3e7e69a Deco mode for plannining is not deco mode for showing
We had (in the wrong place, imo) a new feature that
should differentiate the different deco_modes, you could
plan your dive in buelhman and see it in vpm-b, for instance
but both of them accessed the same pref.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:41:17 -07:00
Tomaz Canabrava
c110b4a238 More preference handling fixes
Remove a few uneeded lines and add more loading code for
the preferences.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:40:43 -07:00
Tomaz Canabrava
27d1385c65 Use the new preferences object to set the preferences
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:40:06 -07:00
Rick Walsh
a2d6bcf23f ToolTipItem: only show gf line in pressure graph when using Buhlmann model
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-27 20:36:08 -07:00
Rick Walsh
d689390140 Heatmap: Show more yellow
Stretch out the yellow zone of the HSV scale, because the yellow band of the
true scale appears narrow.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-20 21:14:27 -07:00
Rick Walsh
fd46167ae0 Heatmap: Color undersaturated values relative to inert gas pressure
Color "undersaturated" values relative to inert gas pressure of gas being
breathed, rather than relative to inert gas pressure of air.
Also change slightly the point at which bright green (hue = 120 deg) from 10%
of M value to 0% of M value (=ambient pressure).
Other than the slight shift in lower bound of the green-red scale, this does
not affect the colors of the tissues with inert gas pressure greater than
ambient pressure, which are relative to the Buhlmann M value.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-20 21:14:19 -07:00
Rick Walsh
a67d3f0e30 Heatmap: Draw lines between data points rather than big dots
By drawing oversize dots for each data point, dots were overlapping such that
the change in tissue presssure wasn't displayed at the right time - typically
out by 1-2 minutes, depending on dive duration.

Drawing a line between discrete points, the data points don't overlap and
change in tissue pressure is displayed at the right time.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-20 21:11:15 -07:00
Robert C. Helling
87ced29e09 Initialize tooltip tissue pixmap properly
...otherwise we show garbage before the mouse enters the
profile for the first time.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-03 07:58:43 -07:00
Dirk Hohndel
c907efb22e Correctly hook up visibility toggle for tissue heat map
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-24 12:50:19 -07:00
Dirk Hohndel
0296a456b2 Hook up the code to toggle DC reported ceiling visibility
This got broken a long time ago it seems and no one ever noticed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-24 12:38:24 -07:00
Rick Walsh
7e09a6c7bc Separate VPM-B conservatism preference for planner and profile
Separate the VPM-B conservatism preference into diveplan.vpmb_conservatism for
planning dives and prefs.vpmb_conservatism for profile ceiling display of
saved dives.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-24 08:30:11 -07:00
Rick Walsh
7b891904e7 Rename conservatism_level to vpmb_conservatism
Make the variable purpose less ambiguous

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-24 08:29:56 -07:00
Robert C. Helling
1b57b6cc17 Separate method for heatmap color scaling
I separated out the color scaling and slightly simplified the expressions.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-17 13:42:46 -07:00
Rick Walsh
1cae1255d7 Allow heat map to zoom
Setting the pen to non-cosmetic means the painted width scales when zoomed

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-17 13:42:33 -07:00
Rick Walsh
ddc7f3dc98 Adjust heat map colour scale
Make the heat map use a colour scale similar to that by Kevin Watt, as used in
Simon Mitchell's presentation, Decompression Controversies
https://www.youtube.com/watch?v=UY61E49lyos&t=2090&authuser=0

Undersaturated: cyan -> blue ->purple -> black
Supersaturated up to M value: black -> yellow -> red
Exceeding M value: red -> white

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-17 13:42:08 -07:00
Robert C. Helling
893bea700c Introduce heat map
This replaces the tissue percentage graph that probably nobody ever
understood with a heat map like the one used in the discussion
of bubble model deco. The information shown is the same but the
saturation is now in the color while the tissue determines the y
position.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-17 13:39:54 -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
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
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
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
Dirk Hohndel
9aa7399c1d Now that we are building with C++11 we need override keyword
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-06-23 16:43:05 -07:00
Linus Torvalds
36a3f649c5 Don't show surface events at the beginning or end of the dive
That's just annoying and pointless.  So we arbitrarily say that surface
events within the first and last 30s of the dive are suppressed.

But we now do show them in the middle, in case the sampling rate is too
low, and the profile itself doesn't show that we got to the surface.

These heuristics still needs tweaking - if the profile already shows
that we're at the surface, then we should probably suppress the event
triangle.

But in the meantime this at least gets rid of the truly pointless cases.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-06-01 13:08:45 -07:00
Dirk Hohndel
eb07faef00 Only do 9 minute interval for min/max/avg
We don't use 3 and 6 minute values anywhere, so why calculate them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-20 15:55:51 -07:00
Linus Torvalds
e0ac1c9a26 Fix 3-, 6- and 9-minute min/max calculations
Make them use indices into the plot-info, fix calculation of average
depth, and fix and add comments.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-20 15:36:25 -07:00
Dirk Hohndel
176b92776b Silence warning
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-14 09:19:01 -07:00
Linus Torvalds
eff4059802 Start using the actual cylinder data for gas switch events
Now that gas switch events always have indices into the cylinder table,
start using that to look up the gas mix from the cylinders rather than
from the gas switch event itself.  In other words, the cylinder index is
now the primary data for gas switch events.

This means that now as you change the cylinder information, the gas
switch events will automatically update to reflect those changes.

Note that on loading data from the outside (either from a xml file, from
a git/cloud account, or from a dive computer), we may or may not
initially have an index for the gas change event.  The external data may
be from an older version of subsurface, or it may be from a
libdivecomputer download that just doesn't give index data at all.

In that case, we will do:

 - if there is no index, but there is explicit gas mix information, we
   will look up the index based on that gas mix, picking the cylinder
   that has the closest mix.

 - if there isn't even explicit gas mix data, so we only have the event
   value from libdivecomputer, we will turn that value into a gasmix,
   and use that to look up the cylinder index as above.

 - if no valid cylinder information is available at all, gas switch
   events will just be dropped.

When saving the data, we now always save the cylinder index, and the gas
mix associated with that cylinder (that gas mix will be ignored on load,
since the index is the primary, but it makes the event much easier to
read).

It is worth noting we do not modify the libdivecomputer value, even if
the gasmix has changed, so that remains as a record of the original
download.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04 22:37:18 -07:00
Dirk Hohndel
7be962bfc2 Move subsurface-core to core and qt-mobile to mobile-widgets
Having subsurface-core as a directory name really messes with
autocomplete and is obviously redundant. Simmilarly, qt-mobile caused an
autocomplete conflict and also was inconsistent with the desktop-widget
name for the directory containing the "other" UI.

And while cleaning up the resulting change in the path name for include
files, I decided to clean up those even more to make them consistent
overall.

This could have been handled in more commits, but since this requires a
make clean before the build, it seemed more sensible to do it all in one.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04 22:33:58 -07:00
Linus Torvalds
2d760a7bff Don't write back dive data that hasn't changed in git
This caches the git ID for the dive on load, and avoids building the
dive directory and hashing it on save as long as nothing has invalidated
the git ID cache.

That should make it much faster to write back data to the git
repository, since the dive tree structure and the divecomputer blobs in
particular are the bulk of it (due to all the sample data).  It's not
actually the git operations that are all that expensive, it's literally
generating the big blob with all the snprintf() calls for the data.

The git save used to be a fairly expensive with large data sets,
especially noticeable on mobile with much weaker CPU's.  This should
speed things up by at least a factor of two.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04 17:27:10 -07:00
Dirk Hohndel
dd0d88f9d7 QML UI: take device pixel ratio into account when scaling pixmaps on iOS
This way warning icons and tank change icons and other event markers are no
longer ridiculously tiny on retina screens. Oddly this doesn't appear to be
needed on Android, only on iOS.

Fixes #1033

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-28 17:05:29 -05:00
Dirk Hohndel
bff3588c25 Undo two more unsigned changes that are no longer needed
With this master should compile without signed / unsigned warning,
hopefully without any more breakage.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-23 10:11:39 -07:00
Rick Walsh
cbd332fbcc Profile widget: Display gradient factors used in plan
Currently, the gradient factors displayed at the top of the profile are the
gradient factors set in preferences.  This is correct for saved dives, but
when planning dives, the gradient factors displayed at the top of the profile
should be the gradient factors used in the plan.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-19 11:31:13 -07:00
Dirk Hohndel
032de3549d Clean up signedness confusion in tankitem.cpp
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-09 21:50:26 -08:00
Dirk Hohndel
28100e8b7e Clean up signedness confusion in diveprofileitem.cpp
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-09 21:50:26 -08:00
Dirk Hohndel
4156bc3651 Silence warnings in profilewidget2.cpp
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-09 21:50:23 -08:00
Tomaz Canabrava
0f386420e0 Silence warnings in divetooltipitem.cpp
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-09 11:43:53 -08:00
Tomaz Canabrava
309f0f722a Silence warnings in divepixmapitem.cpp
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-09 11:43:33 -08:00
Tomaz Canabrava
6f494964de Silence warnings in TankItem
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08 20:58:13 -08:00
Tomaz Canabrava
98e8a04d01 Silence warnings in Profilewidget2
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08 20:58:09 -08:00
Tomaz Canabrava
16320bb580 Silence warnings in DiveProfileItem
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08 20:58:05 -08:00
Tomaz Canabrava
dc6299185b Silence warnings in DiveEventItem
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08 20:58:02 -08:00
Tomaz Canabrava
07606160cb Silence warnings in DiveCartesianAxis
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08 20:57:52 -08:00
Tomaz Canabrava
39313c5b33 Clean up handling of various include file
This is in the context of the iOS port and shouldn't impact any of the
other builds.

[Dirk Hohndel: refactored the iOS patches]

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-06 11:03:00 -08:00
Dirk Hohndel
38ab11a6c0 Add option to allocate the samples in fake_dc()
We (ab)use fake_dc() to create a pleasing profile for a manually added
dive. Based on it's intended use, fake_dc() simply handed back a dc
structure that pointed at staticly allocated samples - that's obviously
(now that I think about it) going to blow up in my face if I edit a
manually added dive more than once.

So now we have an option for fake_dc() to actually allocate the samples -
this way the rest of the code can treat these samples as we would treat
samples created any other way. We can free them and replace them with a
new set.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-20 09:36:14 -08:00
Dirk Hohndel
17134be96d Profile: don't compile code that isn't needed on mobile
We were creating a couple dozen objects that we never needed and because
of that triggered several dozen callbacks whenever the model data changed.
All for UI elements of the profile that are either not used in the mobile
app (like the calculated ceiling or the partial pressure / tissue
saturation graphs), or are only useful when using the profile
interactively (which we also don't do on mobile).

I don't know if this will make a significant impact on performance, but it
seems like the right thing to do either way.

A positive side effect is that the odd blue line on top of the rendered
profile is gone as well.

Fixes #1007

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-06 13:29:31 -08:00
Rick Walsh
8facdc62fd profile-widget: use smaller event icons on Subsurface-mobile
Smaller event icons fit the mobile display much nicer

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-05 22:02:24 -08:00
Dirk Hohndel
130f4cd7ac Do not run the deco calculations in the mobile app
We don't show the calculated ceilings and calculating them is compute
intensive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-05 20:45:18 -08:00
Tomaz Canabrava
411f455291 Fix bug on the visibility of the Ruler Graph
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-25 13:04:39 -08:00
Tomaz Canabrava
7433396333 Fix Ceiling Graph
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-25 13:04:32 -08:00
Tomaz Canabrava
49332bc635 Fix Display / Hide Calculated Ceiling
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-25 13:04:24 -08:00
Tomaz Canabrava
2d3f7f0a90 More Profile Itens on the new Settings
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-25 13:04:21 -08:00
Tomaz Canabrava
2d96139566 Changed quite a few shorts to bool on the c++ implementtion
The shorts where being used on the preferences since a long
while and we cannot just simply change them to bool since this
could break the preferences files, so work around that by
changing them to booleans, since it's the correct type for a
true / false answer.

Also, move some plot curves to the new settings style

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-25 13:04:16 -08:00
Tomaz Canabrava
2c5fad73e8 Start to use the QSettings ObjectWrapper
start of the QSettinsg Object Wrapper usage on the code
this first patch removes two macros that generated around
200 lines in runtime for something like a quarter of it
Basically, whenever we changed anything we called the
PreferencesDialog::settingsChanged and connected everythign
to that signal, now each setting has it's own changed signal
and we can call it directly.

The best thing about this approach is that we don't trigger
repaints for things that are not directly profile related. (
actually we still do, but the plan is to remove them in due time)

this commit breaks correct atualization of the profile (because
everything was connected to PreferencesDialog::settingsChanged)
and now I need to hunt a bit for the correct connections

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-25 13:04:01 -08:00
Tomaz Canabrava
219299dc01 Correctly handle SubsurfaceMobile
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08 08:04:24 -08:00
Joakim Bygdell
f747abaeb2 Small changes to the profile
Due to the small screen of mobile devices,
the positions of the temperature graph and the time axis needs to be shifted
upwards a bit to prevent them from overlapping with the dive computer name.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-05 10:58:11 -08:00
Dirk Hohndel
3a670f8c3b QML UI: don't show "1 of n" for multiple dive computers
This is actually not a change in the QML - it just conditionally compiles out
the code when building Subsurface-mobile.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-27 10:06:32 -08:00
Lubomir I. Ivanov
491ef7edc8 diveprofileitem.cpp: fix unused variable warning on mobile
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-06 12:28:01 -08:00
Lubomir I. Ivanov
2aed907525 profilewidget2.cpp: hide the heartbeat graph on an empty state
Opening Subsurface for the first time with heartbeat graph visible
and then immediately doing File->New shows the logo/background in the
profile space while hiding everything except the heartbeat graph.

This patch makes sure that the graph is hidden with everything
else on an empty profile state.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-06 12:19:44 -08:00
K. \"pestophagous\" Heller
2778470b97 Prevent gaschange tank icons from using garbage coords.
Tank icons were shown at incorrect spots on the profile
when the DiveEventItem object held a pointer to a struct
event even after the struct event at that address had
been freed.  When internalEvent is a pointer to freed
memory, internalEvent->time.seconds could have all kinds
of crazy values, which get used in member function
DiveEventItem::recalculatePos to place the tank at bad
x coordinates.

The DiveEventItem(s) no longer store a pointer to memory
that they do not own.  This way, no matter how the path of
execution arrives into slot recalculatePos, we never need
fear that the DiveEventItem will dereference a garbage
pointer to a struct event.

Fixes #968

Signed-off-by: K. Heller <pestophagous@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-03 22:56:23 -08:00
Dirk Hohndel
63eff39edd QML-UI: turn of some profile features
We don't have a tooltip on the QML UI as it's rendered into a pixmal.
We also don't need the timer as we don't need the TTS calculations.
And we don't need the acrobatics to figure out if we're in the planner as
we don't support the visual planner (or any planner, at this point) with
the mobile UI.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-01 15:37:28 -08:00
Dirk Hohndel
9dd26a00e8 Profile: avoid potential crash
If things go as planned, then the length of the polygon is the same as the
number of rows in the model. Turns out when running Subsurface-mobile on
Android that simple truth doesn't seem to be correct. Most of the time
the polygon seems to have twice as many elements as the model. But a few
times I ended up in here with a polygon that had fewer elements than the
model. And then things crash.

This simply avoids the crash.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-01 15:20:32 -08:00
Robert C. Helling
d8e38764fd Drag and Drop Images
Now that we have the possibility to add images without meaningful
time stamps to a dive, we should let the user provide that time
offset manually. This patch allowed pictures to be dragged from
the image list to the profile.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-24 09:22:16 -08:00
Lubomir I. Ivanov
f5dbc3b44d Planner: support profile in planner print
The "Print" button in the planner dumps the QTextEdit to
a QPrinter via ::print(). This patch renders the Profile
to a Pixmap which is inserted as Base64 stream in an <img>
tag and fed on top of the QTextEdit HTML contents.

This route preserves the planner notes as text in PDF prints.
The quick alternative is to render the QTextDocument to
a QPixmap as well, but that will not preserve the text
and pagination becomes manual.

Possibly the QTextDocument can be rendered as a QPicture
but pagination is still an issue, while so far there is exactly
one user requesting this feature!

Related small change in ProfileWidget2:
Explicitly hide the tooltip when printMode is true.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-15 21:07:27 -08:00
Sebastian Kügler
52b8cb5aa9 profilewidget2: Only add actions in desktop version
This fixes a bunch of warnings in the mobile version where these slots
are not defined (see the corresponding header's conditionals).

Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-11 19:05:33 -08:00
Lubomir I. Ivanov
003ddc6b52 divetooltipitem.cpp: prettify the tooltip bounds and padding
When the tooltip is expanded, not enough padding is present right
from the text and bottom from it, making the tooltip border
appear very close to the text.

When the tooltip is collapsed (no time entries) it clips
the graph/pixmap which makes the graph bottom left corner appear
to be outside of the tooltip, mainly because of the white border
of the tooltip background and the background rounding.

To prevent these visual artifacts and to prettify the tooltip
this patch:
- makes the rounding 8 instead of 10 of the background rectangle
- doubles the padding left and right from the pixmap
(the above two pretty much move the pixmap bottom left corner
away from the rounded bottom left edge of the tooltip background)
- add more padding right and bottom from the text
- never reduce the height of the tooltip to be smaller than
the graph/pixmap height.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-10 09:08:57 -08:00
Lubomir I. Ivanov
e2550de5e6 profilewidget2.cpp: remove unused variables
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-11-07 22:26:32 -08:00
Dirk Hohndel
bb566f7798 Don't connect to the PreferencesDialog in Subsurface-mobile
Just more untangling from the desktop UI.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-06 10:20:18 -08:00
Dirk Hohndel
7e5b66d2c4 Remove more unnecessary include file references
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-06 10:04:17 -08:00
Lubomir I. Ivanov
788b3289e9 remove some mainwindow.h includes
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-06 09:58:46 -08:00
Lubomir I. Ivanov
8e7be1b50a Untangle DiveCalculatedCeiling from MainWindow
DiveCalculatedCeiling is the last class the references
MainWindow in the profile-widget stack.

In modelDataChanged() it looks for the information()
widget and sets a slot for the dateTimeChanged() signal that
information() emits.

To solve the issue we make DiveCalculatedCeiling recieve
a ProfileWidget2 reference and make ProfileWidget2 emit
the dateTimeChangedItems() signal.

ProfileWidget2 itself listens for the dateTimeChanged()
signal that information() emits and emits dateTimeChangedItems()
to notify any possible children/item listeners in the
ProfileWidget2::dateTimeChanged() slot.

The connection between ProfileWidget2 and information()
is set in MainWindow. This makes DiveCalculatedCeiling
unaware of MainWindow and which class originally emits
the dateTimeChanged() signal to ProfileWidget2.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
--
Think delegation.

Tomaz, please take a look at this one, to double check
if i messed up.

also i have zero idea how the mobile app is setting these
connections, if it does so even.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-06 09:58:34 -08:00
Lubomir I. Ivanov
61e768036e This patch reverts ae709ab30e
things like:

potentially, for every item interested in 'printMode'
can clutter the profile-widget stack a lot.

instead the items should be aware of the profile widget
instance and not MainWindow.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-06 09:58:17 -08:00
Lubomir I. Ivanov
6d7eefd52d Untagle DiveCartesianAxis from MainWindow
DiveCartesianAxis and derivatives can recieve
ProfileWidget2 as an instance in their constructor.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-06 09:58:08 -08:00
Dirk Hohndel
ae709ab30e Untangle profile from MainWindow: work around print mode
Since we don't support printing in subsurface-mobile this solves the
problem at hand - but it doesn't do what we really want which is to
untangle the Profile from the MainWindow.

Partial credit.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 21:20:10 -08:00
Dirk Hohndel
3ef9e07380 Profile: include Qt headers directly
No reason to include mainwindow.h

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 17:05:30 -08:00
Dirk Hohndel
f3232b1a6f Profile: don't compile the desktop specific parts on mobile
When building subsurface-mobile we won't be using all these UI elements,
so let's not build them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 16:05:44 -08:00
Dirk Hohndel
662e2a0ff3 Profile: add define when building subsurface-mobile
This way we can conditionally compile out more dependencies on desktop
widgets.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 16:05:19 -08:00
Dirk Hohndel
332e484d68 Untangle Profile from MainTab
This one was easy.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 15:20:05 -08:00
Dirk Hohndel
e7edaea4f8 Untangle Profile from MainWindow: edit current profile
And action can't not just trigger a slot, it can also send a signal.

With this there is no reference to the MainWindow left in the profile.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 13:45:51 -08:00
Dirk Hohndel
2b9316e16a Untangle Profile from MainWindow: update main tab via signal
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 13:45:51 -08:00
Dirk Hohndel
4ec5ce4c7a Untangle Profile from MainWindow: remove silly indirection
Ummm. What? That one was awesome. This seems easier :-)
MainWindow::instance()->graphics() is a way to retrieve a pointer to the
profile widget...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 13:45:51 -08:00
Dirk Hohndel
e70e34801e Untangle Profile from MainWindow: make profile the parent of dialogs
I don't quite know why these were parented to the MainWindow - I bet
there's a very clever reason that I'm missing...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 13:45:51 -08:00
Dirk Hohndel
e28f171731 Untangle Profile from MainWindow: refresh display
Instead of directly calling into the MainWindow, redirect this via a
signal so Subsurface mobile can hook it up as needed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 13:45:51 -08:00
Dirk Hohndel
281a0a945a Untangle Profile from MainWindow: add missing header
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 13:45:51 -08:00
Dirk Hohndel
1013ba39c5 Untangle Profile from MainWindow: shortcuts
This, too, should be done with signals.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 13:45:50 -08:00
Dirk Hohndel
000c9cc21c Untangle Profile from MainWindow: turn off tts/ndl calculation
I'm not sure we can ever run into this issue anymore since we stop
calculating TTS / NDL past 2 hours, but I guess on a fairly slow CPU this
still could take too long.

But instead of calling into MainWindow let's just change the setting right
here and add a signal to show the notification - that way we can use the
appropriate way to make such notifications on the mobile app.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 13:45:50 -08:00
Dirk Hohndel
eb2e76a691 Remove dead code
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 13:45:50 -08:00
Dirk Hohndel
081295cb40 Untangle Profile from MainWindow: files on command line
There's no reason why this should be on the MainWindow widget.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 13:45:50 -08:00
Dirk Hohndel
533d724d1b Profile: begin untangling from MainWindow
Use a signal to turn the toolbar on or off.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 13:45:50 -08:00
Guido Lerch
889fa1e4cc Context menu for images: small fix
Required change within DivePictureItem, adding update
parameter defaulted to true in this case.

Signed-off-by: Guido Lerch <guido.lerch@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-03 08:31:41 -08:00
Dirk Hohndel
8ea7f40457 Merge branch 'cmakeAndPreferences' 2015-11-02 19:54:34 -08:00
Tomaz Canabrava
ff57881265 Preferences: Remove the old dialog and use the new one
The new preferences dialog still needs a bit of fine tuning
but should already work.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-02 12:52:15 -08:00
Tomaz Canabrava
1d6683f3e0 Move Profile widget out of desktop-widgets
The reason for that is, even if profile widget is made with qpainter
and for that reason it should be a desktop widget, it's being used
on the mobile version because of a lack of QML plotting library that
is fast and reliable.

We discovered that it was faster just to encapsulate our Profile in
a QML class and call it directly.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:49 -07:00