Commit graph

17707 commits

Author SHA1 Message Date
Dirk Hohndel
b013611707 Update CHANGELOG
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-14 13:35:33 -07:00
Dirk Hohndel
5ff08598ca mobile: show sync state in menu plate
This seems like the easiest way to show the state without disrupting the UI
elsewhere. Directly below the email address used for cloud storage.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-14 13:35:33 -07:00
Dirk Hohndel
3a409c51ea mobile: add status text for cloud sync state
This allows the mobile UI to reflect the three states that the dive list can be
in:
- changes that haven't been written to local storage
- there potentially are changes in local storage that were not synced with the cloud
- dive list is in sync with cloud storage

The last state could be misleading if the user access the cloud from a
different device and makes changes to the cloud storage from there, but from
the point of view of this device, the states are consistent.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-14 13:35:33 -07:00
Dirk Hohndel
01de67a5a6 mobile: track if we have changes that aren't synced to cloud
If we haven't connected at all to the cloud server we assume that there are
local changes. And whenever we save changes only locally, we also set that
flag.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-14 13:35:33 -07:00
Dirk Hohndel
8b478a969d git-storage: add global flag to indicate successful cloud sync
This may seem like a bit heavy handed as it adds more global state, but given
the number of ways in which attempts to sync with the cloud can fail it seems
much more reliable to claim success in the spots where we actually know that we
have successfully synced with the remote server. Transporting that information
back through the various call chains turned out to be very disruptive and ugly,
so I went with global state instead.

Whenever we access cloud storage (or any git repo), we always first check if it
actually is a git repo by calling is_git_repository() - so this is the perfect
spot to initialize the variable to false.

And there are only two spots where we either clone the remote repo
(create_local_repo()) or update the remote with the (potentially merged) local
changes (check_remote_status()). So those are the two places where we set the
variable to true.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-14 13:35:33 -07:00
Dirk Hohndel
fe9e33ccac git storage: significantly expand logging to stderr
In many cases we did not log the issues the code ran into to stderr which made
remote debugging user problems much harder. This hopefully will help with that.

Since I was looking at the code, I also made the existing messages more
consistent.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-14 13:35:33 -07:00
Berthold Stoeger
23e8839182 download: don't warn on unknown gasmixes
Apparently libdivecomputer can return DC_GASMIX_UNKNOWN when
fetching tank info with
  dc_parser_get_field(parser, DC_FIELD_TANK, i, &tank);
This caused emission of a warning, which was annoying users.
Disable the warning in that case.

Fixes #2866

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-06-13 15:55:35 -07:00
Gaetan Bisson
56c6cd06c9 Fix includes for building against Qt-5.15
Signed-off-by: Gaetan Bisson <bisson@archlinux.org>
2020-06-13 14:00:05 +02:00
Dirk Hohndel
52eefa7561 pull latest translations from Transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-12 12:44:56 -07:00
Dirk Hohndel
bea898c077 Update ReleaseNotes and README for 4.9.5
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-12 12:43:51 -07:00
Dirk Hohndel
2babed6c84 mobile: update version to 3.0.9
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-08 12:29:16 -07:00
Dirk Hohndel
8a4a9382d3 mobile/dive-details: restrict width of tags field
Having a lot of tags (or more precisely, a tags string that is very long) could
cause the width of the dive details view to extend past the width of the the
page. The txtTags label was missing a maximum width, and to make the result
more useful, I also added correct wrapping and elide to the mix (stupidly, we
had the wrap and width for the fixed name of the field ('Tags'), but not for
the user determined content of that field).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-08 12:27:50 -07:00
Dirk Hohndel
e00e72d430 mobile: add option to merge local cloud cache data
The UI is ugly, and of course this is hidden in the developer options that have
to first be enabled in the advanced settings. As I mentioned in the previous
commit, I believe the actual risk that something gets damaged here is very low,
but still, explaining this so it makes sense to the casual user may be a bit...
difficult.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-07 19:47:52 -07:00
Dirk Hohndel
208d46d58e mobile: add helper to import data from local cloud cache
If you pass in the repo name, it isn't treated as cloud storage, but simply as
local git storage and imported (i.e., added) to the current dive list.

