Commit graph

13216 commits

Author SHA1 Message Date
Jan Mulder
5e116db1a1 CHANGELOG.md
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-18 15:23:23 +01:00
Jan Mulder
825afb4db4 mobile: exit edit mode when navigating away from edit page
Navigating using the breadcrumb in the header did leave the
dive detail edit (and add) mode in such a way that (for example)
navigation in the dive list was suspended. Obviously, it is
debatable what should be done. Saving the edits/add, or
cancelling them. For now, this commit cancels them
silently. This is the exact same thing that is happening when
the user selects the dive list from the drawer menu.

Fixes: #932

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-18 15:23:23 +01:00
Berthold Stoeger
7b88f8301e Elevate "can't write hashes" message from debug to warning level
I never realized that my hashes weren't written, because it only
outputs a debug instead of a warning message.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-18 15:23:12 +01:00
Jan Mulder
48d9c8eb6e core: fix git storage save (regression 4.7.4 -> 4.7.5)
Commit 46004c39e2 introduces a new field in the logbook outputs
(depth of a cylinder). While in XML the depth unit is stored with a space
between value and unit (m), in our git storage, the unit m is without
space. As the git storage parser uses a space to separate individual
key/value pairs, the erroneously saved space results in parsing warnings
when opening the logbook.

The unwanted space is normally saved just after download of a new dive
from the dive computers, so all desktop-git-storage uses are affected,
and more worrying, mobile beta users.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-18 15:22:50 +01:00
Dirk Hohndel
a225f62588 Cleanup: mark parameter as unused
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-17 10:25:44 -08:00
Dirk Hohndel
edf569ee6c CLeanup: remove duplicate typedef
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-17 10:25:30 -08:00
Dirk Hohndel
6b80b41c7c Cleanup: durations are now signed
Somehow a whitespace fix snuck in here. Oops.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-17 10:25:01 -08:00
Dirk Hohndel
648fec7a3d Cleanup: fix potential uninitialized use of uuid
And make sure we don't create a dive site for an empty location string.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-17 09:12:44 -08:00
Dirk Hohndel
bd66ab15da Turn on -Wall
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-17 09:08:21 -08:00
Jan Mulder
b59778abd8 mobile: use short date format in edit mode
See issue #949. In the dive list, dates are shown in short format, and
when we start to edit an existing dive, the date field on the edit
page is shown in sort format. However, when adding a new dive, the
initial date shows up in long (normal) format. This in not only
inconsistent, but also introduces the parsing problem, as described
in the mentioned issue.

This can be fixed by using short formatted dates in all cases in
the mobile app. As the screen real estate is precious on mobile,
this seems the most logical choice.

Fixed: #949

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-17 09:04:16 -08:00
Berthold Stoeger
a748e7f239 Unify float calulations: use double
Internal floating point (FP) calculations should be performed using double
unless there is a very good reason. This avoids headaches with conversions.
Indeed, the vast majority of FP calculations were already done using double.
This patch adapts most remaining calculations. Not converted where things
that were based on binary representations and variables which weren't used
anyway.

An analysis of all instances follows:

core/plannernotes.c, l.404:

This was a comparison between two floats. On the left side, first an integer
was cast to float then multiplied with and integer and divided by a constant
double. The right hand side was an integer cast to a float. Simply divide by
1000.0 first to convert to double and continue with calculations. On the right
hand side, remove the cast, because the integer will be implicitely cast to
double for comparison. This conversion actually emits less instructions,
because no conversion to double and back is performed.

core/planner.c, l.613:

Same analysis as previous case.

subsurface-desktop-main.cpp, l.155:

A local variable representing the version OpenGL version. Turn this into
integer logic. Not only does this avoid dreaded FP rounding issues, it also
works correctly for minor version > 10 (not that such a thing is to be
expected anytime soon).

abstractpreferenceswidget.[h/cpp]:

A widget where the position is described as a float. Turn into double.

desktop-widgets/divelogexportdialog.cpp, l.313:

