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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
move initialWidth/initialHeight out of subsurfaceTheme to placeHolder,
this secures no change in behaviour.
Signed-off-by: jan Iversen <jan@casacondor.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Add bottompo2, decopo2 and bestmixend to QMLInterface
Bestmixend in gas options changing with
meter/feet
Signed-off-by: jan Iversen <jan@casacondor.com>
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>
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>
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>
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>
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>
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>
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>
For METRIC and IMPERIAL, show the radiobuttons disabled
For PERSONALIZED, allow user to select individual units.
Signed-off-by: jan Iversen <jan@casacondor.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>