Commit graph

177 commits

Author SHA1 Message Date
Robert C. Helling
5c1abde2a5 Include images in profile
This adds an entry to the dive list context menu to load images. The user
can select image files and set a time offset to align camera and dive
computer clocks.

Using the exif time stamp the images are tried to match to the times of
the selected dives (with a grace period of an hour before and after the
dive).  Upon success an event of type 123 is created per image with the
string value being the path to the image.  Those images are displayed as
thumbnails in the profile. If the matching dive does not yet have a geo
location specified but the image provides one it is copied to the dive
(making the camera a poor man's companion app).

This patch includes easyexif https://code.google.com/p/easyexif/ which is
originally under a New BSD License to parse the image meta data.

This commit includes a new test dive dives/test31.xml with a matching
image wreck.jpg to try out the functionallity.

Obvious to do's:
Have images on the map
Have the images clickable
Have a proper picture viewer
Give visual reference for image time shifting.
Use the new profile

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-06 11:29:23 -08:00
Tomaz Canabrava
c1ed9babc7 Move the divetooltipitem to its own file.
This is needed so we can share the dive tooltip item with the
new and old profile at the same time. Next few commits will be
setting the functionality of the tooltip item on the new one.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-06 06:26:50 -08:00
Tomaz Canabrava
8065374793 Add the DiveCalculatedCeiling item.
This item plots the DiveCalculatedCeiling over the profile. I still need
to add the Calc All Tissues version.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-21 11:35:09 -08:00
Tomaz Canabrava
edad8712b9 Make the colors of the texts be prettier.
Just fixes some colors of the texts on the canvas.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-19 21:38:10 -08:00
Tomaz Canabrava
9d2344d01b Fix the positioning of the Labels using the new DiveTextItem
This uses a combination of items on the canvas which makes it easier to
position it where I want.

This also broke the other texts because I forgot about them. I will
fix that on the next commit.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-19 21:36:55 -08:00
Tomaz Canabrava
35979537d9 Plot the Temperature Text.
I Moved the 'plot text' method of the Old Graphics to the new
layout - this one was mostly unchanged as it was already good
as is.

And used the TemperatureProfileItem to also display texts.
This was the first implementation of the new system that uses
*less* code than the original one, wich makes me happy.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-17 14:04:47 -08:00
Boris Barbulovski
6cc65f5e1c Fix some memory leaks.
Memory leaks were caused by broken parent/child relations.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16 12:15:47 +07:00
Dirk Hohndel
a27f67c026 Whitespace and coding style updates
Another futile attempt to cleanup the code and make coding style and
whitespace consistent. I tried to add a file that describes the key points
of our coding style. I have no illusions that this will help the least
bit...

This commit should ONLY change whitespace

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16 11:50:56 +07:00
Dirk Hohndel
630eece8b2 Fix "hide unused cylinder" behavior
There are at least two scenarios where our old code was flat out wrong.
If you manually add a cylinder (because you may want to switch to it in
the profile), then at least until the next time you restart Subsurface
this cylinder should be shown.

Also, when you switch to a cylinder by adding a gas switch event on the
profile, that change should then make that cylinder visible.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15 16:40:40 +07:00
Anton Lundin
7e9582631d Convert to TRUE/FALSE to stdbools true/false
I had problems with this one on Qt5.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15 15:52:31 +07:00
Dirk Hohndel
c3fe1a9e9f Get rid of pointers to dive structures in the UI
The assumption that the pointer will keep pointing to a valid structure is
fundamentally flawed. And even if that is true today, it might change in
the future - just don't do it. Use the diveId instead.

The exception is when you own the structure and use it within one UI
interaction during which any way to change the dive_table is disabled
(e.g., while adding / editing a dive).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-07 12:10:19 +08:00
Dirk Hohndel
e783493f8a Use helper function to display mean depth with correct unit
In commit 528d0ea0e7 ("Print numerical value of mean depth") Miika once
again forgot the three non-metric countries on this planet... :-)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-06 21:02:19 +08:00
Miika Turkia
528d0ea0e7 Print numerical value of mean depth
This will print the numerical value of mean depth to the profile graph.

