Commit graph

226 commits

Author SHA1 Message Date
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
Lakshman Anumolu
74bfa1b170 Shrink YAxis when heart rate is on display
This patch makes sure that YAxis is not expanded to cover heart rate
when it is displayed on profile panel.

Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-14 21:38:34 -07:00
Anton Lundin
0fbfccd31a profile2: remove unused varable diveComputer
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-14 18:33:57 -07:00
Dirk Hohndel
74616cdddf Rename event: correctly replace event with new one
I don't like that the event structure includes the variable length array.
That really makes it a pain to change the name of an event (on the flip
side, freeing events is easier I guess).

Anyway, to correctly rename an event we need to actually remove the event
from the correct dc and then add a new event with the new name. The
previous code was insane (it only worked if the new name was of smaller or
equal length, otherwise it had a beautiful buffer overflow).

And of course we need to do this both for the current_dive and the
displayed_dive.

Fixes #616

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-12 12:56:03 -07:00
Miika Turkia
79015e17f8 Fix inserting gaschange events
Use a macro that works to get the current DC.

Fixes #613

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-12 08:04:42 -07:00
Miika Turkia
7ce9eb28ee Mark divelist changed when adding bookmark
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 22:50:09 -07:00
Tomaz Canabrava
e18f4dfdee Code cleanup: removed bogus animation functions
All animations are now on the Animations namespace, which resulted in a
bit of code cleanup, which is nice.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 17:01:12 -07:00
Tomaz Canabrava
2171b981ac Correctly disable all animations
This seems to be needed for the correct print of the profile,
What was happening on the print code was that the profile even in print
mode was doing animations, and we were getting a frame of it and trying to
print it.

Also, a bit of code cleanup.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 17:00:40 -07:00
Tim Wootton
9b5048034f profile capitalisation
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 10:44:41 -07:00
Tomaz Canabrava
b9d04c0cf4 Show/Hide pictures working.
This code hoocks the pictures with the preferences change.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 19:59:54 -07:00
Tomaz Canabrava
503a150af0 Added the toggle picture button and hoocked it up
This patch adds the toggle picture button and hoocks
it up with the rest of the code. I'v also changed a call
from ProfileWidget because it caused errors on the ui
generated code, where it would try to call an still-to-be
instantiated object.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 19:59:23 -07:00
Dirk Hohndel
76a8e83a54 Printing: scale fonts when printing
This seem to work better, but it misses a couple of items at times (for
example the highest label on some of the axis).

Needs lots more testing.

See #590

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 13:12:29 -07:00
Dirk Hohndel
2d77788cb2 Printing: force redrawing of the profile
If the first dive we end up rendering is the dive currently shown, the
info overlay would end up being printed which looks really silly.

