Commit graph

243 commits

Author SHA1 Message Date
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
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
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
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
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