aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.cpp
AgeCommit message (Collapse)Author
2013-11-18Fix various issues with the dive add / edit manual dive codeGravatar Dirk Hohndel
- get_gas_from_events does NOT always set o2/he. It only updates them IFF a matching event is found; so we need to make sure we start out with a valid gas mix - the way we tried to restore the edited dive in case of an edit to a manually added that is cancelled was completely bogus. Way too complex when we can simply and reliably simply store the dive and then copy it back Fixes #270 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-18Don't add spurious 5m/15ft node at 10 minutes when canceling editGravatar Dirk Hohndel
When cancelling the edit of a manually added dive, we should send the sample with timestamp 0 to addStop - that's a magic value and causes us to add a node at 5m/15ft and 10 minutes instead. Since the dive always starts at the surface, calling addStop is redundant, anyway, so let's just not do that. See #270 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-17Removed the ugly icons on the visual profile editorGravatar Tomaz Canabrava
Removed the ugly icons on the visual profile editor and replaced them with the much better looking ones that Luisa designed. This was not a simple search and replace since Luisa's design was a bit more sophisticated. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-17Remove ununsed variablesGravatar Dirk Hohndel
The warnings are distracting - and the variables are truly obsolete by now. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15Don't create stop at time zero when re-editing manually added diveGravatar Dirk Hohndel
To our addStop method time = 0 & depth = 0 are a magic flag. And since we always start at the surface, that is assumed, anyway. So let's just not add a stop for that when re-creating a plan from a dive. Fixes #254 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15Once again remove debug output.Gravatar Dirk Hohndel
Oops again. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15Enable a context menu to remove dive handlers.Gravatar Tomaz Canabrava
This commit enables a context menu to remove dive handlers, because it was hard to find that ctrl+click selected it, then a delete button press removed it. it's better now. :) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15Fix dive planner widgetGravatar Dirk Hohndel
In commit 0f50b73f9e88 ("Fix planner / add dive handling of DiveHandler Points") some issues were introduced. While it is fine to remove the artificial first point at the surface, the commit broke the special handling for o2 == -1, i.e., the usual case where a default gas needs to be picked. This generalizes the algorithm previously used to also look to the right, now that we are no longer guaranteed that there is a first point to our left. This also cleans up some whitespace damage introduced in the same commit. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15Fix planner / add dive handling of DiveHandler PointsGravatar Tomaz Canabrava
Dirk, is this really necessary or it's just something that you forgot to remove? this is adding a bit of pain to fix some issues on the planner, so I'm commenting this out untill you have a bit of time to look at it. It looks like this was added to handle the gas in the pos-1, but you reverted if so, this completely reverts it, and things works as expected again. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15Adds the first DiveNode at 5meters / 10minutes when clicking on plusGravatar Tomaz Canabrava
Adds the first DiveNode at 5m / 10 minutes when clicking on the plus button on the DiveNotes Table. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15Fix adding DivePoints on the planner via the table.Gravatar Tomaz Canabrava
Somewhere we broke this, most probably in the code that activated the planner to be used together as an 'add dive'. This commit makes the code workable again. There's one thing, though. if the model is empty, this will add something in the first point - it's behaving strangely. I'll try to fix this in a way that's invisible to the user, but overall, why are we inserting something in the first(0,0) time and depth? Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15Correctly handle changes on the CylinderModel to update the AirModel.Gravatar Tomaz Canabrava
What happened before was that the AirTypes model was only being updated when the user requested to change the air by clicking directly on the Air, in the planner ( but not on the Air Table. ). This fixes it by calling 'repopulate' whenever the cylinder model changes ( by adding, removing and changing something.) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15Close the Air list when clicking outside of it.Gravatar Tomaz Canabrava
This patch closes the air list when clicing outside of it, making the use of the planner more pleasant. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15Remove some unneeded member functionsGravatar Anton Lundin
We can wire qt to call the right functions directly, so we don't need these members. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15Planner: Default to GF from prefs.Gravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15Planner: use a QSpinBox for GFLow/GFHighGravatar Anton Lundin
Switch to using a QSpinBox instead of a QLineEdit. This makes it a bit more intuitive and now you can see how the deco plan changes based on the GF's. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14Hook up the tank change and tank update for the plannerGravatar Dirk Hohndel
This failed spectacularly when I first tried it, so I put it on the back burner. And it appears that with all my recent fixes for "add dive" as a side effect this is working, too. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14Fix some random compiler warningsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14Handle tank data correctly in profile editing mode for manually added diveGravatar Dirk Hohndel
This is subtle. Normally you would expect someone to edit the tank data by simply clicking on it in the equipment tab. But a user could conceivably edit the tank data after clicking on the profile editing button instead. This works now as well. This also addresses the issue that start and end pressure were not shown in profile editing mode. Fixes #235 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-13Correctly convert an existing dive into a planGravatar Dirk Hohndel
I missed this one spot when converting back to the different semantics for divedatapoints. With this change add dive appears to work correctly (fingers crossed). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-13Fix addGas to look at the correct cylinderGravatar Dirk Hohndel
That was a stupid bug. You have to actually update the variable to look at the right cylinder. Duh. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-13Don't change gas used in segments if there is still a cylinder with that gasGravatar Dirk Hohndel
Otherwise adding a second cylinder (to the default one cylinder of air) and subsequently changing the gas of that cylinder will illogically change the gas used in all the segments. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-13Connect changes in the tanks with the dive that is being addedGravatar Dirk Hohndel
- you can no longer delete a tank when its gas is in use - therefore you can no longer delete the last tank - when you change the gas mix of a tank, the corresponding segments in the dive change as well - when changing gas for a segment the correct available gases are offered Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-13Instead of a "Cylinder for planning" use a default cylinderGravatar Dirk Hohndel
Right now hardcoded to AL80. This way in the future we'll have a volume of gas that's available. And this makes much more sense then a random string in the description field. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-13Partially revert d72c69db7a49f and fix its errorsGravatar Tomaz Canabrava
In the offending commit a QWidget was changed to QTableView, but only in the header - and thus making avaliable all method calls, but the initialization of the widgets was still a QWidget, and nothing of QTableView was used besides an incorrect call to setColumnHidden. This commit fixes that by using the view() method provided by the TableView implementation which returns the true QTableView that should be used for specific nitpicking, like hidding columns. :) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-12First steps to make add dive work with the correct infrastructureGravatar Dirk Hohndel
This just makes sure that we do the right thing with the staging drive, that we don't mess up the selection, the we are smart about using our helper functions, etc. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-12Remove some debug outputGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-12Make planner work againGravatar Dirk Hohndel
This partially reverts changes in commit 1b655d5c806b ("Correctly track gases when manually adding and then editing dives") as it turns out this did NOT help us correctly track gases (which is ironic, given the title of that commit). I didn't actually want to revert that commit as infrastructure has changed since then and this made the patches look even more incomprehensible. So we are back to tracking the "gas on which we arrive at this spot" in each dive plan node as this makes the rest of our planning so much easier - I had forgotten about the reasons why we did things this way when I made the above mentioned commit. Instead we now make sure that our available tanks are added the correct way, that such entries are ignored when planning and when drawing the editable profile, and that at the end it all gets assembled correctly. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-12Add depth colum to cylinder modelGravatar Dirk Hohndel
To make the planner work this adds a new column to the Cylinder widget (depth - for the depth at which we want to change to a certain gas during deco). This also tries to hide that column in the equipment view and hide the start/end pressure columns in the planner view. Oddly that fails :-( Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-11When entering a new point, pick the previous gas by defaultGravatar Dirk Hohndel
This is much more useful than always picking air. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-11Connect cylinders entered in planner with the gases availableGravatar Dirk Hohndel
Now the gases for which we have cylinders are offered in the gas selection list and correctly recognized and added for the plan. Still tons of work to be done to make this work the way it is designed, but we are getting closer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-11Hook up delegate to enable cylinder autocompletion in plannerGravatar Dirk Hohndel
That was easy Hand-holding-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-10Enable adding cylinders in the dive plannerGravatar Dirk Hohndel
This is in preparation of using those to define the gases available for planning. Right now this doesn't seem to work quite right - I don't get the auto-completions for the cylinders that I was hoping for... This commit also corrects the tooltip for addint dive data points. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-10Show a cylinder widget in the dive plannerGravatar Dirk Hohndel
This is intended to allow the user to provide the gases / cylinders that she will be diving with. With that information the planner can warn the user about insufficient gases, but more importantly it can show relevant gases in the gas select drop down. Right now the add cylinder button doesn't add a cylinder - that's a problem. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-10Honor "last stop at 6m" in dive plannerGravatar Dirk Hohndel
And recalculate the dive when it changes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-09Remove left over qDebug() callGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-09Merge branch 'addDiveGasFix'Gravatar Dirk Hohndel
2013-11-09Adjust planner to work with the new semanticGravatar Dirk Hohndel
Insert the dive data point at 0,0 manually at the beginning of the plan. Now everything should work. We still can't edit a plan created like this, but at least we can once again plan things. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-09Fix position of depth reading when entering divesGravatar Dirk Hohndel
At 5% it would overlap the scale - now it's much easier to read. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-09Removed inconsistency when user tried to add dive while planning.Gravatar Tomaz Canabrava
The user could add a dive, and in the middle click on the 'plan' button. Since we didn't cared about that on the widget, a lot of inconsistencies could occour. this fixes that by setting a flag on the Planner, that has now three modes: nothing, plan and add. (maybe in the future an edit mode will be valid too.) If in 'NOTHING' mode, user can enter the addition, edition and planning. If in any other mode, user can't do a thing. The mode gets back to NOTHING when user accepts or cancels a plan / add / edition. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-09Fixes garbage left behind when canceling edit dive.Gravatar Tomaz Canabrava
Garbage was left behind when canceling edit dive, and thus when the user set his dive to be editted, after a first canceled edition, all points of the first edition got messed up and showing on the second dive too. if the user clicked 'ok', he got a really bad surprise. Fixes #226 Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-11-08Correctly track gases when manually adding and then editing divesGravatar Dirk Hohndel
The code had quite a few odd special cases that may have been left-overs from the old Gtk algorithm. With this the gas is actually in the dive plan node where it's use starts. And we maintain the gas correctly between multiple edit sessions. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-08Be consistent when passing around gas data in the plannerGravatar Dirk Hohndel
We need to make sure that the correct segment has the correct gas assigned to it - and that those gases are correctly tracked when editing a manually added dive as well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-08Correctly identify airGravatar Dirk Hohndel
Because of rounding issues we need to use our macro to test for air (especially since the events store gas percentages and not gas permille). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-07Include the cylinder information in a dive added with "Add Dive"Gravatar Dirk Hohndel
We only copied the samples, but not the related cylinder data. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-01Enable undo for the Edit mode on Added Dives.Gravatar Tomaz Canabrava
This enables undo for the edit mode on added dives, it uses the premade backup to fill the old dive with data. :) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
2013-11-01Changed the backup implementation of the samples on EditDive.Gravatar Tomaz Canabrava
Changed the backup implementation of the samples on EditDive, it's way cleaner now what's happening, and it's also better for the cancel edit. Next: The Cancel Edit. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
2013-11-01Enable editing a dive that was manually entered.Gravatar Tomaz Canabrava
This patch enables editing a dive that was manually entered, it doesn't cover dive plans yet because on the plan I need to figure out what are the 'user-entered' points, and what are the algorithm point. and I feel lazy. =p One last thing that's missing is to revert the dive to the previous condition if the user cancels the edition, currently canceling and applying ok is the same thing. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
2013-10-11Fix dive planner sidebar depth unitsGravatar Linus Torvalds
The dive planner always showed the depth in our internal units, ie millimeter, in the sidebar that showed the plan points. That made little sense in metric mode, and none at all in imperial. The _graph_ showed things in meter and feet. So make the DivePlannerPointsModel always convert things to and from the user units. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> 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>