Commit graph

14403 commits

Author SHA1 Message Date
Dirk Hohndel
8b37e3f10e Android: add more verbose logging when trying to open USB
The goal is to be able to tell what's actually going wrong.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
2ca8b98091 Android: log both for mobile and full app
We don't usually build the full app on Android, but it's still possible.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
aed7528443 Android: add callback from Intent
Right now all this does is add the device string to the log.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
d27777790e Android: add Java class to receive Intents
We want to be able to respond to a USB device being plugged in.
This simply logs the information we get from the device. Sadly the
really useful getProductName and getManufacturerName require API level
21 (so Android 5.0 or newer) and we still have a couple hundred users on
4.1-4.4.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Robert C. Helling
b9fcc9543d Allow zero length segments in planner
Those are needed to indicate bailout or set point switches
at the beginning of  the ascend.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-08-09 08:46:57 -07:00
jan Iversen
607012cccb tests: add UpdateManager qml test cases
Add tst_qPrefUpdateManager qml file to test C++ qml connection

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-09 08:45:02 -07:00
jan Iversen
9341ea6eef tests: move UpdateManager test from testpreferences
Remove UpdateManager test in testpreferences
add the same UpdateManager tests to testqPrefUpdateManager

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-09 08:45:02 -07:00
jan Iversen
4ce7a2e30c tests: add qPrefUpdateManager testcases
add test cases to secure struct preferences and qPrefUpdateManager work together

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-09 08:45:02 -07:00
jan Iversen
e33545afd0 core: activate qPrefUpdateManager
remove UpdateManager from SettingsObjectWrapper and reference qPrefUpdateManager

update files using SettingsObjectWrapper/UpdateManager to use qPrefUpdateManager

this activated qPrefUpdateManager and removed the similar class from
SettingsObjectWrapper.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-09 08:45:02 -07:00
jan Iversen
e673a3558e core: create qPrefUpdateManager from SettingsObjectWrapper
Update set/get functions to follow common name scheme:
- get function have same name as in struct diveComputer
- set function have set_<name>
- signal function have <name>_changed

one class one .h/.cpp is the C++ idiom. Having load/sync of each
variable in 1 functions (in contrast to the distributed way
SettingsObjectWrapper handles it) secures the same storage name
is used. Having the set/get/load/sync functions grouped together
makes it easier to get an overview.

REMARK: this commit only defines the class, it is not active in production

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-09 08:45:02 -07:00
jan Iversen
e3008c893a tests: add DivePlanner qml test cases
Add tst_qPrefDivePlanner qml file to test C++ qml connection

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-08 14:29:50 +02:00
jan Iversen
fff0e54593 tests: move DivePlanner test from testpreferences
Remove DivePlanner test in testpreferences
add the same DivePlanner tests to testqPrefDivePlanner

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-08 14:29:50 +02:00
jan Iversen
9c26a491a7 tests: add qPrefDivePlanner testcases
add test cases to secure struct preferences and qPrefDivePlanner work together

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-08 14:29:50 +02:00
jan Iversen
21243ec4f7 core: activate qPrefDivePlanner
remove DivePlanner from SettingsObjectWrapper and reference qPrefDivePlanner

update files using SettingsObjectWrapper/DivePlanner to use qPrefDivePlanner

this activated qPrefDivePlanner and removed the similar class from
SettingsObjectWrapper.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-08 14:29:50 +02:00
jan Iversen
357510b9cd core: create qPrefDivePlanner from SettingsObjectWrapper
Update set/get functions to follow common name scheme:
- get function have same name as in struct diveComputer
- set function have set_<name>
- signal function have <name>_changed

one class one .h/.cpp is the C++ idiom. Having load/sync of each
variable in 1 functions (in contrast to the distributed way
SettingsObjectWrapper handles it) secures the same storage name
is used. Having the set/get/load/sync functions grouped together
makes it easier to get an overview.

REMARK: this commit only defines the class, it is not active in production

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-08 14:29:50 +02:00
jan Iversen
27b005b76d tests: update qPrefUnits test cases (remove unsupported vars)
Currently structs and enums are not supported, hence block these
tests

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-08 14:29:50 +02:00
jan Iversen
334099951a core: qPref add STRUCT macro
In order to solve use of e.g. depth_t a new macro is added

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-08 14:29:50 +02:00
Martin Měřinský
a12588ad82 Move DC download icons used by mobile app to mobile-widgets/qml/icons/
Signed-off-by: Martin Měřinský <mermar@centrum.cz>
2018-08-07 09:49:20 -07:00
jan Iversen
72a1bc1325 profilewidget: remove warning of unused var
SUBSURFACE_MOBILE does not include the single function that uses the variable
add #ifndef SUBSURFACE_MOBILE to avoid warning

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-07 09:43:27 -07:00
Dirk Hohndel
46e2e4badf Android: remove unused define
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-05 20:39:34 -07:00
Dirk Hohndel
289e1cc37e Android: whitespace change to build.sh
This indents the code that is only executed when we aren't in 'quick'
mode. git show -w will show that there is no code change in this commit.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-05 20:39:27 -07:00
Dirk Hohndel
35ffd5f71e Android: add -quick flag to build.sh
This allows us to skip all the checking / building of dependency
libraries. This also allows us to pass extra arguments to the make
command by separating them from the arguments to build.sh with '--'.

