[Dirk Hohndel: combined two commits into one and cleaned up some
whitespace issues]
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The code removed was already ported to the New Profile.
We managed to clean quite a bit. huhhy
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The new profile code handles the resizing of the profile area in order to
accomodate the depth and time of the dive much more intuitively - the old
manual buttons to do so are no longer needed.
This also removes a few other unused methods.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This code is not ported to the new profile, but from what I
can understand from it, it doesn't need to be. The purpose
of this code was to setup the correct colors and strings
for the current mouse position, we already do this on the
Profile in a different way, on the Notification Area.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit makes the planner actually work. There ar still
a few edges, but oh, joy - the new Profile gave a very unexpected
and nice addition to it - Grab the last handler of the initial
dive, and move it to the right, or get any handler, and move it
to the bottom to see what I mean.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds a itemChange method, that emits a 'changed'
signal when the handler is moved. I'll use that signal on
the profile to call the correct method.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
All code that was removed already is working on the New Profile,
The code that's behind #if 0 means that it still needs to be ported and
because of some removal, it was not possible to keep it compiling (mostly
the removal of the Ruler class, that is the Axis, on the new profile).
The rest of the code that's untouched - most probably will keep that way.
The DivePlannerPointsModel is correct and well done, no need to change
that, only the Graphics part.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
But it doesn't move the handlers yet, and when you confirm it you also
must click on the dive to select it or the profile will show garbage.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
A signal can connect to another signal, so I removed a slot that had the
sole purpose to call another signal and replaced that with a direct call.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This way, the user can save dives containing sets of "standard cylinders". Selecting one of those prepopulates the gas list for the planner.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Rewrite of the actual planner logic. Now ascend to the next potential stop
depth. There the state is cached and we try to ascend to the next stop
depth. If we hit the ceiling while doing that we go back to the cached
state and wait there for a minute. Then we try again. Then loop.
Converted all depth related variables from unsigned int to int. During
planning, in a time step the current depth can temporarily be negative and
comparisons of a negative int with an unsigned it have not the result I
expected ( (int) -2 < (unsigned int) 3 turns out to be false). And we
don’t really need the 32nd bit that unsigned buys us for depths.
Deco stops are now shown in the same table as manually entered stops in
boldface (I removed the second table to save screen estate).
The gas shown in the table is still misleading as it means the gas used on
the segment leading up to that event.
The update of the profile only works partially upon changes in the list of
available gases.
Treatment of various gases is basically there but needs some more love.
The ascent velocity is now provided by a function that takes the current
depth as argument. Currently it always returns 10m/min but that will later
be variable (and hopefully user configurable).
The profile is not redrawn while deco is computed (avoiding an infinite
recursion).
The table got a new column for the duration of a segment while the old
“duration” column was renamed “Runtime” to reflect what it actually shows.
Currently, only the run time but not the duration are editable.
All deco gases are used from the depth where their pO2 is 1.4bar. This
should become more flexible.
Calculation of the pressure drop in cylinders without configured volumes
is suppressed. This solves a problem with the planner crashing when saving
a dive where not all cylinders had been manually given a volume.
[Short rant break: Treating 0/0 as air bites back at so many places. E.g.
Cylinder data is initialized with memsetting the whole structures to 0.
Then later suddenly this totally unconfigured cylinder is being treated as
it would contain air. Maybe at some point this was a feature. But it lead
to a naughty bug which took me over an hour to resolve. We should
seriously reconsider this choice and better move to 209/0 being air if
changing this everywhere is not too much trouble]
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Model derived from tableview is expected to have remove slot,
which is missing in DivePlannerDisplay currently. This patch fixes
the annoying warning message while starting Subsurface because of
not including remove slot.
Currently there is lot of work to do, that either requires modifying
the model to skip 'remove' slot or find a way to make them inactive.
Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Recently Robert Helling provided a patch "Distinguish between entered and
calculated waypoints" in an attempt to distinguish between entered and
calculated stops.
This patch is an independent (content wise) extension of the above
patch and is built relative to it which adds new table to display
computed waypoints in plan mode.
Currently table includes only two columns "Comp. Depth" and "Comp.
Duration", which can extended to show further information.
This is only a start to the UI interaction in PLAN mode.
In addition to this there are many TODO things that diveplan feature
demands
TODO:
1. Show more details through "Computed Waypoints" table.
2. Remove tooltip from "Computed Waypoints" table widget.
3. Make contents in "Computed Waypoints" table widget non-editable.
4. Fix error when trying to save dive plan without using cylinder data.
5. Make dive plan editable after saving it.
6. Improvise dive planner graphics window.
Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
* 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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
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>
- 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>
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>