Commit graph

16870 commits

Author SHA1 Message Date
Dirk Hohndel
2268b6b212 code cleanup: QLatin1Literal is deprecated in Qt 5.14
Simply replace it with QLatin1String. There is a tiny performance penalty,
but none of that code would care.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-26 16:49:42 -08:00
jan Iversen
df9164f7e5 mobile-widgets/qml: integrate ThemeNew in qml
Update Settings to use ThemeNew (for theme change)
Reduce subsurfaceTheme in main

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-26 16:42:35 -08:00
jan Iversen
3c93ee862b mobile: register themeInterface
Register themeInterface with a temporary name, which allows it to be integrated
in subsurfaceTheme (main.qml).

Once all of subsurfaceTheme (main.qml) is available in themeInterface, the name
will be changed.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-26 16:42:35 -08:00
jan Iversen
9de296f3dd mobile-widgets: add themeInterface
Currently subsurfaceTheme resides in main.qml, where it does not naturally
belong.

Add C++ class that will replace subsurfaceTheme in main.qml in a 1-1 manner.

This opens future posibilities
- on top of the 3 themes, allow users to select colors/fonts
- add stylesheets to Template* components
- make day/night shift automatically.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-26 16:42:35 -08:00
Dirk Hohndel
49616c1842 GitHub Actions: disabling TestGitStorage again
I thought I had it fixed, but we still see a ridiculous number
of random, unexplained failures which distract from what we are
trying to do with the GitHub Actions.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-26 16:29:14 -08:00
willemferguson
996798ae3b Update User Manual: Preferences
Provide text and 12 images to describe the preference system
for Subsurface. Several within-document links updated.

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2020-01-26 16:04:49 -08:00
willemferguson
e9778e7a48 User Manual updates: changed to UI
Replace 11 images in the user manual to reflect latest changes
in the UI (Notes tab, Equipment tab, Information tab).
Change text in user manual.

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2020-01-26 16:04:49 -08:00
jan Iversen
d8b035ffe7 diveplanner: add comments explaining different scaling
In some case the scaling (real value <-> UI value) is different
for mobile and desktop. In order to make the difference understandable
comments are added to each function.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-25 17:27:25 -08:00
jan Iversen
4066a65592 backend-shared: correct wrong comment
Remove comment that was very false (next line contradicted the comment).

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-25 17:27:07 -08:00
jan Iversen
74d13b0554 diveplanner: move mobile specific calc to diveplannermodel
setBottomSac, setDecoSac and setFactor in diveplannermodel
receives display value which are then converted.

subsurface-mobile have slightly different values, move the
correction of these from plannershared to diveplannermodel, in
order to keep the whole convert in one place.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-25 17:26:53 -08:00
jan Iversen
14931db0a9 dive-planner: removed unused QML interface
Remove Q_PROPERTY and signals from plannershared, since they are
no longer used (transferred to qmlinterface).

Unregister object plannershared, since it is no longer used in QML.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-25 17:26:33 -08:00
jan Iversen
6584cd82d5 mobile-widgets/qml: correct backgroundcolor in setup
Use subsurfaceTheme in DivePlannerSetup.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-25 17:26:11 -08:00
jan Iversen
3ff65dd7cf mobile-widgets: update design of TemplateSection
Update size and colors.

Changing the TemplateSection, automatically changes all sections
in the system, converted to the new layout.

The styling would be better in a style/theme class, but
subsurfaceTheme is in main.qml and not in a C++ class, so for now
use primitive styling.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-25 17:25:54 -08:00
jan Iversen
a97a6d607c mobile-widgets: update design of TemplateSpinBox
The standard SpinBox uses far too much real estate.

The new SpinBox have a smaller footprint, and more visual effect.

Changing the TemplateSpinBox, automatically changes all spinboxes
in the system, converted to the new layout.

The styling would be better in a style/theme class, but
subsurfaceTheme is in main.qml and not in a C++ class, so for now
use primitive styling.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-25 17:25:23 -08:00
jan Iversen
c1bbab6eaa mobile-widgets/qml: connect QML to Backend.
Add property pressureUnit to use as BAR/PSI text.

Added slot to catch when user changes BAR <-> PSI.

Add Backend variables to Planning section.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25 17:13:20 -08:00
jan Iversen
ff360d28f5 diveplanner: add surface_segment to plannershared
Add surface_segment to plannerShared and then
update desktop-widgets.

Signed-off-by: jan Iversen <jan@casacondor.com>

desktop-widgets: use plannerShared for surface_segment

