summaryrefslogtreecommitdiffstats
path: root/qt-ui
AgeCommit message (Collapse)Author
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-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-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-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>
2014-05-28Planner: make sure stagingDive is reset to NULLGravatar Dirk Hohndel
If we first ADD a dive and then PLAN a dive, stagingDive first was an alias to the current_dive (for ADD) - we need to make sure that when PLAN is started, a new dive is allocated. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Add dive: only copy cylinders when necessaryGravatar Dirk Hohndel
If the stagingDive is just an alias for the current_dive (as it is in dive ADD mode), there's no need to copy the cylinders; they are already there. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Fix edition of manually added dives.Gravatar Tomaz Canabrava
This patch correctly sets the state of the planner to "NOTHING" after trying to edit a manually added dive. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Fix crash on adding / removing a dives from add menuGravatar Tomaz Canabrava
This patch removes some inconsistencies that were happening on the add dive / cancel actions. a bit of legacy code from the old system was still in, which made things quite... EXPLOSIVE. This fixes restoring the selection only if we have a selection and not deleting the temporary dive twice. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Move code from the Planner that doesn't belongs there.Gravatar Tomaz Canabrava
Moved the connections between DivePlannerPointsModel and MainWindow from inside the Planner class to the MainWindow. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Planner: set up a cylinder, even if no current dive is selectedGravatar Dirk Hohndel
If there was no current dive we didn't set up any cylinder at all which was a bit awkward as we use AIR but have no cylinder corresponding to it, which breaks assumptions elsewhere. Instead we use either the default cylinder or make one up. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Planner: really fix crash after aborting plannerGravatar Dirk Hohndel
Duh. We had to reload the list (and make sure the internal data structures are recreated as well) before restoring the selection. I also switched to simply accessing the widget directly, instead of via the dive_list() call. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Planner: prevent crash when canceling plan with existing dive listGravatar Dirk Hohndel
There is still something seriously wrong here. For now let's just not restore the selection and at least this prevents us from crashing. But I still don't understand why it crashes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Dive list: use helper function when restoring selectionGravatar Dirk Hohndel
Looping over the individual dives will be very slow if there are many of them, as the profile will try to render each of them in succession. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Fixes showing the Empty Profile when Add / Plan dive is cancelled.Gravatar Tomaz Canabrava
for some reason the next selected dive is NULL after cancelling the plan. I'm investigating. This patch fixes the show of the empty profile and it also untangles some parts of the code, keeping the mainwindow where it should belong : the mainwindow. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Minor cleanupGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Try to clear out the profile when dive list is emptyGravatar Dirk Hohndel
This only partially works. If I start from an empty dive list, plan a dive, then abort, there are still leftovers in the profile widget. Hitting Ctrl-W clears that out. But it just runs the same cleanUpEmpty() again... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Dive planner: remove the fake dive earlier on cancelGravatar Dirk Hohndel
This way it's already gone from the dive list before it gets reprocessed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Dive planner: remember the selection before new dives get handledGravatar Dirk Hohndel
On an empty dive list we would remember the new dive (which gets auto-selected since it's the only dive) and then crash when we try to restore that selection after cancel (in which case that new dive is gone). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28Dive add: remove duplicate codeGravatar Dirk Hohndel
This is already done when we create the fake dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-27Dive add: fix crash when cancelingGravatar Dirk Hohndel
We need to reset the editMode right away, otherwise all the changes to the input field (when resetting the data after the user cancels) will cause Subsurface to crash as current_dive will temporarily be NULL. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-27Much, much smarter way of finding the TagsGravatar Tomaz Canabrava
The old way manually implemented a parser, where it could simply call a regexp (or, in my case, a QChar) that will split the QString into many, to find the beginning and end of the strings on the tags. This patch also fixes a Qt5 off-by-one bug on the tag Visualization. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-27Fix manually adding diveGravatar Dirk Hohndel
I'm sure canceling the plan when saving an added dive made sense at some point for some reason. Right now it makes things crash, so let's not do it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-27No need to separately enable and switch focus to the dive listGravatar Dirk Hohndel
RefreshDisplay() does this for us. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-27Planner: correctly refresh the displayGravatar Dirk Hohndel
We were making things way too hard (and were doing things that don't need doing, like clearing the DivePlanPointModel). Currently we still crash after manually adding a dive or when canceling a plan. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-27SetFocus only works if the widget is enabledGravatar Dirk Hohndel
One could argue that this makes sense... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-27Planner: return Profile widget to profile stateGravatar Dirk Hohndel
This still crashes when canceling the plan. And doesn't display the correct dive profile until you switch to a different dive and back. And Keyboard focus is wrong. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-27Planner: use the gas in the first cylinder for initial planGravatar Dirk Hohndel
As Tomaz suggested, I don't need to pass the information whether we are on the planner into the function - it's part of the DivePlannerPointsModel and therefore already knows. Also, we want to make sure we actually use the gas that's in the first cylidner of the staging dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-27Planner: better handle the temporary dive used for planningGravatar Dirk Hohndel
This still crashes when you abort the plan. And when you accept the plan, the profile stays stuck in PLAN mode. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-27Planner: disable the dive list when working on a planGravatar Dirk Hohndel
And reenable it when refreshing the screen. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-27Planner: clean up the logic for starting up the plannerGravatar Dirk Hohndel
The existing code had no chance of every working - on so many levels. First unselect all dives, then extract data from a selected dive? Set up the cylinder data (which didn't work), and then clear the data again? What the heck. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Paint the dive red if the user is breaking ceiling on the planner.Gravatar Tomaz Canabrava
This patch paints the dive red if the user is breaking ceiling on the planner - it's quite fast, it analizes the depth over the max(tissue_1 .. tissue_16) and changes the color of the profile. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Better movements from the lines when added / removed.Gravatar Tomaz Canabrava
This makes the movements from the lines when added / removed SO much better. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Planner: don't try to update the MainTab dive info while in plan modeGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Speed up the grid: don't repaint when uneeded.Gravatar Tomaz Canabrava
Added a flag to only recalculate the axis when needed. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Do not set maxTime when the handler is moving.Gravatar Tomaz Canabrava
Fixes massive cpu hog. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Activate the PlannerGravatar Tomaz Canabrava
On the cleanup dirk forgot to set the plan tipe to PLAN instead of ADD Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Merge branch 'Planner'Gravatar Dirk Hohndel
2014-05-26Planner: copy samples and events for plan and addGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Planner: Don't include the ascent in the default diveGravatar Dirk Hohndel
Allow to both create the full default dive or ownly the descent and bottom part (so the planner can deal with the ascent). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Make the planner show something.Gravatar Tomaz Canabrava
This is working in the wrong way, mostly because I'm setting the plannermodel to ADD state ( and the planner graphic to the correct PLAN state ), but I don't know why - when on PLAN state on the model, things just don't work. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Created a function to create a fake dive for Add and Plan states.Gravatar Tomaz Canabrava
This function should likely to move to C in the future, I'm only adding this here because I'm changing this file so much ( already 4 rewrites of the function ) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Remove uneeded call.Gravatar Tomaz Canabrava
The disableDcShortcuts is called inside of the ProfileGraphics ( I actually think that this method should be moved to there ) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Small code cleanup.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Planner: Move method down below to easy comparisson with another.Gravatar Tomaz Canabrava
Planner and add states are driving me nuts. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Planner: states Add and Plan have a similar behaviorGravatar Tomaz Canabrava
So, the code is equal. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Planner: Re-enable using the new profile.Gravatar Tomaz Canabrava
This correctly enables the planner on the new profile, but it doesn't triggers the correct paint on the canvas. [Dirk Hohndel: remove other remnants of the disabled planner as well] Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Merge branch 'atdotde'Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org> Conflicts: qt-ui/diveplanner.cpp