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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
We don't use any of the Standard Library features or classes in
Subsurface, except for three uses of std::sort, for which I added the
necessary #include.
It's always a good idea to include directly the headers you want,
without relying on indirect inclusion
On my machine, the build time dropped from 16.96s to 13.38s or a 12%
improvement.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
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>
This patch fixes the display of subsurface in smaller
screens by creating ScrollArea containers that are
now englobbing each of the Tab-pages and the Planner
Widget. Some of those widgets were pretty big by the
amount of things on it and it was too big for small
( 14" and 15" ) screens.
This seems to fix it, and looks good both on Gtk+ and
Oxygen styles.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This was not as hard as I assumed it would be. I may still change the
horizontal dimension to be the more logical seconds instead of minutes,
but for now this achieves the main goal.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
I'm sure there are more issues like this where we need to handle things
differently depending on whether we are planning a dive or adding a dive.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add two more rows to the widget - this is getting quite busy.
There still is some weirdness where the focus isn't returned where it
should be and a few other details, but overall getting there.
Added helper functions to parse a temperature and to deal with the
timezone offset - with that latter one I also fixed the time offset bug in
the planner.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
This gets things mostly right.
It creates a dive and uses the planner widget to create samples which are
copied into the dive. It fills in some reasonable defaults (DC model,
timestamp), but doesn't allow editing the timestamp (or the temperatures
and air pressure).
On accept the planner gets reset and the dive appears correctly in the
dive list.
Cancel still needs to be handled.
And I bet there are many subtle bugs lurking here and there. But it's a
start.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
This looks like it might work, but since we keep recreating the dive, the
info entered in the info pane is actually lost. But it's a step in the
right direction.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In add dive mode simply bring the diver safely back to the surface
(currently with a fixed ascent rate of 30ft/min (or 9m/min)).
We should make that rate configurable (for the planner as well as the dive
add function). Also, the dive add function should offer to automatically
include a safety stop.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
This almost fixes it, but the offset from UTC isn't calculated correctly
it seems. Committing and hoping that a Qt expert can help.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
The Planner should be 'almost' like the profile, with the possibility
to use the mouse and keyboard to input a new plan, so this is a bit
of 'getting there.' I don't like too much code duplication but since
the current Profile Graphics is a crude cut-and-paste from the old
Cairo backend, it's easyer to start from scratch and have it well
organized as Qt code.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
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>
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>
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>
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>
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>
Signal that the model changed when editing plan specific information,
when you changes the ATM pressure or any other information, the
graphic of the plan will be generated again to mirror your actual dive.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>