This allows the user to work around failed no-cloud->cloud transitions, merge
different accounts, and most importantly deal with situations were conflicts on
the server caused us to move a cache out of the way and potentially make dives
that were on the mobile device inaccessible to the user.

Once a UI is added, this allows the user to recover those dives (realistically
this is not really all that potentially 'dangerous' to do, but it's definitely
something that would best be done after talking to someone who understands the
cloud storage and can guide the user...).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-07 19:47:52 -07:00
Dirk Hohndel
dd82149726 mobile: make list of local cloud cache directories available
This way QML can show those to the user.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-07 19:47:52 -07:00
Dirk Hohndel
8b167c14ad mobile: tiny whitespace update
Every time I edit main.qml, QtCreator fixes this for me. And then I filter it
from the commit to not mix white space and actual changes. So let's just get
this fixed and move on.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-07 19:47:52 -07:00
Miika Turkia
2d108cb8ad Fix indentation
The diff goes crazy if indentation is not fixed by itself.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-31 08:59:47 -07:00
Miika Turkia
3dc5ac219d Print empty cylinder, if needed
When the dive that is used to generate the header, we need to print
empty cylinders for the dives that had less cylinders than the one used
for header printing.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-31 08:59:47 -07:00
Miika Turkia
108b30e8b5 Print at most as many cylinders as the header has
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-31 08:59:47 -07:00
Miika Turkia
8f7c9bc7d1 Limit cylinders to one dive only
With XSLT we have to be specific if we want to apply cylinder iteration
operation to one dive only. Thus using the last dive as reference when
printing cylinder header.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-31 08:59:47 -07:00
Dirk Hohndel
eb455fe0d2 mobile: update version to 3.0.8
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-30 11:20:58 -07:00
Dirk Hohndel
afdcccc9fe mobile/dive-edit: fix broken editable combo boxes
This is a partial revert of commit 99438121c4 ("mobile/dive-edit: use template
components and theme colors")

Clearly the information given in the Qt documentation on how to theme ComboBox
is flat out broken. The trade-off between 'better dark theme' and 'broken user
experience' is fairly easy to make.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-30 11:19:54 -07:00
Berthold Stoeger
f29278b700 cleanup: make local functions of static linkage
A few functions in save-html.c were local but not marked as static.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-29 09:20:17 -07:00
Berthold Stoeger
bed64f20ba cleanup: remove QCalendarWidget forward declaration and include
This is an artifact of code that never came to be.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-27 13:55:08 -07:00
Berthold Stoeger
330b300f22 cleanup: unglobalize grayImage()
This function was globalized in be462ae1a6 to be used for the calender
widget, but that never came to be. Therefore, for now unglobalize it
until it is needed. That said, there probably is a helper function to
turn pictures into gray-scale.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-27 13:55:08 -07:00
Dirk Hohndel
2690325623 Android: install translations into the right place
When updating the NDK I forgot to adjust the install destination for the
translations.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-27 12:41:14 -07:00
Berthold Stoeger
7417f865cd cleanup: un-singletonize ShiftTimesDialog
There is no reason that this dialog is a singleton. Since it is modal,
it can be created on demand. Apart from removing superfluous global state,
this simplifies code, because preparing the widget can now be done in
the constructor instead of overriding the showEvent() function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-27 09:47:35 -07:00
Berthold Stoeger
25f1bc488f cleanup: un-singletonize RenumberDialog
There is no reason that this dialog is a singleton. Since it is modal,
it can be created on demand. This simplifies code, because the mode
(selected-only or all-dives) can be set in the constructor.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-27 09:47:35 -07:00
Miika Turkia
79f90effe9 Update changelog
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-26 11:33:33 -07:00
Miika Turkia
790c89549a Fix precision bug on SubsurfaceCSV import
We need decimal point as size is stored with one decimal on imperial
export.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-26 11:33:10 -07:00
Miika Turkia
3a1502de71 Remove debug output
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-26 11:33:10 -07:00
Miika Turkia
a1c59260bc Add dive mode support for SubsurfaceCSV import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-26 11:33:10 -07:00
Miika Turkia
a41a8c1065 Fix field indexes after dive mode and sac change
We need to update field numbers when parsing CSV, as recently sac and
dive mode were added.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-26 11:33:10 -07:00
Miika Turkia
c924591f46 CSV import: add SAC if we end up supporting it
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-26 11:33:10 -07:00
Miika Turkia
75f3cb2027 Test case for multicylinder support on CSV import
Test for importing Subsurface generated CSV dive details, with multiple
cylinders support.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-26 11:33:10 -07:00
Miika Turkia
e8f97cbc3f XML start tag does not have new line before header
When Subsurface adds start tag to CSV file, there is no new line after
it. Thus changing XSLT to parse this way.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-26 11:33:10 -07:00
Miika Turkia
3f54af2ca6 Print correct template name on CSV export
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-26 11:33:10 -07:00
Miika Turkia
0acf8721d3 Trip support for CSV export of dive details
Debugging the tests with new test dive, I noticed that CSV export does
not work, if the exported XML includes trips.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-26 11:33:10 -07:00
Miika Turkia
5a7e11b0bc Use single cylinder dive for tests
Now that CSV export supports multiple cylinders and import doesn't, we
need a test dive with single cylinder in it. (Multi-cylinder import from
CSV will be supported for Subsurface style CSV export only, and not
generic exports that are used here.)

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-26 11:33:10 -07:00
Miika Turkia
cef10454aa Initialize variable to silence compiler warning
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-26 11:33:10 -07:00
Miika Turkia
368719379e Add multicylinder support for Subsurface CSV import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-26 11:33:10 -07:00
Miika Turkia
dc829e3487 Take SAC into account on SubsurfaceCSV import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-26 11:33:10 -07:00
Miika Turkia
889f36a57c Multi cylinder support for CSV export
Fixes #2830

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-26 11:33:10 -07:00
Miika Turkia
19cdab52b3 CSV export: Split printing of header
This will split the printing of header for CSV export. Cylinder
information is printed by itself allowing me to later print it in a loop
as many times as there are cylinders.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-26 11:33:10 -07:00
Dirk Hohndel
9deb4f4a22 mobile/credentials: email address must be lower case
I could have sworn that I have fixed this several times in various places,
but apparently (as shown by todays support emails) it's still possible to
setup a mixed case email address. So let's try to solve this problem at
the very top.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-25 08:36:01 -07:00
Berthold Stoeger
891c0e7ec6 cleanup: whitespace fixes in TabDiveInformation
Use C-style function definitions (squirly brackets on new lines) and
remove empty lines at end of file.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-25 08:33:08 -07:00
Berthold Stoeger
2d17edeb40 desktop: localize salinity value
The salinity value was not displayed with localized thousands separators.
E.g. to a user of a German locale the density read as slightly over
1 g/l, when it should be approximately 1000 g/l. For consistency, also
localize that value.

Also localize the CNS and OTU numbers, even though these should
(hopefully!) never come with thousands separators.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-25 08:33:08 -07:00
Berthold Stoeger
87c91af824 cleanup: constify time_during_dive_with_offset() function
There is no reason to pass a non-const dive pointer as first
argument.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-22 14:40:49 -07:00
Berthold Stoeger
9365061e27 cleanup: remove unused function get_dive_n_near()
The last caller was removed in 7eb422d988.
Since this is the only caller of dive_within_time_range(), remove that
function as well.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-22 14:40:49 -07:00
Berthold Stoeger
8f80129bac cleanup: create common QDateTime -> timestamp conversion function
In analogy to the timestamp -> QDateTime conversion, create a
common function.
1) For symmetry with the opposite conversion.
2) To remove numerous inconsistencies.
3) To remove use of the deprecated QDateTime::toTime_t() function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-22 12:31:06 -07:00