Commit graph

1060 commits

Author SHA1 Message Date
jan Iversen
9d74b4dc82 mobile-widgets/qml: remove use of eval()
eval() cannot be used in combination with the Qt5 qml compiler,

replace eval() with switch statements.

Signed-off-by: Jan Iversen <jani@apache.org>
2019-12-24 03:52:40 +09:00
jan Iversen
161bedf58d mobile-widget: use qPref variable
change prefs.cloudUserName to PrefCloudStage.cloud_storage_email.

This is slightly more effective (direct instead of indirect), and
reduces the use of prefs.

This is part of limiting the use of prefs. (which is a precessor to
qPref) to the login process, and ultimately remove it.

Signed-off-by: Jan Iversen <jani@apache.org>
2019-12-18 13:26:29 +09:00
jan Iversen
1dd7d9df3a mobile-widget: correct set of default_cylinder
set_default_cylinder is accepted, because it is defined in Qt Meta system,
however the call is never carried out, because the Q_INVOKE macro is missing

Change PrefGeneral.set_default_cylinder(...) which is a function call
to PrefGeneral.default_cylinder = ... which is a builtin assignment

Signed-off-by: Jan Iversen <jani@apache.org>
2019-12-18 13:26:29 +09:00
jan Iversen
bf7954ebe7 core: remove LOG_STP from mobile
LOG_STP is on longer providing the data needed, since a lot of the startup
is indirectly in QML, furthermore using the xcode project and running profiler
gives much more detailed information

Signed-off-by: Jan Iversen <jani@apache.org>
2019-12-13 07:04:00 -05:00
jan Iversen
080ddc0df2 mobile/qml: Integrate/activate diveshare in Export
Integrate diveshare in Export
Activate diveshare radio button

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-12 21:35:55 -05:00
jan Iversen
53069fe777 mobile-widgets: activate uploadDiveShare in qmlmanager
Remove "TO BE IMPLEMENTED" and add call doUpload

Connect signal to signal in QMLManager to avoid registring the
upload class.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-12 21:35:55 -05:00
jan Iversen
dd183eaabf mobile/qml: Clear status field in Export
When opening the saveAsDialog a second time, it contains
the last status from first time.

Clear statusText before calling saveAsDialog

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-12 10:10:01 -05:00
jan Iversen
786b0db724 mobile/qml: make close dialog in Connect work
When using Connect, the context is switched, so close()
might or might not work.

Change unqualified close() to qualified uploadDialog.close()

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-12 10:10:01 -05:00
jan Iversen
adedfe5965 mobile/qml: remove empty line
Remove empty line that does not make sense.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-12 10:10:01 -05:00
jan Iversen
a2717c558a mobile/qml: close upload dialog if success
Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11 12:36:43 -05:00
jan Iversen
1d74eb509f mobile/qml: handle upload signals
Add uploadFinish and uploadProgress to Export page

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11 12:36:43 -05:00
jan Iversen
4b2cae3f7c mobile-widgets: make upload signals available to QML
Connect signal to signal in QMLManager to avoid registring the
upload class.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11 12:36:43 -05:00
jan Iversen
5cba410aa6 mobile/qml: close export page after upload
pop from pagestack.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11 12:36:43 -05:00
jan Iversen
422bb0da57 mobile/qml: add pref suppport for userid in Export
Handle reading/writing of userid/password settings in the
saveAsDialog and set field to visible when needed.

Activate divelogsde radio button

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11 12:36:43 -05:00
jan Iversen
03c9cdfbed mobile-widgets: activate uploadDiveLogsDE in qmlmanager
Remove "TO BE IMPLEMENTED" and add call doUpload

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11 12:36:43 -05:00
jan Iversen
5aba24248f mobile/qml: correct typo in Export.qml
Correct default value for export type.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11 12:36:43 -05:00
jan Iversen
190b024bec mobile-widgets/qml: add divelogsde stylesheet to resources
Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11 12:36:43 -05:00
jan Iversen
936362c102 mobile/qml: activate dive_site export in UI
Dive_site export is now implemented in Exportfuncs, so
allow users to select it.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-05 10:11:42 -08:00
jan Iversen
599984d44a mobile-widgets/qml: close Export page after export (or cancel)
Remove page from pageStack, which removes the page from user view.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-05 09:57:06 -08:00
Berthold Stoeger
4b1a3a1a6e Selection: move selection functions from divelist.c to selection.c
Since we now have a selection.c translation unit, put the selection-
related functions there.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04 13:00:23 +01:00
jan Iversen
92b56d0583 mobile-widgets/qml: block profile export (temporary)
The current png generation is intertangled with the desktop
UI, and a shared Webservice needs to be developed.