total_weight is described as float. Use double arithmetics instead. This
instance fixes a truncation warning emitted by gcc.
2017-12-17 09:02:44 -08:00
Jan Mulder
b1d94b2470 mobile: manual add dive and cancel fails when repeated
This commit fixes a very subtle bug. Probably there for ages,
but never noticed. When manually adding a dive, and canceling
the add right away, the divetable was extended by 1 dive (using
the core function add_single_dive), but canceling never removed
that dive (using delete_single_dive). This is corrected here.

Notice that commit ef543da5af claims to fix issue #950.
With this commit, however, that issue can be seen sometimes
again.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-16 19:04:57 -08:00
Stefan Fuchs
2890be9256 divepicturemodel: Reset start and end row for displayed_dive correctly
Correct way of using indices for rowDDstart and rowDDend.
Reset rowDDstart and rowDDend at beginning of updating dive pictures.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-15 09:11:28 -08:00
Jan Mulder
ef543da5af mobile: clear internal data when edit/add dive is finished
When editing (or adding) a dive, the internal data containing the
attributes on the edit page was not cleared when editing was
finished (in any way, by saving the edit or by cancelling it).
As long as the user only edits existing dives, all this poses
no problem, as at the start of a dive edit, the data is filled
from the dive to be edited. However, when adding a dive, data
coming from previous edits shows up. This not clearing data
also causes the strange effect as written in issue #950: adding
a dive, deleting it, and adding a dive again, added the first
added dive data, without the edit screen being shown.

All this can be solved by clearing the data from the edit when
editing is done.

Fixes: #950

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-15 09:03:24 -08:00
Miika Turkia
9e165602c4 Add git submodule init to build script
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-12-14 08:54:53 -08:00
Jan Mulder
c2e76aab4b CHANGELOG.md
I think that every published issue that is fixed should be in
the changelog.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-14 08:53:06 -08:00
Jan Mulder
dd87350cb7 mobile: stay on same dive after edit
See issue #875. In hindsight the reason for this bug is easy to
understand. When updating a dive, the dive was first removed
from the model, and added in its new state again. This does seems
resonable, but the delete in the model causes the internal (QML)
state to be changed, and the previous state (like the currentIndex
that was pointing to the just deleted row, so that one is changed to
something valid internally) is not restored at recreation of
the edited dive. The QML engine has no way to understand that
the remove and subsequent add are in fact one atomic operation.

This can be solved by simply updating the underlying data in
place, and notifying the change using a dataChanged emitted
signal. The dataChanged signal takes care of the repaint of
the screen, and there is no need for removeRow/insertRow pairs.

Fixes: #875

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-14 08:53:06 -08:00
Jan Mulder
62ef78b5e8 mobile: show message when going offline
Trivial fix. Show the message "Turning off automatic
sync to cloud ..." when turning automatic sync to offline. Just
a more logical moment to show this message. Also rephrase the
message "Enable auto sync" to "Auto sync enabled". It shows
a status, and not an action.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-14 17:01:51 +01:00
Berthold Stoeger
c21e998277 Don't create GeneralSettingsObjectWrapper object
Instead use the application-wide instance. Creating a local
object defeats the whole purpose of these objects - nobody
can receive signals in case the settings changed.

No other cases of locally created SettingsObjectWrapper
objects were found.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-14 17:01:34 +01:00
Berthold Stoeger
074ddc0596 Remove function isCloudUrl()
The function isCloudUrl() was only called in one place, parse_file().
But, isCloudUrl() could only return true if the filename was of the
git-repository kind (url[branch]). In such a case, control flow would
never reach the point where isCloudUrl() is called, since
is_git_repository() returns non-NULL and the function returns early.

