Commit graph

14725 commits

Author SHA1 Message Date
Lubomir I. Ivanov
044069484d CHANGELOG.md: update with the latest Win32 log files change
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-09-03 13:29:03 -07:00
Lubomir I. Ivanov
6af67f541d core/windows.c: write logs to the user path
Writing logs to the path where the executable is located,
might not be possible if the current user doesn't have
permissions to write there.

Obtain the user path and write the log files to the
user path instead - e.g.:
c:\users\myuser\appdata\roaming\subsurface\subsurface_*.log

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-09-03 13:29:03 -07:00
Lubomir I. Ivanov
c47b6b672f code/windows.c: add method for converting from utf16 to utf8
Modify the funcion system_default_path_append() to
both receive and return wchar_t types.

Remove fallback in system_default_path_append()
as this is now redundant.

Add a function utf16_to_utf8() and use that
in places where system_default_path_append() needs
to be converted to utf8.

Move both utf16_to_utf8*() and utf8_to_utf16*()
near the top of the file.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-09-03 13:29:03 -07:00
Dirk Hohndel
0ef145337a Desktop: allow using a file dialog to find Garmin folder
If we don't auto-detect where the Garmin Descent is mounted, the user
can either just type in the correct path, or can use a file diealog to
specify it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-01 17:46:19 -07:00
Dirk Hohndel
c8ff060efe Update to latest libdivecomputer
This adds support for the Garmin Descent, among other changes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-01 12:01:40 -07:00
Berthold Stoeger
19f7b5279a Cleanup: silence clang missing braces warning in core/color.cpp
C++11 initializer lists should be passed via {{ ... }}.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-01 11:31:18 -07:00
Dirk Hohndel
23067e5dd8 Desktop: fix warnings when building preferences UI
Fixes #1618

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-01 08:13:24 -07:00
Berthold Stoeger
89e0c3f464 Cleanup: make DiveTripModel a global object
DiveTripModel (the model describing the dive-list) was destroyed
and recreated on every reset of the list. This seems excessive.
Instead - in analogy to most other models - make it a single
global object.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-01 07:48:43 -07:00
Berthold Stoeger
236f0512be Filter: sort filter items in FilterModelBase::updateList()
All callers of FilterModelBase::updateList() sorted the items
(except the last one). Thus we can do the sorting inside the
function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-31 07:48:23 -07:00
Berthold Stoeger
9b90c461a2 Filter: Make FilterModelBase a proper Qt model (mostly)
Since FilterModelBase now contains complex data (counts and checked),
we might just as well make it a full model and keep track of
the name as well. I.e. do not derive from QStringListModel but from
QAbstractListModel and add the name to the item structure.

