Commit graph

227 commits

Author SHA1 Message Date
Tomaz Canabrava
dfaa302383 Make ruler respect dive depth.
The only place on the code that the y() position didn't accompanied the
dive-depth was this one, so let's see if this patch fixes it.

See #455

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-20 09:48:34 -07:00
Lubomir I. Ivanov
71f2fd91b5 Profile2: fix widths on some lines for Qt5
Qt5 uses different widths for some of the poly. lines
in the profile. Setting an explicit value fixes that.

Tested-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-19 09:37:12 -07:00
Lubomir I. Ivanov
6d6721dc9b Profile2: use unsigned int for the divecomputer number
display.h: dc_number is unsigned int, thus a couple of warnings
may pop-out.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-18 11:56:06 -07:00
Hugle
a908186716 Clear PN2 PO2 PHE GasItem
After the dive log has been closed, the ProfileWidget2 does not clear
the pn2 po2 and ph2 gas line.

This patch cleared the three lines after dive log closed.

Acked-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Hugle <wulong@comp.nus.edu.sg>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-18 11:49:57 -07:00
Linus Torvalds
37794e2e23 Be more careful about dive computer selection
The selection logic was a bit random: some places would return NULL if
the dive computer index was out of range, others would return the
primary dive computer, and actually moving between dive computers would
just blindly increment and decrement the number.

This always selects the primary computer if the index is out of bounds,
and makes sure we stay in bound when switching beteen dive computers
(but switching between dives can then turn an in-bound number into an
out-of-bounds one)

Fixes #464

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-17 10:53:49 -07:00
Dirk Hohndel
60ceb8ebc1 Silly change to a comment
I had intended to amend the previous commit with this before pushing it
out. This changes the comment that pointed out the bug that the previous
commit fixed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-17 10:53:12 -07:00
Dirk Hohndel
33b1b0ed9d New profile: fix event hiding logic
Turns out we unconditionally set all events as visible when redrawing the
dive - even with a comment that this should take into account if the event
is visible. Oops.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-16 15:11:35 -07:00
Dirk Hohndel
401aa210ff New profile: add event manipulation to context menu
This got lost when we switched to the new profile.
Remove event works. Hide events does call hide() on the DiveEventItem but
for some reason it stays visible. I'll hope for one of the more
experienced Qt people to fix that.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15 21:12:34 -07:00
Jan Mulder
aa0cd792bb Bugfix: generalize pp graphs to allow for multi over-threshold periods
Especially in O2 decompression parts of a dive, the pp02 is typically very
close to the threshold value (normally 1.60 bar). The old implementation
of the pp profile graphs assumes that there is exacty 1 consecutive set of
samples that needs to be in the "warning color". This results in an
erroneous display of the mentioned graphs, connecting multiple episodes of
too high pp with bogus lines in between.

This fix generalizes the pp graph logic to allow for multiple segments of
high pp, each to been drawn seperately in the "warning color".

Signed-off-by: Jan Mulder <jlmulder@planet.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15 12:07:34 -07:00
Dirk Hohndel
ae2f18678d New profile: fix Information overlay location
By simply storing the coordinates based on the scene (instead of trying to
map them to real coordinates) the overlay position is correctly restored.

Also remove the redundant positioning before readPos is called.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-13 10:28:15 -07:00
Lubomir I. Ivanov
4abe9d5c8b Profile2: place the ruler and tooltip on top (Z order)
The topmost Z order of items in the profile should be:
- background (poster / logo)
- toolTipItem
- rulerItem
...

This mostly fixes the ruler being under other elements.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-12 11:25:23 -07:00
Lubomir I. Ivanov
f2bfc72648 Ruler: change how the ruler text drawing works
A couple of problems with the ruler:
- the rotated text doesn't look very well at all and interpolation doesn't
  help it much
- measuring towards the right most part of the profile makes the text go
  out of the screen

To solve these issues and attempt to improve the ruler this patch does the
following:
- place the text at the bottom of the lowest of the start and end points.
  this way the line will never intersect with the text
- clamp the x position, so that the text doesn't ever leave the screen
  horizontally
- place a white background behind the text so that it will cover text and
  graphics under the ruler item

