aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.cpp
AgeCommit message (Collapse)Author
2013-08-26Fixed entering a dive stop before another dive stop.Gravatar Tomaz Canabrava
Fixed entering a dive stop before another dive stop, the correct way is to fix the position of them but this is easyer - I'll update the correct one in a couple of patches. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-26Fixed invalid values on the TableViewGravatar Tomaz Canabrava
The values of the dive points on the tableview were too big, I'm now dividing time by 60 and depth by 1000 to get the correct results. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-26Fixed a bug where moving a handler would mess the plannerGravatar Tomaz Canabrava
Fixed a bug where moving a handler would mess the planner by calculating invalid values to the planner on the model side. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-26Moved a lot of code to the Model, cleaning the interface.Gravatar Tomaz Canabrava
Moved a lot of code that handled the positioning of the DiveHandles on the interface to the model. there are a few bugs left ( regressions ) that I will fix in the next commits. With this commit an edition of the points on the widget will trigger a repaint of the planner profile. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-26Moving Handler on Graphics Updates the Model on the PlannerGravatar Tomaz Canabrava
Moving the handler on the graphics updates the model on the planner Unfortunately, the graphics will move back to it's original position because of the legacy code used to calculate the dive plan. Next: fix the legacy code used to calculate the dive plan. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-26Moved the creation of the data plan point to the model.Gravatar Tomaz Canabrava
Moved the creation of the data plan point to the model, this way when the user creates a data point on the graphical planner, or when the user creates the point on the QWidget based view, both of them will be updated. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-26First implementation of the Shared Model for the PlannerGravatar Tomaz Canabrava
This implementation of the shared model already shares some, but not all data between the two views, but it's already a huge improvement. When the user clicks on the visual planner, it will update the view on the qt-widget based view. The editing of the view is still not allowed, and removing nodes is not allowed too ( yet. ) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-26Started the Model to handle the DivePointsGravatar Tomaz Canabrava
Started the model to handle the divepoints between the Qt Widget interface and the QGraphicsView one. good thing is that we share code. Bad is that a model is harder to work, but doable. :) With this finished ( in a couple of commits ) one can insert a point on the Qt widget or on the graphics view and it will be 'mirrored' to both interfaces. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-26Changed the WindowHint of the planner popup to 'Popup'Gravatar Tomaz Canabrava
Changed the Window Hint of the planner popup to 'Popup' this removes ghost items from the task bar. Hint By: Danilo Cesar Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-26Code Cleanup: Buttons on Graphical PlannerGravatar Tomaz Canabrava
Removed a bunch of non-used graphics buttons, since the new widget now contains everything needed for the creation / cancelation of the dive plan. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-26Added a new widget to control the PlannerGravatar Tomaz Canabrava
Added a new widget to control the DivePlanner, now we have two widgets, a graphics one and a qt sidget based one. the Technical divers will most likely use the QtWidget one while the hobbists will most likely use the QGraphicsView one. there's not a option to choose one, they both will appear at the same time. Next step: make the screens to work. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-05Delte the temporary dive from the divelist after calculating deco.Gravatar Robert C. Helling
This bug manifested itself as too long deco obligation when moving waypoints to later and then back to earlier times as all intermedite versions were created as dives in the divelist (and the saturation of these "previous dives" was taken into account. It is not entirely clear to me how the dive will be permanently added to the divelist once ok is pressed: One could in createDecoStops allocate struct dive from the heap rather than from the stack and return a pointer to it and which is then added to the dive list upon pressing ok. [Dirk Hohndel: add include file to make this compile] Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-07-21Added the possibility to choose gases in the planner.Gravatar Tomaz Canabrava
Added the possibility to choose gases in the planner, now the user should click on the name of the gas, a popup window will appear, asking the user to choose what gas he wants for that ascent / descent. now we need to hook that up with the createDecoStops method that calculates the decompression. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-21Added a missing #UNDEFGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-21Good code cleanup.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-21Added the current gas used on the plannerGravatar Tomaz Canabrava
Added the current gas used on the planner, now it's a matter of choosing the new gas, that will be done in the next commit.e Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-21Removed unused code.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-21Added button to reduce dive time on the planner.Gravatar Tomaz Canabrava
Added a button and a method to reduce time on the dive planner. The dive planner will not reduce below deco-time and it will also not reduce below TIME_INITIAL_MAX. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-21Added ( finally ) the code to reduce depth on the plannerGravatar Tomaz Canabrava
Added the code to reduce depth on the planner. Depth cannot be lower than 40m and it also won't let the user reduce if there's any point on the 'reduced' area. the icon is ugly - we need an artist. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-04Added a messageBox when the planner quits with a working plan.Gravatar Tomaz Canabrava
Added a messageBox to warn the user that he quit with a working plan, to reduce the risk of unwanted loss of work. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-04Added the left / right shortcuts for moving the handlers around in time.Gravatar Tomaz Canabrava
Added the left / right shortcuts for moving the handlers around in time, this also made me wonder why we have the 'previous dc' on the menu, it got actually to broke my code on the shortcuts for the planner because they are active everytime - should they be active only when the profile's visible or they serve any other purpose? If they serve only for the profile, I'll get them out of the menu and put them in their proper place - the profile view. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-04Added 'up' and 'down' actions on the dive planner.Gravatar Tomaz Canabrava
Added 'up' and 'down' keyboard actions on the dive planner, you need to select the handlers with ctrl + click, then press up to make the handler go 1m up, or down, to make the handler go 1m down. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-04Added a 'delete' action, with the keyboard.Gravatar Tomaz Canabrava
Added a delete action from the keyboard, there's also a possibility to add the same action from the menu, but I frankly don't like much the idea. so, to delete a handler now, you need to select it ( ctrl + click ) then press the delete button. Multiple delection is also possible. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-04Added a shortcut to 'esc', so it clears the selection or cancels the plan.Gravatar Tomaz Canabrava
Added a shortcut to the esc key, so it clears the selection, if there's no selection, it acts just like clicking on the 'cancel' button. Next: delete selected handlers. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-04Make possible to 'select' an handler by ctrl+clickGravatar Tomaz Canabrava
Make possible to select an handler by ctrl+click on it, this will be used in the future for the shortcut actions, like delete, arrow keys, and such. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-04Fixed the 'hard to grab' Handler, Dive Planner now is very smooth.Gravatar Tomaz Canabrava
So, it was on the docs, but I didn't read it before, if the scene has items that ignores transformations, we need to pass the view transform to the method that gets the items in the scene. I also used IntersectsItemBoundingRect instead of IntersectsItemsShape because it's faster, and our items are small, so we don't need an very accurate but slower method. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-04Make it possible to drag a handle between handlersGravatar Tomaz Canabrava
Make it possible to drag a handle between handlers, this way the configuration of the dive is more acurate and easyer to make. I'v discovered a problem where it's a bit hard to 'grab' the handler, investigating it now. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-04Make it possible to add a handler between othersGravatar Tomaz Canabrava
Make it possible to add a handler between others, someone asked why I didn't make like this from the beginning, the answer is that I wanted to have something stable before messing a bit more with the planner, but since the planer is almost-stable, I added. :) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-04Better positioning of buttons on dive plannerGravatar Tomaz Canabrava
Better positioning of buttons on the dive planner. The ok / cancel buttons are in the correct place, and the '+' sign for time will not overlap the time string anymore. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Silence some warningsGravatar Dirk Hohndel
One of them actually looks like it was a bug... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-07-02Make the increase time button to work.Gravatar Tomaz Canabrava
Makes the increase time button to work, it will increase the minimum time, not the correct time of the dive. the total time is calculated by the deco, and does not come from this, unless the deco is smaller than the minimum time. This patch also fixes the problem where a button would only click once - I was holding the first clicked button as the 'mouse grabber', bad tomaz. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Make the 'increase depth' button to work.Gravatar Tomaz Canabrava
Make the increase depth button to work, it also adds a 'safety' stop at 150m, I know that this is deep, and maybe we need to adjust this to a better safety stop. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Removed user-entered lines on the plan, keeping only deco.Gravatar Tomaz Canabrava
Removed the user-entered lines on the plan, keeping only deco, This way the graph looks way prettier and we don't loose any functionality. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Change the color of the DepthString based on it's deepnessGravatar Tomaz Canabrava
Change the color of the DepthString based on it's deepness on the profile planner. The new color of the profileString ( the string that follows the mouse stating how deep you are) is now interpolated from SAMPLE_SHALLOW and SAMPLE_DEEP - but since those two colors were the same and I had to change it so that could work, I want somebody to check if my choose of colors were ok. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Use the same profile colors on the planer for the Time and DepthGravatar Tomaz Canabrava
Use the same profile colors on the planner for the Time and Depth rulers. this needed a new method on the rulers - setColor, that will call the setPen method and make everything behave properly. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Fixed positioning of the dive Handlers.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Correct collors for the DivePlanner background.Gravatar Tomaz Canabrava
Use the correct colors for the Background on the Dive Plan, same as on the Profile. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Added the last 'tick' to the rulersGravatar Tomaz Canabrava
The last tick to the rulers were missing, this was making them to look odd, this make the rulers better looking, but it caused the other-non-ported-yet-to-percent stuff to behave in a not so good way, most visible one is the handlers, gonna update them next. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Change the rules so they work with percentages.Gravatar Tomaz Canabrava
Changed the ruler so that they work with percentages, also added a new method to the rules to set the size of the ticks. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Added a method and a simple stub to position things using percentage.Gravatar Tomaz Canabrava
Added a method and a simple stub to position things on the canvas using percentage - this way I have a proper control on where I want to put things on screen and it will make simpler for future changes, even if the amount of code written is a bit bigger. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Shared background for profile and planner.Gravatar Tomaz Canabrava
Share the background for profile and planner. Those are not the same class, but they should behave somwheat the same. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-27Make planner prettier. but still ugly.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-27Removed memleak created by the diveplan calculationsGravatar Tomaz Canabrava
Removed a small memleak created by the diveplan calculations. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-27Added the Ok / Cancel buttons on the dive planner canvas.Gravatar Tomaz Canabrava
Added the ok / cancel buttons on the dive planner canvas. I still need to hook the esc button to cancel it too, but since I removed the 'floating dialog' option and merged it into the mainwindow, it's necessary. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-27Moved the DivePlanner to the MainWindow.Gravatar Tomaz Canabrava
Now, activating the dive planner will hide the profile and show the planner on the same place. we still need a way to 'cancel' or 'accept' the profile created. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-27Somewhat saner behavior for rescaling the planner time axisGravatar Dirk Hohndel
We always resize if the dive is longer than the current scale allows, but we don't shrink it overly aggressively and we never shrink it below the initial size. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27Correctly prevent time travel in plannerGravatar Dirk Hohndel
Prior to this change the visual feedback (the handle that is drawn when the user moves the mouse while pressing the left mouse button) would not move to an illegal position (one that is impossible without time travel), but it the user moved the mouse to such an illegal position and then released the mouse button, we still added that illegal position to the plan. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27Remove unused codeGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27Remove incorrect logic for first line in plannerGravatar Dirk Hohndel
This greatly simplifies the code. Similar to (but not based on) code submitted by Robert Helling. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27Removes circle in planGravatar Robert Helling
Remove circle in plan by starting the first line at the first point rather than the last. In addition marks all entered points as entered and not just the first and sets line color accordingly. Makes plan_add_segment return the added data point. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>