Commit graph

1312 commits

Author SHA1 Message Date
Dirk Hohndel
9e36968881 mobile/export: don't allow file based exports on Android
There is no native file dialog, access to the file system is highly restricted
and will be much more so in Android 11. Let's not even start with this.

This should never have been merged as it was.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-17 10:50:51 -08:00
Dirk Hohndel
0178f0c7e7 mobile/export: remove most of the export options
A tablet or phone is not a computer. What would you do with a CSV or TeX/LaTeX
file on a phone. Yeah, I get it, feature parity.

This should never have been merged.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-17 10:50:51 -08:00
Dirk Hohndel
b8c02c9b03 mobile/export: clean up whitespace
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-17 10:50:51 -08:00
Dirk Hohndel
619de80dfd mobile UI: restructure menu
This changes the 'GPS' entry to be called 'Location', moves the 'Map' entry
below that, and reuses the map icon for both the map inside this submenu and
for the main menu item.

It moves the 'About' entry under 'Help' and both 'Export' and 'Dive summary'
under 'Dive management'.

This way we have only five (or with 'Developer' enabled, six) entries in the
main menu making it much more appropriate for really tiny screens.

Additionally, the entrieis moved into sub-menus are ones that are not all that
commonly used.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-13 14:01:34 -08:00
Dirk Hohndel
f915c45c43 mobile/summary: remove some debug output
I don't think we need that anymore.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-10 08:02:56 -08:00
Dirk Hohndel
4b3761861e mobile/summary: expand refresh button
Buttons ignore the width of the enclosed label and base their width on the
illogically named implicitWidth instead.

Also translate the button text.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-10 08:02:56 -08:00
Dirk Hohndel
57024d188c mobile/summary: more UI fine tuning
Creating more space for the header column and a little visual separation for
the different sections.

The commit is much smaller than it looks - try 'git show -w'.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-10 08:02:56 -08:00
Dirk Hohndel
a7d1dbd013 mobile UI: fix font size breakage on Android
The pointSize() of a font can return -1 if the font was originally specificied
with a pixelSize. Work around this by using QFontInfo to calculate the correct
value.

Additionally, don't use the pointSize() of a font when we can instead use the
calculated size.

This fixes the problem with the missing star ratings on Android.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-09 16:45:04 -08:00
Dirk Hohndel
ba201eabc7 mobile UI: fix alignment issue in dive details view
The 'Map it' button could overlap with the dive number below, depending on font
size. This fixes the issue.

Reported-by: Peter Reinold <mcc.nash@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-09 12:45:55 -08:00
Jason Bramwell
caabf1b888 Correcting typos of the word celsius
Corrected typo of the word celsius in three files:
core/import-csv.c
core/divefileter.h
mobile-widgets/qml/Settings.qml

These were spelled as celcius but corrected these to celsius.
The 'core files were just comments but the mobile-widgets file would be
'active' code.

Reported by: tormento <turment@gmail.com>
Signed-off-by: Jason Bramwell <jb2cool@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-09 12:45:55 -08:00
Berthold Stoeger
2ec570098b Cleanup: remove exportFunc class
exportFunc was a collections of functions for exporting dive data.
It had no state, therefore there is no reason for it to ever be
instantiated.

Simply remove the class. Rename the saveProfile function to
exportProfile so that all export functions start with "export".

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-09 12:13:18 -08:00
Dirk Hohndel
3bb9b08f33 mobile UI: correctly determine the number of columns when screen size changes
This also deals with a bug we had before where we didn't re-start the calculation
for the various sizes from the assumption of 'at least 21 grid units'. Now you can
rotate the device and the right thing will happen.