See #590

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 11:19:08 -07:00
Dirk Hohndel
15720837d3 replot() needs to really force a replot
So let's set forceReplot to true to make sure that happens.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-08 12:34:26 -07:00
Dirk Hohndel
d8c3113584 UI restructure: don't use random dives from the divelist for data
Everything should come from the displayed_dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03 14:43:32 -07:00
Dirk Hohndel
ce47683de8 UI restructure: always display pictures for displayed dive
The only time this is ever wrong is in print mode, so let's never show
pictures in print mode.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03 09:37:55 -07:00
Dirk Hohndel
635a7ab771 UI restructure: updateDiveInfo shows the selected dive by default
So don't be redundant.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03 09:37:55 -07:00
Dirk Hohndel
2a55e55868 UI restructure: plotDive: plot current dive by default & use displayed_dive
No longer use the dive structure that is passed in but instead always use
the displayed_dive to display things.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03 09:37:54 -07:00
Dirk Hohndel
91086d08ad UI restructure: plotDive should just take one dive
We don't have a concept of what to do when plotting multiple dives, so
let's not pretend and remove all the messing around with lists.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-02 12:03:40 -07:00
Tomaz Canabrava
1ac0b00662 Only replot the dive if maxDepth > oldMaxDepth on plan / add mode.
This fixes the "impossible to work with" planner with the mouse
now the dive will only grow and not shrink untill you release
the mouse.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-30 16:06:53 -07:00
Tomaz Canabrava
4da7dee8cf Better colors for Add and Plan modes.
Those are ligther colors and it should be a better choice
a way better choice is to ask for a designer wich color to use
but most of my minions are busy.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-30 16:06:41 -07:00
Dirk Hohndel
816a78f5ba Profile: show dive computer nickname instead of model
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-29 08:31:37 -07:00
Tomaz Canabrava
c84b40664d Fix dive picture position
I was messing with the origin point, making the dive picture
be a tiny bit to the right. This removes the rotation, but
that was also not very good.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-27 20:37:11 -07:00
Tomaz Canabrava
3f98f024e4 Open picture manager when clicking on the picture at the profile
This patch makes the click on pic == open picture browser works
also on the profile instead of only on the list view..

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-27 20:37:11 -07:00
Anton Lundin
9400e1190b Enable Info box in the planner again.
Its great to be able to see the planned "turn pressure", EADD at
different points and so on.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-18 04:56:20 -07:00
Dirk Hohndel
2b59765da3 Allow the user to delete a dive computer from a dive
This can't be the only dive computer, of course. Goes nicely with the
ability to reprder them.

Fixes #551

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-11 13:56:33 -07:00
Dirk Hohndel
c4aa1f542c Profile: add a flag to force redrawing the profile
This is needed if something has changed that requires a redraw, but the
plotDives() function can't tell (for example when a dive computer has been
deleted and there's now a different DC in the same spot, with the same
number - see next commit).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-11 13:55:51 -07:00
Lubomir I. Ivanov
8b3ebaa8a3 profilewidget2: fix -Wreorder warnings
warning: 'ProfileWidget2::someVariableName' will be
initialized after [-Wreorder]

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-09 16:55:44 -07:00
Dirk Hohndel
a26719c541 Picture handling: switch to stronger typed offset
Also change the on file XML to be even easier to read by making it a
duration as well (which gets us '32:34 min' instead of un-typed seconds).
This is backwards compatible, it will happily read what was written with
the previous commit).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-09 09:38:50 -07:00
Dirk Hohndel
1604299a5b Picture handling: change data structure to store offset instead timestamp
It makes no sense to store a 64bit time stamp with every picture. Even the
32bit offset (in seconds) from the dive start is WAY overkill. But
switching to that makes the code much more simple in a number of spots.
And makes what is saved to the XML file easier to read, too.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-08 17:17:49 -07:00
Dirk Hohndel
3a14076b1d Picture handling: stagger the pictures
If the pictures are too close to each other, spread them out a bit more.
This seems to give a reasonably pleasant layout.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-08 12:42:51 -07:00
Dirk Hohndel
f037f03268 Picture handling: put the picture near its correct time during the dive
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-08 12:42:51 -07:00
Tomaz Canabrava
e14a15e61c Subtle animation when the picture gets hovered with the mouse.
This patch adds a subtle animation when the picture gets hovered
with the mouse, and restored to it's original size when mouse exits
the image area.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-08 12:42:51 -07:00
Dirk Hohndel
714fdc7ced Force TTS/NDL calculation off if things take too long
This is kind of a random cut off, but if plotting the dive takes more than
a second and TTS/NDL is on, we force it off. Because the algorithm for
that is fundamentally quadratic in nature it can take a VERY long time -
getting users to think something is broken.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-04 13:44:34 -07:00
Tomaz Canabrava
3e46b4862a Do not plot pictures that don't have a timestamp.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03 16:47:43 -07:00
Tomaz Canabrava
43cf9fdb7a Add a method to plot the pictures on the profile.
It plots in the wrong place for now, because I need to change the model a
bit. But it shares the same pixmap with the other widget which is nice. :)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03 16:43:06 -07:00
Tomaz Canabrava
ebe799e0a0 Connect & disconnect the PictureModel on the profile
Ignore the warnings for now, this patch connects and disconnects the (not
done yet) plotPictures() method.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03 16:41:51 -07:00
Dirk Hohndel
49053e86aa Make most of the shortcuts widget specific
Having the window specific means that you can't have a key do different
things on different widgets.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03 15:30:27 -07:00
Dirk Hohndel
cc012c1fa6 Fix addStop to work as slot again
In order to call this as slot it needs to have defaults for all arguments.
So we need to change the gasmix into a pointer - which is actually better
as this allows to easily pass a NULL pointer when we want to continue to
use the previous gas.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-02 12:40:36 -07:00
Dirk Hohndel
89f3532145 More conversions to gasmix
addStop, addGas and createSimpleDive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01 18:18:57 -07:00
Dirk Hohndel
2bf46381a8 Use proper types
This is step one of many to use gasmix instead of int o2/he.
Right now some of these changes look ridiculous because after changing a
few lines we immediately go back to o2 = get_o2(gas). The reason is that I
wanted to convert a hand full of functions at a time. So in this commit I
only change validate_gas(), get_gas_from_events() and get_gasidx() to use
a struct gasmix instead of int o2, int he.