Change getter/setter for surface_segment to plannerShared, in
order to share the conversion with mobile diveplanner

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25 17:13:20 -08:00
jan Iversen
995340b68a mobile-widgets: make planning vars available to QML.
Update qmlinterface.h with the planning variables (calling
plannerShared).

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25 17:13:20 -08:00
jan Iversen
ee839fe5d9 mobile-widgets: make DECO_MODE and DIVE_MODE available to QML
Duplicate deco_mode to DECO_MODE, in order to make it available to QML.

Duplicate enum divemode_t to DIVE_MODE in order to make it
available to QML. Only part of the enum is made available.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25 17:13:20 -08:00
jan Iversen
59ac506091 mobile-widgets/qml: correct reference in TemplateComboBox
theme is not available, use older subsurfaceTheme.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25 17:13:20 -08:00
jan Iversen
8f6aaaba25 mobile-widgets/qml: graphic layout Planner (Planning)
Add all needed graphical elements for DivePlannerSetup
planning section.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25 17:13:20 -08:00
jan Iversen
1e3879d87d diveplanner: add last gas variables to QMLInterface
Add bottompo2, decopo2 and bestmixend to QMLInterface

Bestmixend in gas options changing with
meter/feet

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25 17:13:20 -08:00
jan Iversen
86fd49f2d7 diveplanner: adjust sac-factor calculation.
The real values are 1.0 to 10.0, but QML needs int so mobile
gets values 10.0 to 100.0

add sacfactor() to QMLInterface and update QML.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25 17:13:20 -08:00
jan Iversen
cd3c2266f9 dive planner: correct bottomsac/decosac calc.
Move conversion cuft <-> liter from desktop-widget/diveplanner.cpp
to plannerShared, to facilitate the same results in mobile
diveplanner

Use Backend for bottomsac/decosac and update to check
for switch LITER <-> CUFT

Add bottomsac/decosac to QMLinterface.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25 17:13:20 -08:00
jan Iversen
5548376776 mobile-widgets: correct error in connect
connect to set_o2narcotics missed an & but the compiler did not
complain (which it usually does).

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25 17:13:20 -08:00
jan Iversen
e55c740d84 diveplanner: call planner model directly for simple variables.
Variables without conversion, do not need to pass plannerShared
(due to the QML interface).

Simple variables do not pass plannerShared, but diveplanner
in desktop-widgets and qmlinterface in mobile-widgets call the
implementation directly.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25 17:13:20 -08:00
willemferguson
ff18de053f Parse GPX dive coordinates: Qt XML framework
This replaces the C-code XML parsing with a Qt infrastructure.
QXmlStreamReader is used to parse the GPX file.

It also takes into account comments by @neolit123

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2020-01-25 23:25:33 +02:00
jan Iversen
1e14c3f0d3 mobile-widgets/qml: add slot for volume change
Catch when volume type is changed and update bottomsac/decosac.

Also update text l/min <-> cuft/min and add a space between value and unit.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-24 20:23:37 -08:00
jan Iversen
2ef0d23c29 mobile-widgets/qml: Add drop_stone to rates
Drop_stone_mode, when set, affect the descent rate, so place it alongside the
descent rate.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-24 20:23:37 -08:00
jan Iversen
0710e610d3 mobile-widgets: add simple part of remaining planner variables
Add simple variables, where getter uses prefs. and setters call directly to set
function (without using plannerShared).

rename last_stop --> last_stop6m

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-24 20:23:15 -08:00
jan Iversen
663fe7f78b backendShared: remove length slot
Length variables are updated from the QML and desktop directly.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-24 20:21:28 -08:00
jan Iversen
b0e46c208d mobile: move dive planner notes access to pure interface
Make notes rates available to QML through the Backend interface.
Remove the corresponding variables from plannerShared.

Getters are from prefs. while setters are linked to diveplan model.

Remark: signals from qPrefDivePlanner is used, because the diveplanner model
sets qPrefDivePlanner but do not issue special signals.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-24 20:20:42 -08:00
jan Iversen
e22943fa21 mobile-widgets/qml: use Kirigami Units instead of hardcoded values
This allows for better scaling of the UI.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-24 20:20:41 -08:00
jan Iversen
20a1b4befb scripts: expand build.sh
Add option "-src-dir <source directory>" to build options.

When calling build.sh without -src-dir it uses src/subsurface as usual, but when called
with -src-dir <source directory>, it uses src/<source directory> as source basis.