Small warning - this checks the orientation of the screen, which is exactly what
you want it to do on your device. When running mobile on desktop this may not be
what you expect. Even if the window has a portrait aspect ratio, your screen is
likely still landscape... so testing this feature in mobile on desktop mode is a
bit harder...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-08 13:58:54 -08:00
Dirk Hohndel
96a56cf04d mobile/settings: add UI for single column preference
This is placed in the Advanced section as I expect this to be rather unusual
for people to enable.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-08 13:58:54 -08:00
Dirk Hohndel
6c7411c776 mobile/summary: use more intuitive time periods
No one will ask you about your dives in the last seven months (and the
existing code actually provided the past 210 days in that case). Instead
do more intuitive periods. Last month, quarter, half year, year.

Use Qt's ability to make sane date calculations easy.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-08 10:29:36 -08:00
Dirk Hohndel
fb057b7094 mobile/summary: improve the spacing of the content
Use more idiomatic ways to indent the rows, replace the TemplateLabel with a
simple Label since drawing the extra rectangle for the background of the
TemplateLabel is obviously redundant and using it doesn't change the number
of properties we need to set.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-08 10:29:36 -08:00
Dirk Hohndel
5f6b7450a9 mobile/summary: correctly align text to vertical center
I keep forgetting that the verticalAlignment is only within the current object,
which means that in a single line label it has no meaning at all.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-08 10:29:36 -08:00
Berthold Stoeger
feab249bf2 mobile/summary: add refresh button
On tablet devices, the summary page stays open and therefore
the summary is not refreshed. For now, add a button. Later, this
should be connected to signals when dives are edited, added or
deleted.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-08 10:29:36 -08:00
Berthold Stoeger
a93c303b8b mobile/summary: add section headers
Add section headers to the dive summaries on mobile by adding
a section-property. Of course, this will not work on desktop.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-08 10:29:36 -08:00
Berthold Stoeger
1809dbd00a mobile/summary: remove dive summary calculation
Since we now use a model to calculate the dive summary, there
is no need to export recalculation of the dive summary via
QMLInterface.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-08 10:29:36 -08:00
Dirk Hohndel
a5823a5b0d mobile/summary: implement frontend code for the new summary model
Implements the ListView and its delegate to use the dynamic data
provided by the DiveSummaryModel

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-08 10:29:36 -08:00
Berthold Stoeger
48ccd114fc mobile/summary: recalculate first and last dive on visibility change
Recalcluate not only the statistics for the given period, but also
the global first and last dive date.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-08 10:29:36 -08:00
Berthold Stoeger
f7c73f1987 mobile/summary: implement firstDiveDate and lastDiveDate
Instead of transporting the global first and last dive date
in the dive summary, calculate it in an external function.
Since we already have time and date functions in qthelper.cpp
implement those functions there. Provide a stub in QMLInterface
so that QML can access these standalone functions.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-08 10:29:36 -08:00
Dirk Hohndel
988ccba710 mobile: prevent crash adding dives
When the cylinders became a dynamic data structure, a get_cylinder() call
suddenly could return a NULL pointer. So use get_or_create_cylinder() for the
first call when parsing the user's data.

