Commit graph

1209 commits

Author SHA1 Message Date
jan Iversen
63fa532b15 core: create qPrefLanguage from SettingsObjectWrapper
Update set/get functions to follow common name scheme:
- get function have same name as in struct preferences
- 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-13 11:49:32 -07:00
Dirk Hohndel
ce4e0d3276 Use hex USB VID/PID
Except of course that the Android intent does give us these values in
decimal.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-12 15:37:21 -07:00
jan Iversen
75ce813a27 core: activate qPrefLocationService
remove LocationService from SettingsObjectWrapper and reference qPrefLocationService

update files using SettingsObjectWrapper/LocationService to use qPrefLocationService

this activated qPrefLocationService and removed the similar class from
SettingsObjectWrapper.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-12 11:30:19 -07:00
jan Iversen
2b11fd4cc8 core: create qPrefLocationService 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-08-12 11:30:19 -07:00
jan Iversen
cb2dc7515b core: activate qPrefTechnicalDetails
remove TechnicalDetails from SettingsObjectWrapper and reference qPrefTechnicalDetails

update files using SettingsObjectWrapper/TechnicalDetails to use qPrefTechnicalDetails

this activated qPrefTechnicalDetails and removed the similar class from
SettingsObjectWrapper.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-12 07:36:10 -07:00
jan Iversen
b98ba9ba94 core: create qPrefTechnicalDetails 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-12 07:36:10 -07:00
jan Iversen
3c69c8299b core: SettingsObjectWrapper remove buehlmann property
remove buehlmann(), setBuehlmann(bool)

buehlmann() is really planner_deco_mode == BUEHLMANN, so no need for a function
setBuehlmann is dangerous, because buehlmann is saved on disk, but not in prefs.* and thus can lead to inconsistency between bool buehlmann and planner_deco_moce.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-12 07:36:10 -07:00
jan Iversen
e2374e2f81 core: qPrefDivePlanner, cleanup SettingsObjectWrapper
Remove individual store to disk for divePlanner in SettingsObjectWrapper

The save was double effect, qPrefDivePlanner::instance()->sync(), which
was preciding already do this.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-12 07:36:10 -07:00
Jocke
c33a952582 Mobile: return pressures for all used cylinders
Return all pressure values for all used cylinders as a list.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11 11:19:07 -07:00
Jocke
f9e81c7326 Mobile: return all used gasmixes as a list
Planning ahead for full edit capabilities of dives that uses multiple cylinders.  

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11 11:19:07 -07:00
Jocke
80df7dd441 Mobile: return all used cylinders as a list
Planning ahead for full edit capabilities of dives that uses multiple cylinders.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11 11:19:07 -07:00
Dirk Hohndel
a85d4a6447 FTDI support: list PIDs in decimal everywhere
This makes it easier if we ever add one to make sure we find
all the places those need to be changed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
9f94aaf450 Whitespace cleanup, extra braces, and null checks
Thanks to Lubomir for the review.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
b85098d401 Android: add callback to Java code to check pending Intents
If we get launched by an intent, we need to delay processing that Intent
until after the app is initialized. This is the helper function we'll use
for that.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
ae6756e7f1 Android: don't assume that non-BT means FTDI on Android
We do support download from USB devices like the Atomic Aquatics Cobalt.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
23bde692fa core: remove confusing information from debug message
This always looked like a thread number and really made no sense since
we had a much more informative debug message just a couple lines above.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
1bbbc07dd5 core: add indexOf member to ConnectionListModel
This will allow us to programatically set the connection in the QML UI.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
0b242bcaca Android: notify the UI a dive computer was plugged in
And try to guess which one from the device string we get from the Intent.

The function is named to indicate its future use (because once the user
plugs in such a device, we should show the download page).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
7cc9da6347 Android: more FTDI debugging
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
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
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
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
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
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
Dirk Hohndel
46e2e4badf Android: remove unused define
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-05 20:39:34 -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
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
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
jan Iversen
311b2672da core: qPrefPrivate.h added HANDLE_PREFERENCE_INT_DEF_EXT
Add missing type macro, needed for qPrefProxy

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-30 07:43:22 -07:00
Kristaps Dz
02e76be96a BT support: disable BT download when compiling without BT
When BT_SUPPORT is not enabled, don't default to "true" for using bluetooth for downloading dives.
Otherwise, bluetooth will be forced since the bluetooth button has been removed and is never overridden.

Fixes #1541

Signed-off-by: Kristaps Dzonsons <kristaps@bsd.lv>
2018-07-29 10:55:25 -07:00
Berthold Stoeger
fce42d4858 Dive media: Extract thumbnails from videos with ffmpeg
Extract thumbnails using ffmpeg.
Behavior is controlled by three new preferences fields:
 - extract_video_thumbnails (bool): if true, thumbnails are calculated.
 - extract_video_thumbnail_position (int 0..100): position in video
   where thumbnail is fetched.
 - ffmpeg_executable (string): path of ffmpeg executable.

If ffmpeg refuses to start, extract_video_thumbnails is set to false
to avoid unnecessary churn.

Video thumbnails are marked by an overlay.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-28 15:31:25 -07:00
Kristaps Dz
51066e5478 Build-system: add OpenBSD support
Rename linux.c to unix.c and add OpenBSD support as well. Conditionally compile based on OS.

Signed-off-by: Kristaps Dzonsons <kristaps@bsd.lv>
2018-07-28 14:08:06 -07:00
jan Iversen
f175890632 core: activate qPrefFacebook
remove Facebook from SettingsObjectWrapper and reference qPrefFacebook

update files using SettingsObjectWrapper/Facebook to use qPrefFacebook

this activated qPrefFacebook and removed the similar class from
SettingsObjectWrapper.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-27 12:36:20 -07:00
jan Iversen
e0f1817fdc core: create qPrefFacebook 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-07-27 12:36:20 -07:00
jan Iversen
037ee9994d core: fix qPrefCloudStorage to derive git_url
remove set_git_url and git_url_changed, because it is not possible
to set git_url, this is done inderectly through set_base_url

Update disk_base_url to generated git_url for both load/sync

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-27 12:23:09 -07:00
Dirk Hohndel
c7f0e65b12 Whitespace cleanup core divecomputer handling
Not entirely script based because of two odd issues where the script creates
bogus indentation.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-07-26 16:32:51 +03:00
Dirk Hohndel
128fc5f4b8 Whitespace cleanup core/settings
We can argue about any of the changes here, but they are the result of our
whitespace.pl script - so if any of this is offensive to you, part of the
resolution will be fixing the script...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-07-26 16:32:51 +03:00