Implement proper reset / add / rename semantics. This is overkill at the
moment, as after all any modification the model will be reset, but
ultimately it will allow us to be smarter and only update rows when
needed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-31 07:48:23 -07:00
Berthold Stoeger
b1fb578eb9 Filter: remove diveSiteAdded signal of MainTab
Signals can be useful. In this case, a simple function call does
it. Thus, remove the signal. It can be readded later at an more
appropriate place.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-31 07:48:23 -07:00
Robert C. Helling
554a7aaba4 Zero initialize deco state struct
Valgrind found use of some uninitialized variable (probably
ds->gf_low_pressure_this_dive ), see #1614. Zero is the correct
value to start with. Lacking a working version of valgrind I cannot
check this actually fixes the problem.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-08-31 06:34:44 -07:00
Dirk Hohndel
4e1f806d02 Travis: show performance test results
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-31 06:33:46 -07:00
Dirk Hohndel
9083404981 Travis: put large test data in place for TestParsePerformance
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-31 06:33:46 -07:00
Dirk Hohndel
78cd2f4e09 Add performance test case
This requires the user to manually copy the large test file into the
dives directory (because I really don't want to add this to the repo);
instructions how to do that are displayed if the file is missing.

Next it uses the git version of that same file (but prefetches it to
try and remove the network speed from what is being measured).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-31 06:33:46 -07:00
Berthold Stoeger
59a68fe9b5 Parser: split out name-comparison from match() function
The match() function in parse-xml.c calls a very specific callback,
which doesn't take a context-parameter. To be able to call other
callbacks, split out the actual name-comparison.

Moreover, remove the "plen" parameter, as this was called with
strlen(pattern) in all cases anyway. Replace the old logic which
potentially accessed a byte beyond the end of name with a simply
classical C-style loop.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-30 13:32:09 -07:00
Berthold Stoeger
2de8e70ab0 Parser: move match() into core/parse-xml.c
The match() function compares a pattern with a name with
a twist: The name may either end in '\0' or '.'. If pattern
and name match, a parsing function is called on a buffer and
a destination value. The result of the parsing is not checked.

This seems awfully XML-specific and therefore move the function
from the general parse.c to the specialized parse-xml.c unit
and make it of local linkage.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-30 13:32:09 -07:00
jan Iversen
1515b9496b core/settings: add missing load_* call in qPrefDisplay
Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-30 05:36:36 -07:00
jan Iversen
cf2ffdc432 core/settings: add README
Add simple explanation of how the program flow is.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-30 05:36:36 -07:00
Linus Torvalds
f59679320a parse "GPS" string fields and turn them into dive sites when downloading
Dive computers that do GPS can report their GPS data as one or more
string fields, and if the first tree letters of the description is
"GPS", then we'll take the string and turn it into a dive site for that
dive.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-29 21:40:19 -07:00
Berthold Stoeger
156e053050 Dive trips: don't crash on repeated trip-removal
In the UI it is possible to remove a dive from a trip twice,
which leads to a crash, because trip is NULL (obviously).

Instead of doing a proper fix (don't show the "remove from
trip" entry in the first place), ignore dives without a
trip, since a rewrite of the undo-code is planned for the
medium future anyway.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-29 21:38:48 -07:00
Dirk Hohndel
2d87a657d2 Revert "desktop-widgets: remove QSettings from desktop-widgets"
This reverts commit 321a920a98.

It appears that the load_xxx functions aren't called, so while the correct
values are stored to the settings, they aren't retrieved. Let's revert while
this gets fixed.

Fixes #1609

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-29 03:09:10 -07:00
Dirk Hohndel
4bb72160a6 core: fix typo in preference name
In commit 1bc361b2ea ("core/tests: add uuidString to qPrefUpdateManager") a
typo was introduced for the preference name.

Reported-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-28 12:11:16 -07:00
Dirk Hohndel
edfecfad81 Cleanup: we don't support configuring a Uemis SDA
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-28 12:03:03 -07:00
Berthold Stoeger
66aeaddd0f Filter: cache number of dives fulfilling filter rules
Currently, in FilterModelBase::data() the number of dives is recalculated.
This happens for every mouse-over event!

Calculate the number of dives only on recalculation and store the count
in the items-struct.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-28 05:03:59 -07:00
Berthold Stoeger
e3f8615054 Whitespace: make range based for loops consistent in filtermodels.cpp
Consistently use "for(item: items)" instead if "for(item : items)".

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-28 05:03:59 -07:00
Berthold Stoeger
ec586d0e0a Filter: replace checked-state by struct
In the future, we might be smarter about the dive-counts and calculate
them only once and incrementally (if e.g. new dives are added).
Prepare for more complex caching by turning the checked boolean into
a struct, which can then be extended by a count and other things
(e.g. the name).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-28 05:03:59 -07:00
Linus Torvalds
80fe8fb331 Add support for opening a DC_TRANSPORT_USBSTORAGE stream
This is part of the whole "let's support the notion of dive computers
being exported as USB storage devices" push.

With an older libdivecomputer, we'll just fall back on failing the
operation, but we still want to support the generic notion of
DC_TRANSPORT_USBSTORAGE since we have our own internal Uemis downloader.
That one won't ever get to the open phase, since it's caught earlier.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-27 22:11:05 -07:00
Linus Torvalds
270e9eccad Make device enumeration use the device transport data
This removes some special-case code for Uemis, replacing it with simply
passing in the device transport information.

This makes device enumeration work for the Garmin Descent (if it is
listed by libdivecomputer as a USB storage device, that is).

I don't actually do any of the libdivecomputer parsing yet, and only
have a stub for the Garmin Descent, but now the directory selection
works with that stub. The actual download obviously does not.

[Dirk Hohndel: removed obsolete FIXME from code]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-27 22:10:38 -07:00
Linus Torvalds
bb067b6ee4 Treat the "GARMIN" mount point exactly like the "UEMISSDA" one
The logic for finding a mount point for the Garmin FIT devices is
basically exactly the same as for the UEMISSDA, even if the rest of the
sequence is not the same.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-27 22:09:44 -07:00
Jan Mulder
cae30f450a Show new firmware notice for OSTC Plus
Also show a new firmware notice for a HW OSTC Plus. This appeared
to be broken (as can be verified on the current master from today,
as HW just released version 2.98 of the firmware).

Notice that there is some confusion in both Subsurface and
Libdivecomputer with respect to types of OSTCs. Physcically,
there exist 2 type of OSTC3's. The first edition with
only DC_TRANSPORT_SERIAL (and an USB connector), and a second
version that lacks the connector but supports both BT and BLE.
Confusingly, the second version is marked OSTC3 on the device,
but the user needs to select OSTC Plus (which is basically a 3rd
version of the OSTC3, combined with a successor of the OSTC Sport)
to download dives using BT/BLE.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-08-27 17:41:09 -07:00
Lubomir I. Ivanov
0566f344a9 CHANGELOG.md: update with the latest divelist columns fix
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-08-26 23:08:24 -07:00
Lubomir I. Ivanov
449782a892 divelistview: always show at least one column
Currently it is possible to hide all columns by unchecking them
in the context menu that appears by right clicking the header
of the divelist. But once all are hidden the header disappears.
This can cause a situation where the user cannot show any
columns and the only fix for that is to edit the application
configuration.

To avoid this sutuation prevent the last column from being hidden.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-08-26 23:08:24 -07:00
Lubomir I. Ivanov
5204af58da CHANGELOG.md: add note for the latest dive list row height change
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-08-26 23:06:00 -07:00
Lubomir I. Ivanov
5aa55e7ed5 modeldelegates: use font metrics for dive list row height
Include font metrics as part of the height in DiveListDelegate::sizeHint().

When 22px is hardcoded, this handles small fonts, but for larger
fonts it seem that the bottom of the dive list row text is cut
on Windows.

Keep 22px as the minimum size hint, but for larger fonts
use QFontMetric::height().

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-08-26 23:06:00 -07:00
Dirk Hohndel
eaf1bdbe5f Merge branch 'filter8' of https://github.com/bstoeger/subsurface 2018-08-25 11:58:27 -07:00
jan Iversen
321a920a98 desktop-widgets: remove QSettings from desktop-widgets
The variables referenced are moved into qPref in earlier commits
so in general all QSettings calls are replaced by qPref*:: calls

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25 11:49:47 -07:00
jan Iversen
5f4a040dd2 core/tests: add class var to qPrefGeneral
Add static class variables to qPrefGeneral
(and remove QSettings from desktop-widgets)

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25 11:49:47 -07:00
jan Iversen
da6e8a4cd5 mobile-widgets: remove QSettings
update qmlprefs and qmlmanager to use qPref

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25 11:49:47 -07:00
jan Iversen
b7a1bb670c core/tests: add loadFromCloud var to qPrefCloudStorage
Add special property loadFromCloud + mail to qPrefCloudStorage
this variable is used by qmlmanager.cpp

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25 11:49:47 -07:00
jan Iversen
5dd0981961 core/tests: remove QSettings from testgitstorage
update testgitstorage.cpp to use qPrefProxy and qPrefCloudStorage
remove core/prefs-macros.h since it is unused

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25 11:49:47 -07:00
jan Iversen
2393dca38e core: remove QSettings from qPrefDivePlanner
remove not needed include from qPrefDivePlanner

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25 11:49:47 -07:00
jan Iversen
c85f5c560c desktop-widget: remove QSettings
Update desktop-widget to use qPrefDisplay (amended variable)

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25 11:49:47 -07:00
jan Iversen
3436734bb9 smtk_import: remove QSettings
Update smtk_import to use qPrefDisplay (amended variable)

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25 11:49:47 -07:00
jan Iversen
31eb48c3c2 profilewidget: remove QSettings
Update profilewidget to use qPrefDisplay (amended variable)

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25 11:49:47 -07:00
jan Iversen
ebc0e6d3f3 core/tests: merge Animations and add vars. to qPrefDisplay
Add class variable tooltip_position to qPrefDisplay
Add class variable lastDir to qPrefDisplay
qPrefDisplay is updated to use new qPrefPrivate functions
Adjust test cases incl. qml tests

qPrefAnimations only has 1 variable, that really is a display variable
Merge the variable into qPrefDisplay, to simplify setup (and avoid loading
extra page in qml).

correct theme to save in correct place, and make it a static
class variable

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25 11:49:47 -07:00
jan Iversen
82b626b3fd core: remove QSettings from qthelper
uiLanguage overloaded qPrefLanguage and used useSystemLanguage instead
of use_system_language

Replace local load using QSettings with qPrefLanguage

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25 11:49:47 -07:00
jan Iversen
1bc361b2ea core/tests: add uuidString to qPrefUpdateManager
add static class variable uuidString to qPrefUpdateManager
correct test cases

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25 11:49:47 -07:00
jan Iversen
be9c47954c core: qPrivate add handle macros for class variables
Some variables are not in structure prefs, but are static class
variables, these will not be synced on exit, because they can only
be changed through the setter, but loaded on startup.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25 11:49:47 -07:00
jan Iversen
69f21d9aed core: make methods in qPrefPrivate static
Small cleanup, using static methods is simpler and faster

Added propSetValue and propValue instead of exposing setting
variable.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25 11:49:47 -07:00