Also, deal with an oddity where the string lists look different because an
empty list technically isn't the same as a list with one empty string.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-08 10:26:21 -08:00
Dirk Hohndel
102f3bf295 mobile/notes-edit: ensure cursor stays visible editing dive notes
This seems to work much more reliably as it specifically compares the cursor
position to the visible bottom and top of the screen.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-07 14:01:23 -08:00
Dirk Hohndel
074dcfb656 mobile/settings: fix the width of cylinder drop down
The GridLayout isn't part of a Layout, so set its width and
have the combo box fill it's part of the grid.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-06 21:45:00 -08:00
Dirk Hohndel
5735c1f387 mobile UI: set correct width for TeplatePage
A page by default fits in a column.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-06 21:45:00 -08:00
Dirk Hohndel
bb123c78fa random white space fix
QtCreator fixes that for me after every edit, I'm getting tired
of manually removing those hunks.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-06 21:45:00 -08:00
Dirk Hohndel
eb410aee55 mobile UI: redo the screen size magic
This still is way to fragile. Ordering of object completion doesn't appear
consistent. Hopefully bringing the properties all into one (now reasonably
named) object will help.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-06 21:45:00 -08:00
Dirk Hohndel
f1a08eb952 mobile: comment out planner references
I don't expect this to be complieted. I'll keep it in the tree
for the moment, but expect to remove all of the related code
eventually.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-06 21:45:00 -08:00
Dirk Hohndel
f44e63b427 mobile/settings: correctly draw the size buttons
With the columnSpan 3 (in a grid with only two columns) they were drawn
on top of the drop down for the theme.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-06 21:45:00 -08:00
Dirk Hohndel
b7433b15ff mobile/settings: refer to the correct theme object
This was missed when switching object names.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-06 21:45:00 -08:00
Dirk Hohndel
b3994ffd3f mobile/settings: white space cleanup
Some odd empty lines and an unnecessary line break.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-06 21:45:00 -08:00
Dirk Hohndel
2a0ba04d33 mobile/settings: make the color swatches work as color swatches
In a color swatch the color of the body of the swatch is the one that
matters. And we need to ensure readability. So for each pair of colors,
use the combination in the regular order (color/textcolor) for the
background swatch, and inverted for the text swatch.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-06 21:45:00 -08:00
Dirk Hohndel
0f33aee1af mobile/settings: correctly set label background
The TemplateLabel comes with a set background color which creates a very odd
effect and makes the text generally unreadable in the color swatches.
Fix this by matching the color of the parent rectangle.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-06 21:45:00 -08:00
Dirk Hohndel
f532aae2e9 mobile/settings: remove confusing frame around column titles
These are not color swatches like the rest, these are the column titles, so
don't draw them the same way as the color swatches.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-06 21:45:00 -08:00
Berthold Stoeger
5e0ce206a0 Cleanup: remove capture-all lambda clauses
These were forgotten the last time.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-04 16:24:29 +01:00
jan Iversen
35de9c49a4 mobile-widgets: switch to new subsurfaceTheme
Remove subsurfaceTheme from main.qml
Replace ThemeNew -> subsurfaceTheme
change registration ThemeNew -> subsurfaceTheme

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-02-03 17:30:35 -08:00
jan Iversen
38120d555f mobile-widgets/qml: secure subsurfaceTheme.initial*
move initialWidth/initialHeight out of subsurfaceTheme to placeHolder,
this secures no change in behaviour.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-02-03 17:30:29 -08:00
jan Iversen
c3be85fbd9 mobile-widgets/qml/settings.qml: show all colors
Show all colors in a theme, allowing user to change theme.

This is preparation for allowing users to click on the individual
colors and change them.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-02-03 17:30:20 -08:00
jan Iversen
15fbcb655a mobile-widgets/themeinterface: make most part static
Make variables and functions static where possible, this is done
to prevent different versions of theme with different values.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-02-03 17:30:15 -08:00
jan Iversen
f16dc72556 mobile-widgets/qml: use new templates in converted pages
Use the TemplatePage and TemplateButton in the converted pages.

In order to avoid a bigger search/replace all other pages are left
untouched (for now).

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-02-03 17:30:06 -08:00
jan Iversen
3aa43f3ea5 mobile-widgets/qml: add TemplateButton
Do "git mv SsrfButton TemplateButton", and search/replace
all uses.

The general idea of the templates are to secure common layout,
but also to isolate the Kirigami parts (slowly) in the templates.

Signed-off-by: Jan Iversen <jani@apache.org>
2020-02-03 17:29:58 -08:00
jan Iversen
fb7920ef58 mobile-widgets/qml: add TemplatePage
Signed-off-by: Jan Iversen <jani@apache.org>
2020-02-03 17:29:51 -08:00
Berthold Stoeger
d27b6805f3 Cleanup: rename plannerShared to PlannerShared
Usually, we use PascalCase (i.e. camelCase with a capital
letter at the start) for class names. For consistency, let's
do it here as well.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-04 02:17:52 +01:00
Berthold Stoeger
3b42de66dc Cleanup: remove QMLInterface::instance()
QMLInterface::instance() is only used in one single place. This
makes the whole notion of having a global instance of the object
moot, isn't it?