This state builds and survived some mild testing. Let's continue on top of
that.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01 14:19:19 -07:00
Dirk Hohndel
e74914fdd0 Planner: wild guess attempt to fix a crash on Mac
Staring at the stack trace it seems that it gets into an infinite
recursion when trying to recalculate after being alerted to a change on
the ruler. I cannot recreate this here (not on Linux, not on Mac), but
here's a random attempt to prevent the issue: simply refuse to recalculate
the ruler while in Add or Plan mode.

Crude, but might show us if this really is the issue. Otherwise it's easy
enough to revert this change. The qDebug() in there should tell us if
people on a Mac do indeed see this even without moving the ruler around in
Add or Plan mode.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-31 14:57:57 -07:00
Tomaz Canabrava
2744714970 Hide the DiveHandlers that are not entered by mouse.
We need to create them, even if we don't display ( only because it
was a pain to correctly track them from the model ) - so, hide them
if it's not entered by mouse, but a deco one.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-29 20:38:24 -07:00
Tomaz Canabrava
490c7a0645 Hide DiveHandlers and GasTexts when on profile mode too.
When switching from PLAN or ADD mode to PROFILE, we
kept the dive handlers visible, not anymore.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-29 20:37:59 -07:00
Robert C. Helling
45725d1c30 Planner: remove infobox overlay and enable calculated ceiling
Make the infobox invisible in planner (it really doesn't provide a lot of
useful info while planning a dive and more likely gets in the way).
Make the calculated ceiling always visible in planner and add mode.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-29 08:26:55 -07:00
Tomaz Canabrava
1e4f744165 Fixes showing the Empty Profile when Add / Plan dive is cancelled.
for some reason the next selected dive is NULL after cancelling the
plan. I'm investigating.

This patch fixes the show of the empty profile and it also untangles
some parts of the code, keeping the mainwindow where it should belong
: the mainwindow.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28 12:25:36 -07:00
Dirk Hohndel
0d58cfb641 Planner: don't try to update the MainTab dive info while in plan mode
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26 15:18:15 -07:00
Tomaz Canabrava
addec6b69f Do not set maxTime when the handler is moving.
Fixes massive cpu hog.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26 14:07:27 -07:00
Tomaz Canabrava
eec0b327a3 Make the planner show something.
This is working in the wrong way, mostly because I'm setting the
plannermodel to ADD state ( and the planner graphic to the
correct PLAN state ), but I don't know why - when on PLAN state
on the model, things just don't work.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26 13:18:53 -07:00