aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profilegraphics.cpp
AgeCommit message (Collapse)Author
2014-02-12Don't redeclare variables of the same nameGravatar Dirk Hohndel
This isn't broken, but it's confusing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12Replace mainWindow() with MainWindow::instance()Gravatar Boris Barbulovski
C++ style of accessing single instance class object. Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11Use our macro for FP comparisonsGravatar Dirk Hohndel
I think that catches all the ones we missed (thanks clang -Wfloat-equal). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-06Include images in profileGravatar Robert C. Helling
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-06Move the divetooltipitem to its own file.Gravatar Tomaz Canabrava
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-01-21Add the DiveCalculatedCeiling item.Gravatar Tomaz Canabrava
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-19Make the colors of the texts be prettier.Gravatar Tomaz Canabrava
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-19Fix the positioning of the Labels using the new DiveTextItemGravatar Tomaz Canabrava
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-17Plot the Temperature Text.Gravatar Tomaz Canabrava
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-16Fix some memory leaks.Gravatar Boris Barbulovski
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-16Whitespace and coding style updatesGravatar Dirk Hohndel
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-15Fix "hide unused cylinder" behaviorGravatar Dirk Hohndel
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-15Convert to TRUE/FALSE to stdbools true/falseGravatar Anton Lundin
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-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>