This commit is easier to understand because it didn't increase the
indent in the large block of code that is now only executed if we aren't
in 'quick' mode. That will be fixed in the next commit that is
whitespace only.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-05 20:39:21 -07:00
Dirk Hohndel
7b4d661ff2 iOS: quiet verbose warnings for libzip
And don't try to build manuals, regression tests and examples, while we are at
it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-05 17:54:01 -07:00
Dirk Hohndel
81ca29e688 Android: use our fork of qt-android-cmake
This tells androiddeployqt to look at the qml modules to find all
dependencies.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-05 15:09:44 -07:00
Dirk Hohndel
32a630ece3 Android: build latest libzip
Small hacks needed, but otherwise this seems to work.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-05 15:08:19 -07:00
Dirk Hohndel
9328726358 Update to latest libdc
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-05 12:07:36 -07:00
Dirk Hohndel
d81a2c812b iOS: fix libzip build instructions
Recent libzip no longer supports autotools.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-04 15:07:04 -07:00
Dirk Hohndel
93983b7e4c Android: build libzip 1.1.3
Switching to GitHub as source for libzip means that we need to encode
the version number differently. Newer versions of libzip don't compile
cleanly on Android and this one seems new enough.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-04 14:32:16 -07:00
Dirk Hohndel
8df6789a9d build-system: update libzip to 1.5.1
This also switches us to libzip's new official home on GitHub, and takes into
account that libzip no longer supports autotools and instead now is cmake
based.

Building against that, on my Mac build system, Subsurface once again correctly
opens DLD files downloaded from divelogs.de.

Fixes #1534

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-04 12:23:47 -07:00
Miika Turkia
a65a8267a5 divelogs.de import: improve export for temperature
Add support for exporting dive temperatures if they are user entered
instead coming from a DC.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-08-04 07:21:20 -07:00
jan Iversen
264aa883b2 core: qPref, remove inline and ; for inline functions
Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-02 13:31:08 -07:00
jan Iversen
d6983391c6 tests: add Units qml test cases
Add tst_qPrefUnits qml file to test C++ qml connection

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-02 08:59:56 -07:00
jan Iversen
ccfd14211a tests: move Units test from testpreferences
Remove Units test in testpreferences
add the same Units tests to testqPrefUnits

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-02 08:59:56 -07:00
jan Iversen
d9b7aaef76 tests: add qPrefUnits testcases
add test cases to secure struct preferences and qPrefUnits work together

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-02 08:59:56 -07:00
jan Iversen
affdc9d394 core: activate qPrefUnits
remove Units from SettingsObjectWrapper and reference qPrefUnits

update files using SettingsObjectWrapper/Units to use qPrefUnits

this activated qPrefUnits and removed the similar class from
SettingsObjectWrapper.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-02 08:59:56 -07:00
jan Iversen
54335e1ec6 core: create qPrefUnit from SettingsObjectWrapper
Update set/get functions to follow common name scheme:
- get function have same name as in struct diveComputer
- set function have set_<name>
- signal function have <name>_changed

one class one .h/.cpp is the C++ idiom. Having load/sync of each
variable in 1 functions (in contrast to the distributed way
SettingsObjectWrapper handles it) secures the same storage name
is used. Having the set/get/load/sync functions grouped together
makes it easier to get an overview.

REMARK: this commit only defines the class, it is not active in production

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-02 08:59:56 -07:00
jan Iversen
470b41e595 core: change type of unit_system to enum
unit_system is an enum, but was declared as short, correct declaration.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-02 08:59:56 -07:00
Berthold Stoeger
90c7be0772 Cleanup: shrink size of three-letter month name strings to 4
There was a comment reading

/*++GETTEXT: these are three letter months - we allow up to six code bytes*/

