Commit graph

405 commits

Author SHA1 Message Date
Giuseppe Bilotta
32ab2b34d3 Unify icon metrics
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-18 15:16:15 -07:00
Giuseppe Bilotta
72b256de62 actually use defaultIconSize()
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-18 15:16:11 -07:00
Giuseppe Bilotta
d8f756fe14 Dynamic ToolTipItem metrics
Instead of hard-coding the icon sizes and spacing, compute them from the
font sizes, that Qt auto-computes from the displya DPI.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-18 15:15:53 -07:00
Anton Lundin
3b30009d7a Remove unused variables
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-12 12:34:40 -04:00
Linus Torvalds
df4e26c875 Start sanitizing gaschange event information
Decode the gasmix data into a sane format when creating the event, and
add the (currently unused) ability to specify a gas change to a
particular cylinder rather than (or in addition to) the gasmix.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-12 07:45:37 -04:00
Joakim Bygdell
00c3b8dbaa Untangle the graphs at the bottom of the profile.
When multiple graphs are displayed at the same time they end up being printed on top of each other.
Scale the lowest graph to accommodate the tankbar.
Add an intermediate scaling step to the depth axis when pp graphs or the tissue graph are visible.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-10 02:41:26 -04:00
Tomaz Canabrava
2b760bdd39 Fix crash when moving the mouse over the profile when no dive is shown
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-20 18:35:08 -07:00
Robert C. Helling
15a99f8789 Add tissue saturation plot to tooltip
This adds a graphical representation of tissue loadings at the current moment during the dive
to the tooltip box. The layout is inspired by the Sherwater Petrel.Add tissue saturation plot to tooltip

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-19 21:48:05 -07:00
Robert C. Helling
3fc9c1e005 Tissue saturation plot a la Sherwater Pretel
This adds a toolbox icon to turn on a tissue plot inspired by the bar
graph of the Sherwater Petrel,

It shows the inert gas partial pressures for individual compartments. If
they are below the ambient pressure (grey line) they are shown in units of
the ambient pressure, if they are above, the excess is shown as a
percentage of the allowed overpressure for plain Buehlmann. So it has the
same units as a gradient factor. Thus also the a gradient factor line (for
the current depth) is shown.

The different tissues get different colors, greener for the faster ones and bluer
for the slower ones.

Positioning and on/off icon action still need some tender loving care.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-19 21:46:30 -07:00
Robert C. Helling
d6abb739d9 Helper function for partial pressure calculation
This patch introduces a new structure holding partial pressures (doubles in bar) for
all three gases and a helper function to compute them from gasmix (which holds fractions)
and ambient pressure. Currentlty this works for OC and CCR, to be extended later to PSCR.

Currently the dive_comp_type argument is unused.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-18 06:20:25 -07:00
Tomaz Canabrava
9acf1caca3 A much better Toolbar for the profile.
Using QToolBar I was able to remove much of the dead code
from the mainwindow.ui xml file by transforming the QToolButtons
into actions and loading them dynamically in the .cpp code.
I couldn't use the designer for this ( as I wanted ) because
Qt has no notion of ToolBars outside of the areas where the
MainWindow should have one, and we use it in a very different
area.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-23 08:09:11 -07:00
Dirk Hohndel
fb371c0633 TankBar: don't risk dereferencing stale pointers
Basically we could end up in a situation where the plotInfo is no longer
valid, yet the model changes and triggers a redraw before the new data is
passed into the TankBar.

Instead of chasing that race condition it seemed much easier to just copy
the plot_data entries and the gas information in the dive.

Fixes #716

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-23 07:23:42 -07:00
Dirk Hohndel
0b5e3389e2 Make sure tank bar button triggers tank bar
This worked flawlessly on Mac and Linux, but on Windows I needed to add
the explicit setVisible here - not quite sure why.