Therefore, remove this function. Moreover, adapt the affected if-statement
by replacing "str && !strcmp(str, ...)" with the more concise
"same_string(str, ...)".

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-14 17:01:05 +01:00
Jan Mulder
375490dfc9 CHANGELOG.md
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-13 08:23:27 -08:00
Jan Mulder
239974d600 mobile: reset download screen in a sane state
Set download srceen in a sane state after a previous download
session using this screen. The erroneous behavior was very
similar to the one fixed in commit 7fe9bbe295dcf92. For example,
download some dives, quit the screen, go back, and the bottom
buttons are still selectable.

This commit resets some values when leaving the download screen
(ie. not only swiping it away), so that it looks sane at a next
visit.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-13 08:23:27 -08:00
Jan Mulder
59f86a06ad mobile: reset Retry button to Download
Reset the Retry button on exit of the Download from divecomputer
page. So, it it not reset wehen swiping this page away, or
cancelling a running download, but resetting it on accepting
downloaded dives.

As we do not have real error reporting (from download failures),
this all is a little arbitrary. Another "fix" could be, not
changing the button text at all.

Further notice, this is not specific iOS, but also Android.

Fixes: #895

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-13 08:23:27 -08:00
Dirk Hohndel
88141fb70d Add CHANGELOG for the last merge
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-13 05:51:39 -08:00
Stefan Fuchs
82170579ad Enable removal of pictures from different dives at the same moment
Suggested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-13 05:48:20 -08:00
Stefan Fuchs
7bc77947f6 Fine tune the position of pictures in the profile
Start a new column a little bit earlier otherwise it will get difficult
to fit a high number of pictures.
Don't put more than ~16 pictures in one column.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-13 05:48:20 -08:00
Stefan Fuchs
003e490dd2 Reenable picture tab when dive trip is selected
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-13 05:48:20 -08:00
Stefan Fuchs
5b7e4c57f7 Dive pictures show pictures of all selected dives
In the dive picture tab show pictures of all selected dive.
But at the same moment take care that in the profile only
pictures from displayed_dive are displayed.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-13 05:48:20 -08:00
Stefan Fuchs
a11622623a Remove unused divesitepicturemodel from qt-models
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-13 05:48:20 -08:00
Jan Mulder
3479c9e197 applying gps fixes: group repetitive code under a macro
See 2182167b53. Keep the dupicated code in sync.

Originally-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-13 05:07:15 -08:00
Jan Mulder
ee9531f76e Do not prefer gps fixes just for being into dive time
See commit 6f42ab46da. Unfortunately, this code is duplicated
(and an obvious candidate for code cleanup). So replicate the mentioned
commit here. In fact, the mentioned issue #666 talkes about the mobile
app, and the fix was only done for the desktop.

Originally-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-13 05:07:15 -08:00
Jan Mulder
5707554e98 mobile: do not just create a new dive site
This fixes an annoying bug. When entering an existing divesite
in the mobile app, always a new divesite (with same name) was
created, resulting in multiple sites on the same gps location.

So, be more carefull in checking and creating a new site.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-13 05:05:49 -08:00
Jan Mulder
3a64d8a481 CHANGELOG.md
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-13 05:03:36 -08:00
Jan Mulder
9d2c52f692 Add pSCR divemode detection
In libdivecomputer, a new divemode is added (DC_DIVEMODE_SCR) useful
for dive computers that have specfic functionality for semi-closed
rebreathers. At this moment, only the HW computers seem to provide
this.

This commit takes care of proper recognition of this new divemode
when importing data from a dive computer.

Tested on an actual import from an OSTC3 that contained
dives in this new mode.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-13 05:03:36 -08:00
Jan Mulder
78d1a3ed58 Rename DC_DIVEMODE_CC to DC_DIVEMODE_CCR
This is just code cleanup. Jef renamed the CCR divemode constant
in libdivecomputer, but added a define to be backward compatible as
as well (so this rename did not break our Subsurface build).