but this is not valid (anymore), since the array contains only
untranslated strings, which will be translated on-the-fly.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-02 08:55:08 -07:00
Berthold Stoeger
8c036234e2 Cleanup: move sort_table() from subsurface_startup.c to divelist.c
The function is not only used at startup and arguably belongs
the the file with the rest of the low-level divelist functions.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-02 08:55:08 -07:00
Berthold Stoeger
1c4a859c8d Cleanup: remove all override modifiers
Commit df156a56c0 replaced "virtual"
by "override" where appropriate. Unfortunately, this had the
unintended consequence of producing numerous clang warnings. If
clang finds a override-modified function in a class definition,
it warns for *all* overriden virtual functions without the override
modifier.

To solve this, go the easy route and remove all overrides. At least
it is consistent.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-01 06:30:00 -07:00
Berthold Stoeger
42aae8196f Cleanup: remove silly " != 0" expression
In metadata.cpp, replace a silly
 "if (!memcmp(...) != 0)"
by the intended
 "if (!memcmp(...))"

Obviously, both have the same effect. Fixes a warning.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-01 15:30:54 +03:00
Berthold Stoeger
df156a56c0 Cleanup: replace virtual by override where appropriate
The keyword "virtual" signalizes that the function is virtual,
i.e. the function of the derived class is called, even if the
call is on the parent class.

It is not necessary to repeat the "virtual" keyword in derived
classes. To highlight derived virtual functions, the keyword
"override" should be used instead. It results in a hard compile-
error, if no function is overridden, thus avoiding subtle bugs.

Replace "virtual" by "override" where appropriate. Moreover,
replace Q_DECL_OVERRIDE by override, since we require reasonably
recent compilers anyway. Likewise, replace /* reimp */ by
"override" for consistency and compiler support.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-31 11:02:34 +02:00
Berthold Stoeger
7fe76a5dbd Cleanup: Make WindowsTitleUpdate a global object
WindowsTitleUpdate is such a trivial object (a QObject with a single
signal and no own state), that it's not really understandable why
it would need all that "singleton" boiler-plate. Just make it
a default constructed/destructed global object.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-30 13:55:23 -07:00
Berthold Stoeger
4bdd811f06 Cleanup: remove DiveListView::fixMessyQtModelBehaviour()
The function DiveListView::fixMessyQtModelBehaviour() was used to
expand the first columns of dive-trips in the dive-list view.
This function was called everytime that the dive-list was modified.
It is kind of ludicrous that external callers would have to
tell the DiveListView, when it has to update its column headers.

Instead, place this functionality in the overriden reset() and
rowsInserted() functions, as these are the only ways that
rows can be added. Change the DiveTripModel to use the proper
beginResetModel()/endResetModel() pair instead of the previous
full deletion and full repopulation using the beginRemoveRows()/
endRemoveRows() and beginInsertRows()/endInsertRows().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-30 12:21:17 -07:00
Berthold Stoeger
5e1e6110ce Cleanup: remove parameter from currentDiveChanged signal
The currentDiveChanged signal was emitted by the DiveListView
to inform the MainWindow of a change of current dive. The
new current dive was passed as a parameter. The slot in MainWindow
then called select_dive() on the dive.

This seems pointless because:
1) In both emits, selected_dive dive was passed as argument. But
   MainWindow can read this global variable itself.
2) Calling select_dive() again is a no-op, because obviously,
   this already *was* the selected dive.

Moreover it seems conceptually wrong to set the current dive in the
slot that is informed of the change of the current dive.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-30 12:20:26 -07:00
jan Iversen
d3f3d82abd tests: add Proxy qml test cases
Add tst_qPrefProxy qml file to test C++ qml connection

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-30 07:43:22 -07:00
jan Iversen
7acd489891 tests: move Proxy test from testpreferences
Remove Proxy test in testpreferences
add the same Proxy tests to testqPrefProxy

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-30 07:43:22 -07:00
jan Iversen
e198230c83 tests: add qPrefProxy testcases
add test cases to secure struct preferences and qPrefProxy work together

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-30 07:43:22 -07:00
jan Iversen
181d2cf364 core: activate qPrefProxy
remove Proxy from SettingsObjectWrapper and reference qPrefProxy

update files using SettingsObjectWrapper/Proxy to use qPrefProxy

this activated qPrefProxy and removed the similar class from
SettingsObjectWrapper.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-30 07:43:22 -07:00
jan Iversen
f4f798f8dd core: create qPrefProxy from SettingsObjectWrapper
Update set/get functions to follow common name scheme:
- get function have same name as in struct prefs
- set function have set_<name>
- signal function have <name>_changed

one class one .h/.cpp is the C++ idiom. Having load/sync of each
variable in 1 functions (in contrast to the distributed way
SettingsObjectWrapper handles it) secures the same storage name
is used. Having the set/get/load/sync functions grouped together
makes it easier to get an overview.

REMARK: this commit only defines the class, it is not active in production

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-30 07:43:22 -07:00