Simply make the object static to the function that uses it, which
guarantees that the object will be created when the function is
called. I.e. the same behavior is retained with less complexity.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-31 21:28:45 +01:00
Berthold Stoeger
188e513761 Cleanup: connect QMLInterface signals in constructor
It appears weird to connect the QMLInterface signal/slot combination
in a static helper function. This generates a bunch of lambdas that
call the instance() function.

Instead, simply do the connections in the constructor as we do it
in numerous other places.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-31 21:28:45 +01:00
jan Iversen
a65ec77263 mobile-widgets/qml/divesummary.qml: detect change in units
When either length or volume unit is changed, the text needs to be
changed.

Let signal lengthChanged and volumeChanged cause a recalcation and therefore
new text.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-30 19:51:50 +02:00
jan Iversen
906cce9e88 mobile-widgets: emit signals for each color
Emit signals for each standard color when theme changes.

The iconStyle property was changed from being a constant, because it can
change, and thus a signal was added.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-30 07:53:34 +02:00
jan Iversen
5a7ebe15a5 mobile-widgets: correct empty lines
Remove extra empty lines in themeinterface.cpp just a cleanup, no functionality
change.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-30 07:53:12 +02:00
jan Iversen
8339384eeb mobile-widgets/qml: move fontMetrics to ThemeTest
fontMetrics is no longer used in production code, but still in the theme test
page.

Isolate fontMetrics in ThemeTest page.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-30 07:52:57 +02:00
jan Iversen
3d871ef0de mobile-widgets: do not use fontmetric for height
In order to remove fontMetrics from QML, replace references (height)
in DownloadFromDiveComputer and Settings

Add include kirigami as needed

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-30 07:52:31 +02:00
jan Iversen
2cc215d3f2 mobile-widgets: move font property to themeInterface
Move setting of font properties used throughout to themeInterface.
Add new settings "currentScale".

The properties are kept in main (subsurfaceTheme) in order not to do
a big search/replace.

Update settings to use currectScale and signal changes in themeinterface.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-30 07:52:14 +02:00
jan Iversen
a3e3a30b70 mobile-widgets: move basePointSize to themeinterface
Check defaultfont and calculate basepointsize in themeinterface instead
of in QML.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-30 07:51:05 +02:00
Dirk Hohndel
08e39f9d2d mobile/dive summary: rewrite statistics code
There were quite a few issues with the code - clearly a complete failure of
code review.

- all values were '??' if a period contained no dives
- imperial units were not calculated at all
- significant truncation and data loss in the way totals were added as meters
  and minutes instead of the higher precision data that is available
- several issues in striing conversion methodology, e.g. missing zero padding
  for minutes
- missing maxSac
- incorrectly calculated avgSac
- incorrectly claculated number of EANx dives
- hard to read code with most variables named 'temp'

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-30 07:45:25 +02:00
jan Iversen
a534f1a25c mobile-widgets/qml: Fix Kirigami error.
Solve kirigami error:
INFO: qrc:/org/kde/kirigami/ScrollablePage.qml:187: TypeError: Cannot assign to read-only property "parent".

Kirigami.scrollPage does not allow a ListModel be defined, even though it is allowed in QtQuick.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-29 06:19:25 -08:00
jan Iversen
303b5865cd mobile-widgets/qml: add icon to dive summary entry
Add sigma icon to menu entry "dive summary".

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-28 15:34:34 -08:00
jan Iversen
7ebfdd6232 mobile icons: add sigma svg
Add svg sigma to be used for dive summary.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-28 15:34:14 -08:00
jan Iversen
2d8af34016 mobile-widgets: add dive_mode variable to QML
Add dive_move variable to qmlinterface, to make it aviable to QML.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-28 11:28:30 -08:00
jan Iversen
f424f9292e mobile-widget/qml/Settings.qml: correct theme switches
Replace subsurfaceTheme with ThemeNew, since there are still 2 objects
subsurfaceTheme in main.qml and ThemeNew in themeinterface.*

