Our primary dive computer really is special, not just because it's the
first one: it's directly embedded in the "struct dive", and so if you
just walk the divecomputer list, you'll miss it, because it's not _on_
the list, it is the very head _of_ the list.
We had that bug in copy_dive(), and it turns out we have it in
clear_dive() too: clear_dive() would free all the dive computers on the
list, but not the actual primary one.
This is a minor memory leak, no more, so it's not exactly critial, but
let's just do it right.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
A few basic rules for gas validation:
We can't have <0%, or >100% of either O2 or He
O2 + He must not be >100%
Switch depth can't be <0%
This places limits on user-input values
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For starters, let's just state that this dive was downloaded from
Shearwater. However, once we have information how model numbers map to
names, we can use that info for the models we know about.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The previous patch (Planner: add best mix EAD preference) used the term EAD
(equivalent air depth) in variable names and strings, when it should have been
END (equivalent narcotic depth).
They're not the same thing and shouldn't be confused.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add best mix EAD preference and UI, along with a tooltip describing what it
does
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This allows calculation and selection of best mix in the planner cylinder
entry, by entering the gas depth, followed by "b" for best (trimix) mix, or
"bn" for best nitrox mix.
The UI is not intuitive, but it is quick and easy. At the very least, it
should be documented.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Best mix O2 calculated based on planner Bottom O2 preference
Best mix He calculated based on EAD of 30m (should be made user-configurable)
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This sets the list models for autocompleting suit, buddy and
divemaster.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In order to get autocomplete to work on manual dive add
we apparently need a separate init function.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Hide the handles for the comboboxes, making the text input fields
look like the normal text fields.
This is left as a separate patch as there currently seems to be issues with autocomplete
on Android.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds autocompleting text input fields for suit, buddy and
divemaster.
[Dirk Hohndel: some whitespace cleanup]
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This generated the QStringLists needed to populate the combobxes
in DiveDetailsEdit.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When importing dive details from a CSV file, it is better to treat the
values as manually imported instead of imported from a dive computer.
The original way discarded the temperature values from the details
import if a dive profile was imported and merged to the dive details.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This parses .txt log files produced by Dataplus and Oceanlog software.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The iOS build process is rather stupid - it scans all .qml files
in the root directory of the project to determine which QML dependencies
are required.
This is why we had the weird leftover fake QML project in our sources.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Splitting the bottomlayout in two leads to columns in the grid not lining up.
It was a workaround that hopefully isn't needed any longer.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The QML manual advises against setting width property of gridLayout children
directly, and recommends setting preferred, min and/or max width instead,
letting QML do the work to determine the optimum width. But we've found
letting QML determine gridLayout widths leads to infinite loops in too many
situations, so we're forcing a width. It's better to force a width by setting
it directly, rather than setting minimum = maximum.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I did this semi-automatically: I used the script from
the previous patch and then did some manual corrections.
This marks only title: and text: tags, there might be others
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The ApplicationWindow has the backRequested signal and if we don't accept
that event, Kirigami will exit the app which is never what we want.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
While this seemed to work fine on iOS and when compiling the QML UI on
a desktop, on Android the nocloud button wasn't shown at app start.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This will parse the date and time information on CSV import if the file
name matches the one used by APD log viewer (date and time are available
in the file name). Hard coding the year to 20?? is a bit unfortunate,
but as there is only 2 digits in the year, we have to invent something.
And it would be quite optimistic to assume this will bite us back any
time soon :D
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The grid layout had each column fixed to a width
taken as a portion of the grid width, but since
the grid has a columnSpacing defined as well,
the computation doesn't add up, helping in causing
an infinite recursion problem in the attempt of
sizing and positioning all the children of the layout
[Dirk Hohndel: heavily modified, but the basic idea remains]
Signed-off-by: Marco Martin <notmart@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Printed command line can be used to manually test the import function,
allowing faster testing of XSLT changes, and showing debug prints that
are discarded by Subsurface.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This will convert cylinder size when importing from imperial units. I am
using default working pressure of 3000 PSI that is not precisely
correct, but should be close enough for the most common aluminium
cylinders.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
if the text in every column can wrap anywhre,
we don't have a stable way to know how large the columns
themselves may be. This can cause an infinite recursion
while trying to figure out the width of the items, as
the sizeHint(Qt::ImplicitSize) of those labels
(Buddy, Cylinder etc) will not be stable as it will once
return the size of the text wrapped and once the size of
the text not wrapped.
Signed-off-by: Marco Martin <notmart@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
No point in having it defined in each main program's .cpp. Especially
since the unit tests don't define them.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since the big layout causes an infinite recursion in the Qt/QML layout
engine.
Also remove a no longer accurate comment.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>