aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.h
AgeCommit message (Collapse)Author
2014-02-27Massive automated whitespace cleanupGravatar Dirk Hohndel
I know everyone will hate it. Go ahead. Complain. Call me names. At least now things are consistent and reproducible. If you want changes, have your complaint come with a patch to scripts/whitespace.pl so that we can automate it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11Put include guard to every headerGravatar Boris Barbulovski
* ensure include guard to every header * comment endif guard block Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11Update #include statement for QStringListModelGravatar Boris Barbulovski
Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09diveplanner.cpp improvementsGravatar Boris Barbulovski
* Add missing variable members to the initializer lists. * Add *lazy* structure initializations. Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-24Don't use QList if sizeof(item) > void*.Gravatar Tomaz Canabrava
QList is optimized for storing pointer-sized items, thus a QVector is the better choice for everything else. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> 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-09Implement a settingsChanged in DivePlannerWidgetGravatar Anton Lundin
This is so we can default to the GF's from the preferences. We need the bail handler in createTemporaryPlan, because its triggered when we change GF's, and if we don't have a stagingDive there, we will access a NULL-pointer. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-08Keep track of user requested minimum depthGravatar Anton Lundin
When got auto-rescaling of the depth scale, always reset the depth scale to what the profile would suggest. This introduces a concept of user requested minimum witch we will update and not scale down to lower than. Reported-by: Henrik Brautaset Aronsen <henrik@synth.no> Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-03Correct parameter namesGravatar Dirk Hohndel
It's very confusing when a parameter is called "minutes" but holds seconds... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-30Delete the graphics items for the ticks and labels in the rulerGravatar Thiago Macieira
Ruler::updateTicks() was creating them, but nothing deleted them. Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-26Changing the preferences should update the Add Dive interfaceGravatar Tomaz Canabrava
Since all internal units are in mm we needed to only update what's shown on the interface. Fixes #299 Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19Enable gas selection through a context menuGravatar Tomaz Canabrava
This patch re-enables gas selection through in the add dive profile. Good thing ( and I really didn't think of that before ) is that it is less than half of the code of the other implementation. :D Fixes #265 Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19Removed obsolete Code ( gaslist on text click )Gravatar Tomaz Canabrava
This commit removes obsolete code, there was a gaslist selection when user clicked on the buttons, but this shouldn't be anymore, since the next commit will add a menu to select the gas for that particular point. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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-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-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-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-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: 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-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-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-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-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-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-09Merge branch 'addDiveGasFix'Gravatar Dirk Hohndel
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-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-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-06First steps towards removing glib dependenciesGravatar Dirk Hohndel
- remove the build flags and libraries from the Makefile / Configure.mk - remove the glib types (gboolean, gchar, gint64, gint) - comment out / hack around gettext - replace the glib file helper functions - replace g_ascii_strtod - replace g_build_filename - use environment variables instead of g_get_home_dir() & g_get_user_name() - comment out GPS string parsing (uses glib utf8 macros) This needs massive cleanup, but it's a snapshot of what I have right now, in case people want to look at it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-03Make the classes generated by uic be real members of our classesGravatar Thiago Macieira
This means we don't have to new/delete them, which is a waste of overhead. Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-03Include the ui_*.h headers in the main headers.Gravatar Thiago Macieira
This means we can also remove the forward declarations. This is the first step in removing the memory allocation for the ui sub-classes. Without the second step, this commit is just making the compilation time increase for no good reason :-) Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-22Prevent nodes in planner / dive add profile edit to run past each otherGravatar Dirk Hohndel
I always disliked the fact that when you moved the handlers around you could just 'run over' the neighbors. This also (as a somewhat intended side effect) prevents vertical descents and ascents). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-21In planner / add dive use 'ESC' to hide the gas selection popupGravatar Dirk Hohndel
Not sure if there are other keys we should support. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-20When manually adding a dive, start with a simple diveGravatar Dirk Hohndel
This is much friendlier than just showing an empty profile. I picked a nice and simple three level dive. 25 minutes at 18m, 15 minutes at 9m, and a safety stop. Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-19Merge branch 'addDive'Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-19Continous update of plannerGravatar Robert Helling
Make the planner update its display continuously upon moving points including deco. This appears fast enough on typical PCs. If this ends up being to slow on some systems we may have to make it configurable. [Dirk Hohndel: cleaned up the two patches and turned into one commit] Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-18Rename createDecostops to drawProfileGravatar Dirk Hohndel
After all, that's what the function does. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-18Use Planner dialog to add diveGravatar Dirk Hohndel
Right now this is just calling the same code and setting a flag whether we are planning or adding a dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-16Plotted the Scale on the Ruler ( depth / time ) on the plannerGravatar Tomaz Canabrava
Plotted the Scale on the Ruler in the planner. There's a tiny bit issue - mostly noticiable while resizing, but it's not a killer. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-16Ok on the planner now correctly creates a Dive.Gravatar Tomaz Canabrava
Ok on the planner now correctly creates a dive, a few remarks, tougth: 1 - the number of the added dive is always 0 ( but I may be testing it wrong ) 2 - the information pane is working only when the mouse is clicked, this is a regression and it will be fixed. ;) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-16Move the creation of the dive plan to the modelGravatar Tomaz Canabrava
The dive plan was bein created on the Profile, this While this worked out, it created a bit of spaggethi code, so now the model will take control of *everything* on the planner. I tested it quite a bit and doesn't seems to have appeared a regression, wich is good. Now that a dive plan is bein created, I can just save it. :) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-16Plug the Cancel action on the Dive Planner Table and start the 'ok' code.Gravatar Tomaz Canabrava
Plug the cancel action on the dive planner ( before that, only by hitting the 'ESC' button things worked, so now you can also click on the Cancel box that's on the right of the planner profile window. Also, the beginning of the 'ok' code is also at place. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-16Position the X and Y labels of the RulersGravatar Tomaz Canabrava
Position the X and Y labels of the rulers, this way it's a bit more clear the deepness and the length of the trip. It's still not the best approach, but I'm getting close. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-09Make the Plus Button on the planner work.Gravatar Tomaz Canabrava
Clicking on the plus button now adds a new stop on the planner. The depth is always 10m and the time is 10 minutes after the last stop. can be changed by double clicking or dragging the balls around the canvas. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-09Plug most of the dive planner - non - model stuff.Gravatar Tomaz Canabrava
Plug most of the dive planner controls that weren't plugged yet - StartTime, ATMPressure, BottomSAC, DecoStopSAC, LowGF and highGF are being used by the calculations now. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-02Code Cleanup: Merged the three TableViews shared codeGravatar Tomaz Canabrava
Merged the shared code for the three table views into one code, this way less code is needed if we need to construct another tableview in the future. I still need to clean some of the models too. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-30Make planned points deletion works on the Table too.Gravatar Tomaz Canabrava
Now the planner deletes points by clicking on the trash icon on the table. The dive planner is almost finished. <3 next: add a point from the table. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-30Moves deletion logic of divepoints to the Model.Gravatar Tomaz Canabrava
Deletes the logic of divepoints to the model, this makes automatic updates on the table on deletions. ( remember, to select dive points, ctrl+click on it. ) if you want to delete it, press 'delete', it will be removed from the graphics part and also from the table. Next: delete point by clicking on the table trash- icon. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>