Replace theme color references with ThemeNew, as they are no longer available
in main.qml (subsurfaceTheme).

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-28 11:05:45 -08:00
jan Iversen
1d35942249 themeinterface: move registration to themeinterface
Move setup call and registration from subsurface-helper
to themeInterface, in order to keep the registration where the code
are.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-28 11:05:45 -08:00
jan Iversen
97e2890990 mobile-widgets/qml: integrate DiveSummary in menu.
Add DiveSummary to globalDrawer

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-27 14:25:03 -08:00
jan Iversen
b6e86a1c70 mobile-widgets/qml: add DiveSummary.qml
Add DivePlannerSummary, a page to show in dive centers.

Allow user to select period for the 2 colums in DiveSummary.

Default is "Total" and "3 month", but allowing the user to change
these, make it a very simple tool to view how the user progresses.

Variables are taken from Backend.

[Dirk Hohndel: adjusted text strings as these aren't really months]

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-27 14:25:03 -08:00
jan Iversen
6cd46bee06 divesummary: add DiveSummary class to shared and backend
Create DiveSummary class in backend-shared and make the DiveSummary calculation
results available to QML.

This adds a loop over all dives (could have been done with a model, but the
models available to mobile are very limited, so use the basic way).

[Dirk Hohndel: renamed the results variable and combined a couple of commits]

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-27 14:25:03 -08:00
jan Iversen
bb13065a75 mobile-widgets/qml: add background color property
Add property "colorBackground" to allow instances of templateLabel to have
background color overwritten.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-27 14:25:03 -08:00
jan Iversen
0920adf40f mobile-widgets/qml: correct spelling error
Correct spelling error in TemplateTitle.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-27 14:25:03 -08:00
Dirk Hohndel
5b81997459 code cleanup: whitespace cleanup
A lot of whitespace issues have snuck in recently, this just cleans those up so
that I don't need to hand-edit patches every time I touch this file (since
QtCreator automatically fixes whitespace when I make changes).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-26 16:51:05 -08:00
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
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
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
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
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
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
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
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
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
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
jan Iversen
75fe59b0da mobile-widgets/qml: use strongly typed units in QML
Change Settings and DivePlannerSetup to use the strongly typed enums

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20 09:49:36 -08:00
jan Iversen
25a5be0fe9 mobile-widgets: allow qPrefUnit strongly typed in QML
Add qPrefUnit Q_PROPERTY but using QMLInterface enums, that way
all variables become strongly typed in QML.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20 09:49:05 -08:00
jan Iversen
11c6851c74 mobile-widgets: move rest of gridlayout to section advanced
Create section advanced around the remaining gridlayouts, and adjust.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-19 11:59:48 -08:00
jan Iversen
5bce4895cc mobile-widgets/qml: create units section and move unit_settings
Move gridlayout unit_settings to TemplateSection units, without changing
anything (apart from adding a visible: attribute).

Removed first label in units_settings, since it is the title of the section

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-19 11:59:04 -08:00
jan Iversen
0443d7f2c9 mobile-widgets/qml: create theme section and move themesettings
Move gridlayout themesetting to TemplateSection theme and use the
TemplateTitle.  Also switch from using PrefDisplay.mobile_scale to
subsurfaceTheme.currentScale

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-19 11:56:13 -08:00
jan Iversen
ba7a8f68bc mobile-widgets/qml: move dive computers to general section.
move gridlayout divecomputers to TemplateSection general, without changing
anything (apart from adding a visible: attribute and replacing the Rectangle
used to draw a line at the bottom with a TemplateLine on top.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-19 11:54:54 -08:00
jan Iversen
3d239a7903 mobile-widgets/qml: move default cylinder to general section.
move gridlayout defaultCylinder to TemplateSection general, without changing
anything (apart from adding a visible: attribute and replacing the Rectangle
used to draw a line at the end with a TemplateLine at the top).

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-19 11:53:45 -08:00