summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/profilewidget2.cpp
AgeCommit message (Collapse)Author
2014-12-04Don't interpolate pressure while dragging waypointsGravatar Robert C. Helling
A profiler session in the planner shows that for deep long dives a significant amount of CPU time is spent in populate_pressure_information() which interpolates the cylinder pressure graphs. This patch introduces a "fast" flag for the replot of the profile which is active while the mouse button is still pressed and that suppresses this calculation. In the future, this flag could be used for other responsiveness tunings of the plot. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-01Context menu entry to change setpointGravatar Robert C. Helling
This patch adds a context menu entry to add a setpoint change event. In particular, this can be used to turn a logged dive into a CCR dive. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-19Profile: adjust tank pressures at gas change (incomplete)Gravatar Dirk Hohndel
This code sets up the UI that will allow the user to adjust tank pressures at a gaschange event. The actual changing of the pressure is not implemented, yet, so this is disabled until someone finds time to do so. The scenario is this: a tec diver or sidemount diver without pressure sensors on at least one of their tanks still wants to reasonably accurately track gas consumption during a dive. The diver takes notes of the pressures at every tank switch (I find that odd, but apparently some cave divers indeed do that as they switch back and forth between different gases) and then wants to adjust the pressures in Subsurface to match those written down. One difficulty here is that the first and last pressure of a tank with no sensor data is still considered "sensor pressure" - this is basically an implementation detail in the code that is used to do the pressure interpolation to have constant-SAC pressure plots for tanks without sensors. So when we check if there is indeed no pressure data available at the gas change, we can't just work with the interpolated pressure - if this is the first (or last) time the tank was used, that pressure may be marked as sensor pressure. What's missing is the UI to enter the desired new pressure plus the black magic that actually inserts this into the dive in a way that doesn't break the assumptions in the rest of the code. I'm running out of time to do that but wanted to preserve this code so someone can continue this later. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-19Profile: don't offer to switch to an already active tankGravatar Dirk Hohndel
Adding a gas change to tank that we are already breathing from makes no sense, so let's not offer this. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-19Profile: add helper function to get the sample entry for a mouse positionGravatar Dirk Hohndel
This seems quite useful to have. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-19Profile: keep the plotInfo in the corresponding member variableGravatar Dirk Hohndel
We had the variable. As a pointer. Which we used memset to clear. Ouch - that smells like some bad cut and paste. With this change the object keeps the corresponding plotInfo around (just like some others do) and can use it later. I suspect this code could use some larger cleanup, but it's a bit too late for this in the development cycle, I guess. I'm sure I'll regret this in the future... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-19Don't offer to add a gas change if there is ony one gasGravatar Dirk Hohndel
In the context menu of the profile it makes no sense to offer the ability to switch gases unless there is a gas to switch to. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-15Mark string for translationGravatar Salvo 'LtWorf' Tomaselli
An error string was left untranslated. Signed-off-by: Salvo 'LtWorf' Tomaselli <tiposchi@tiscali.it> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-01Fix partial pressure graph thresholdsGravatar Dirk Hohndel
Since we only store things in the preferences if they are different from the default, the existing code that simply compared with the settings value didn't work when people used the defaults. We now compare to the actual preference at runtime which should address that. Fixes #731 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-30Fix adding gas change to a diveGravatar Dirk Hohndel
Yikes this was stupid. We mixed changing the displayed_dive and the current_dive. So we'd pass in the displayed_dive and a pointer to the dive_computer structure of the current dc in the current dive. Oops. This makes much more sense. And: Fixes #738 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-29Allow the user to switch to a gas in a specific tankGravatar Dirk Hohndel
When entering a gas switch manually, explicitly show the different tanks that are available and correctly switch between different tanks with the same gas. See #702 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-21Correctly place the first gas label in drop to bottom modeGravatar Dirk Hohndel
When dropping to the bottom in plan (and add) mode, the gas label was placed along the diagonal line from (0,0) to the second dive data point (i.e. the one at the end of the "at deptch" segment). That looks terrible, the label needs to be along the segment that we are spending at the bottom. This patch fixes that problem. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-10Untangle the graphs at the bottom of the profile.Gravatar Joakim Bygdell
When multiple graphs are displayed at the same time they end up being printed on top of each other. Scale the lowest graph to accommodate the tankbar. Add an intermediate scaling step to the depth axis when pp graphs or the tissue graph are visible. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-19Add tissue saturation plot to tooltipGravatar Robert C. Helling
This adds a graphical representation of tissue loadings at the current moment during the dive to the tooltip box. The layout is inspired by the Sherwater Petrel.Add tissue saturation plot to tooltip Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-19Tissue saturation plot a la Sherwater PretelGravatar Robert C. Helling
This adds a toolbox icon to turn on a tissue plot inspired by the bar graph of the Sherwater Petrel, It shows the inert gas partial pressures for individual compartments. If they are below the ambient pressure (grey line) they are shown in units of the ambient pressure, if they are above, the excess is shown as a percentage of the allowed overpressure for plain Buehlmann. So it has the same units as a gradient factor. Thus also the a gradient factor line (for the current depth) is shown. The different tissues get different colors, greener for the faster ones and bluer for the slower ones. Positioning and on/off icon action still need some tender loving care. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-23A much better Toolbar for the profile.Gravatar Tomaz Canabrava
Using QToolBar I was able to remove much of the dead code from the mainwindow.ui xml file by transforming the QToolButtons into actions and loading them dynamically in the .cpp code. I couldn't use the designer for this ( as I wanted ) because Qt has no notion of ToolBars outside of the areas where the MainWindow should have one, and we use it in a very different area. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-21Make sure tank bar button triggers tank barGravatar Dirk Hohndel
This worked flawlessly on Mac and Linux, but on Windows I needed to add the explicit setVisible here - not quite sure why. Fixes #710 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-19Fix crash when calling the planner twice in a rowGravatar Dirk Hohndel
Turns out that the fix in commit f7119bdccfb2 ("Planner: make sure no old handles are around when entering Add/Plan") was incorrect. We ONLY want to remove the existing handlers when we re-plan a dive, NOT when we call add or plan. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-19Planner: make sure no old handles are around when entering Add/PlanGravatar Dirk Hohndel
In some cases we don't appear to remove all of the old handles from the scene and end up showing a handle from a previous instance of the planner in the upper right corner of the profile. This patch makes sure that we remove any stray handles that might still be around before entereing plan or add mode. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-15TankBar: hook into prefs and make ppGraphs resize accordinglyGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-15TankBar: use the itemPos as intendedGravatar Dirk Hohndel
Which actually makes the code much clearer as now the object is at the correct spot on the canvas and the positions inside are relative to that. No more magic gradiants starting at "92" Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-14Add gas text to tank barsGravatar Dirk Hohndel
Also restructures the code a bit to make it a little more sane and changes the colors slightly. With these changes I think we can claim that this Fixes #557 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-14Add initial support for a visual tracker of gas usedGravatar Dirk Hohndel
This shows a color-coded bar at the bottom of the graph that corresponds with the active gas. Todo: - text that explicitly states gas on the left edge of the bar - better vertical positioning of the bar - ability to turn this on and off Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-06Show the cross hair only when planning or adding a diveGravatar Dirk Hohndel
In normal profile mode it's rather redundant and clatters the profile. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-06Fix order of initialization warningGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-06Don't zoom the profile when the left button is pressedGravatar Robert C. Helling
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-05Make the cross hair less obnoxious on MacGravatar Dirk Hohndel
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-05Add lines that follow the mouse helping see time and depth.Gravatar Tomaz Canabrava
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-05Picture handling: cleaning up the messGravatar Dirk Hohndel
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-05Picture handling: hide the pictures before deletingGravatar Dirk Hohndel
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-05Profile: Don't disconnect too many signalsGravatar Dirk Hohndel
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-04Planner: show mean depthGravatar Dirk Hohndel
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-07-30Implement the functionality of remove_picture.Gravatar Tomaz Canabrava
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-30Instead of holding the index, hold the URL.Gravatar Tomaz Canabrava
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-30Planner / Add dive: hide handler after removing itGravatar Dirk Hohndel
Otherwise users can still interact with it. Fixes #648 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29Do not show the heartrate info unconditionally.Gravatar Tomaz Canabrava
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-29Change the Ruler text values when metric system changes.Gravatar Tomaz Canabrava
"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-29Another string to translateGravatar Sergey Starosek
[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-23Code cleanup: HeartRate item was doing insane thingsGravatar Tomaz Canabrava
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-23Animation speed is a value, not a booleanGravatar Tomaz Canabrava
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-23Don't plot pictures in Print modeGravatar Tomaz Canabrava
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-23Set visibility in a saner wayGravatar Tomaz Canabrava
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-23Break really long line.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-14Shrink YAxis when heart rate is on displayGravatar Lakshman Anumolu
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-14profile2: remove unused varable diveComputerGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-12Rename event: correctly replace event with new oneGravatar Dirk Hohndel
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-12Fix inserting gaschange eventsGravatar Miika Turkia
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-11Mark divelist changed when adding bookmarkGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11Code cleanup: removed bogus animation functionsGravatar Tomaz Canabrava
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-11Correctly disable all animationsGravatar Tomaz Canabrava
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>