This is hard coded in version.cmake for now. The intent is to go to 1.0 in
the first release version and to increment from there whenever we create
an update.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
All error cases need to reset it as well.
And it's easier to reset it right after we come back from parse_file()
instead of trying to track all the exit cases after that.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When manually adding a dive and moving it in the dive list (by editing
it's start time) we could create a situation where the dive list
internally was correct, but the dive list model on screen showed an
incorrect dive list with the new dive in two different spots.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This code is very similar to the undo code in the desktop UI, but
untangling that from the desktop seemed massive overkill; we don't have
lists of dives to delete and undelete here - so this is actually much
simpler and easier to maintain (I hope).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Don't allow negative depth or depth beyond 500m.
Additional checks that the gas mix is possible (even thought QML code
SHOULD only allow valid combinations).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We (ab)use fake_dc() to create a pleasing profile for a manually added
dive. Based on it's intended use, fake_dc() simply handed back a dc
structure that pointed at staticly allocated samples - that's obviously
(now that I think about it) going to blow up in my face if I edit a
manually added dive more than once.
So now we have an option for fake_dc() to actually allocate the samples -
this way the rest of the code can treat these samples as we would treat
samples created any other way. We can free them and replace them with a
new set.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We only need to deal with this if the dive changed. And in that case, if
we calculate a new fake DC, we need to clear out the meandepth as
otherwise the algorithm will try to match both max and mean depth. Since
the user potentially changed the max depth that could have very odd
consequences.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When the user explicitly sets the units when editing or adding dives, we
used to change the display preferences. This was changed for some but not
all fields in commit 6252d0cd3b ("While parsing weight and pressure we
should not change the users settings")
Now we do this consistently for all inputs.
Also, when editing the depth of a manually added dive, we now throw away
the samples (as those are certain to be inconsistent).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
First cylinder only, show warning if there are more than one cylinder defined.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Now it is possible to enter a specific unit that is different from the
unit stored in the preferences. If only numbers are inputed the unit will
be the same as specified by the users preferences.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This should have been obvious. Without explicitly asking for only local
git activity, it will connect to the remote.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since some users report hangs when changing credentials it would be useful
to see how far the application got.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Otherwise, when switching back and forth between two logins, during the
second switch the dive list is not loaded as the code checks against the
remembered git SHA before rewriting the dive list.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Otherwise Qt attempts to be smart and re-uses previously successful
username (email) and password. This is an odd corner case, but it seems
the right thing to do.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There are several parts of the UI that will do better if they know if the
credentials that we have are incomplete (e.g., no password), invalid
(server rejected them), valid (server accepted them) or potentially valid
(we found a local cache for the email address, so that's likely correct,
but because we are offline we cannot (or have not yet) verify the
passord).
So far this is specific for the mobile UI - it might make sense to try and
use the same backend code and status tracking for desktop and mobile.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When editing the duration of a dive, if only numbers are entered they are
treated as full miuntes.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
First cylinder only, show warning if there are more than one cylinder defined.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We need to execute the same sequence of steps both when starting the app
and when switching cloud credentials. This way things will work correctly
when the device is offline and the user wants to switch accounts.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since this variable is specific to the cloud credentials in use, we need
to reset it when we change credentials.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It makes no sense to only do this the very first time we connect to a
cloud storage account. The existing code only happened to work because we
incorrectly tried to maintain the loadFromCloud status across restarts of
the application. So one bug hid another bug.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
What matters is that the cloud storage for a specific email address has
successfully been synced - and we need to remember this across restarts of
the app. This way Subsurface-mobile can work with different accounts, even
if offline.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
But only if there is only one weight system defined in the dive. Otherwise
display a read only text that explains that this cannot be edited.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I tried various things to do this from QML but it just doesn't seem to
work at all. So I gave up and instead added a trivial helper function.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
By giving them a fake profile we can actually edit the dive profile in the
desktop app.
Fixes#998Fixes#1000
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Right now the UI shows "--" as place filler for empty data. That may or
may not change - but while it's there, we should not store that string in
the corresponding string fields of the dive.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
As per Tomaz recomendation the helper functions from 19588ce and e072596
are moved from qmlmanager to DiveObjectsHelper.
[Dirk Hohndel: merged with the latest code]
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since we are short on space on the mobile version, lets just show "Multiple" if
a dive has multiple cylinders.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Helper function that retrieved the total weight for a dive to be displayed
on the DiveDetials page.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Helper function that retrieves the cylinder description to be displayed in the
DiveDetails. Only the first cylinder for a dive is retrieved.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>