Fixes #710

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-21 07:52:14 -05:00
Dirk Hohndel
642ad1e0fe Fix crash when calling the planner twice in a row
Turns out that the fix in commit f7119bdccf ("Planner: make sure no old
handles are around when entering Add/Plan") was incorrect. We ONLY want to
remove the existing handlers when we re-plan a dive, NOT when we call add
or plan.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-19 21:57:15 -05:00
Dirk Hohndel
f7119bdccf Planner: make sure no old handles are around when entering Add/Plan
In some cases we don't appear to remove all of the old handles from the
scene and end up showing a handle from a previous instance of the planner
in the upper right corner of the profile.

This patch makes sure that we remove any stray handles that might still be
around before entereing plan or add mode.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-19 21:18:26 -05:00
Dirk Hohndel
88fe28636e TankBar: make outline zero-width
In some circumstances Qt will draw a really thick border around
rectangles. This explicitly makes the border of the tank bar thin.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-18 11:47:18 -05:00
Dirk Hohndel
e8d430341c TankBar: hook into prefs and make ppGraphs resize accordingly
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-15 08:11:14 -06:00
Dirk Hohndel
e71119b40b TankBar: use the itemPos as intended
Which actually makes the code much clearer as now the object is at the
correct spot on the canvas and the positions inside are relative to that.
No more magic gradiants starting at "92"

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-15 07:30:31 -06:00
Dirk Hohndel
87ca15c5c3 Add gas text to tank bars
Also restructures the code a bit to make it a little more sane and changes
the colors slightly.

With these changes I think we can claim that this
Fixes #557

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-14 22:39:47 -06:00
Dirk Hohndel
fa3c18d83b Add initial support for a visual tracker of gas used
This shows a color-coded bar at the bottom of the graph that corresponds
with the active gas.

Todo:
- text that explicitly states gas on the left edge of the bar
- better vertical positioning of the bar
- ability to turn this on and off

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-14 18:22:27 -06:00
Tomaz Canabrava
44f59b6022 Move the Trash bin to the topRight on the pictures
It was too easy to remove a picture by mistake, not anymore.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-07 13:12:32 -07:00
Tomaz Canabrava
68af9f0afb Delete pictures from the Widget by pressing delete
Select the picture, press delete, profit.

[Dirk Hohndel: removed the stray hunk that snuck into this patch]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-06 18:32:28 -07:00
Dirk Hohndel
b0addb4567 Show the cross hair only when planning or adding a dive
In normal profile mode it's rather redundant and clatters the profile.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-06 12:33:36 -07:00
Dirk Hohndel
4c252d8e23 Remove unused static function
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-06 10:59:26 -07:00
Dirk Hohndel
98e374e65a Fix order of initialization warning
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-06 10:54:37 -07:00
Robert C. Helling
71bed5022c Don't zoom the profile when the left button is pressed
This prevents zooming out to more than max in the planner. Using a Mac
MagicMouse it happens at times that the finger slides on the mouse while
dragging a waypoint which can result in zooming out further than max.

Fixes #695

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-06 06:21:24 -07:00
Dirk Hohndel
ebf1b8f624 Make the cross hair less obnoxious on Mac
While on Linux it was drawn as fine 1px line, on Mac it came out rather
fat and obnoxious by default. With this it's always set to a very thin
line.

This still needs more work, but let's leave it where it is for Beta 5.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-05 15:47:02 -07:00
Tomaz Canabrava
eb4e64d22a Add lines that follow the mouse helping see time and depth.
This was missing from the conversion from the oldPlanner
to the new one, and it also works ok on the profile.

One thing is missing is the Labels on the bottom / left
saying which position it is, but it's already userful.

Fixes #674

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-05 14:43:18 -07:00
Dirk Hohndel
4583cd8e09 Picture handling: cleaning up the mess
We had pointers to data structures on the stack which we frequently
reallocated. These data structure contain basically a filename and an
offset. We then create a hash of the pointers to those datastructures with
the filename being the key. And then we passed those pointers around
through a Qt model(!!!) only in order to then later look up by filename
what the offset might be.

I am at a loss for words for the lunacy behind this design.

How about we just remember the offsets and pass the integers around?

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-05 12:37:14 -07:00
Dirk Hohndel
3adbff2320 Picture handling: hide the pictures before deleting
Because of the way deleteLater() is implemented, the pictures need to be
hidden, otherwise they might stay around at the wrong time (e.g., when
printing).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-05 11:42:19 -07:00
Dirk Hohndel
4a76c3b8df Profile: Don't disconnect too many signals
If we disconnect the picture releated signals then in dive add and dive
plan mode the pictures from the last shown dive could appear on the
profile. That's not cool.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-05 11:34:38 -07:00
Dirk Hohndel
825eb019ab Planner: show mean depth
Almost invisible, mostly looking like an odd bug in the profile code,
there was a tiny red line at depth 0 in the planned profile. Turns out
that was the missing mean depth. We didn't populate enough data in the
dive computer of the dive we generated from the plan (and the length of
the depth line was incorrectly determined by the duration of the dive
instead of the duration stored in the dive computer).

Fixes #570

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-04 07:36:07 -07:00
Tomaz Canabrava
7bf63c5b0b Add a new 'show' Animation, and use it on the close button.
The error with 'ungrabMouse' warning that we got was because
we were removing an item that had the mouse grab instead of
waiting a few milisseconds so it won't be the mouse grabber
anymore.

So I'v used the Animations::hide() to get rid of it, and
since it worked well, I'v also added a Animations::show()
method to display it in a good fade-in way.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-30 14:15:09 -07:00
Tomaz Canabrava
3b9bceacb6 Implement the functionality of remove_picture.
Added the remove_picture functionality, with code
shamelessy stolen from remove_event, and hoock it
up with the interface.

Fixes #650

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-30 12:52:31 -07:00
Tomaz Canabrava
1e6986d870 Instead of holding the index, hold the URL.
Since the idea is to remove the picture in the future, we need
to not hold the row on the model, as when we delete one, the
other pictures will change the row. but the QUrl is unique.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-30 12:34:43 -07:00
Tomaz Canabrava
75aafdc715 Added a button to hide a picture from the dive.
This patch hides a picture from the dive, it should actually
remove it, but because I didn't found a quick way to remove
a picture from the dive yet, it just hides it.

To remove a picture from the dive, the DivePictureItem has to
remember the QUrl of the original file, to remove that from the
model, and currently it only has the QPixmap.

this can be for 4.2.1 or we can postpone 4.2 a tiny bit since this
is a important feature.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-30 12:34:39 -07:00
Dirk Hohndel
74d89fc818 Planner / Add dive: hide handler after removing it
Otherwise users can still interact with it.

Fixes #648

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-30 09:31:22 -07:00
Tomaz Canabrava
fcbe6bfc13 Do not show the heartrate info unconditionally.
use the preferences instead.

Fixes #664

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29 15:44:37 -07:00
Tomaz Canabrava
f0f8b91c00 Make the Axis set the changed flag when a new line is set
This was preventing the recalculation of the ticks, making the
line static when we enabled or disabled the PP graphs.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29 15:33:00 -07:00
Tomaz Canabrava
078332bae1 Change the Ruler text values when metric system changes.
"ups", as I did this in Metric system I forgot to update
to imperial when the user selected it.

Fixes #665

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29 13:06:19 -07:00
Sergey Starosek
d9e16ecd2d Another string to translate
[Dirk Hohndel: took only one of the two parts and adjusted commit message
               accordingly]

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29 09:38:47 -07:00
Tomaz Canabrava
607d450cd6 Code cleanup: HeartRate item was doing insane things
This simplifies so much of the code that we were using to control
the visibility of the HeartRate. now things are much saner.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23 07:51:22 -07:00
Tomaz Canabrava
65eefe7b59 Animation speed is a value, not a boolean
This breaks compatibility with old preferences, but it's a single
key and not that very important so I don't think it's a bigger issue
I've renamed prefs.animation to prefs.animation_speed to denote
that it's a value, and not a state.

Also, fixed the places that were treating it as a state (on/off)
to treat it like a correct value.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23 07:50:03 -07:00
Tomaz Canabrava
82bcb1767c Don't plot pictures in Print mode
The pictures were being plotted in print mode, the main
reason for this was that when we entered print mode and
had already a picture plotted, the method would return
before removing them from the screen. This fixes it.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23 07:48:22 -07:00
Tomaz Canabrava
5da2e667d0 Set visibility in a saner way
for some reason we did a if(true) setValue(true) else serValue(false)
now we just use the value to set the value. =p

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23 07:47:27 -07:00
Tomaz Canabrava
efa05bc0c9 Break really long line.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23 07:47:23 -07:00
Tomaz Canabrava
d3c0a723b8 Save / Restore the QPainter before operations.
I don't know if this fixes anything, but it is asked of us to
do that by the Qt docs.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18 10:14:27 -07:00
Anton Lundin
8e5eb71e0b Correct usage of current_dive to displayed_dive
current_dive is the selected dive, and displayed_dive is the one we are
currently drawing. They are quite often the same one, but not in the
case of adding a dive for example.

This fixes potential null pointer dereferences in the case of a blank
divelist, and makes sure we use the correct data in the case of adding
and planning dives.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18 10:09:42 -07:00
Anton Lundin
3b99b03133 Hide gachange events in the first 30 seconds
Back in 4.0 we hide all gaschange events during the first 30 seconds,
not just gaschange events on second 0. Eg, the OSTC3 emits its gaschange
event on the first sample, which can be 2, 10 or 30 seconds into the
dive.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-17 00:04:44 -07:00
Anton Lundin
6f8dc22e08 Use get_cylinder_index instead of get_gasidx
Replace get_gasmix_from_event and get_gasidx with get_cylinder_index.

get_cylinder_index actually knows about both types of gaschange events
and the difference between them.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-17 00:04:32 -07:00