Fixes #405

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-06 20:50:58 +08:00
Dirk Hohndel
f79cc7bd91 Fix typo
Reported-by: Peter Konings <peter.l.e.konings@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-29 09:20:26 -08:00
Miika Turkia
e72d001d3e Fix bookmark/gaschange setting for Ubuntu
On Ubuntu, new events have time zero. This is fixed by resetting
gc.rightx to maxtime at the end of plot function.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-28 10:25:18 -08:00
Miika Turkia
3ddb03a27e Use bookmark flag when bookmark contains heading
Bookmark with compass heading is named 'heading' and should use the
bookmark icon.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-28 07:40:38 -08:00
Dirk Hohndel
4ab58d6b47 Use M_OR_FT macro instead of switch statement
This is easier to read and also avoids an incorrect gcc warning.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-20 09:53:06 -08:00
Lubomir I. Ivanov
86ed014339 Fix an unused variable warning
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-19 07:28:26 -08:00
Tim Wootton
ecc33e6375 Adds unhide to profile menu context menu
Unhide menu is only shown when hidden events exist.
Also updates relavent manual section.

Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-18 14:07:41 -08:00
Lubomir I. Ivanov
fbcad20072 profilepgrahics.cpp: fix preceding limit check
ProfileGraphicsView::plot_depth_profile():
The iterator limit check (i < 7) should precede the indexing
(increments[i]).

Reported by the program cppcheck.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-11 16:29:39 +01:00
Anton Lundin
022e2d0d9d Guard against dereferencing undef
Introduce some harness in ProfileGraphicsView::plot_one_event, so we
detect bad stuff and bail, instead of dereferencing undef pointers.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-11 03:13:30 +01:00
Anton Lundin
26a1904cf8 Remove some unused variables
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-09 22:47:28 +01:00
Sergey Starosek
bf88efae08 Fix profile legend strings
Use proper case and subscripts for gas names on profile legend.

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-07 07:25:19 -08:00
Tomaz Canabrava
441838def0 Different Icon for a Bookmark Event.
This patch adds a different icon for a Bookmark Event, and it
also cleaned a lot of code. :)

See #300

[Dirk Hohndel: made the two icons slightly bigger]

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-04 19:41:29 -08:00
Tomaz Canabrava
d3a56c137b Fixes positioning of the legend in View and Print modes.
This patch makes a better assumption of the location for the
legend in both View and Print modes. It also fixes a few oddities
that we used to have ( like hardcoded spacing ).

We are taking the scene().sceneRect() now into consideration to
better place it on canvas.