Block Radiobutton

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-03 21:30:39 -08:00
jan Iversen
d2b633b2a8 mobile-widgets/qml: block DiveLogs.de and DiveShare export (temporary)
The current Webservice implementation is intertangled with the desktop
UI, and a shared Webservice needs to be developed.

Block Radiobutton

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-03 21:30:39 -08:00
jan Iversen
c6348e96de mobile-widgets/qml: block dive sites export (temporary)
DiveFilter have 2 implementation on or desktop and one for mobile,
the common export function uses DiveFilter (desktop version).

Block Radiobutton

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-03 21:30:39 -08:00
jan Iversen
117aa13dbe mobile-widgets/qml: add upload dialog to export page
divelogs.de and diveShare are web uploads, which need a special
custom dialog.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-03 21:30:39 -08:00
jan Iversen
093813698c mobile-widgets/qml: add filedialog to export page
All exports are to file except 2 which are upload to web.

Integrate standard qml filedialog for all exports (minus 2).

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-03 21:30:39 -08:00
jan Iversen
5307cbc1c7 mobile-widgets/qml: integrate export page in main.qml
Add export function to GlobalDrawer, allowing the user to
export the divelog.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-03 21:30:39 -08:00
jan Iversen
578abeda80 mobile-widgets/qml: add export page
Prepare page for exporting the diveLog (feature currently
only in the desktop version).

Add Radiobuttons to select type of export
also add "anonymize button"
and a "explain" text field

Subsurface-mobile does not allow selection of dives, therefore
export will always be all dives

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-03 21:30:39 -08:00
jan Iversen
86aa96936a mobile-widgets/qml: add export stylesheets as resource
Add export stylesheets to mobile-resources.qrc to ensure
they get installed.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-03 21:30:39 -08:00
jan Iversen
27ce89a6e5 mobile-widgets: add export functionality to qmlmanager
Add enum with different export types (used to signal which type
of export QML desires).

Add QML export functions (one for file and one for upload to web)

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-03 21:30:39 -08:00
jan Iversen
7eda75d7ab mobile-widgets/qml: add qmldir to include map-widget
qml demands all qml files to be in 1 directory, but allows
a "qmldir" file to reference qml files in other directories.

Add qmldir to reference map-widget.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-11-26 09:44:13 -08:00
Dirk Hohndel
1b058d58f7 Mobile: make it clear that 'all BT devices' setting is temporary
Making this persistant creates a very unpleasant user experience.
And if a dive computer needs this setting, we really want people
to report this to us so we can fix it.

Fixes: #2358

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-22 16:53:29 -08:00
jan Iversen
bd7357238f mobile-widget/qml: correct syntax error introduced in e63257f0e
default parameter values is not supported as this syntax was introduced
in ECMA-262 6th edition while QML only implements the fifth edition
(as of Qt 5.11).

remove default parameter and check for undefined instead.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-11-11 20:44:35 +01:00
Dirk Hohndel
4f0d437f1e Mobile: add ability to directly open support email
This is even easier and more obvious than copying the logs on the About page
and then manually creating an email and pasting those logs.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-10 21:59:32 +01:00
Berthold Stoeger
794066b236 Cylinders: access cylinders with get_cylinder()
Instead of accessing the cylinder table directly, use the get_cylinder()
function. This gives less unwieldy expressions. But more importantly,
the function does bound checking. This is crucial for now as the code
hasn't be properly audited since the change to arbitrarily sized
cylinder tables. Accesses of invalid cylinder indexes may lead to
silent data-corruption that is sometimes not even noticed by
valgrind. Returning NULL instead of an invalid pointer will make
debugging much easier.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-09 19:19:04 +01:00
Berthold Stoeger
7c9f46acd2 Core: remove MAX_CYLINDERS restriction
Instead of using fixed size arrays, use a new cylinder_table structure.
The code copies the weightsystem code, but is significantly more complex
because cylinders are such an integral part of the core.

