Commit graph

12605 commits

Author SHA1 Message Date
Lubomir I. Ivanov
56e755b711 Use lrint() for all degrees_t related rounding
In certain places the '(int)' cast is used, while in other the
llrint() or lrint() functions. Make the conversation from degrees
in the 'double' form to the 'int' degrees_t consistent using lrint().

lrint() is the function which should give the best results,
because it accepts a 'double' and results in a 'long'
even if degrees_t is 'int'. If the truncation from 'long' to 'int'
is discarding some of the precision then the next step
would be to turn degrees_t into a 64bit signed integer type.

Possible fix for #625.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-09 13:38:58 +03:00
Stefan Fuchs
f5f2754b81 Preferences units dialog: Tab order and silence warnings
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-09 11:49:29 +03:00
Stefan Fuchs
78cda85444 Display units in dive list table based on prefs option
Add a preferences option which enables or disables display of units in the
main dive liste table.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-09 11:49:29 +03:00
Lubomir I. Ivanov
2cb5d45231 preferences: add missing dialog icon
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-08 16:01:03 -07:00
Stefan Fuchs
c3857db23b Hide outdated gas name strings in profile in planner
When deleting dive planner points in the planner we currently sometimes
miss to hide the outdated gas name strings printed close to the profile
legs.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-08 23:19:23 +02:00
Rick Walsh
f9d05a8038 VPM-B profile: calculate parameters when in planner mode
Calculating parameters when in the planner mode is necessary to display the correct ceiling.

Fixes #601

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-10-08 23:16:40 +02:00
Jan Mulder
fb42213111 mobile: do not clear email and passwd when cancelling
Commit cf8e87545f implemented a way to cancel pin setup,
and this also has effects on an exit from the app after pressing
the android exit. The change button started with clearing the
email and passwd in order to get the credentail page(s) active
again. While this worked ok, it confuses users that exit the
app from the credential pages, resulting in the need to enter
the credentials again after a restart. It appears that clearing
the credential state is sufficient to get the pages active.

Notice that the android exit is still not working (it seems
a no-op), but the interaction with the buttons in the app
preserves the email/passwd.

Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-08 19:45:40 +03:00
Jan Mulder
f4165a9eea mobile: only set old credential status in one place
The old credential status should only be set when changing the
actual credential status using the setCredentialStatus function.
Setting it here is just wrong. It sets the old status to the
current, and than adds the current to the prefences,
obviously, resulting in old = current, which can not be right
and results in a wrong flow of control in the credential state
processing.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-08 19:45:40 +03:00
Miika Turkia
04785f3c8b Fix crash when text empty
Exporting to divelogs.de triggered this bug when divesite name is empty.

Fixes #656

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-10-08 19:41:54 +03:00
Miika Turkia
6573132307 Store RBT value on DivingLog import
Fixed-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-10-07 22:38:49 -07:00
Dirk Hohndel
20f42e7aa8 Locationinformation: correctly handle strings on the heap
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07 17:04:26 -07:00
Darexon
53c503dc35 Typo fix remoev -> remove
Signed-off-by: Cameron Phillips <darexon331@gmail.com>
2017-10-07 16:58:05 -07:00
Linus Torvalds
d5a0184f71 Fix divinglog import temperature truncation
The code incorrectly divided the temperature by 10 as an integer,
causing unnecessary precision loss due to truncation.

Fix it, and update the test results for the now improved temperature
import.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07 14:52:57 -07:00
Linus Torvalds
03b10383c9 Fix divinglog import limit checking
The divinglog import did horrible things with the strings returned from
the sqlite queries, and ended up using uninitialized values at the end
of the secondary profile data strings.

This rewrites the import logic to track the length of the strings
properly when importing the divinglog data.