Obviously, this breaks the build for people that build against an older
libdivecomputer, but I see no reason to do that.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-13 05:03:36 -08:00
Dirk Hohndel
c12e14a61d Update to the latest libdc version
This gets us the first merge with the upstream iostream implementation.
This requires a small change for serial_ftdi.c to build.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-12 21:16:19 -08:00
Berthold Stoeger
4ac5b9c965 Simplify mainwindow title logic: remove MainWindowTitleFormat enum
The MainWindow::setTitle() function was passed an enum, which depended
on whether existing_file is set or not. The check can be (and was!) done
directly in setTitle(). Therefore, remove the whole enum.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-11 23:10:09 -06:00
Berthold Stoeger
931bcc1966 Remove unused variable in on_actionCloudstorageopen_triggered()
This was an artifact of commit 136110784e

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-12 04:08:58 +01:00
Robert C. Helling
256ae870a6 Write profile images to correct directory in TeX export
Before, we did not look at the path of the filename to export
to but we should write the images there and not in pwd.

Fixes #931

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-11 20:26:22 +01:00
Berthold Stoeger
ae26875a61 Use the copy_string() helper function in set_filename()
copy_string() does the same as the current code, but in one instead
of four lines. Strictly speaking, it does not exactly the same thing
because the empty string ("") case is handled differently. copy_string()
returns NULL instead of a copy of "", which is probably preferred anyway.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-11 00:17:39 +01:00
Berthold Stoeger
ea0cbba804 Remove second parameter (bool force) in set_filename()
The last force=false case was removed in commit 96d1cc570e.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-11 00:17:39 +01:00
Berthold Stoeger
fa469aa86c Fix broken link in CONTRIBUTING.md
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-11 00:14:09 +01:00
Salvador Cuñat
1c2127d232 location service: reduce default thresholds
Current values (1000m, 10 min) may be too long to choose an accurate fix
while automatically applying gpsfixes to dives. They are fine if we are
diving from a static position, but will give wrong positions e.g. while
drift diving.
Reducing the default values to shorter 100m, 5min won't hurt most dives
from shore or static boats, but will make other diving styles get more
accurate gpsfixes.

signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-10 11:38:19 -08:00
Salvador Cuñat
2182167b53 applying gps fixes: group repetitive code under a macro
Title is self explanatory.

[Dirk Hohndel: small edits to remove typo / improve readability]

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-10 11:38:19 -08:00
Salvador Cuñat
6f42ab46da Do not prefer gps fixes just for being into dive time
ATM we were giving preference to a gps fix taken during dive time over
another taken before dive start time (proven both in predefined
SAME_GROUP 6 hours range).
While this logic is right for a static boat or a shore dive - as it
ensures a correct position - will fail for drift dives or dives where
boat changes its position during dive time.

Instead, will choose the gps fix closer to the dive start time.

fixes issue #666

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-10 11:38:19 -08:00
Berthold Stoeger
c3c5256dc4 Remove outdated comment
The removed comment in qt-models/divepicturemodel.h described
todo items which were already implemented.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-10 15:00:53 +01:00
Berthold Stoeger
92ad7865d0 Make thumbnail code threadsafe
The thumbnailing in qt-models/divepicturemodel.cpp was performed
concurrently, but the thumbnailCache was not protected from races.
Resolve this by guarding the thumbnalCache accesses with mutexes.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-10 15:00:53 +01:00
Berthold Stoeger
c73828d605 Simplify DivePictureModel
The code of DivePictureModel used a QHash to keep track of thumbnails.
Not only was the code rather complex - it also had the consequence that
pictures are sorted according to the hash function, i.e. seemingly
random.

This commit replaces the QHash by a simple QList which keeps track
of thumbnails and some meta-data.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-10 15:00:53 +01:00
Berthold Stoeger
a07d3b7bfe Whitespace fixes in qt-models/divepicturemodel.cpp
Note that constructs like QList<QFuture<void>> is incompatible with
pre-C++11 compilers. But the code base is so full of C++11isms that
we may just as well remove asymmetric eye-sores of the kind
"QList<QFuture<void> >".

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-10 15:00:53 +01:00
Miika Turkia
2e340d3a61 Include cylinder pressures on export when they exist
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-12-10 11:29:52 +02:00