We remember what was selected before and restore it. Maybe there's a more
"Qt way" of doing this, but my implementation appears to work :-)
Also remove unconditional debug output that snuck into an earlier commit.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When right clicking a dive on the divelist a dialog for selecting a dive
was opened. However, Save As requires a getSaveFileName dialog so that
user can give a new file name as well as selecting an old file to
overwrite.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When reordering the info overlay content to make it jump around less,
somehow the SAC data got printed twice.
[Dirk Hohndel: rewrote incorrect commit message]
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Store the calculated values in separate variables in the plot_data
struct, and display them separate. This makes sure we don't confuse the
calculated values with the ones from a dc, and now we can compare the
two.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
We carefully assembled the correct data in the cylinders - don't replace
that data when manually editing a dive.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
- 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>
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>
While the argument could be made that this is just a symptom of Subsurface
getting very confused about the selection (which it still gets at times -
most likely we are calling select_dive() instead of selectDive() (or the
corresponding deselect functions) in places where we shouldn't), but
either way, we should not crash.
Fixes#220
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We previously did did bad things when running with an empty configuration.
This attemps to clean it. We will now correctly handle the splitters in
almost all cases ( if I didn't break anything on the way. )
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
Break the huge calculate_deco_information into three different functions.
One for the current deco calculations, one for the ndl/tts/deco stop and
one for the gas calculations.
This makes it easier to disable/enable different functionality.
This also gets rid if the ccrdive state variable, and keeps that state
in the plot_data struct. Now we calculate the deco before we calculate
the gas properties, so if we have a po2, we're in ccr-mode, and if we
don't, we're in oc mode.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When moving along the plot, it's hard to look at a certain value when its
place in the info box moves due to values being added or removed above it.
This commit moves the "stable" values up top in the info box and the
values that come and go further down, so that the box expands downwards.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This changes the special handling of ndl calculations when we deem that we
are too shallow for doing them. Previously we just set ndl to -1 and
printed a "-", now we return and print max_ndl, just as how most
divecomputers work.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Let the user choose if the calculation of ndl and tts is worth the time
it takes.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This will fill out the gaps of temperature data between all the points
so we always have a temperature to show in the info box.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This isn't perfect as it doesn't really cover all cases. If we need to
generate a profile for some fairly insane cases, the stupid thing just
gives up rather than try to search for a solution that satisfies the
constraints.
For example, if you have a maxdepth=10m and an average depth of 9.9m, it
will try two different (roughly sane) dive profiles, fail to get anything
that matches that kind of dive and that average depth, and then just say
"screw it, I'll match an insane profile instead" and basically generate a
rectangular dive.
It does seem to handle the few cases I tried.
Somebody should double-check my math, and I think we might want to make
the "default profiles" a bit saner. Right now the preferred default
profile simply says "ascent/descent rate of 5m/min, with two levels at
max_depth and 1/3rd maxdepth".
That profile might not work for the simple reason that maybe we did a
quick dive to 40m, but then came up and spent a lot of time in shallower
waters, so our average depth was just 10m or so. Obviously we can *not*
make a dive that has the two depths 40m and 13m come out to an average of
10m deep.
So it has a fallback for things like that, where we try to generate a
profile with a faster ascent/descent rate, and a shallower second depth.
And then there's the fallback with an insane 10m/s ascent/descent rate and
a second depth that is basically at the surface, and if we can't generate
a dive profile with those parameters, either my math is wrong, or somebody
was playing with rockets under-water. So we just give up.
There's a few other heuristics too (if there is no average depth, we
create a random one just to make the profile look reasonable).
I *think* this is all perfectly fine, but I do want others to take a look.
It might be doing something stupid.
[Dirk Hohndel: after the discussion I took the patch and reworded parts of
the commit message]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Previously gps information was always overwritten, unless the user had
modified it in the current editing session. This causes problem with
some use cases, like when coordinates are provided before the location
name by the companion app.
Now gps information is only overwritten when it is:
- Empty
- Auto-completed in the current editing session. (When the user hits
accept it is considered hand-edited.)
Signed-off-by: Michael Andreen <harv@ruin.nu>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This now offers the correct gases for which we have cylinders defined.
For both the planner and add dive we still don't end up with the correct
cylinders in the resulting dive. But that's for another commit to fix.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This should leave the program in a consistent state after add dive was
cancelled (and do the right thing in case the dive list was empty).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
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>
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>
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 caused us to get royally confused when manually adding a dive and
trying to set the location through the marble widget.
Fixes # 229
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>
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>
So in case the OK button was relabeled to 'Retry', relabel it back to OK.
Also, 'Retry' should be capitalized.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This can happen if the Uemis is not correctly connected, but the user
still has the path set (as default DC most likely) and tries to start a
download.
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>
This patch saves and restores the state of the TreeView after the user
clicks on another columns that will make the tree disappear. All of the
branche states are saved, this way the expanded nodes will be restored
when the user gets back to tree mode.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is a try: when the user changes the orientation on the columns
by clicking on the title of them and organizing by something that's
not the number, we lost track of the opened branches. this commit
doesn't fix that, but it fixes a possible similar issue.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>