Commit graph

161 commits

Author SHA1 Message Date
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
Dirk Hohndel
f2035bcd79 Don't translate the fake DC models
Since the model name is written into the XML file it has to be a literal
string that isn't translated. Otherwise a datafile written in one locale
behaves differently when opened by Subsurface under a different locale.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-07 16:52:39 +09:00
Tomaz Canabrava
69d4ccae6d Added a new option to edit the dives.
Added a new option to edit the dive in the profile view. The option
will only be visible if the dive was manually entered or if the dive
is a plan.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
2013-11-01 09:33:39 -04:00
Anton Lundin
437246d3ed Move sac-calculation to profile.c
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17 14:54:11 -07:00
Tomaz Canabrava
22afca58bf Fixed the moving around of the InfoPanel on non KDE enviroments.
This patch restores the ability to move the info-overlay panel on the
profile. For some reason the eventFilter wasn't working (and actually,
looking at the code, it really shouldn't, because I didn't see where I set
it to work, maybe someone (me) broke it a long time ago) well, it seems
fixed now at least. :)

Tested on XFCE, Gnome and KDE, with three different window managers.

[Dirk Hohndel: removed debug output]

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-15 19:40:16 -07:00
Lubomir I. Ivanov
005f8ecf83 profilegraphics.cpp: Use text sizes in plot_text()
Make the active font (fnt) use the 'size' member of the received
text_render_options_t. This allows changing the size of
certain text elements.

For the moment most text elements are set to 12px.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-15 04:24:02 -07:00
Patrick Valsecchi
291ce1d9ac Fix the DC ceiling in the profile.
entry->ndl is computed and therefore should not be used for showing
the DC's ceiling. That made the DC ceiling jump to 0m when the computed
celing was at 0.

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-14 12:30:32 -07:00
Anton Lundin
dd3b8210a9 Remove unused arg in plot_cylinder_pressure
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-11 10:18:07 -07:00
Tomaz Canabrava
1b9a4f2bf8 Good deal of whitespace fixes and code cleanup.
I just went thru all of subsurface code removing
some whitespaces issues and trying to make the
code prettyer, I also removed a few QString issues.d

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-11 10:21:04 -03:00
Dirk Hohndel
c74b286e70 Fix potential uninitialized variable
Most of the "possibly unitialized" warnings are bogus, but this one is a
potential real bug.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09 00:15:46 -07:00
Thiago Macieira
00eba99039 Compile without depending on the global MAX macro
There's a C++ way for it. And, for some reason, it wasn't defined on my
MinGW build:

qt-ui/profilegraphics.cpp:1006:57: error: 'MAX' was not declared in this sscope

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-07 16:57:54 -07:00
Dirk Hohndel
054406b420 Remove even more code and declarations
There's lots more stuff that can go.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-07 13:43:17 -07:00
Anton Lundin
d53d00db02 Lookup gas via the plot_data, not the event
When straight decoding the event, it failed to handle older
SAMPLE_EVENT_GASCHANGE(11), the ones without he-part correctly. This was
shown clearly when it printed the 21/35 in dives/test20.xml as air.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-03 13:49:06 -07:00
Lubomir I. Ivanov
374f3d0de6 Profile: use a 10px font when printing profile text
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-03 09:38:26 -07:00
Maximilian Güntner
a3ce871e0a correct the placement of pressure markers
Adding +30 (seconds) to the position works fine for long dives but
when zoomed in on short dives, 30 seconds are a lot.
This commit sets the offset to +10 px regardless of the scaling.

Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
2013-09-27 18:45:07 +02:00
Maximilian Güntner
88172571ca Added a toolbar to the profile
The toolbar adds two buttons to the profile.
The user can now toggle the scaling (zoomed to dive/round up to 30 mins)
and adding /removing ruler to/from the profile using this toolbar.

Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
2013-09-27 18:45:04 +02:00
Maximilian Güntner
248f1b86d1 Added a ruler which can be dragged along the profile
This patch adds a ruler QGraphicsItem which can be dragged
along the profile. The ruler displays minimum, maximum and
average for depth and speed (ascent/descent rate). Also, all used
gas will be displayed.

This also adds a new attribute to struct plot_data to store the
speed (not just as velocity_t).

Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
2013-09-27 18:42:19 +02:00