aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profilegraphics.cpp
AgeCommit message (Collapse)Author
2014-01-07Get rid of pointers to dive structures in the UIGravatar Dirk Hohndel
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-06Use helper function to display mean depth with correct unitGravatar Dirk Hohndel
In commit 528d0ea0e7bd ("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-06Print numerical value of mean depthGravatar Miika Turkia
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>
2013-12-29Fix typoGravatar Dirk Hohndel
Reported-by: Peter Konings <peter.l.e.konings@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-28Fix bookmark/gaschange setting for UbuntuGravatar Miika Turkia
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-28Use bookmark flag when bookmark contains headingGravatar Miika Turkia
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-20Use M_OR_FT macro instead of switch statementGravatar Dirk Hohndel
This is easier to read and also avoids an incorrect gcc warning. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-19Fix an unused variable warningGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-18Adds unhide to profile menu context menuGravatar Tim Wootton
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-11profilepgrahics.cpp: fix preceding limit checkGravatar Lubomir I. Ivanov
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-11Guard against dereferencing undefGravatar Anton Lundin
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-09Remove some unused variablesGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-07Fix profile legend stringsGravatar Sergey Starosek
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-04Different Icon for a Bookmark Event.Gravatar Tomaz Canabrava
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-04Fixes positioning of the legend in View and Print modes.Gravatar Tomaz Canabrava
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-04Improve labeling for partial pressure graphsGravatar Dirk Hohndel
This backs off a little on what was added in commit c1102a38f359 ("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-03Disable calc_ndl_tts for printGravatar Anton Lundin
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-03Add legend for the Partial Gass Pressure if active.Gravatar Tomaz Canabrava
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-01We need the correct context to translate event namesGravatar Dirk Hohndel
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-11-30More strings to be translatedGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-30Remove unused variableGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-30Reorder initializers to be more c++-strictGravatar Anton Lundin
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-28Fixes ToolTip Item showing out of boundaries tooltipsGravatar Tomaz Canabrava
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-28More gradient on the partial pressure graph.Gravatar Tomaz Canabrava
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-27Rephrase tooltipGravatar Dirk Hohndel
This seems to better explain what the button does. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-26Fixes the positioning of the ToolBarGravatar Tomaz Canabrava
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-26Fix ToolTip disappeared when resizing the ProfileWindowGravatar Tomaz Canabrava
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-21Cleanup and bugfix gaschange event printingGravatar Anton Lundin
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-21Refactoring of the configuration handling.Gravatar Patrick Valsecchi
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-21Complete add bookmark for the profile context menuGravatar Dirk Hohndel
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-21Work around QMessageBox not showing its title on MacGravatar Dirk Hohndel
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-19Add gas change event from profile context menuGravatar Dirk Hohndel
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-19Hiding events doesn't change the dive_tableGravatar Dirk Hohndel
So let's not mark it as changed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19Hooked up 'Hide Events'Gravatar Tomaz Canabrava
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-19Enable the 'Remove Event' callback.Gravatar Tomaz Canabrava
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-19Adds half of the support for the menu on the profile.Gravatar Tomaz Canabrava
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-19Print bailout on separate row from SP changeGravatar Anton Lundin
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-16Fix showing the tooltips on the profile.Gravatar Tomaz Canabrava
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-16Fix a crash with trying to show the tooltip on the profile.Gravatar Tomaz Canabrava
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-15Make tooltips work in the profile toolbarGravatar Taiane Ramos
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-07Don't translate the fake DC modelsGravatar Dirk Hohndel
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-01Added a new option to edit the dives.Gravatar Tomaz Canabrava
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-10-17Move sac-calculation to profile.cGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-15Fixed the moving around of the InfoPanel on non KDE enviroments.Gravatar Tomaz Canabrava
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-15profilegraphics.cpp: Use text sizes in plot_text()Gravatar Lubomir I. Ivanov
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-14Fix the DC ceiling in the profile.Gravatar Patrick Valsecchi
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-11Remove unused arg in plot_cylinder_pressureGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-11Good deal of whitespace fixes and code cleanup.Gravatar Tomaz Canabrava
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-09Fix potential uninitialized variableGravatar Dirk Hohndel
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-07Compile without depending on the global MAX macroGravatar Thiago Macieira
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>