This is a needed option, when working with "git worktree", which is used when working on
different branches in parallel (e.g. master and my-feature-branch), because it allows a
build directory in each worktree, and thus much faster when switching work.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-24 10:56:26 -08:00
jan Iversen
5d3691bbcd documentation: add line to CHANGELOG
Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-24 10:55:04 -08:00
jan Iversen
97376eb382 mobile-widgets/qml: add radiobuttons for single units.
For METRIC and IMPERIAL, show the radiobuttons disabled
For PERSONALIZED, allow user to select individual units.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-24 10:55:04 -08:00
jan Iversen
cc5b856280 mobile-widgets: use radiobuttons for Units
Change to radiobuttons for units, and add a third choice (personalize).

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-24 10:55:04 -08:00
willemferguson
ef9bce9233 Desktop: Import gps coordinates: test files
These are test files enabling a test of the import of dive
coordinates from GPS

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2020-01-24 09:51:51 -08:00
Dirk Hohndel
ee5a156498 core: move GPX parsing into core
This shouldn't be part of the desktop UI code; there's still the issue that we
really shouldn't hand code XML parsing, but I'll leave that for later.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-24 09:51:02 -08:00
Willem Ferguson
1ecd5065a0 Desktop: Import dive coordinates directly from GPS
This allows Subsurface to obtain the coordinates of a dive directly
from a GPS track. It parses a GPX file (GPX V1.0 or V1.1) from
a GPS to locate the trackpoint immediatedly after the start of a
dive. There is an additional "Use GPS file" button in the Edit Dive
Site panel that is selected from the Notes tab. Image:

This allows one to select a GPX file, bringing up the Import GPS
dialog.

There is extensive provision for cross-checking that the dive track
synchronises with the dive start and end. If the Save button in the
dialog is pressed the dive coordinates are copied into the Dive
Coordinates text box in the Edit Dive Site panel. The map moves
to indicate the location of the dive site.

The bulk of the work is done in importgps.cpp. The code is
pretty intergrated: I tried to break it up in smaller commits but that
was not feasible.

The code includes responses to the comments by @neolit123 and
@bstoeger. The C-based file input was replaced with Qt-based
code using QChar, QString and QFile.

[Dirk Hohndel: fixed several small issues in the .ui file, removed
               various headers includes that weren't needed and
               fixed printing of minutes as zero padded]

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-24 09:51:02 -08:00
jan Iversen
1f51251f1b backend-shared: remove asc/desc functions
Ascent/Descent rate functions are fully implemented in diveplannermodel,
therefore remove these functions.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20 15:49:02 -08:00
jan Iversen
6db7e6d278 mobile-widgets/qml: use Backend instead of Planner
Use Backend instead of Planner for ascent/descent variables.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20 15:47:26 -08:00
jan Iversen
699665ce9e mobile-widgets: add asc/desc rates to pure interface
Make ascent/descent rates available to QML through the Backend interface.

Remark signals from qPrefDivePlanner is used because the diveplanner model
sets qPrefDivePlanner but does not issue its own signals.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20 15:46:08 -08:00
jan Iversen
d924afdf52 qt-models: add suffix Display to unit system aware asc/desc setters
Change ascent/descent setter function names to set_<name>Display
to show the value is prepared for displaying (common for desktop and QML).

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20 15:45:20 -08:00
jan Iversen
b1751ac0c6 desktop-widgets: use set/get asc/desc rates in diveplannermodel
The spinboxes are already connected to diveplannermodel set_ functions, remove
second connect to plannerShared.

Change get functions to use diveplannermodel.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20 15:43:53 -08:00
jan Iversen
851ab68aa2 qt-models: add getters to diveplanner model
diveplannermodel already contains set_<asc/desc> function that convert from
screen value to real value; this adds get functions that convert real value to
screen value, so now all conversions are done in one place.

Use prefix Display to identify this is values prepared for the UI (both desktop
and QML).

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20 15:41:21 -08:00
Dirk Hohndel
917e3ff0a2 Update CHANGELOG
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20 15:39:22 -08:00
Dirk Hohndel
51a242a1db mobile UI: add ability to unset the default cylinder
This was requested in a 'bug report' by a user.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20 15:39:22 -08:00
jan Iversen
77352751fa core/settings: removed unnecessary if
prefs.unit_system is set at the top, so no need to set it again.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20 09:55:57 -08:00
jan Iversen
ed4e7e3fc4 core/settings: correct signal error
prefs.unit = x  needs to be after the setters are called, otherwise the setter
will not do anything, and result in an inconsistency between the values stored
on disk and in prefs.units.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20 09:55:57 -08:00
jan Iversen
6e06550631 core/settings:: remove string functions for units
Remove string version of unit_system, duration_units, length, pressure,
temperature, vertical_speed_time, and volume, including tests and make signals
strongly typed in C++

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20 09:55:26 -08:00