We should run 'valgrind' a whole lot more than we do, I suspect.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07 14:52:48 -07:00
Stefan Fuchs
2d47fd1fed Tab order for location information dialog
Fixed the tab order and excluded "notes" and "dive sites with same
coordinates" from accessability via tab key.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-07 21:53:28 +03:00
Dirk Hohndel
2b8dda1182 Update translation source strings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07 10:33:25 -07:00
Dirk Hohndel
3f75059a77 Add connectionlistmodel.cpp/h to iOS qmake file
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07 10:06:47 -07:00
Dirk Hohndel
56c82081a5 Make compile succeed without BT_SUPPORT
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07 10:06:47 -07:00
Dirk Hohndel
7aacaf60da Move ConnectionListModel into its own source file
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07 10:06:47 -07:00
Robert C. Helling
030c094854 Remove disfunctional asc. rate signals and add disable keyboardTracking
The connection wasn't working anyway since the signal comes without
value while the slot wanted a value and thus only created a runtime
warning.

Turning of keyboard tracking means that when typing the number 123 the
value change signal is not fired three times (with values 1, 12, and 123)
but is only fired upon pressing enter or the spin box losing focus.

We should add a similar setting to the depth, duration and runtime
columns of the DivePlannerPointsModel but i have no clue how to do that.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-10-07 08:42:06 -07:00
Miika Turkia
e78f89b0d8 Safeguards for Liquivision import
I have received one sample log where after parsing a bunch of dives
properly, the sample count hits zero, and after that it is astronomical.
In case of zero, the only data we have is dive date and time of a
duplicate dive that we already parsed with proper dive profile. So
preventing a crash with this hack without properly understanding the
weird file format.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-10-07 08:36:10 -07:00
Dirk Hohndel
1b0812a8cb Warn if we edit non-existant dive site
And try to add it to the dive - bubt we really shouldn't get here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07 08:16:53 -07:00
Dirk Hohndel
3278953f86 Fix two bugs in taxonomy_set_country
The random coincidence that this code actually ended up working
in my tests is weird.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07 08:16:53 -07:00
Dirk Hohndel
53b1b17f4f LocationInformationWidget: make sure to clean out fields
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07 08:16:53 -07:00
Dirk Hohndel
0799d046ba Disable editDiveSiteButton without dive site name
Entering a name first creates and hooks up a dive site which we can then
use in the edit dive site dialog to store modifications.

This doesn't really fix these two bugs, but it might impact whether they
can still be recreated

See #633
See #636

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07 08:16:53 -07:00
Lubomir I. Ivanov
174b414436 map-widget: don't crash if the map QML failed to load
If the QML modules for QtLocation and QtPositioning are
missing the QML in mapwidget.cpp will fail to load,
which can lead to crashes.

To solve the issue check if the QML has loaded and set
a flag 'isReady' to true. If the loading has failed
load another QML which is for showing a red error text
in the lines of `MapWidget.qml failed to load!`.

If the map QML has failed, use a macro in all relevant
MapWidget members to turn them into a NOP. This approach
leaves the rest of the codebase intact - e.g. no checks
in classes which connect to the MapWidget class.

Fixes #596

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-07 08:09:05 -07:00
Dirk Hohndel
d1a18b36b4 QML UI: open v2 user manual
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07 12:14:08 +03:00
Dirk Hohndel
8e295db70e Revert "QML UIL: go back to older Kirigami"
This reverts commit 893ff019dbabf356a477da0bdf7d954123759018.