Two functions to access the cylinders were added:
get_cylinder() and get_or_create_cylinder()
The former does a simple array access and supposes that the cylinder
exists. The latter is used by the parser(s) and if a cylinder with
the given id does not exist, cylinders up to that id are generated.

One point will make C programmers cringe: the cylinder structure is
passed by value. This is due to the way the table-macros work. A
refactoring of the table macros is planned. It has to be noted that
the size of a cylinder_t is 64 bytes, i.e. 8 long words on a 64-bit
architecture, so passing on the stack is probably not even significantly
slower than passing as reference.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-09 19:19:04 +01:00
Dirk Hohndel
15674f1a71 Mobile: modify filter so that all models get notified
When we change the filter string, we need to make sure that the collapsed model is
also aware of the change.

Similarly, instead of just calling resetFilter and directly changing the core
data structures, we need to set the filter to the empty string which ensures
that all three models get notified and the view updates correctly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08 20:50:05 +01:00
Dirk Hohndel
20fda8afc3 Mobile: reconnect the correct model after changing filter
This caused a blank, unusable dive list.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08 20:50:05 +01:00
Dirk Hohndel
ae27dd77a7 Mobile: consistently refer to the dive list model
The number of different ways we tried to refer to the model made my head spin.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08 20:50:05 +01:00
Dirk Hohndel
9e09a7d920 Mobile: ensure there's some space between date and depth/duration
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08 20:50:05 +01:00
Dirk Hohndel
8b0f4e65d3 Mobile: use the CollapsedDiveListSortModel for dive list
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08 20:50:05 +01:00
Dirk Hohndel
c759157331 Mobile: setup CollapsedDiveListSortModel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08 20:50:05 +01:00
Dirk Hohndel
b01e9fb0a8 Mobile: derive the index from the dive id
The previous code assumes that both the vertical dive list and the list of dive
details which allows the horizontal swiping from dive to dive are based on the
same model.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08 20:50:05 +01:00
Dirk Hohndel
9d9047d040 Mobile: give visual indication that we are saving dives
Allow showing that the app is busy and showing why at the same time.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08 20:50:05 +01:00
Dirk Hohndel
e63257f0e9 Mobile: allow message argument to showBusy function
When called without arguments, no message is shown.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08 20:50:05 +01:00
Dirk Hohndel
505ff4032a Mobile: add UI feature tests to Developer menu
Running Subsurface-mobile on iOS, the notification texts are sometimes very
hard to read, and in some situations the busy indicator isn't showing up at
all.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08 20:50:05 +01:00
Dirk Hohndel
3a7b8d73d8 Mobile: let the user know if we can't save changes
While the error that caused this to happen should be fixed, we should at least
let the user know if things failed catastrophically and we can't figure out how
to save their data.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08 20:50:05 +01:00
Dirk Hohndel
ccace53b83 Mobile: remember if we were able to open the local cache
If there is a local cache, we at least once successfully accessed the cloud, so
this is a valid cloud based git tree.

Without this change we run into a subtle bug: after a fresh install, or when
switching users, when the cloud data is accessed the very first time, we don't
remember that this was indeed loaded from the cloud. So if we then download
from a dive computer or make any other changes to the dive log, we cannot save
those dives to cloud storage - but we fail silently doing so. Which to the user
would look that inexplicable data loss.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08 20:50:05 +01:00
Dirk Hohndel
08e2013d1e Mobile: remove useless attempt to prevent access to the cloud
This code really made no sense, adding a comment to try to explain that.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08 20:50:05 +01:00
Dirk Hohndel
4111de70e8 Mobile: drop extra argument to QString
Clearly a cut and paste error. Only creates a harmless warning, still...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08 20:50:05 +01:00
Dirk Hohndel
f1e7adfedc Mobile: don't dereference the dive list model when it's disconnected
This avoids a bunch of annoying warnings.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-03 04:02:00 -08:00