Fixes: #322

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-04 19:31:10 -08:00
Dirk Hohndel
5fc50b2aab Improve labeling for partial pressure graphs
This backs off a little on what was added in commit c1102a38f3 ("More
gradient on the partial pressure graph.") - the numbers simply got too
busy. I also slightly changed the positioning of the numbers to be a
little more "natural looking".

Fixes #323

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-04 13:27:34 -08:00
Anton Lundin
04bbfe2ab1 Disable calc_ndl_tts for print
NDL and TTS doesn't show up in the printed profiles, and it takes
significant time to calculate, so just don't do it.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-03 15:22:49 -08:00
Tomaz Canabrava
a75168dcc9 Add legend for the Partial Gass Pressure if active.
This patch adds legend for the partial gass pressures if the
graphs are active. when enabling / disabling the square
that represents the color of a gas will also appear / disappear.

Fixes: #272

[Dirk Hohndel: minor changes to layout and whitespace]

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-03 12:58:54 -08:00
Dirk Hohndel
dc03b7e7d6 We need the correct context to translate event names
Qt assumes that all strings are in the context of the class in which you
use them. So when we want to display the translated event names from
within the ProfileGraphicsView we need to make it explicit that these are
strings that come from the C part of the code.

Doing that showed another bug in the code where we foolishly compared the
translated text to a fixed string. Not smart.

Fixes #312

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-01 18:03:32 -08:00
Sergey Starosek
527ae08e76 More strings to be translated
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-30 07:53:26 -08:00
Anton Lundin
4eab1cce20 Remove unused variable
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-30 07:21:49 -08:00
Anton Lundin
047e1cf013 Reorder initializers to be more c++-strict
c++ have some idea about in what order things should be initialized.
This makes us comply with that order.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-30 07:21:24 -08:00
Tomaz Canabrava
f8c2efe1ce Fixes ToolTip Item showing out of boundaries tooltips
This patch fixes ToolTip Item showing out of boundaries
Tooltips when in resizing animation.

Fixes #294

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-28 15:29:01 -08:00
Tomaz Canabrava
c1102a38f3 More gradient on the partial pressure graph.
This patch adds a bit more of gradient on the lines for the partal
pressure graph grid, it also moves a tiny bit to the side the
even numbers so it's easyer to read when they are too near each other.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-28 15:27:18 -08:00
Dirk Hohndel
579c566bbe Rephrase tooltip
This seems to better explain what the button does.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-27 10:06:30 -08:00
Tomaz Canabrava
97fd22b1be Fixes the positioning of the ToolBar
This is a workaround, I plan to remove that toolbar from inside
of the Profile for the next version, but since it's there for now,
let's keep it.

This patch hides the toolbar when the zoomLevel != 0, since the
profile is unclickable while zoomed...

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-26 11:25:50 -08:00
Tomaz Canabrava
e91a1fc26c Fix ToolTip disappeared when resizing the ProfileWindow
When resizing the ProfileWindow and the tooltip was out of
boundaries, it was really out of boundaries and there was
no way to get it back ( besides re-expanding the window. )
this patch moves the tooltip to (0,0) and don't save that
position, so when the window is re-expanded, it will move to
the correct location again

Fixes #237

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-26 11:25:50 -08:00
Anton Lundin
891892cde4 Cleanup and bugfix gaschange event printing
When a gaschange to air happened, the code did
name += name=+ tr("air") which probably was due to the block being just
confusing with all the ?:
Unrolls to proper if statements, and fixes the bug.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 15:54:34 -08:00
Patrick Valsecchi
4c4a7a6d96 Refactoring of the configuration handling.
Before, when clicking the OK button on the preferences GUI, we were
updating in-memory preferences from the GUI, saving them to the
configuration file from the GUI, reloading from the file to the
in-memory preferences. Then, to add to the ducplication, when the
application was exiting, some fields were saved again.
Basically the first step and the last step were useless appart from
the fact the the other steps where missing a few fields here and there.

This patch removes the first step and fixes the missing fields.

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
ACKed-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 08:11:40 -08:00
Dirk Hohndel
58088d5897 Complete add bookmark for the profile context menu
This (together with the commits fixing the QMessageBox title) should
finally close all the issues in bug 250.

Fixes #250

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 05:13:18 -08:00
Dirk Hohndel
995192c5fb Work around QMessageBox not showing its title on Mac
This is a bit hacky and simply adds the title to the message text when
compiling on a Mac, but hopefully this will be enough.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 04:23:10 -08:00
Dirk Hohndel
36cb50fb37 Add gas change event from profile context menu
This allows to add missing gas change events to the currently shown dive
computer. Only gases defined in the Equipment section are offered.

Fixes: #250

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 20:35:15 -08:00
Dirk Hohndel
c1f936f288 Hiding events doesn't change the dive_table
So let's not mark it as changed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 18:22:40 -08:00
Tomaz Canabrava
df6a80fb37 Hooked up 'Hide Events'
With this commit one can hide all events of the selected type through a
context menu on the profile.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 18:17:41 -08:00
Tomaz Canabrava
e8d1f14c90 Enable the 'Remove Event' callback.
Based on the code in the Gtk branch.

[Dirk Hohndel: whitespace cleanup and changed the message text]

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 17:58:18 -08:00
Tomaz Canabrava
4c2e6c4658 Adds half of the support for the menu on the profile.
This adds the menu, it just doesn't do anything, yet.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 17:04:25 -08:00
Anton Lundin
c7941f66b4 Print bailout on separate row from SP change
It looked kinda weird without a separator between the SP change and the
bailout.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 15:34:40 -08:00
Tomaz Canabrava
47c833015b Fix showing the tooltips on the profile.
We incorrectly mapped the profile's widget tooltip based on the
global screen coordinates.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-16 20:33:02 -08:00
Tomaz Canabrava
5058d8914a Fix a crash with trying to show the tooltip on the profile.
Fixed a crash with trying to show the tooltip on the profile,
with an empty profile. Since the widgets are not created yet,
we got a crash trying to access the toolBarProxy.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-16 20:32:41 -08:00
Taiane Ramos
7e859da939 Make tooltips work in the profile toolbar
This patch enables tooltips on the profile toolbar. Tooltips were
being treated as text to be shown at notification area. Now it is
verified if the cursor was positioned over the toolbar when it
activated the event. If so, tooltip is shown normally.

Fixes #238

Signed-off-by: exhora <exhora.tat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 13:26:01 +09:00