Thanks to the amazing support from Marco Martin the theming issue in
Kirigami master has been fixed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-06 23:22:12 -07:00
Subsurface
95e5bcb081 Merge pull request #642 from Subsurface-divelog/editStartsOnTop
Edit starts on top
2017-10-05 22:27:20 -07:00
Subsurface
30be43c311 Merge pull request #641 from Subsurface-divelog/taxonomyCrashFix
Taxonomy crash fix
2017-10-05 22:27:02 -07:00
Dirk Hohndel
49101b9f04 QML UIL: go back to older Kirigami
This brings back correct theming.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-05 22:25:42 -07:00
Dirk Hohndel
80e6032f6f Prevent crash when adding country to dive site
We need to make sure that the taxonomy information has been allocated
before assigning values to it...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-05 15:42:46 -07:00
Dirk Hohndel
deff17fa36 Whitespace
This commit is empty when shown with '-w' - it just updates the
indentation after commit c00804eff6 ("QML UI: always start edit at top
of page").

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-05 13:40:31 -07:00
Dirk Hohndel
c00804eff6 QML UI: always start edit at top of page
When starting to edit / add a dive, the Flickable needs to be positioned
at the top of the page, not the last position shown.

For clarity I'll do the re-indentation in the next commit.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-05 13:38:32 -07:00
Lubomir I. Ivanov
90674cf7f8 divesite.c: use NULL instead of 0 for char* buffers
Makes it clearer that these are buffers and not integers
like `ds->uuid`.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-05 12:06:13 -07:00
Lubomir I. Ivanov
d96c47a1b9 divesite.c: prevent double free()
Reported-by: Benjamin Fogel <nystire@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-05 12:06:13 -07:00
Stefan Fuchs
c127a92e8e Explicitly copy a cylinder which was marked as "unused" in the planner
When planning a new dive (not replan!!!) based on an existing (planned)
dive, the cylinders from the existing selected dive are copied.
This patch guarantees that cylinders which had been marked as "unused"
are indeed copied as well. Sounds strange at the first moment but makes
sense because if one marks a cylinder explicitly as "unused" in the
planner instead of deleting it that does mean that one wants to keep
this cylinder to have it available and be able to reenable it later-on.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-05 20:32:35 +02:00
Dirk Hohndel
3487612337 QML UI: add transition when switching to edit mode
The hard switch was not ideal. This isn't perfect, yet, but a step in
the right direction. The 'transitions' to change the visibility
properties are a bit odd, but that's how it's done in the examples as
well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-05 08:21:55 -07:00
Dirk Hohndel
2dd8a2ad7b QML UI: download icon in main menu
We need a white path drawn on the dark action button, but a black path
drawn for the main menu.

(looks like a white space change snuck in here)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 17:13:46 -07:00
Dirk Hohndel
f7f31c55cb QML UI: hide all buttons when keyboard is visible
This extends the hack in commit 2e057bc29a ("QML UI: hide action button
when keyboard is visible") to the left and right button as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 17:08:58 -07:00
Dirk Hohndel
636904e078 QML UI: make edit page scrollable
And have a tiny bit of space around it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 17:08:58 -07:00
Dirk Hohndel
7f0c7eeb24 QML UI: change the dive edit to not be an overlay
This way the accidental closing of the edit (and loss of data)
should no longer happen.

See: #495

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 17:08:58 -07:00
Dirk Hohndel
41f24f2859 QML UI: top padding for dive details
This used to work without manually adding space here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 17:08:58 -07:00
Dirk Hohndel
ec7a878149 QML UI: avoid warning before currentTheme is set
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 17:08:58 -07:00
Dirk Hohndel
b4b3864f50 QML UI: adjust icon names
These changed in Kirigami.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 17:08:52 -07:00
Dirk Hohndel
d774b6cc49 Switch back to latest Kirigami
And fix the build issue.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 09:05:27 -07:00
Dirk Hohndel
b19db6afb5 White space and clarifying braces
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 08:05:09 -07:00
Dirk Hohndel
8f4a047cf0 Add satellite icon to qrc file
Otherwise it's not shown on the divesite edit page.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 08:05:09 -07:00
Dirk Hohndel
9162dee8a1 Whitespace change
This is just the indentation change for the code that was inside the
loop before.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 08:05:09 -07:00
Dirk Hohndel
09b02aae4e Simplify the geo reverse lookup function
We never actually create a list of dive sites for which we
call the reverse lookup service, it's always just displayed_dive_site.
So make this all much simpler and just go straight for that.

This commit removes a loop, but doesn't change the indentation of the
code inside the loop to make it easier to see what was changed. That
whitespace change will be in my next commit.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 08:05:09 -07:00