(TODO: place the ruler on top of everything else)

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-12 11:24:20 -07:00
Tomaz Canabrava
9cc942376e Only anim if not first dive when openning subsurface with a divelog.
The animation appeared when the user started subsurface with a default
file, wich was a little annoying since it didn't had a 'from' position
to go and it was also increasing it's size on some window managers
that do subtle windows animations when a program starts. This patch
treats the first dive opened when the program loads with a divelog pa
rameter differently as the following ones storing the velocity value
on a temporary, and reassigning it later.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-11 17:42:42 -07:00
Tomaz Canabrava
751c76a578 Support save / load for the Animation Speed on the Preferences
User can now fine-tune the animation speed on the preferences,
a value of zero disables it completely.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-11 17:41:41 -07:00
Tomaz Canabrava
9f37bac07a Support Animation Speed via Settings.
This is very userfull for a ( yet to be implemented )
preference dialog about the animation speed, so the
user can enable / disable the animations or make it a bit
faster for it's taste.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-11 17:41:41 -07:00
Lubomir I. Ivanov
466f160c01 Profile2: provide means to disable the tool buttons
Once the poster is displayed when there are no dives in the list,
we may also want to disable the QToolButtons (PO2, SAC, etc..),
until a new dive is loaded and the profile is redrawn.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-11 11:30:31 -07:00
Lubomir I. Ivanov
41cec17cff Profile2: reset the zoom level when a new profile is drawn
If the user has zoomed in but then changes to a new dive,
we may want to reset the scale back to the original value (1.0)
based on the current zoomLevel, so that the profile is not stuck
in zoomed mode.

This patch adds a snippet that resets the QGraphicsView scale,
zoomLevel variable and also the toolTip position.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-10 09:02:31 -07:00
Lubomir I. Ivanov
324b8cbff1 Profile2: use a different image when no profile is visible
This patch adds a new image resource named poster.png which,
is shown instead of the 3 posters. The main reason for that
is due to the poster text not being visible. This new image
is pretty much the Subsurface logo only.

It also removes the grid lines, while the poster is visible.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-10 09:02:25 -07:00
Lubomir I. Ivanov
7d9849cfed Profile2: use an implicit initializer for a struct array
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-10 09:02:01 -07:00
Lubomir I. Ivanov
0325b267ee Profile2: fix some initializer list order warnings
Such can be disabled with -Wno-reorder and are clearly
more of a nuisance, but C++98 12.6.2.5 says the order should be
the same as in the class declaration.

On theory this would only speed the compile times a tiny amount.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-10 09:01:58 -07:00
Tomaz Canabrava
a052c63b00 Fix retrieving the initial position of the Notification Area.
We had all in place, all that was missing was to actually load
the position stored on the settings for the tooltips.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-09 08:50:54 -07:00
Tomaz Canabrava
24c5b2e3c1 Code Cleanup ( that fix 2 bugs )
This code cleanup fixes the two issues that I raised on
my last e-mail. hurrah.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-09 08:50:54 -07:00
Tomaz Canabrava
00c97e710f Remove a Lot of Dead Code.
This is just removal of dead code from the old profile, probably there's
still a bit more to remove, but this is a very good cleanup already.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-07 08:56:06 -08:00
Tomaz Canabrava
ac9a23ef3b Remove the old profile from the main screen of Subsurface
This patch partially removes the code for the old profile from
Subsurface. It removes the use of the old profile on the mainwindow,
but keeping the code in the tree for now.

A bit of code-cleanup also entered this commit because I had to change
every instance of the code that used the old profile.

Now to the real code-cleanup

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-07 08:54:20 -08:00
Tomaz Canabrava
6dec4b0556 Fix a crash on changing dives when the ruler is used.
The ruler is a weird beast - it has two child objects that access the
parent to call another function, that call the child functions.

When I updated the plot_info I didn't take that into consideration, what
happened is that when I set the parent's plot_info, the children's
plot_info are still invalid, but the update method is called anyhow.

This patch updates all plot_info's before calling anything else.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-07 08:53:14 -08:00
Dirk Hohndel
7c535452f9 Whitespace cleanup
Minor change to the perl postprocessing script and resulting changes to
the affected source files.

This deals with two issues:
- "foreach"-like structures were not always treated correctly
- some longer calculations that ended on "+ constant" were reformatted in
  a rather unatractive manner

In one source file (divelist.c) I ended up adding braces to the sources...
trying to cascade the indentation further down without having the block
there seemed a lot more trouble than it's worth.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 13:29:22 -08:00
Gopichand Paturi
9b07acbee8 Add Units to mean depth value
Fixes #445

Signed-off-by: Gopichand Paturi <gopichandpaturi@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-02 08:16:29 -08:00
Dirk Hohndel
76e6420f6b Massive automated whitespace cleanup
I know everyone will hate it.
Go ahead. Complain. Call me names.
At least now things are consistent and reproducible.
If you want changes, have your complaint come with a patch to
scripts/whitespace.pl so that we can automate it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 20:09:57 -08:00
Tomaz Canabrava
006265d7a0 Try to fix the font issue on the ruler.
This changes the ruler a bit, I hope nobody gets offended by it. :)

The main issue is that the scene is now 100x100 pixels wide, so the font
was *really* huge. and setting itemIgnoresTransformations on the ruler
broke a lot of stuff.

I removed the code that painted the text and created a QGraphics TextItem
for that - that will hold the text for the ruler.

