aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2014-06-01Add stub for a widget to show the dive pictures.Gravatar Tomaz Canabrava
This has a few classes: the model is the list of pictures for the current dive, the delegate is how this pictures will be displayed on screen, the widget is the collection of delegates, and the DivePictureThumbnailThread is a worker-thread to generate the thumbnails so the UI will not freeze. [Dirk Hohndel: added the new files to subsurface.pro] Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01Do not replot for each picture added to dive.Gravatar Tomaz Canabrava
Instead wait until all pictures have been set and plot that. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01Fix layout on the Shift-Image-Time import dialogGravatar Tomaz Canabrava
The dialogs where hard-coded and some variations of themes could broke the placement of the text on it. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01Simplify ruler update code.Gravatar Tomaz Canabrava
This should fix the infinite recursion on OSX and also clean a lot of code, which is also very nice. <3 Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01Remove some unused variablesGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01Next step to using gasmix instead of o2/heGravatar Dirk Hohndel
This changes the divedatapoints and functions that deal with them. It changes plan_add_segment(), create_dp(), gasToStr(), and tankInUse() to consume gasmix instead of o2/he. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01Use proper typesGravatar Dirk Hohndel
This is step one of many to use gasmix instead of int o2/he. Right now some of these changes look ridiculous because after changing a few lines we immediately go back to o2 = get_o2(gas). The reason is that I wanted to convert a hand full of functions at a time. So in this commit I only change validate_gas(), get_gas_from_events() and get_gasidx() to use a struct gasmix instead of int o2, int he. This state builds and survived some mild testing. Let's continue on top of that. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01Remove the .used member of the cylinder structureGravatar Dirk Hohndel
Instead calculate this information on the fly, taking into account all dive computers on the dive in questions. There is one wrinkle to this - previously we abused the '.used' member to make sure that a manually added cylinder didn't disappear the moment it was added (think of the workflow: you add a cylinder, then you add a gas change to that cylinder -> right after you add it it is unused and would not be shown). I am thinking that we might have to add the "manually_added" property to the properties that we store in XML / git. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01Encapsulate the horrid gas encoding in gas change eventsGravatar Dirk Hohndel
We should never pass permille values around as integers. And we shouldn't have to decode the stupid value in more than one place. This doesn't tackle all the places where we access O2 and He "too early" and should instead keep passing around a gaxmix. But it's a first step. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01Planner: correctly track gas usedGravatar Dirk Hohndel
This part of the algorithm was off as part of it (but not all of it - crazy, I know) assumed the old semantic for gas changes where the new gas was introduced at the end of the segment and not at the beginning. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01Planner: track gas used even if we don't have a real cylinderGravatar Dirk Hohndel
We tracked gas used by simulating a dive with a cylinder - but for that we need a cylinder size and working pressure. If the user just enters a gas but no cylinder data (likely in order to figure out how much gas is used so that she then can pick a big enough cylinder), we didn't show any gas consumption. It kinda sucks to add another member to the cylinder structure, but this seemed far more reasonable then some other, global structure that independently tracks gas usage. This just seemed to make sense. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01Planner: more fixes for gas trackingGravatar Dirk Hohndel
Gas switches are now for the current segment, not for the next. We can only track gas for cylinders for which we have size / working pressure information. Print a warning for others. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01Planner: add warning if the plan consumes more gas than providedGravatar Dirk Hohndel
If we have size information including working pressure for a cylinder, we already track the expected pressure at each way point - this way we can also alert the user if more gas is consumed than is available in the cylinder. This does not include sound planning strategies like "rule of thirds". It simply assumes that you won't be able to breathe down the cylinder past about 10bar (using 0 as cutoff seemed silly). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-31Revert "Show the calculated deco stops in the planner table"Gravatar Dirk Hohndel
This reverts commit 7d42b53bba235894668ed1f2da3f5d17cd97b9c5. With the addition of the dive plan details widget we no longer want to show the deco points in the dive planner points table. Conflicts: qt-ui/diveplanner.cpp
2014-05-31Planner: don't include the disclaimer in the dive plan detail widgetGravatar Dirk Hohndel
We want the disclaimer in the final dive that can be printed, but it's distracting when shown while planning the dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-31Planner: show the plan notes in the new widgetGravatar Dirk Hohndel
That was easy. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-31Planner: add dive plan output area that replaces dive listGravatar Dirk Hohndel
When switching to / from plan mode, we switch to show either the dive plan detail widget, or the dive list widget. So far this widget does nothing. This just makes sure it's there. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-31Planner: wild guess attempt to fix a crash on MacGravatar Dirk Hohndel
Staring at the stack trace it seems that it gets into an infinite recursion when trying to recalculate after being alerted to a change on the ruler. I cannot recreate this here (not on Linux, not on Mac), but here's a random attempt to prevent the issue: simply refuse to recalculate the ruler while in Add or Plan mode. Crude, but might show us if this really is the issue. Otherwise it's easy enough to revert this change. The qDebug() in there should tell us if people on a Mac do indeed see this even without moving the ruler around in Add or Plan mode. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-31Planner: look harder to find the right gasGravatar Dirk Hohndel
Silly bug - while we normally fill the cylinders in a tight group with no "null" cylinders in the middle, since we copy from an existing dive and since that may end up with an odd sequence of cylinders, we need to continue looking at ALL cylinders and not stop with the first one that's empty. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-31Merge branch 'latest'Gravatar Dirk Hohndel
2014-05-31Allow editing segment duration. This shifts all following waypoints.Gravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-30Planner: don't recreate the dive while cleaning up the widgetsGravatar Dirk Hohndel
Otherwise the change to the Cylinder widget would trigger a recreation of the dive in an inconsistent state. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-30Planner: remove check for empty diveplanGravatar Dirk Hohndel
This was introduced in commit fc1336107930 ("Don't crash if we try to save a empty plan") - but it doesn't seem to make any sense. It is perfectly reasonable for the diveplan to have no datapoints at this spot - we are just about to call createTemporaryPlan() which will fill those datapoints from the mode. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-30Planner: don't do unnecessary work on empty dive plansGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-30Remove unused structure memberGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-30Planner: remove pointless codeGravatar Dirk Hohndel
This never made any sense. If we have NO datapoints then go and cancel the plan? And anyway, we already check this higher up in the call stack. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-30Planner: after freeing the plan, throw away the pointerGravatar Dirk Hohndel
Otherwise we'll happily go back and access the freed data structures later. Oops. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-30Planner: make sure all cylinders have a sane depthGravatar Dirk Hohndel
When copying cylinders from an existing dive, the mod of the cylinder might not be set. Assume a conservative 1.4 pO2 and fill in those data. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-30Planner: start the ascend with the strongest allowed deco mix.Gravatar Robert C. Helling
In analyze_gaslist() we were only keeping gases that had their .depth above the current depth, i.e. where we could switch to in the future. Now we take note as well of the strongest gas that we could have already switched to and switch to it before we attempt to ascend. [Dirk Hohndel: minor whitespace and code cleanup] Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-29HTML: Quote the '<' and '>' operators before inserting break tagsGravatar Gehad elrobey
The smaller than and greater than operators should be quoted before inserting the <br> tags in HTML. Otherwise breaks will be quoted which corrupts the format. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-29Do not offer an editor when double-clicking REMOVE on the planner.Gravatar Tomaz Canabrava
The planner would offer an text-editor if the user double clicked it's remove column. forbidding that. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-29Do not show 'trash' icon for deco stops.Gravatar Tomaz Canabrava
Besides not deleting them, we shouldn't offer the icon for it. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-29Do not remove a Deco Stop by clicking on the trashGravatar Tomaz Canabrava
This patch forbids deletion of the Deco Stop from the QTableView that holds the model. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-29Hide the DiveHandlers that are not entered by mouse.Gravatar Tomaz Canabrava
We need to create them, even if we don't display ( only because it was a pain to correctly track them from the model ) - so, hide them if it's not entered by mouse, but a deco one. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-29Hide DiveHandlers and GasTexts when on profile mode too.Gravatar Tomaz Canabrava
When switching from PLAN or ADD mode to PROFILE, we kept the dive handlers visible, not anymore. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-29Fix CMakeGravatar Tomaz Canabrava
save-html was not there yet. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-29Planner: only update the plan after the cylinder data has been updatedGravatar Dirk Hohndel
This way we avoid trying to create a dive from the plan while the plan references the cylinder that has just been changed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-29Planner: clean up the function that tracks our gasesGravatar Dirk Hohndel
This doesn't add gases. It just makes sure they are there. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-29Show the calculated deco stops in the planner tableGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-29Planner: track gas consumption in cylinders and samplesGravatar Dirk Hohndel
This commit is a little bigger than I usually prefer, but it's all somewhat interconnected. - we pass around the cylinders throughout the planning process and as we create the plan we calculate the gas consumption in every segment and track this both in the end pressure of the cylinder and over time in the samples - because of that we no longer try to calculate the gas consumption after being done planning; we just use what we calculated along the way - we also no longer add gases during the planning process - all gases have to come from the list of cylinders passed in (which makes sense as we should only use those gases that the user added in the UI or inherited from a the selected dive (when starting to plan with a dive already selected) With this patch I think we are close do being able to move all of the planning logic back into the planner.c code where it belongs. The one issue that still bothers me is that we are juggling so many dive structures and then keep copying content around. It seems like we should be able to reduce that. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-29Don't assume that pressures are always positiveGravatar Dirk Hohndel
When planning a dive, the dive could use more gas than is in the cylinder. So getting a negative end pressure is a useful indication to the user that there plan might not be a good one. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-29Planner: remove infobox overlay and enable calculated ceilingGravatar Robert C. Helling
Make the infobox invisible in planner (it really doesn't provide a lot of useful info while planning a dive and more likely gets in the way). Make the calculated ceiling always visible in planner and add mode. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-29Small whitespace fixesGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-29Need to quote some more HTML charactersGravatar Miika Turkia
Double quote will break HTML export when it is e.g. within notes. Similarly < and > characters are treated as HTML tags unless quoted properly. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-29Export tags in json arrayGravatar Gehad elrobey
This will help in searching based on tags Also some minor coding-style fixes Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-29Fix json exporter outputGravatar Gehad elrobey
The note is prefixed by a colon Fix the output of Null values of dive master, dive suit, location and buddy. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-29Some fixes for the json exporterGravatar Gehad elrobey
- check for zero Kelvin degrees temperature - show dives in group of trips - show the number of dives starting from 1 as in subsurface application. - produce localized output as selected in the user's preferences. - use &lt; and &gt; on the arrow buttons in the HTML file. - Call the translation functions for text strings Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-29HTML list exporterGravatar Gehad elrobey
Exporting the raw dive list into JSON format for later viewing with html and js files. Also some worldmap code organizations. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Planner: record the new dive at the correct timeGravatar Dirk Hohndel
We don't want to do this when calling plan() from createTemporaryPlan() - we only want to record the dive at the end of createPlan(). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Planner: always recreate staging diveGravatar Dirk Hohndel
Instead of even trying to keep one around (which then could cause all kinds of trouble) we now always delete it at the end of the planner. So simply always recreate one when starting the planner (and make sure that the staging dive has always been cleared out, first). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>