Then I played with the view to get the correct angle of the line, that was
in scene coordinates and thus, could not be used directly on the item that
had ignore transformation changes.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 18:57:48 -08:00
Tomaz Canabrava
a4d0f7bdb3 New profile: Make the ruler work. (caution, fonts are BIIIG )
This patch makes the ruler work again, the problem is that the fonts are
*terribly* big, I'll fix that on the next commit.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 12:03:59 -08:00
Tomaz Canabrava
0a24e13469 Remove the pInfo pointer, make it a real structure instead.
This fixes the invalid pointer stage crash.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 12:03:34 -08:00
Tomaz Canabrava
c356fac3b6 New profile: Toggle on / off the ruler via settings.
This patch toggles on / off the ruler via QSettings.
When the user clicks on the toolbar, this sets the settings to true /
false, in a way that if the user turns Subsurface on/ off, we still get
the last choosed option.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 10:48:47 -08:00
Tomaz Canabrava
35e102b176 New profile: add the RulerItem
This patch adds the RulerItem inside of the new profile, and already takes
settings into consideration.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 10:48:47 -08:00
Tomaz Canabrava
250653a67f New profile: DiveRuler compiles / not working yet.
This patch removes the GC macros and change the calling to use the
DiveCartesianAxis.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 10:48:47 -08:00
Tomaz Canabrava
52fe9101c8 New profile: add placeholder code for the RulerItem
This patch just creates two files for the rulerItem, a .h and a .cpp.
nothing was done to make it visible on the new profile yet - will do that
on the next commits

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 10:48:47 -08:00
Tomaz Canabrava
1695894130 New profile: connect the scale action
Just quick'n dirty glue code so that when the user clicks on the 'scale'
toolbar item, the new profile graphic is scaled.

Lovely thing: Animations for free. <3

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 10:48:47 -08:00
Dirk Hohndel
30b25d1212 New profile: create fake DC if we have no samples
This call got lost when creating the new plot_info structures.
dives/test15.xml is a good test case.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-26 11:43:56 -08:00
Dirk Hohndel
67a1e3f3e0 New profile: try to pick better HR samples for which to print number
This simply tries to pick at least local minima / maxima.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-25 14:24:09 -08:00
Dirk Hohndel
21ed18816a New profile: fix tooltip display for events
We need to use the transform() of the view, not the tooltip.

Suggested-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-25 13:58:57 -08:00
Dirk Hohndel
eb5cbf64eb New profile: small cleanup of heartrate code
Remove unused variable and correct comment.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-25 13:30:00 -08:00
Dirk Hohndel
c0e489c1ea New profile: add event info to tooltip
This appears to correctly add the tooltip to the event item, but for some
reason the tooltip isn't displayed for most events.

Still needs more work.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-25 12:27:12 -08:00
Dirk Hohndel
b5a02e50aa New profile: create new class for DiveHeartrateItem
This allows us to give it a different color (red) and make it a smaller
size.

While implementing this I also fixed the size of the temperature text in
the new profile.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-23 15:28:31 -08:00
Dirk Hohndel
76393a2f53 New profile: better positioning for the heartrate labels
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-23 14:36:47 -08:00
Dirk Hohndel
41abab7253 Calculate minimum and maximum heartrate
And setup the axis accordingly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-23 14:32:25 -08:00
Dirk Hohndel
f5862201a8 Don't try to setup event if it is NULL
This also fixes the whitespace in a function that I instrumented to figure
out what's going on. I restored it to its original state, but I couldn't
leave the whitespace unfixed...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-23 08:35:06 -08:00
Dirk Hohndel
48db63736b Don't try to set visibility of events before they have been added
Admittedly this code doesn't do anything useful right now, but at least
have it not to anything useful in the right spot.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-23 08:33:58 -08:00
Robert C. Helling
0474fe70fc New profile: add image pixmaps for image events
For reasons that I don’t understand, the image is only shown if the event
happens to be at the same time as a depth sample. This is, however, not
specific to these image events, it seems to apply to all events.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-22 13:11:40 -08:00
Tomaz Canabrava
508cbc82b8 Implement the rest of the heartbeat.
The only thing that was missing was the size of the vertical axis. I'm
setting a small line on the bottom of the temperature axis, since both
have blue color, this will not make people think one is the other.

TODO: change the color to red.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-19 20:58:48 -08:00
Dirk Hohndel
fd1a62568b New profile: partial addition of heartrate
This was done during an IRC hacking session with Tomaz.
It compiles, it shows something but not the right graph.
Committed here so Tomaz and I can continue to work on it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-19 17:19:57 -08:00
Dirk Hohndel
08490785b2 Only recalculate the tooltip if time has changed
Small optimization, but seems to make sense.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-19 16:06:16 -08:00