Commit graph

1140 commits

Author SHA1 Message Date
jan Iversen
6c8dae5a04 mobile-widgets/qml: add TemplateSpinBox
standard font-size are set in the template (but can
be overwritten in the object)

Using TemplateSpinBox allows central change of how
spinBoxes are presented in the UI.

Signed-off-by: Jan Iversen <jani@apache.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 10:18:09 -08:00
jan Iversen
99cce7e807 mobile-widgets/qml: add TemplateLabel
standard font-size as well as color are set
in the template (but can be overwritten in
the object)

Using TemplateLabel allows central change of how
labels are presented in the UI.

Signed-off-by: Jan Iversen <jani@apache.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 10:18:09 -08:00
jan Iversen
8468d28a41 mobile-widgets/qml: add TemplateSection
TempleSection is a clickable rectangle that contains
information.

It is used to
- group information
- hide/unhide details

And are an important building block in decluttering small
screen, while showing all information on bigger screens

Signed-off-by: Jan Iversen <jani@apache.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 10:18:08 -08:00
jan Iversen
9c74ac23a5 mobile-widgets/qml: remove console messages
Remove console.log messagees used to test the
split of startpage/divelist.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-27 01:29:30 +09:00
Dirk Hohndel
3dbdd2ee5e mobile UI/login: fix PIN entry page
In commit a4d299e01e ("mobile-widgets/qml: use showPin/oldStatus consistently")
one instance of rootItem.showPin wasn't replaced with prefs.showPin and as a
result we had a very strange password entry line in the middle of the PIN entry
screen.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-24 15:53:15 -08:00
jan Iversen
611c4bb088 mobile UI/login: move startpage to main
StartPage does not belong in divelist.

Remove startPage from diveList and anchor in main.

Make needed functional changes.

Signed-off-by: Jan Iversen <jani@apache.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-24 15:53:15 -08:00
jan Iversen
11810d5d06 mobile UI/login: remove startpage dependency in divelist
DiveList should not depend on StartPage, so remove references to
startPage.

Signed-off-by: Jan Iversen <jani@apache.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-24 15:53:14 -08:00
jan Iversen
b83dcc4b25 mobile UI/login: make divelist a proper object in main
Instanciate DiveList like all the other pages.

Move DiveList properties set in main to DiveList.qml

Signed-off-by: Jan Iversen <jani@apache.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-24 15:53:14 -08:00
jan Iversen
4687de8c82 mobile UI/login: clean startPage/setupActions from Divelist
setupActions() in StartPage contained a mixture of StartPage
actions and DiveList actions.

Split setupActions to be pure.

However currently StartPage is embedded inside DiveList so the
action onVisibleChanged must be simulated.

Signed-off-by: Jan Iversen <jani@apache.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-24 15:53:13 -08:00
jan Iversen
d1bee58dad mobile UI/login: move onCompleted actions to main
manager.finishSetup() have nothing to do with startpage/divelist,
but belong in main (seeing main as responsible for setup and window layout).

Move onCompleted functionality to main.

Signed-off-by: Jan Iversen <jani@apache.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-24 15:53:11 -08:00
jan Iversen
5af7727ad0 mobile UI/login: replace use of cloudPassword
Replace prefs.cloudPassword with PrefCloudStorage.cloud_storage_password in QML

Replace QMLPrefs.....cloudPassword with PrefCloudStorage::cloud_storage_password in C++

Signed-off-by: Jan Iversen <jani@apache.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-24 10:24:15 -08:00
jan Iversen
ac28896a5d mobile UI/login: replace use of cloudUserName
Replace prefs.cloudUserName with PrefCloudStorage.cloud_storage_email in QML

Replace QMLPrefs.....cloudUserName with PrefCloudStorage::cloud_storage_email in C++

Signed-off-by: Jan Iversen <jani@apache.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-24 10:22:39 -08:00
jan Iversen
4b713ece96 mobile UI/login: do not revert to old credentials.
If the user asked to change credentials it is equivalent to a signout,
so no need to store old credentials. This simplification allows removal
of the temporary credentials in qmlPrefs.

this commits secures the user is locked in the login page, until one
of 3 things happen:

- enter verified credentials (divelist is loaded from cloud)
- select no-cloud mode (divelist is loaded from local)
- enter new credentials, PIN page shows, enter PIN or
  cancel (back to enter credentials).

This is consistent even if the program is restarted.

Old version had a non consistent way:
A user enters new credentials,
  sees the PIN screen,
  but does not receive the email immediately,
  so works with other applications (causing the mobile app to close)

Having received the email with the PiN,
  the user starts mobile again,
  BUT does not see the PIN screen, instead the old credentials are used.

Signed-off-by: Jan Iversen <jani@apache.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-24 10:17:45 -08:00
jan Iversen
9117aa2a52 mobile-widgets: make saveCredentials() an atom
Call saveCredentials with username/password to avoid first
setting the two and then calling.

Change saveCredentials() to use newUser, newPassword.

Signed-off-by: Jan Iversen <jani@apache.org>
2019-12-25 03:15:52 +09:00
jan Iversen
e92dbe7974 mobile-widgets/qml: clean whitespace in main.qml
Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-25 03:15:52 +09:00
jan Iversen
a4d299e01e mobile-widgets/qml: use showPin/oldStatus consistently
Remove aliases for showPin/oldStatus and reference prefs.showPin/oldStatus directly.

showPin/oldStatus are "temporary" variables, that are not saved in settings,
so they easily be replaced

Signed-off-by: Jan Iversen <jani@apache.org>
2019-12-24 08:25:51 +09:00
jan Iversen
ab28008679 new mobile login: remove non existing function from CloudCredentials
the function manager.accessingCloud is not defined in QMLManager.h

Remove manager.accessingCloud.

Signed-off-by: Jan Iversen <jani@apache.org>
2019-12-24 08:25:51 +09:00
jan Iversen
1468af3519 new mobile login: remove saveCredentials() from StartPage.qml
The local qml function saveCredentials() in StartPage are not used.

Signed-off-by: Jan Iversen <jani@apache.org>
2019-12-24 08:25:51 +09:00
jan Iversen
5f5d4ffbc9 mobile-widgets/qml: disable global drawer in startpage
Do not show global drawer when user is doing login.

Signed-off-by: Jan Iversen <jani@apache.org>
2019-12-24 08:25:51 +09:00
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
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
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
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
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
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
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
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
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
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
Dirk Hohndel
9f34f4f97d Mobile: disconnect model while updating dive list
If the dive list is connected to the model while the model is updated
with the downloaded dives, sometimes the UI hangs completely.

Disconnecting the model and then reconnecting it does add a fairly
noticeable delay on longer dive lists, so there are tradeoffs here.

Of course the obvious solution is to make reconnecting the model
faster...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-03 04:02:00 -08:00
Dirk Hohndel
113cb1acc0 Mobile: use appendTextToLog to get timestamps in logs
This helps tremendously when tracking down some problems. We should
never use console.log.

In the process this also updates a couple of the messages to be clearer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-03 04:02:00 -08:00
Dirk Hohndel
d401271dab Mobile: make the GPS service icon work again
I don't recall when this stopped working.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-27 12:42:38 -07:00
Dirk Hohndel
fdf03966d4 Mobile: ensure we go back to the dive list after download
The pop() by itself wasn't enough to do that.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26 11:38:26 -07:00
Dirk Hohndel
d709cfb0b8 Mobile: try harder to get the right dive list
This should ensure that the dive list correctly repopulates after the model
was updated.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26 11:38:26 -07:00
Dirk Hohndel
65910177b2 Mobile: also show busy spinner when applying GPS fixes
That's another function that can take a little while.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26 11:38:26 -07:00
Dirk Hohndel
9b6ec64853 Mobile: simple message and busy spinner while storing downloaded dives
Due to some recent changes processing the downloaded dives and
re-displaying the dive list can take quite a while. So show a small
message and the busy spinner to warn the user.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26 11:38:26 -07:00
Dirk Hohndel
84920fd657 Mobile: change show/hide busy functions
The old code was ill named - this way the busy spinner itself
becomes reusable with a reasonable set of function names.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26 11:38:26 -07:00
Dirk Hohndel
bf6a644fc6 Mobile: provide better tracking of applied GPS fixes
Also reset the page stack to make sure we don't end up with stale data.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26 11:38:26 -07:00
Dirk Hohndel
4c55074bd7 Mobile: more code to deal with undefined elements
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26 11:38:26 -07:00
Dirk Hohndel
dc5f22d047 Mobile: reset dive list after applying GPS fixes
This way new fixes are actually shown when the user looks at the dive
list after applying the GPS fixes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26 11:38:26 -07:00
Dirk Hohndel
e03d3ac5d6 Mobile: don't show nothing for the location
We use 'Dive details' as page title, everywhere else we use
'<unnamed dive site>'.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26 11:38:26 -07:00
Dirk Hohndel
320d2c47aa Mobile: fix incorrect variable dereference for dive site
Since we are accessing the model, this is the variable we should use.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26 11:38:26 -07:00
Dirk Hohndel
f69b93de40 Mobile: don't push map page if it's already on the stack
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26 11:38:26 -07:00
Dirk Hohndel
4e583f9120 Mobile: avoid dereferencing undefined values
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26 11:38:26 -07:00
Dirk Hohndel
face9ba1a8 Mobile: fix cacheBuffer for log window
The old value made no sense at all. Why would we want to cache up to 10k
entries of the log?

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26 11:38:26 -07:00
Dirk Hohndel
e6298f9352 Mobile: allow editing dive number
No checks regarding duplicate numbers - we trust the user knows what
they are doing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-21 15:50:41 -04:00
Dirk Hohndel
158a2ec159 Mobile: remove remaining accesses to DiveObjectHelper from QML
Add a couple more roles and remove the dive role that allows accesss to
the DiveObjectHelper in the first place.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-20 16:08:55 -04:00
Dirk Hohndel
613a3112d2 Mobile: get dive details directly from the model
By getting a DiveObjectHelper and then dereferencing that we ended up
creating hundres and hundreds of these objects, only to immediately
destroy them after using a tiny part of the data.

Instead make those data available directly from the model, without
having to create a DiveObjectHelper forst.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-20 16:08:55 -04:00
Dirk Hohndel
01f1bea995 Mobile: ensure input fields stay visible after keyboard opens
When the user taps on a TextField to enter text, usually the virtual
keyboard will pop up. This code tries to ensure that the keyboard
doesn't cover the entry field that the user was trying to work on.

In order to centralize these changes, this introduces a new
SsrfTextField type which we use to also remove a few redundant default
settings that we previously had for every field. The one TextArea for
the Notes field didn't seem worth creating yet another type for, so
there the changes are done directly in DiveDetailsEdit.

The awkward timer mechanism is necessary as the keyboard pops up
asynchronously and then triggers a change of height for the app, so we
need to wait a little bit before doing the adjustment.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-14 13:39:45 -07:00
Dirk Hohndel
85d810119b Mobile: pick icons depending on theme
QML has ways to style icons - and we use that for the main theme color,
but it doesn't seem to work (anymore?) for the edit and save icons.
Instead of tracking down what changed there, simply switch between icons
with different foreground color, depending on theme.

All the other icons seem to work well in all three themes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-14 13:39:45 -07:00
Dirk Hohndel
fe56fa587a Mobile: bring back the adaptive size for the tool bar
When switching to the global tool bar this was lost, and then it turned
out to be broken and required more patches to fix.

Commented out because it doesn't work at all.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13 11:32:27 -07:00
Dirk Hohndel
56713842b9 Mobile: ensure consistent path when accessing arrow icons
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13 11:32:27 -07:00
Dirk Hohndel
e3eaf03d2f Mobile: implement our own back entry for GlobalDrawer
This way we'll get a working back icon on Android and also correct font
size for the (translated) Back text.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13 11:32:27 -07:00
Dirk Hohndel
fda10b8baa Mobile: update the map when the selected dive changes
Now we see the highlighted dive flag match the dive selected in the dive
list.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13 11:32:27 -07:00
Dirk Hohndel
2f0689d3b8 Mobile: move pageIndex function to main.qml
This way it can be more easily called from other pages.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13 11:32:27 -07:00
Dirk Hohndel
2ef401ef5f Mobile: when selecting dive via map, expand its trip
Previously if the dive was in a different trip, we'd scroll to that trip
but not expand the trip, which was a confusing user experience.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13 11:32:27 -07:00
Dirk Hohndel
6422079de5 Mobile: when selecting dive via map, update details view
We updated the selected dive in the dive list, but not the one shown in
the details view.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13 11:32:27 -07:00
Dirk Hohndel
b07a1cc8b6 Mobile: when switching to the details, reuse existing page
While pageStack.push() can handle pushing a page that's already there,
that creates an unfortunate sequence of currentItemChanged signal which
leads us to do the wrong thing with our map hack.

This commit changes things around to first look for the page in the page
stack and just switch to it, and only pushing the page as new if it
cannoot be found oon the page stack.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13 11:32:27 -07:00
Dirk Hohndel
d8cc8732bd Mobile: use tri-state variable to improve the map hack
QML enums are a bit painful to use, so this uses poor man's emums
instead.

Basically what this changes is that a forced switch to the map doesn't
count as picking the map. That seems obviously correct, as otherwise you
could end up in a situation where a legitimate switch away from the map
is ignored.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13 11:32:27 -07:00
Dirk Hohndel
4e4fcda91c Mobile: insane hack to make map page work
This makes no sense and seems crazy. But it also seems to work,

For some reason with the current Kirigami version and Qt 5.13.1
selecting the map page makes the pageStack jump back to the previous
page right away. I cannot find what triggers this behavior.
Since I cannot fix the root cause, I am working around the bug. When we
select the map page we remember that fact and when a different page is
picked with the mapPage being the last page on the stack, we force the
page selection back to the map page. I can imagine countless ways in
which this could go horribly wrong - but right now I can't figure out a
better solution.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13 11:32:27 -07:00
Dirk Hohndel
8cd1abb7f7 Mobile: keep existing page stack when showing map
There doesn't appear to be a reason to pop all of the existing pages from the stack.
Just on principle, only close the drawer if it was open.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13 11:32:27 -07:00
Dirk Hohndel
a200ac0982 Mobile: need to recalculate column width when rotating
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13 11:32:27 -07:00
Dirk Hohndel
5025943bc4 Mobile: don't make sub-pages fill the parent
This had very strange results with the current Kirigami.
Instead set the width of those pages based on our overall column width.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13 11:32:27 -07:00
Dirk Hohndel
b9861a0059 Mobile: change handling of columns and column width
The old calculation was clearly bogus, we'd also get zero columns here.
Instead do a correct calculation of the number of columns and make the
resulting column width a property of the rootItem so we can refer to it
elsewhere.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13 11:32:27 -07:00
Dirk Hohndel
e047e97190 Mobile: ApplicationHeader is now deprecated
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13 11:32:27 -07:00
Dirk Hohndel
57d50d0101 Mobile: show the undo for delete for 5 seconds
Before that it was 3 seconds that was a little too short for peopl to
be happy.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13 11:32:27 -07:00
Paul Buxton
65ec16e59d Fix text in darkmode on mobile app.
Signed-off-by: Paul Buxton <paulbuxton.mail@googlemail.com>
2019-10-06 11:39:46 -07:00
Dirk Hohndel
e7e21aec6b Mobile: fix reloading dive list after download
There was a sad typo in commit eecca6aab0 ("Mobile: replace model-reset
by row-addition in DiveListModel::reload()").

Additionally, we need to also refresh the dive list so that the new
dives are shown.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-02 08:04:49 -07:00
Dirk Hohndel
1c24ac1a94 Mobile: don't allow width change without rotation
We get incorrect changes to a new screen width that causes us to try
draw to a much larger screen than we actually have. Ignore those
changes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-02 08:04:49 -07:00
Dirk Hohndel
cd98cb8921 Mobile: add more debugging output for screen width issue
Somehow we need to be able to figure out which width information is
correct.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-02 08:04:49 -07:00
Dirk Hohndel
c90050f449 Mobile: recalculate base units only for first real change
Different Android devices seem to have different patterns of throwing
incorrect width information at us. This seems like a really bad hack,
but for the ones I've seen so far this should give us the right width
information.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-02 08:04:49 -07:00
Dirk Hohndel
d635d5de1f Mobile: only print debug output if there's information
On many devices the Screen property doesn't give us a manufacturer,
model, or name.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-02 08:04:49 -07:00
Berthold Stoeger
ad7ffa0af0 Import: Make DownloadThread a subobject of DiveImportedModel
Currently, desktop and mobile are accessing the DownloadThread
and the DiveImportedModel concurrently. This makes a big data
flow mess. To achieve a more hierarchical data flow, start
by making the DownloadThread a subobject of DiveImportedModel.

Start the download by calling a function in DiveImportedModel.

Route the finished signal through DiveImportedModel. Thus,
the model can reload itself with the new data.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02 08:04:49 -07:00
Berthold Stoeger
eecca6aab0 Mobile: replace model-reset by row-addition in DiveListModel::reload()
Owing to apparent QML breakage, a model-reset leads to the DiveDetail
page being reloaded for every dive in the list(!). Therefore, add
rows instead.

This leads to extremely subtle code, as it is now imperative that
the model has been properly cleared beforehand. Nevertheless, for
now we have to do this to fix a severe performance regression.

Fixes #2295

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-27 16:33:37 -07:00
Berthold Stoeger
f0fc1f3a56 Mobile: Don't access dive-id via DiveObjectHelper
There is already a role to do that. Query the model directly to
avoid creating a full DiveHelperObject.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-27 16:33:37 -07:00
Dirk Hohndel
71a75bfda5 Mobile: more space around menu button on Download page
This looked fine when playing with it on the desktop, but required
more space on device for some reason.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21 16:30:12 -07:00
Berthold Stoeger
9322c54b6a Mobile: pass section directly to tripTitle() and tripShortDate()
Instead of converting the section-heading string to a trip-pointer
in QML and pass that to the tripTitle() and tripShortDate()
functions, pass the string and convert in C++ code.

Hopefully, this makes the code more robust.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-21 16:12:23 -07:00
Dirk Hohndel
cefebc17bd Mobile: don't show filter button when entering credentials
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21 15:13:10 -07:00
Dirk Hohndel
7c3b8f32db Mobile: dump the information QML has about the screen
Maybe this will allow us to customize things for certain devices?

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21 15:13:10 -07:00
Dirk Hohndel
dab2613791 Mobile: correct font size of 'Previously used DC' label
This appears to be the one label where we didn't set the
correct font size based on the global scaling.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21 15:13:10 -07:00
Dirk Hohndel
8c0af2b147 Mobile: recalculate gridUnit and font size if width changes
This could happen when you rotate a mobile device, or when running
Subsurface-mobile on the desktop.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21 15:13:10 -07:00
Dirk Hohndel
54f48f0b37 Mobile: move gridUnit and font adjustment to function
This way we can call it in other situations when needed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21 15:13:10 -07:00
Berthold Stoeger
e780b0a96c Mobile: don't generate numerous DiveObjectHelpers in startEditMode()
Since that object is very heavy, generate one object and read out all
the necessary values. The old code accessed the model again and again.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14 13:20:59 +02:00
Berthold Stoeger
0026aa3955 Mobile: replace clear()/addAllDives() pairs by reload()
The clear()/addAllDives() pair was bogus as the former didn't
clear the model (this is not possible anymore - the model
represents the core dive list) and the latter readded all
dives again.

Replace this by a reload() function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14 13:20:59 +02:00
Berthold Stoeger
a79c45e401 Mobile: return depthDuration directly from DiveListModel
We don't want to generate a DiveObjectHelper numerous times for
every item in the dive list. Therefore, return this data directly
from the model. In this case, don't remove from DiveObjectHelper,
as these data might be used by grantlee templates.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14 13:20:59 +02:00
Berthold Stoeger
c4831d7ace Mobile: return location directly from DiveListModel
We don't want to generate a DiveObjectHelper numerous times for
every item in the dive list. Therefore, return this datum directly
from the model. In this case, don't remove from DiveObjectHelper,
as this datum might be used by grantlee templates.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14 13:20:59 +02:00
Berthold Stoeger
4b389e267d Mobile: return dive-number directly from DiveListModel
We don't want to generate a DiveObjectHelper numerous times for
every item in the dive list. Therefore, return this datum directly
from the model. In this case, don't remove from DiveObjectHelper,
as this datum might be used by grantlee templates.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14 13:20:59 +02:00
Berthold Stoeger
bf081866e9 Mobile: return dive-id directly from DiveListModel
We don't want to generate a DiveObjectHelper numerous times for
every item in the dive list. Therefore, return this datum directly
from the model. In this case, don't remove from DiveObjectHelper,
as this datum might be used by grantlee templates.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14 13:20:59 +02:00
Berthold Stoeger
c6b3309d13 Mobile: return dateTime directly from DiveListModel
We don't want to generate a DiveObjectHelper numerous times for
every item in the dive list. Therefore, return this data directly
from the model. In this case, don't remove from DiveObjectHelper,
as these data might be used by grantlee templates.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14 13:20:59 +02:00
Berthold Stoeger
54720e6cff Mobile: move tripNrDive from DiveObjectHelper to DiveListModel
We don't want to generate a DiveObjectHelper numerous times for
every item in the dive list. Therefore, return this datum directly
from the model.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14 13:20:59 +02:00
Berthold Stoeger
1b9581369a Mobile: move tripId from DiveObjectHelper to DiveListModel
The canonical way of displaying lists in Qt is via models.
Thus, return the tripId directly from the DiveListModel instead
of going indirectly via a DiveObjectHelper. In the future, this
will allow us to make the DiveObjectHelper value-based, as it
is not generated numerous times for every list item.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14 13:20:59 +02:00
Dirk Hohndel
6ab4105211 Mobile: adjust grid unit on very narrow screens
If the default font size is big enough to leave us fewer than 21 grid
units per row, shrink the grid unit.

In order for this to create consistent results, we need to reduce the
default column width to 21 grid units as well. And with that change, the
columnWidth property becomes obsolete.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-11 21:50:41 +01:00
Dirk Hohndel
00e673230a Mobile: reserve space for the hamburger menu on Download page
Having a label with no width that can expand wasn't really a great way
to do so.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-11 21:50:41 +01:00
Berthold Stoeger
f3acb0ca02 Mobile: catch null references in DownloadDCThread
There are reported crashes on Android that suggest a null
"tables" attribute in DownloadDCThread. This should never
happen, as the table() function connected to this attribute
returns the address of a subobject. Thus, even if the original
DownloadThread is null, this would not return a null pointer
(the subobject is not at address 0).

Catch these null-object accesses and write a warning message
to the console. Hopefully, this will help is localizing the
problem.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-08-10 09:58:19 -07:00
Dirk Hohndel
144de49ad4 Mobile: add checkbox to force downloading all dives
This has been a feature people have asked for quite frequently. It is
taking up some valuable screen real estate - so the question could
become if there should be a switch to enable / disable it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-05-11 11:40:07 -07:00
Berthold Stoeger
82af1b2377 Undo: make undo-system dive site-aware
As opposed to dive trips, dive sites were always directly added
to the global table, even on import. Instead, parse the divesites
into a distinct table and merge them on import.

Currently, this does not do any merging of dive sites, i.e. dive
sites are considered as either equal or different. Nevertheless,
merging of data should be rather easy to implement and simply
follow the code of the dive merging.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12 18:19:07 +03:00
Dirk Hohndel
9d582c5512 Mobile: only show dive computers in the Bluetooth connection list
And offer an option to show all devices in the settings. This is intentionally
not stored in the preferences as this should never be needed. We don't support
BT or BLE dive computers that we don't recognize. This is a last resort in case
a new firmware were to change the name or some other weird issue causes us not
to recognize a dive computer - and that should be fixed instead of worked
around.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-02-14 09:05:58 -08:00
Berthold Stoeger
ff9506b21b Import: don't add to new trip while downloading
Since process_imported_dives() can add dives to a newly generated
trip, this need not be done in the downloading code. This makes
data flow distinctly simpler, as no trip table and no add-new-trip
flag has to be passed down to the libdivecomputer glue code.

Moreover, since now the trip creation is done at the import step
rather than the download step, the latest status of the "add to
new trip" checkbox will be considered.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-19 13:48:17 -08:00
Berthold Stoeger
f542dc4030 Import: add trip_table argument to DiveImportedModel::repopulate()
In the future we want to download trips into a distinct trip-table
instead of the global trip-table to allow for undo of import.

Therefore add a trip_table argument to DiveImportedModel::repopulate()
and a trip_table member to DiveImportedModel. To correctly set these,
add a DownloadThread::trips() function, which currently simply returns
the global trip table.

Finally, make "struct trip_table *" a Q_METATYPE, so that the corresponding
arguments can be passed from QML.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-09 20:58:04 -08:00
Lubomir I. Ivanov
0903bef9db update year to 2019 in about screens
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2019-01-02 09:45:01 -08:00
Dirk Hohndel
c38215dfa7 Mobile: deal with BT name and address when tapping Download
Instead of trying to update this whenever the connection text changes,
instead deal with it right before it actually gets used.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-12-21 14:53:45 -08:00
Miika Turkia
53ba950c8f Mobile: copy the dive data when configuring settings
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-12-21 09:13:37 +02:00
Miika Turkia
8e7a9a4f4c Mobile: UI for selecting what to copy-paste
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-12-21 09:13:37 +02:00
Berthold Stoeger
bfe69239df Import: unglobalize downloadTable
To make data flow more clear, unglobalize the downloadTable object.
Make it a subobject of DownloadThread. The difficult part was making
this compatible with QML, because somehow the pointer to the
download-table has to be passed to the DiveImportedModel. Desktop would
simply pass it to the constructor. But with objects generated in QML
this is not possible. Instead, pass the table in the repopulate()
function. This seems to make sense, but for this to work, we have to
declare pointer-to-dive-table as a Q_METATYPE. And this only works
if we use a typedef, because MOC removes the "struct" from "struct
dive_table". This leads to compilation errors, because dive_table is
the symbol-name of the global dive table! Sigh.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-12-17 07:37:32 -08:00
Berthold Stoeger
68414531ad Mobile: don't format trip heading for all dives
QML's ListView uses the "section" property to test if items belong to the
same section. Apparently, this must be a string and therefore we can't
pass e.g. a dive-trip object. Therefore a specially formatted string
was passed in, which was guaranteed to be unique (contained the dive-trip
pointer value) and the fully formatted trip-title and short-date.

The disadvantage of that approach is that the formatting is performed for
every dive and not every trip. Perhaps not a problem now, but it makes
it for example necessary to cache the number of filtered dives.

To be more flexible, pass in only the pointer value formatted as
hexadecimal string and provide a function to convert that string
back to a trip-pointer (in the form of a QVariant, so that it can
be passed to QML). Moreover provide two functions for formatting the
title and the short-date.

The three new functions are members of DiveListSortModel. This might not
be the perfect place, but it is easy to reach from the DiveListView.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-23 13:22:24 -08:00
Miika Turkia
88d5eccb17 delete-copy-paste buttons layed out properly
Now these buttons are finally shown with long press and seem to be
working more-or-less as intended.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-11-18 06:31:44 +08:00
Miika Turkia
76a68f71a4 Support for copy-pasting specific fields on mobile
Initial implementation/prototype of copy-paste support for
Subsurface-mobile. The UI part is really lacking; right now the copy
button is initially visible and paste is achieved by long press on a
dive and clicking the paste button when it appears. Delete is currently
not possible at all, as I just failed to layout the buttons properly
using QML. It just sounds so simple, to put all the copy-paste-delete
buttons next to each other...

The data to be copied is currently hard-coded. A dialog to choose
inteded fields would be nice, but it'll take quite a bit effort to get
used to QML enough to be able to hack something together.

Anyway, this seems to work, even though the UI is not always reflecting
the paste without switching dives (when testing on laptop).

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-11-18 06:31:44 +08:00
Jocke
03143f1ef1 Mobile: Allow multiple divemasters
While not something that many will use, editing a dive on
Subsurface-mobile should not result in data loss.
This makes the divemaster field behave in the same way as the buddy
field with regards to multiple entries.

Fixes #1853

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-15 18:10:13 +08:00
Dirk Hohndel
4636fcc834 Mobile/filtering: don't show the filter line when pulling divelist down
Even though the height was zero, when pulling down the dive list for refresh,
the filter input line would still be visible. With this fix it no longer is.

Also remove unused property.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-31 14:34:43 -07:00
Berthold Stoeger
75b5d61522 Dive site: replace UUID by pointer in mobile code
Replace UUIDs by pointers to dive-site in mobile code. In both
cases, the value is transported via a QVariant. The function
getCoordinatesForUUID(), which was only used from mobile, can
be replaced by a getCoordinatesFor() function taking a variant
supposed to contain a dive-site pointer. Likewise, the variant
of the centerOnDiveSite function is now supposed to wrap a
pointer-to-divesite.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-29 00:09:31 +00:00
Dirk Hohndel
01cd2e224f QML UI: we don't need Controls 2.4
In commit 99c06dec3d ("Mobile/filtering: simple busy indicator") we switched to
Controls 2.4 which requires Qt 5.11. Revert that one line of the commit as it
isn't necessary.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-27 07:17:51 -07:00
Dirk Hohndel
e0e3b63601 Mobile/filtering: make busy indicator smaller
Suggested-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
3eabb80398 Mobile/filtering: update number of dives shown when resetting filter
Otherwise we start showing an illogical '0' there when first opening the filter
dialog, and the equally wrong previous count when closing and then re-opening
the filter dialog.

Reported-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
51e7603d7e QML UI: remove some of the log file noise
A couple came from this series, others are much older.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
1e6c5d002b Mobile/filtering: show a better message while waiting for the filter
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
cf3fcc53b6 Mobile/filtering: implement the filter update through a thread
It's important to disconnect the model from the ListView, otherwise the update in a
different thread will fail.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
84822ebd2f Mobile/filtering: remove redundant busy indicator on dive list
We should use the global one instead.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
b0a0e1e374 Mobile/filtering: simplify the filter toggle
Simply make it always reset the filter. There's no point remembering the last
filter pattern and explicitly setting it, if the last thing we do is to reset
this pattern.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
2183e41bb0 Mobile/filtering: add properties for dive list model and filter text
This allows us to modify those from different parts of the code.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
09507416c8 QML UI: add busy indicator to the main window
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
6d77e66b69 Mobile/filtering: clean up whitespace from last commit
This one does nothing but whitespace - separating it into two commits makes the
previous one a lot easier to read.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
00a80c0e08 Mobile/filtering: add background rectangle for filter row
We are still trying to ensure that the filter is indeed shown in front of the
dive list. This is working when running on the desktop without the rectangle,
but on Android this appears to be needed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
76e4826fbc Mobile/filtering: simplify transitions
We don't need to toggle visibility, toggling height is sufficient. This
dramatically simplifies the transitions.  But as a result we need to use the
'enabled' property to reset the filter.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
e4e0c608e1 Mobile/filtering: simple busy indicator
Filtering takes a noticeable time on mobile, so lets show the user we are doing
something.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
c0540d7682 Mobile/filtering: add Settings options for filtering
Toggle case sensitive and whether or not to include the notes in full text search.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
2caaf8889b Mobile/filtering: make sure the header is top-most element
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
97e6494eee Mobile/filtering: ensure filter input field has focus when shown
QML's logic for who gets focus is a bit complicated. But forceActiveFocus()
cuts through the confusion and makes sure that your field does indeed get
focus.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
fd31dfe40d Mobile/filtering: use margins instead of rectangles to create space
I'm not sure why this had initially failed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
c797038bd8 Mobile/filtering: only filter when editing is finished
This is a usability / performance tradeoff. I like it better when it filters as
I type, but on mobile this may make things feel sluggish.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
f965492241 Mobile/filtering: reset the filter text when toggled
This seemed less UI clutter than adding a clear button.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
cadb072a0c Mobile/filtering: improve code readability
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:29 +01:00
Dirk Hohndel
e5ee895793 Mobile/filtering: animate the filter header
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:29 +01:00
Dirk Hohndel
90d321f0ff Mobile/filtering: add count of filtered dives to search bar
The count in the trip headers is still that for the complete trip and therefore
misleading.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:29 +01:00
Dirk Hohndel
65aa6bc43b Mobile/filtering: make the search box an overlay
This way it stays at the top of the dive list.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:29 +01:00
Jan Mulder
0bc0b6bfe8 Mobile/filtering: first attempt to filter on dive site
[Dirk Hohndel: this is the starting point of my following commits, I decided to
	       leave it in place to give Jan credit for the work he did on
               figuring out some of the plumbing needed to get things to work]

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:29 +01:00
Jan Mulder
f1bb2c8478 Mobile/filtering: add icons for filter and sort
Add 2 icons for filter and sort capabilities. And as before, these
icons are coming from the Google Material design set.

[Dirk Hohndel: Jan's commit forgot to add the actual icons, I added
               those so the commit matched its message]

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:29 +01:00
Jocke
9c6d24e50e Mobile UI: make SsrfSwitch resizable
Back in 8ab8a67f the checkbox where made resizable.
This applies the same functionality to the selector switch and makes the
two objects match in vertical size.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-10-21 14:43:41 -04:00
Jan Mulder
4263d1c3f5 QML, cleanup: remove stackView
There is no reason (any more?) to have a property defined
that basically renames the global pageStack into a local
pageView. Just cleanup.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-12 08:22:26 -07:00
Jan Mulder
8074f12b91 QML UI: disable rescan when no bluetooth
This is cosmetic only. It make no sense to selected rescan when
Bluetooth is off.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-10 06:27:21 -07:00
Jan Mulder
8034af5ad5 QML UI: do not try to download from DC with empty vendor/product
Disable the Download button when one of the fields vendor, product,
connection is not filled in. The app will crash when trying.
In addition, make the underlying core code to actual download
more safe by checking this, and silently fail instead of crash.
And, yes, this is a double fix in this scenario, but the core code
is used in more places, so better safe than sorry.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-10 06:27:21 -07:00
Jocke
8686b53c37 Mobile/DC download: reset the "Download" button
When changing to another DC, reset the "Download" button text.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-10-09 21:04:23 -07:00
Jocke
3ce019cf1a Mobile/rememberDCs: remove duplicated code
The code to disable a quick button has moved to the DC matching logic,
in order to inactivate the correct button also for USB DCs.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-10-09 21:04:23 -07:00
Jocke
e7fd50113f Mobile/rememberDC: update matching logic
Update the matching logic to account for known and unknown BT DCs.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-10-09 21:04:23 -07:00
Jan Mulder
a95e658946 Mobile: factor out syncToCloud [3/3]
After the previous commits, we now have a preference that nicely
preserves the state of the UI, and we have the well known git_local_only
global, that is used to denote whether we want to use to local repo
only, or we want to interact with the online cloud as well.

This commit gets rid of the now superfluous syncToCloud logic. Instead
we simply set the git_local_only directly.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-09 10:03:21 -07:00
Jan Mulder
87b8155576 Mobile: preserve auto download status [2/3]
Hook up the new preference to the UI. So now, an earlier choice
if automatic or manual download to the cloud is preserved in
between sessions. Strictly speaking this fixes issue 1725.

Notice that there is also a higly related syncToCloud thing
present. As factoring out that seemingly duplicate piece
of code is non-trivial, this will be done in a seperate
commit.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-09 10:03:21 -07:00
Jan Mulder
26234d326f Mobile: no switch to auto cloud in no-cloud mode
We disabled the drawer menu button to switch between auto/manual
sync when in no cloud mode. Unfortunately, disabeling does not
give a visual cue to the user (like greyed out). Instead, just
make this button invisable in no cloud mode.

In conjunction a question. The manual sync to cloud menu item
takes you to the Cloud Credetials page in case pressed in
no cloud mode. While valid, this seems strange. This is not
changed in this commit.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-09 10:03:21 -07:00
Jan Mulder
68fdc0b6f4 QML UI: set proper active background color for downloaded dives
And another simple one. Make the active background of the
dowloaded dives follow the theme.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-07 17:43:34 +03:00
Jan Mulder
3c18618bfb QML UI, trivial: set proper background color GPS list
The background color was plain white, where we use a slightly different
color in other places.  In addition, the background when clicking on a row
did not follow the theme setting. Consistency fix.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-07 17:43:34 +03:00
Jan Mulder
a8f45406bd QML UI, consistency: add text attribute for all actions
Something I only see on mobile-on-desktop, so at this point in time
not very relevant to the device apps. When hovering on the action
button, a toast message shows a hint box. These where empty in some
cases. So, just give the actions a text attribute where it was
missing.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-07 17:43:34 +03:00
Jan Mulder
684e3eec6b QML UI, cleanup: remove usesless Item
Trivial cleanup. A QML Item is intendend for visual items, so embedding
a timer in it is plain useless.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-07 17:43:34 +03:00
Jan Mulder
42eae7e48b Mobile: simpify startup logic
When starting the mobile app, I noticed a short display of an empty
page with title "Cloud creditials" just before showing the
divelist. Simply a not nice visual effect.

This commit simplifies some logic and resolves this. As the code
in this part is fragile, this is tested for normal and clean
startup of the app, switching credentials, from no cloud to
valid account (which even nicely imports the no cloud dives:
this surprised me as I have never seen this working).

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-02 22:27:19 +02:00
Jocke
b29f6ef2c0 Mobile: remove all related data when forgetting DCs
We need to delete all related data when forgetting dive computers or we will
have an issue if we connect a DC from the same vendor but of a different model.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-10-02 18:40:47 +02:00
Jocke
c504c08097 Mobile download from DC: improve selection logic
Improve the logic when auto selecting a DC for download.
Some USB cables only supply vendor information  but we can select the correct
model if we have downloaded from it before.
For BT/BLE our discovery process adds the device name to the address, so we need to keep that in mind when we try to match against what we seen before.
When we have a positive match for a DC we have seen before we deactivate the
corresponding button of our saved DCs.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-10-01 06:32:41 -07:00
Jan Mulder
9b199602c6 Mobile QML UI: bump Kirigami imports to 2.4
Primarily for reasens of keeping up with upstream. And hopefully
bugfixes and added functionality.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-01 05:29:46 -07:00
Jan Mulder
e321d1563e QML UI: clip divedetails Listview
A technically trival commit, but one with long story. This commit
basically reverts dd1d90b529 (1.5 year ago). While upgrading
Kirigami after Kirigami commit 26b8bdea24c39, we suddenly have
overlapping divelist and details pages in case they are both
on the pageStack (this occurrs when navigating from divedetails
to the divelist using breadcrumb navigation). At this point, its
not clear (to me) if this the by design of Kirigami, or an unintended
effect of the mentioned Kirigami commit.

This all said. Simply clipping resolves our issue of overlapping
pages, and it does not harm.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-01 05:29:46 -07:00
Jan Mulder
bec029c766 QML UI: trivial resize of datebox
Something that I simply overlooked earlier with respect to scaling the
divelist. The trip databox did scale a bit, but it was not nicely
related to the hight of the trip header. So there was a tiny
overflow on the small scale on a small device. Fixed here.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-01 05:28:18 -07:00
Jan Mulder
c6a4250a58 QML UI: correct trip separator line
Partially cosmetic and partially a bug fix. 1) the seperator line
between trips and dives that are not in a trip was drawn in the
background color => the line was invisible. 2) When looking very
closely, there was a 1-2 pixel wide error between the seperator line
between trips and dives that are not in a trip. 3) there was a comment
that the trip separator needed to be extra thick. IMHO, this
looks ugly, and is superfluous as there is a nice sidebar along
the dives that belong to the trip. Finally, the line shall not
be displayed when not in a trip.

So, basically, the line (the QML rectangle) is completely rewritten,
to take care of all issues. There is 1 hack: the line color is
taken from the dive separator line. But its fully unclear to me
where that color is defined in Qt/QML or Kirigami, so I hardcoded
the proper color. That just works.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-30 08:16:52 -07:00
Jan Mulder
40a65a2e6b QML UI: center delete from divelist button
A small cosmetic change. The delete from divelist button was "glued"
to the top of the line. Not nice, so just center it vertically, and
make the button a tiny bit smaller, so that it fits nicely on the line.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-30 08:16:52 -07:00
Jan Mulder
751286e4e7 QML UI, cleanup: no reason for 2 overlapping mouseareas
Fully usure why the code was as it was. The trip header had 2
overlapping mouse areas, to expand the trip and vise versa. Simply
remove the smallest one.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-30 08:16:52 -07:00
Jan Mulder
bce952615c QML UI, cleanup: do not use iconSizes for unrelated sizing
A very unimportant change, but found when looking through the code
for places where size of icons where used. The one changed here
has nothing to do with icon related placement of a string, so
its replaced by a way more logical placement of the affected string.

Simply center the "no dives in the dive list" for an empty logbook
on the screen, instead of at some random place in the upper left
corner. Like I said: very unimportant, but it just looks nicer
in the UI.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-30 08:16:52 -07:00
Jan Mulder
0ad7df9859 mobile, QML UI: Settings page scalability
A relatively big change for such a simple page. Most relevant
changes are:

1) Do not use Kirigami.Header anymore. It appears that this header
has word wrapping on (and we cannot override that). This is
annoying on this page, as headings seems randomly be split over
2 lines, even in cases where there is more than enhough room to
display it on one line. And as the Kirigami.Header is just a
trivial wrapper of a Text field, we can simple replace it.

2) A lot of the toplevel GridLayouts had width properties set. These
are not needed (and confused my debugging code), so they are removed
withput any visual change. As a general rule, do not try to set
properties that are not needed. In general, it can only lead to
binding loops or undefined behavior.

3) Add a font size to our Theme. The step from regular to title size
was a little too big.

4) And, obviously, numerous font.pointSize lines are added to actually
resize the font.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-27 06:36:22 -07:00
Jan Mulder
441e06cdb8 mobile, QML UI: whitespace in dive details page
There was a strange big margin at the top of the the dive details
page. Just make it a bit more "normal".

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-26 08:38:53 -07:00
Jan Mulder
97031da0d8 mobile, QML UI: margings and paddings in download screen
There was a significant of not needed whitespace on the download from
DC page. Most importantly, the bottom buttons where not on the bottom,
so we had to truncate the downloaded dives early (to prevent overflowing
the buttons). Further, a tiny bit of padding is removed between the
3 top pull down items.

All this, results in the diplay of more dives without scrolling.
For example, previously, only 1 dive (with 1 stored DC) was shown
on my 5.5" device, and now 3 (scale: regular).

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-26 08:38:53 -07:00
Jan Mulder
8ab8a67f81 mobile, QML UI: make SsrfCheckBox resizable
Changed some hard coded size and positioning of the SsrfCheckBox,
in such a way that is scales nicely to the current setting of the
mobile_scale.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-26 08:38:53 -07:00
Jan Mulder
7367d2535f mobile, QML UI: fix overlapping button
The select buttons in the downloaded dives delegate overlapped
the dive data. Simple margin change fixes this.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-26 08:38:53 -07:00
Jan Mulder
be1d3a7986 mobile, QML UI: ssrfButton and download controls resizable
Make the ssrfButton and the pull down menu's on the download page
resizable. Notice that also the contents of the pulldown
menu's is scaled based on the font size.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-26 08:38:53 -07:00
Berthold Stoeger
0aab39b35d Mobile: use editText instead of currentText in Suit and DiveMaster boxes
A user reported problems with editing the Suit and DiveMaster fields.
Apparently, editing does not change the currentText. Without doing
a deeper analysis, simply use editText (a more proper fix might be
changing the currentIndex on editing).

(Parially?) fixes #1694

Reported-by: Mark Powell <mcpowell123@gmail.com>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-25 09:27:16 -07:00
Jan Mulder
6850e6d567 mobile, QML: correct font scaling of the divelist
Changing the scale, it seems that the header of trips is not rescaled.
The reason for this is simple. That string does not use our manipulated
font but a different one. In fact, this is the only ocurrence on the
divelist that did not scale. However, other screens hardly rescaled at
all. All these will be fixed in seperate commits.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-25 16:01:39 +02:00
Jan Mulder
b332dd108a mobile, QML: scale font from the buttons
After the work in the previous commit, it gets very simple to implement
font scaling. Just assign a the new desired font scale to the used
font metrics. The QML engine does all the work.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-25 16:01:39 +02:00
Jan Mulder
c2c751c164 mobile, QML: introduce basePointSize in subsurfaceTheme
By manipulation the used font pointSize property, we can dynamically
scale fonts and derived UI objects. At the same time, we have
some logic to determine the default font, its size, etc, for example
depending on screen properties. The scaling of the UI (and its font)
does not need to interfere with those defaults.

However, when we want to reset the pointSize, we alter the default, so
a backup of the default is needed. Ok, not al full backup, as the only
thing we like to manipulate is the pointSize, to which we want to be
able to return.

All this leads to this commit. A basePointSize property is added, that
is initialized from the default. Due to the binding logic of the QML
engine, it is not a classic initialization, but a binding between the
2 properties. We need to break that binding explicitly, so that
the original PointSize is always preserved.

In addition, a display of the new font property is added to the
developers theme test.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-25 16:01:39 +02:00
Jan Mulder
a9c6b1472b mobile, QML: do not user a local font metric object
This theme test display created a new local FontMetrics object, that
does not per definition correspond with the "global" font metric
as defined in main.qml. The fix is simple. Display the font theme
data based on the one and only font metric from main.qml

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-25 16:01:39 +02:00
Dirk Hohndel
be0468b706 QML UI: add settings for scale factor
The visual feels backwards as the selected one is grayed out...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-25 15:58:17 +02:00
Dirk Hohndel
38307a5b3c QML UI: ensure we use the correct default font
It seems the documentation is incorrect - unless you explicitly set the
ApplicationWindow font to the the Application Font (just writing this
down sounds so silly...), it doesn't actually work.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-25 15:58:17 +02:00
Jocke
c68ac31425 Mobile/download DC: disable selected DC button
Disable the button for the currently selected DC.
This gives an extra visual hint of which DC is currently selected.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-09-25 15:35:43 +02:00
Jocke
2d3777ce87 Mobile/settings: clear all of qPrefDiveComputer.vendor
To prevent stale data in the download DC path we need to clear the entire
 qPrefDiveComputer.vendor() object when the user purges the used DCs.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-09-25 15:35:25 +02:00
Jocke
3b8f36ff13 Mobile/Settings: Disable unusable option
Disable the "Forget DCs" button when there is no DCs saved. 

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-09-25 15:35:02 +02:00
Jocke
69cead138b Mobile/download DC: simplify startup
Since we now store the last used DCs in out preferences we can use the information
to pre-populate the DC selector.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-09-25 15:34:49 +02:00
Jocke
0a3130cd86 Mobile/downloadDC: always start with empty index
To prevent stale data being visible always set the combobox indexes to -1

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-09-25 15:34:36 +02:00
Jocke
c4d6886daf Mobile: let Flow object use all of the parent width
There is no point in further restricting the width of the Flow object.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-09-25 15:33:11 +02:00
Dirk Hohndel
0ae57cfe92 Mobile/remember DCs: try to match device names
We only store the address part of the connection name, so don't try to find an
exact match, try to find the sub-string.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-23 11:49:30 -07:00
Dirk Hohndel
a5b56d0ba0 Mobile/settings: add button to forget remembered dive computers
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-23 11:49:30 -07:00
Dirk Hohndel
500f4c44fc Mobile/remember DCs: allow the buttons to flow
The hard grid may look nicer on bigger screens, on smaller screens it's
a problem.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-23 11:49:30 -07:00
Dirk Hohndel
52c70a3594 Mobile/remember DCs: add UI for the mobile app
This uses the same backend as the desktop version.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-23 11:49:30 -07:00
Jocke
5b37d87e2d Update divelist when changing units
We need to explicitly refresh the divelist when switching between
metric and imperial unit systems. Or the changes will not be visible until
we restart the app or scroll outside of what's in the current cache.
This will update both the divelist view and the dive profiles to show the new units.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-09-22 14:44:59 -07:00
Jocke
a63be142b5 Mobile: add units selection to settings page
Add the option for the user to set the desired unit system for
Subsurface-mobile regardless of system locale

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-19 14:41:03 -07:00
Jan Mulder
c11a4e4633 Mobile: rename UI string for webservice
Trivial rename of a UI string. The string "Subsurface GPS data webservice"
reminds me too much of the legacy webservice.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-19 14:05:14 -07:00
jan Iversen
c9122283cc mobile-widgets: replace qmlprefs::theme with qPrefDisplay::theme
Shortcut and use qPrefDisplay::theme() direct

Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-12 20:18:32 -07:00
jan Iversen
51bc41b517 mobile-widgets: remove setTimeThreshold from system
Use qPrefLocationService::set_time_threshold and remove from
qmlprefs.cpp and qmlmanager.cpp

Remark: mobile UI shows time in minutes, while it is stored (and calculated)
in seconds. Therefore a /60 when reading and *60 when setting.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-12 20:18:32 -07:00
jan Iversen
baa828e900 mobile-widgets: move distanceThreshold handling to qPref
Remove distanceThreshold from qmlprefs and use qPref instead
update qml

no user experience change

Signed-off-by: Jan Iversen <jani@apache.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-12 20:17:39 -07:00
jan Iversen
c454f6954f mobile-widgets: make show_developer persistent
Remove developer from qmlprefs and use qPref instead
Update qml

show_developer is saved on disk, and thus remembered between starts.

Signed-off-by: Jan Iversen <jani@apache.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-12 20:16:46 -07:00
jan Iversen
d0edc29636 core,tests: change qml register function
In order to address the C++ object directy in qml, a different
registration is needed.

qmlRegisterType, registers the C++ class, allowing qml code to inherit
from it and make qml objects. This is needed for graphical elemnets
like profile and map

setContentProperty, registers the C++ object, thus allowing signals to be
catched.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-11 17:22:58 -07:00
Jan Mulder
987e221f8e Mobile: Remove webservice, remove UI components
This is the first commit related to the removal of the GPS
webservice. It is nothing more then removing 2 buttons from the
menu to upload and download from the server, so technically
a trivial change.

As with the desktop application: Be very careful here as this
forces our users to use Subsurface-mobile, and a online cloud
account as that is the way to transfer GPS data from a mobile
device to the desktop.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-10 07:50:50 -07:00
Jocke
02af3463d0 Mobile: add default cylinder UI
Add the UI components to let the user set the default cylinder and select
the chosen cylinder when adding a new dive.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-25 07:01:42 -07:00
Jocke
0fb086a4a5 Mobile: fix saving new dive
With the new setup we need to know which state we are coming from
when we are saving cylinder related info. When we are adding
a new dive we explicitly should save cylinder data to the first cylinder.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11 11:19:07 -07:00
Jocke
bd8eec5c8e Mobile: fix adding new dive
All the changes to multi cylinder editing broke the option to add a new dive.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11 11:19:07 -07:00
Jocke
ae70a751c7 Mobile: save pressures
Save start and end pressures for used cylinders.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11 11:19:07 -07:00
Jocke
891e8acaa8 Mobile: save gasmixes
Same as for cylinder info, we need to make sure that the gasmixes gets saved to the correct cylinder.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11 11:19:07 -07:00
Jocke
9c9450748b Mobile: display all used gases on the edit page
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11 11:19:07 -07:00
Jocke
94428b9a18 Mobile: save edited cylinders
Save the edited cylinder in the correct slot.
Since the cylinder number and the used cylinder number need not be
the same we first need to test if the cylinder are used.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11 11:19:07 -07:00
Jocke
6b93e5fe27 Mobile: Display used cylinders on edit page
This displays the used cylinders in a dive so that they can be edited.
Currently limited to 5 as a POC.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11 11:19:07 -07:00
Jocke
914b061d8a Mobile: display all used cylinders
Display all used cylinders as a comma separated list.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11 11:19:07 -07:00
Dirk Hohndel
5cdba2d652 QML UI: don't overwrite good info with bad
If we don't know the vendor or product, let's not overwrite information
that we may have remembered from the last time the user downloaded from
this dive computer.

Note that this doesn't try to associate a specific cable with the
information used last time. We could be smarter here for people who have
multiple dive computers, but for the most typical user with just one
dive computer, this does seem like a good solution.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
fbf94d4a7b QML UI: add callback to run after app is fully initialized
And then use that to check for pending Intents on Android.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
f8d551ac6e QML UI: don't show bogus warning if page stack is reset
As we clear all the pages from the stack, we can briefly have no valid currentItem.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
40ecb179a3 QML UI: don't mangle 'USB device' as device name
We do strip the user friendly name from BT addresses and this mistakenly
mangled 'USB device' to 'device'.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
1a7ada5a90 QML UI: directly access currentText
No need to qualify our own object name.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
9d577e4b80 QML UI: disable connection selection for Atomics Aquatics
This is one of the dive computers that we simply connect to as USB device.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
e19944ce14 QML UI: when triggering download page, set up vendor/product/connection
This only works if the USB device contains enough information to do so.
We need to collect more information to understand what information we
get if those get plugged in. Maybe we'll get only the vendor and need to
leave it to the user to set the product (which we can do by passing an
index of -1 for product).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
593978a473 QML UI: set indices when showing Download page
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
de8359e4f0 QML UI: expose vendor/product/connection index as properties
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
842210c80d QML UI: show download page when device was plugged in
Unless, of course, the user was editing or adding a dive - that would
be annoying to have interrupted (even though, of course, it's the user
plugging in the device which would trigger this in the first place).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
76e81e5d53 QML UI: create separate function to show download page
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Dirk Hohndel
a3ddd823bb QML UI: add property to pass detected device name to UI
If the user plugs in a device on Android we get a device string that
should allow us to figure out which dive computer was plugged in. Make
that string available to the QML UI.

Right now all we do is log it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11 11:14:22 -07:00
Martin Měřinský
a12588ad82 Move DC download icons used by mobile app to mobile-widgets/qml/icons/
Signed-off-by: Martin Měřinský <mermar@centrum.cz>
2018-08-07 09:49:20 -07:00
jan Iversen
8d66633fe7 core: make qPref::cloud_status the only version of the enum
add enum to qPref and remove elsewhere
update source core to reference qPref.

the enum cannot be in pref.h because it is to be used in qml and Q_ENUM
need the enum to be defined as part of the class

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-10 10:30:50 -07:00
Dirk Hohndel
478b5de9e7 QML UI: fix layout of Download page
The info text from the download process wasn't rendered correctly.
maximumWidth ended being a recursive reference and as a result the text
would render as very narrow and super-tall field.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-27 16:28:01 -07:00
Dirk Hohndel
f998b59900 QML UI: don't use anchors within Layouts
Qt 5.11 adds useful warnings when code attempts to use anchors within
Layouts and even tells you how to fix things.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-26 03:56:44 +08:00
jan Iversen
ff88e7ee99 mobile: remove MapWidget from mobile-resources.qrc
remove MapWidget entries from mobile-resources.qrc, and
reference map-widget.qrc in Subsurface-mobile.pro for iOS

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-21 20:27:58 -07:00
Dirk Hohndel
7f7e7cf51d QML UI: ensure we track vendor/product for download
This is based on something that Anton Ludin sent to the mailing list.
Reading through the code it seemed that there were scenarios in which
DC_vendor and DC_product were not updated correctly. That's one of the
problems of the declarative approach in QML - it can be very hard to
figure out which code is run when in certain situations.

This may help address the issue with FTDI downloads no longer working on
Android.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-20 12:07:11 +09:00
Dirk Hohndel
1ccf21f08d QML UI: improve banner in global drawer
The asynchronous load seemed to be (at least one of) the culprit(s) of
the banner occasionally not showing up.
Making the font for the cloud ID smaller looks better (and works much
better for long email addresses).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-20 11:50:14 +09:00
Dirk Hohndel
e6835d76cc QML UIL: fix more problems with members moving from manager to prefs
That change clearly would have benefited from better code review.
This is a superset of a change proposed by Jan Iversen.

Closes #1406

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-20 09:34:27 +09:00
Murillo Bernardes
2466351a5f mobile: use full icon path.
For some reason Kirigami.Icon mess up icon display when filename
extension is omitted. Because of this a perfectly good, scalable svg
show up as a low resolution scaled up icon.

Signed-off-by: Murillo Bernardes <mfbernardes@gmail.com>
2018-06-18 06:54:40 +09:00
jan Iversen
cc77046db5 mobile: move call to savePreferences back to manager.
calls to savePreferences was moved to prefs. in
b8eb348f54, but the corresponding
C++ code was not merged.

Revert call to savePreferences to manager.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-18 06:52:59 +09:00
jan Iversen
a24f0d3107 mobile: revert e993d4f005
The commit secured that plotDive was not called before actually being used.
However our (rather fragile) C++ qml interface did not work correctly (ony sometimes).

Revert the previous commit.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-18 06:37:01 +09:00
Dirk Hohndel
ca84d96a50 QML UI: show the cloud credentials in the global drawer banner
This is an additional side-benefit of rolling our own banner.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-18 06:32:23 +09:00
Dirk Hohndel
c8ef3d7924 QML UI: build our own icon and header for global drawer
Kirigami appears to have a bug that makes it fail to show our icon.
With this we can be much more flexible in what we show in the top area
of the global drawer.

Fixes #1331

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-18 06:32:23 +09:00
Dirk Hohndel
238d47710e Whitespace cleanup
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-18 06:32:23 +09:00
jan Iversen
74ee577357 mobile: add Dark_gps.svg
The blue gps was reused for the dark theme.
Copy Blue_gps.svg and change color to dark.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-17 19:42:16 +09:00
Murillo Bernardes
fed2a283b2 mobile: fix reference to credentialStatus property
Commit b8eb348f moved credentialStatus but missed one spot.

When starting from a fresh install, clicking "No cloud mode” fails because of this.

Signed-off-by: Murillo Bernardes <mfbernardes@gmail.com>
2018-06-16 04:01:49 -07:00
Dirk Hohndel
16d7620e21 QML UI: fix variable reference
Looks like commit 807571a588 ("core: update deviceData default from
qml") never actually was tested with dive computer download. This looks
rather like an automatic renaming gone wrong.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-16 11:19:49 +09:00
jan Iversen
b8eb348f54 mobile: move settings from qmlmanager to qmlprefs
add settings variables/functions to qmlprefs
remove settings variables/functions from qmlmanager
change manager. to prefs. in qml files for setting variables/functions

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-15 14:12:14 -07:00
jan Iversen
d0e9f62624 mobile: add qmlprefs class
add class to cmake and pro
register class

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-15 14:12:14 -07:00
jan Iversen
13b9c7a822 Mobile: correct wrong C++ ref in qml
change data() to manager.
correct comboDevice -> comboConnection

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-11 09:43:32 -07:00
jan Iversen
807571a588 core: update deviceData default from qml
remove setting default in qml to C++

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-09 21:19:46 +02:00
jan Iversen
f7e8f21245 mobile: remove context icons
Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-09 20:54:10 +02:00
jan Iversen
eaaf0fc431 mobile: remove png/svg icons not used
Delete icons that are taken from kirigami

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-09 19:48:36 +02:00
jan Iversen
e993d4f005 mobile: do not call plotDive during startup
Check in profile if visible before calling plotDive

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-09 17:16:53 +02:00
jan Iversen
0acda9a509 mobile: white space clean in DiveDetailsView.qml
Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-09 17:16:53 +02:00
jan Iversen
64c0881e9f mobile: decoupled ssrf.qrc and mobile.qrc
remove /subsurface.qrc from .pro
copy missing mapwidget icon references to mobile-resources.pro

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-08 17:04:43 +02:00
jan Iversen
f7fde20a2c mobile: main.qml, change load of dive.jpg
change load of dive.jpg to reflect new location.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-08 17:04:43 +02:00
jan Iversen
cee754f200 mobile: mobile unreferenced ic icons
Remove 24px icons not referenced.
update README.license

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-08 17:04:43 +02:00
jan Iversen
92b505be72 mobile: remove unneeded alias from mobile-resources
remove alias where alias == file
rename *24px* icons and remove alias

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-08 17:04:43 +02:00
jan Iversen
1c9bd08d55 mobile: clean qml dir (move dive.jpg to icons)
Cleanup qml dir by moving dive.jpg to the icon dir

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-08 17:04:43 +02:00
jan Iversen
552f625e52 mobile: sort mobile-resources.qrc
Sort to make it easier to read.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-08 17:04:43 +02:00
jan Iversen
487a4b2c32 mobile: correct comboProduct if model changes
update  onModelChanged in comboProduct to read the
current index

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-07 18:43:56 +02:00
jan Iversen
03f30f6281 mobile: delay combobox selection for download.
Set index of comboboxes in Download screen when the page
becomes visible instead of when it is created.

The pages is created before QBluetoothDeviceDiscoveryAgent on iOS and desktop,
therefore combobox indexes cannot be set during page creation.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-04 10:27:13 -07:00
Murillo Bernardes
424efb7720 mobile: make list action buttons appear again
Dive list: on holding an item, the delete button
was not showing the icon.

Show GPS fixes: when swiping an item icons were
not being shown.

Partial for bug #1267

Signed-off-by: Murillo Bernardes <mfbernardes@gmail.com>
2018-05-27 16:58:17 -07:00
jan Iversen
f265504dab mobile: Adjust About.qml to fit small screens.
Adjust size of image and text to ensure that
the clipboard buttom is (nearly) always visible

The buttom is not directly visible in landscape
mode on a small device.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-27 08:07:52 -07:00
jan Iversen
4a872f74a4 iOS: updated text in About to reflect logs not log
Both subsurface.log and libdivecomputer.log are on the clipboard.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-21 07:57:14 -07:00
jan Iversen
571965ec6d mobile: removed setting for libdivecomputer.log
Users need a simple way to report download problems. Asking them
to go into settings, activate logging, and repeat the download
is too much.

libdivecomputer.log will always be generated, but overwritten, with every
download, so the latest log is ready.

The download is very slow due to BT, so there are no impact of having the log
active, neither in terms of size (a concern on small mobiles) or write time.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-21 07:57:14 -07:00
jan Iversen
4c8ed5a5ae QML UI: allow changing the connection ID
When downloading with bluetooth, changing connection did not work.
The new selection was not passed to the download thread.

Fixes #1274

Signed-off-by: Jan Iversen <jani@apache.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-05-20 11:35:28 -07:00
jan Iversen
a181020b19 mobile: add "Copy log to clipboard" button
on iOS it is practically impossible to copy the App log
to e.g. a mail! in iOS 11 the log file is stored within
the subsurface container and you first need to copy (actually
using the clipboard) out from there to the "normal" document
shared space, before it can be used.

At least iOS users (and I believe Android users) are not really
used to work with files, so the process is not easy to document
in an understandable way.

The alternative is to provide a button, which simply puts the
log on the general clipboard, allowing it to be pasted in a
multitud of applications.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-18 12:43:15 -07:00
Murillo Bernardes
6b4e830670 mobile: fix next icon prefix
Icons used directly by Kirigami use /org/kde/kirigami
as prefix. Ex: previous and next icons on header.

Signed-off-by: Murillo Bernardes <mfbernardes@gmail.com>
2018-05-13 13:18:01 -07:00
Murillo Bernardes
944de155d7 iOS: fix "previous" button icon
Icons used directly by Kirigami use /org/kde/kirigami
as prefix. Ex: previous button on the GlobalDrawer.

Signed-off-by: Murillo Bernardes <mfbernardes@gmail.com>
2018-05-13 13:18:01 -07:00
Murillo Bernardes
f4a9571da5 mobile: show selected dive on details view
Call positionViewAtIndex in order to make the selected dive
visible.

Signed-off-by: Murillo Bernardes <mfbernardes@gmail.com>
2018-05-09 06:32:20 +02:00
Dirk Hohndel
d2d46d848a QML UI: fix incorrect icon references
Not sure why this has worked in the past - it was simply wrong.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-16 18:57:08 -07:00
Dirk Hohndel
bb03bd862b QML UI: ensure delegate height is not a fraction
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-16 14:11:31 -07:00
Dirk Hohndel
c1bcba46f0 QML UI: dive list performance: enable caching
We had turned this off since it caused rendering issues, but that
appears to be fixed now - and it should help to get us smoother
rendering of the dive list.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-16 14:11:22 -07:00
Dirk Hohndel
95c9a505c6 QML UI: dive list performance: no background rectangle
This is one of the suggested performance enhancement to reduce redundant
painting.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-16 14:10:04 -07:00
Dirk Hohndel
2529529ff9 QML UI: make the code easier to read
And maybe this will make it faster as well? Depends on how the binding
is implemented, I guess.
But at least it's less confusing to read now.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-16 09:40:14 -07:00
Dirk Hohndel
f8742a48b2 QML UI: show offline notice when going offline
The logic was backwards and showed the notice when the user switched to
auto sync mode.

Fixes #1204

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-16 08:12:56 -07:00
Dirk Hohndel
6b9a1f3850 QML UI: change auto cloud sync menu texts
This way the menu items describe what happens when you tap on that menu
item.  That seems more consistent and intuitive.

See #1204

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-16 08:08:24 -07:00
Dirk Hohndel
e10b252153 QML UI: suppress warnings when showing GPS fixes
Kirigami gets unhappy if a SwipeListItem isn't named listItem.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-15 18:27:02 -07:00
Dirk Hohndel
026e90df3d QML UI: don't show a vertical scrollbar in dive list
With the folding trips it just looks confusing as it changes size.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-15 08:16:59 -07:00
Dirk Hohndel
a47bcbb3e7 QML: remove unused property
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-15 08:16:59 -07:00
Dirk Hohndel
8508fa5be8 QML UI: always show dives that aren't in a trip
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-14 21:04:56 -07:00
Dirk Hohndel
cc319ad8b1 QML UI: allow collapsing the open trip
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-14 20:32:40 -07:00
Dirk Hohndel
a454b4fd19 QML UI: animate trip folding
This looks much nicer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-14 17:39:40 -07:00
Dirk Hohndel
4923aecc9d QML UI: bring back folding trips
In older versions of Kirigami this caused all kinds of problems so we
eventually gave up on it in commit 13c49276d1 (Revert "QML UI: make
dive list fold dive trips").

Now this seems to work much better, so let's bring back trip folding!

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-14 17:39:40 -07:00
Dirk Hohndel
1d95cc4cbf QML UI: if we don't have a current position, update it later
Once we get a new fix we asynchronously update the text.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-14 13:37:44 -07:00
Dirk Hohndel
e5162f81d6 Fix typo
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-09 09:34:52 -07:00
Lubomir I. Ivanov
167db8fc18 mapwidget-mobile: initialize the map to [0,0]
Instead of showing the map zoomed over London by default,
initialize the center at [0,0] and show the whole globe.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-04-02 13:47:43 -07:00
Lubomir I. Ivanov
48c032bb8e mapwidget-mobile: do not animate the first selection
centerOnLocationHard() is added in MapPage.qml so that
on `firstRun` the map is hard panned to the desired location
without animation.

This affects the selection of a new "Dive details" -> "Map it" or
when opening a GPS location in the map.

The idea behind this change is to avoid starting the map animation
from an arbitrary location such as [0,0] or London. Also, to not
start the map zoomed out completely and then zoom in on a selected
dive.

For this change to work, add the helper getCoordinatesForUUID()
to qmlmapwidgethelper.cpp/.h and use it to obtain the
QGeoCoordinates for a dive site UUID.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-04-02 13:47:43 -07:00
Joakim Bygdell
01e4ec47be QML UI: Fix checkbox color
The background color in our own checkbox should match the page background.
Also includes some whitespace cleanup.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-03-19 12:03:06 -07:00
Joakim Bygdell
ab99703b02 QML UI: drop focus when selecting a location
Make sure to drop focus both for typing and when selecting
an entry from the list.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-03-19 12:01:14 -07:00
Joakim Bygdell
94e0ec8dc9 Mobile: change location combobox id
Change the id of the location combobox to math the naming scheme
of the other comboboxes.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-03-19 12:01:14 -07:00
Joakim Bygdell
07fb1db3ad Mobile: Fix location combobox
In the initial move to comboboxes the correct location model
was not used. This uses the correct model and makes it behave
like the other comboboxes.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-03-19 12:01:14 -07:00
Joakim Bygdell
93ba8f1a05 Mobile: for multiple buddies pick index of first
When a dive has multiple buddies, pick the index of the first
to prevent the user from hanving to scroll through the entire
list when editing.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-03-19 12:01:14 -07:00
Joakim Bygdell
6badba2bae QML UI: drop focus on edit
Drop focus on editable comboboxes when pressing enter.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-03-19 12:01:14 -07:00
Joakim Bygdell
477d1a3533 Moblie: remove comparison when saving
Removing the comparison of currentText vs editText when saving buddies
fixes the issue of data loss when dive has more than one buddy.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-03-19 12:01:14 -07:00
Dirk Hohndel
7feb9a3b6e QML UI: drop focus when ComboBox element is picked
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-03-19 12:01:14 -07:00
Dirk Hohndel
9145ea209f QML UI: cylinders aren't editable
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-03-19 12:01:14 -07:00
Joakim Bygdell
9755650b3c QML UI: switch editing back to comboBox
The HintsTextEdit just doesn't feel natural and intuitive.

Edit, fixed rebase issues.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-03-19 12:01:14 -07:00
Lubomir I. Ivanov
49f566d6d8 main.qml: handle mapPage in pageStack.onCurrentItemChanged()
When the slot pageStack.onCurrentItemChanged() is reached
make sure that the stackView becomes non-interactive.
This prevents swiping left on the map to "go back".

Also, always reload the map markers when the map becomes visible.
This is not optimal and instead something in the lines of:
  DiveList.model.onChanged()
is a much better solution.

Ideally the map reload should happen on dive removal, dive addition,
dive edits and sync from cloud.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11 11:40:12 -07:00
Lubomir I. Ivanov
fe9c3d4c95 main.qml: add a drawer action for the map
This action uses the Breeze icon "map-globe.svg" and calls
showMap().

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11 11:40:12 -07:00
Lubomir I. Ivanov
68da4de643 main.qml: modify showMap() to not accept location
showMap() uses a location to open Google Maps in a browser.
Make showMap() a generic function to push the mapPage on the view
stack.

Update the calls to this function from child widgets and pages.
Also either call mapPage.centerOnLocation()
or mapPage.centerOnDiveSiteUUID() depending if the caller
wants the map to center on a dive site or on map coordinates.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11 11:40:12 -07:00
Lubomir I. Ivanov
61c90efc6b main.qml: create an instance of MapPage
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11 11:40:12 -07:00
Lubomir I. Ivanov
392a3e5910 mobile-resources.qrc: add the map related resources for mobile
1) QML files
2) Map widget specific icons
3) The Breeze map-globe.svg icon

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11 11:40:12 -07:00
Lubomir I. Ivanov
27ad58aa78 mappage.qml: add a Kirigami page for the map widget
The Page object has the following functionality:
- reloadMap(): reload all map markers.
- centerOnDiveSiteUUID(): center the map on a dive site uuid.
- centerOnLocation(): the map on a latitude, longitude in decimal.
- Select a dive list entry based on a marker selected on the map via
diveList.setCurrentDiveListIndex()

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11 11:40:12 -07:00
Lubomir I. Ivanov
d3607e0b77 divelist.qml: add the setCurrentDiveListIndex() helper
Add the setCurrentDiveListIndex() wrapper for:
  diveListView.currentIndex = idx
wich also makes it possible to disable the scroll animation when
selecting dive list indexes which are too far apart.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11 11:40:12 -07:00
Jan Mulder
928e7ed869 QML UI Mobile: correct margins on log page
Also a developer likes to see a nicely formatted page, so correct
some bugs in margin handling on the log page. There was a strange
multi-line whitespace on the top of the list, and the total width
of the page was (initially) a little smaller than full page, so
showing a small strip of the page left on the pageStack. This
just looks weird. So again, cosmetics only.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-24 11:39:49 -08:00
Jan Mulder
76a7c860f1 Mobile QML UI: wideScreen property change
See also 15cdcdbc6. There, we introduced the wideScreen (set to true)
to evade a (cosmetic) bug in (most likely) Kirigami. The top dive
was partially obscured on the start of the app. And by setting the
wideScreen to true, the application header became of a fixed height.

Numerous changes further in Kirigami, we can now set this property to
false. This results in a correctly displayed divelist at the start of
the app, and *also* an application header that correcly hides itself
when scrolling up, and displays itself again when scrolling down. So,
a behavior that is common to, for example, mobile brouwsers.

This all said. I still believe this is a workround for strange behavior.
In fact, we should not need to set this wideScreen property at all,
and Kirigami should behave correct in all cases (true, false, unset
at our end). It behaves correctly when set to true or false, but
still displays a partially hidden top item in the dive list when
unset.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-24 11:39:49 -08:00
Jan Mulder
564e134bba Revert "Mobile QML UI: fix more background colors (gpslist)"
This worked correctly while compiled against Qt 5.10.0, but after
installing Qt 5.10.1 the behavior was just wrong. And as there
seems no way to color the background of a Kirigami SwipeListItem,
just revert this, and accept the (slightly) inconsistent coloring
of the page (for now).

This reverts commit 6700715b5d.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-24 11:39:49 -08:00
Jan Mulder
394054ebc1 QML UI: do not overflow right margin on BT text
Trivial and cosmetics only fix. The width of the rescan button
was forgotten, and this pushed the right margin to the right,
causing the combo menus to overflow the right margin.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-19 19:30:26 +01:00
Jan Mulder
6700715b5d Mobile QML UI: fix more background colors (gpslist)
And another one. The SwipeListItem also needs to have a set
background color. Unfortunately, the lines between the
individual SwipeListItem disappeared, so, set the
smallest possible border on these items.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-17 21:05:33 +01:00
Jan Mulder
e7ccb7d4d9 Mobile QML UI: color the application header correctly
Also, this got broken after the Kirigami to verion 2.2 in main.qml.
So, set the header background color according to our theme setting.

Notice, that there is a remaining issue here. We could color the
text color in the header, but now, this seems impossible (or I
do not understand how and where to set this).

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-17 21:05:33 +01:00
Jan Mulder
65d80d3cd0 Mobile QML UI: fix background colors
For some reason, after the update of the main.qml to version 2.2,
all Kirigami Pages and scrollablePages show up plain white.

So now, set a proper background for these pages.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-17 21:05:33 +01:00
Jan Mulder
01188905ae Mobile QML UI: Divelist hover/selected colors
This is subtle one. With the changing of the theme color, it
appeared that the hover and selected colors in the divelist
where wrong (as in, always blue-ish). This is easily solved
by setting the activeBackgroundColor to our theme color, and
Kirigami does the rest (tint and opaque settings for the
different states a selected dive can be in).

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-17 21:05:33 +01:00
Jan Mulder
bd10a8442a Mobile QML: main.qml to Kirigmi 2.2
This is a long standing issue. I wish to keep up with Kirigami developments
including new versions of their controls, but this is not always easy.
While we upgraded to Kirigmi 2.2 for most of our QML earlier, using this
new version of main.qml breaks numerous stuff. In fact, so much that
we just needed to wait.

With the progress in Kirigmi, it is now possible to upgrade, with still
some issues on our side to be fixed, but this is manageble now.

The main show-stopper was a construct to set our theme colors, for example:
Kirigami.Theme.highlightColor = Qt.binding(...)
This is not posssible any more, as the Kirigami.Theme has made these
readonly on their end.

This commit just removes the assignments to the now readonly theme
items. And the setting of a correct theme color for the action button.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-17 21:05:33 +01:00
Jan Mulder
7b320fc859 Mobile QML: set fontsize for developer log
Just set the fontsize to something sane.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-11 21:17:57 +01:00
Jan Mulder
72f59d54cb Mobile cleanup: remove unused actions
Trivial removal of 2 unused Kirigami actions. These were leftovers
from the time we had a very different style of cloud account
management.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-08 21:29:47 +01:00
Jan Mulder
6a53ec69ae mobile cleanup: repair stupid mistake
Commits fed2c5b6a1 and 572fc4707 erroneously deleted two
aliases. That is corrected here. Yes, QML with only runtime
errors can be a pain.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-02-02 13:13:46 +01:00
Jan Mulder
494ad26540 mobile cleanup: restyle construction of locationlist
See also e6e1473e6. The construction of the locationlist
was not the same as the 3 previous lists, and it needs
the inclusion of a new model file (divelocationmodel.cpp)
in the mobile app. In addition, as the mobile app is mainly
interested in a simple stringList (model) to populate a HintsText
field (or maybe later a combobox), this stringlist is added
to the model, to easy interfacing with QML.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-31 14:48:14 +01:00
Jan Mulder
83259008e7 mobile cleanup: unduplicate code and do not loop over dives (3)
See e6e1473e6. Exact same commit but here for the
list of divemaster. The careful reader will spot a
small addition to the clearDetailsEdit() QML function.
Two more field are cleared.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-31 14:48:14 +01:00
Jan Mulder
572fc47071 mobile cleanup: unduplicate code and do not loop over dives (2)
See e6e1473e6. Exact same commit but here for the
list of buddies.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-31 14:48:14 +01:00
Jan Mulder
fed2c5b6a1 mobile cleanup: unduplicate code and do not loop over dives (1)
This is the first of a set of commits that are (very) similar.
It appeared that a number of more or less static lists, which are
constructed by a loop over all dives in the logbook, were executed
when changing focus to a next dive. For example, the in this
commit addressed list of used dive suits.

What was wrong was that the suitList was linked to a dive. There
is only a need to construct the list of used suits when data is
changed (and obviously, once on startup of the app). Further, it
appeared that a lot of code was duplicated and that we can use
(in this case) the same code from the desktop completionmodels.cpp.

Basically, this commit involves the following changes:
- include completionmodels.cpp in mobile and desktop (so move
it from the desktop only category to the generic category).
- remove double code from DiveObjectHelper.cpp
- Do not differentiate in the init phase and the normal refresh
of the list
- the per dive logic is now only the getting of a previously
constructed list (in init or update of the divelist).

There are no visible changes in the UI, other than a better
performance when scrolling over dive details.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-31 14:48:14 +01:00
Jan Mulder
6193aef9ac mobile: fix crash on delete dive from divelist
This is a somewhat hacky commit. For a very long time, the delete
from the divelist on mobile crashed. That is, not always for anyone,
but for me almost consistently. This commit tries to solve it.

I found that trying to save the delete immediately after removing
data from the underlying model seemed to cause the crash. Hacking
around, I found that a simple beginResetModel/endResetModel between
the delete of the underlying model data and actual save is
sufficient to solve the crash.

The big question is, why does this all work? I suspect some of race
condition between deleting model data, and giving the QML engine
the opportunity to do its thing.

This is also related to issue #311, but that is not implemented
here.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 20:34:16 +01:00
Jan Mulder
47bf5cf5e0 mobile: silence warnings in the app log
The new SHA mysteriously caused more than 300 extra warnings in the
app log. It was caused by a code change in Kirigami. The way to
suppress it is, in hindsight, after some hours of searching, trivial.
A Kirigami.BasicListItem shall have an icon defined. And as we do
not care about any icon here, just define it empty.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-03 14:04:08 +01:00
Jan Mulder
a5b44362c6 mobile: newer Kirigami SHA
This commit consists of the following 3 parts:
1. There are 2 source files added, adapt our build process
accordingly.
2. Due to a change in icon and kirigami QML prefixes, we need to
adapt for this as well. Changed mobile-resources.qrc for that.
When this would not be changed, the icons will not be found.
3. To further prepare for the future, abandon the iconName
property in favour of the new icon grouped property, which
can have more attributes than only the name. But currently
it is only a syntactic change.

Tested on Android device, and no visible changes.

Signedoff-by: Jan Mulder <jlmulder@xs4all.nl
2018-01-03 14:04:08 +01:00
Jan Mulder
86860b941e Get ready for 2018
Copyright strings updated.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-30 08:23:22 -08:00
Jan Mulder
ff3b107a9d mobile: close GPS menu drawer when selected
This is mainly a cosmetic improvement. The GPS menu stayed
visible, when selecting most of the options. This looks weird,
as the close of the menu is also an indication of the selected
action carried out. So, just close it

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-26 13:08:37 -08:00
Jan Mulder
5e116db1a1 CHANGELOG.md
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-18 15:23:23 +01:00
Jan Mulder
825afb4db4 mobile: exit edit mode when navigating away from edit page
Navigating using the breadcrumb in the header did leave the
dive detail edit (and add) mode in such a way that (for example)
navigation in the dive list was suspended. Obviously, it is
debatable what should be done. Saving the edits/add, or
cancelling them. For now, this commit cancels them
silently. This is the exact same thing that is happening when
the user selects the dive list from the drawer menu.

Fixes: #932

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-18 15:23:23 +01:00
Jan Mulder
ef543da5af mobile: clear internal data when edit/add dive is finished
When editing (or adding) a dive, the internal data containing the
attributes on the edit page was not cleared when editing was
finished (in any way, by saving the edit or by cancelling it).
As long as the user only edits existing dives, all this poses
no problem, as at the start of a dive edit, the data is filled
from the dive to be edited. However, when adding a dive, data
coming from previous edits shows up. This not clearing data
also causes the strange effect as written in issue #950: adding
a dive, deleting it, and adding a dive again, added the first
added dive data, without the edit screen being shown.

All this can be solved by clearing the data from the edit when
editing is done.

Fixes: #950

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-15 09:03:24 -08:00
Jan Mulder
62ef78b5e8 mobile: show message when going offline
Trivial fix. Show the message "Turning off automatic
sync to cloud ..." when turning automatic sync to offline. Just
a more logical moment to show this message. Also rephrase the
message "Enable auto sync" to "Auto sync enabled". It shows
a status, and not an action.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-14 17:01:51 +01:00
Jan Mulder
239974d600 mobile: reset download screen in a sane state
Set download srceen in a sane state after a previous download
session using this screen. The erroneous behavior was very
similar to the one fixed in commit 7fe9bbe295dcf92. For example,
download some dives, quit the screen, go back, and the bottom
buttons are still selectable.

This commit resets some values when leaving the download screen
(ie. not only swiping it away), so that it looks sane at a next
visit.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-13 08:23:27 -08:00
Jan Mulder
59f86a06ad mobile: reset Retry button to Download
Reset the Retry button on exit of the Download from divecomputer
page. So, it it not reset wehen swiping this page away, or
cancelling a running download, but resetting it on accepting
downloaded dives.

As we do not have real error reporting (from download failures),
this all is a little arbitrary. Another "fix" could be, not
changing the button text at all.

Further notice, this is not specific iOS, but also Android.

Fixes: #895

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-13 08:23:27 -08:00
Joakim Bygdell
e9bcca9103 Mobile: Enable editing multiple buddies
While the autocomplete function only works for the first entry
adding multiple comma separated buddies can still be done.

Fixes #608

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-12-07 21:43:17 -06:00
Robert C. Helling
1c223b09c3 Show BT device names first
Show them left of address (so they are in the user's view) rather
than on the right.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-07 18:15:40 +01:00
Robert C. Helling
4a9add167f Don't close menu after click
I consider it more natural for example for the GPS menu
to stay open when an action is clicked. So this turns off
the general close but has to trigger it on individual items.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-06 06:00:22 -08:00
Robert C. Helling
afd46a60f7 Add button to rescan BT devices
Otherwise the divecomputer has to be in pairing mode
at app start time.

Unfortunately, this leaves less space for the progress message.
My time/qml knowledge does not suffice to move that to the next line
(when moving that out of the RowLayout it overlaps with
the buttons).

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-05 20:05:16 -08:00
Robert C. Helling
89bd0cfdbd Unify capitalization
Sorry, this introduces a new string...

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-05 10:11:57 +01:00
Murillo Bernardes
78aface44a iOS: Display GPS menu
Signed-off-by: Murillo Bernardes <mfbernardes@gmail.com>
2017-12-03 08:19:00 -08:00
Murillo Bernardes
8f3ac0402c iOS: check for UUID instead of physical address
on iOS the address we display on Connection is an UUID, not
a physical address.

This change the pattern (on iOS) used to enable bluetooth_mode.

Signed-off-by: Murillo Bernardes <mfbernardes@gmail.com>
2017-12-02 08:21:33 -08:00
Jan Mulder
806c7077f2 mobile: get GPS data from dive site name
When the user entered a dive site using autocompletion, it
is a known site, of which we might have a GPS location already.
Just fill the known site coordinates.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-25 08:13:42 -08:00
Jan Mulder
64704d6e5a mobile: autocomplete location names
Add the capability to select the location name from a list, constructed
from the known dive sites in the logbook.

Fixes: #546

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-25 08:13:42 -08:00
Jan Mulder
fea111cb3a QML UI: QtQuick.Layouts to 1.2
And again, no visual changes.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-19 12:20:43 -08:00
Jan Mulder
e9903d1835 QML UI: QtQuick.Controls to version 2.2
Tested fine without visual changes.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-19 12:20:43 -08:00
Jan Mulder
f3d978b8a5 QML UI: QtQuick to 2.6
Upgrade QtQuick to 2.6. Seeing a small artifact in the application
header, lets see what happens when upgrading more includes.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-19 12:20:43 -08:00
Jan Mulder
3b5375d553 QML UI: Kirigami to 2.2
When first tested this commit, especially the dive list was looking
terrible. However, after including newer SHA's from libkirigami, and
correcting lots of spacing/margin issue, a retest of this commit shows
no strange artifact any more, and the amount of warnings in the log
output is reduced significantly. So now, it appears save to
upgrade.

Notice that main.qml still uses Kirigami 2.0. and is not updated in
this commit. With version 2.2, there is a new way of theming, that
is not (yet) compatible with our current code. Blindly upgrading to
2.2 leads to a almost black dive list, wrong button colors, and
runtime errors in the log, due to the fact the direct setting from
QML Kirigami's Theme colors is not allowed any more.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-19 12:20:43 -08:00
Lubomir I. Ivanov
956b45ddfd map-widget: move the widget and its resources to 'map-widget'
Move all the map widget platform agnostic files to the
<subsurface-root>/map-widget folder.

This avoids the confusion about the desktop version of subsurface
using mobile components. The map widget is planned as a shared
component between the mobile and desktop versions.

desktop-widgets/mapwidget[.h/.cpp] still remain as those are specific
to the desktop version.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-05 14:48:56 -08:00
Jan Mulder
15cdcdbc69 QML UI: show divelist from the top
In commit bdf6dc7828, we pulled in some changes from Kirigami.
I checked all the new commits and they seemed just fine, and a
test (on desktop) on both Qt 5.9.1. and 5.9.2 showed no obvious
problems.

However, some time later, working on something else, I compiled
from Android to test, and saw some strange behavior in the dive
list. The topmost dive is partially hidden behind the application
header on startup of the app, but can be pulled down. Not a big
deal, but is does not look right.

After tedious testing, bisecting, etc, I found commit
d0f3941a4d7f4d4c6 in Kirigami (obviosuly, it was not clear from
the start that it was in Kirigami, as I could well have been
some error in Subsurface, or even Qt). Mentioned commit is
trivial, and handles with the wideScreen property of the
application window. With wideScreen = false, the bug is
visible, when true the bug is gone.

This all said. Just set the wideScreen to true, which can
definitely be considered a workaround. I exspect that this
commit can be reverted later on when Kirigami is fixed.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-30 18:42:58 +01:00
Jan Mulder
cf75e6451d QML UI: Scrolling in dive details
While testing the mobile app on Qt 5.9.2, I encounted a show stopping
issue. Select a dive in the dive list, go back to the dive list (as
selecting a dive opens the details), now scroll down to a different
dive, and select one. The app starts enumerating (moved smoothly
according to the specs) all the dives between the old and the new
selected dive. So, depending on the distance, this could take forever.
Explicitly: on 5.9.2. only.

From the Qt docs:

highlightFollowsCurrentItem : bool

If this property is true (the default value), the highlight is moved
smoothly to follow the current item. Otherwise, the highlight is not
moved by the view, and any movement must be implemented by the highlight.

End Qt docs.

Setting this property to false solves the issue. Tested on both Qt 5.9.1
and 5.9.2.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-29 11:08:10 -07:00
Lubomir I. Ivanov
9367610220 mapwidget: add the 'isReady' flag to the Map component
The 'isReady' boolean flag is now set to 'true' only
once the Component.onCompleted slot is reached.

The flag is then used as a safe-guard in the
onZoomLevelChanged slot. Calculate the small circle radius
(mapHelper.calculateSmallCircleRadius()) only if 'isReady'
is set to true.

Prevents a crash if the Map widget is not ready, yet a zoom
level is set via the 'zoomLevel' property. The crash happens
because mapHelper.calculateSmallCircleRadius() has a callback
to the Map component to estimate some points and distances of the
small circle.

Reported-by: Stefan Fuchs <sfuchs@gmx.de>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-29 08:26:11 +01:00
Jan Mulder
6d81e19eae map widget: start with normal zoomlevel
Commit 344d976593 resulted in the start of Subsurface with a map of
the whole world. The user has to zoom in (assuming the case that the
first selected dive has a position), in evenry session. This is solved
by setting the zoomlevel at startup at the default value. Ok, this
results in a map of central London, UK, when starting Subsurface with
a dive without location, but is this as good as any map.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-29 08:26:11 +01:00
Jan Mulder
6bd5312dfa QML UI: prevent full overflow of bottom buttons
A not perfect improvement, but way better IMHO. Prevent the list of
downloaded dives to grow over the buttons at the bottom. Just a simple
change by adding a bottomMargin to the list.

Notice that there is still some overlap, but for now I consider this a
trade-off between the scarce screen real-estate and the wish to present
and much as possible dowloaded dives.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-27 19:28:42 +02:00
Jan Mulder
f25cc3a67f QML UI: repair long trip headers
Trip headers spanning more than one line where broken at incorrect
locations in the string. Not exactly sure, but I think this came with
the newest Kirigami SHA, and especially the Label change.

Carefully reading the code for the trip heading shows a "strange"
negative margin. So the margin is on the outside. This margin was
used to split the string, allowing for a small invisible part of
the string to present as trip header.

This is solved by this commit.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-27 19:27:47 +02:00
Linus Torvalds
344d976593 Make the map widget more pleasant to use
This does two main things to the map widget:

 - if there are no coordinates, do *not* zoom out to the whole-world
   view. Just leave the map alone.

 - when zooming out to move to a new dive site, zoom back in to the same
   zoom level it was before.

These two changes make it much more pleasant to move between dives,
particularly as you move back-and-forth without losing the zoom level.

NOTE! The zoom level gets reset if you move dives _while_ zooming is
happening, and so moving quickly between dives will still end up losing
the original zoom level, replacing it with a bigger zoom-out that was
active _during_ a previous zoom.

That could be seen as a feature (moving incrementally to an "overview"
zoom when moving quickly between dive sites), but honestly it smells
more like a bug to me.  But regardless of that feature/bug, this new
zoom behavior is more pleasant than our older "always reset when
moving".

But it might be a matter of taste, so people should try this out and
comment.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation,org>
Cc: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-23 10:34:19 -04:00
Jan Mulder
a9b692f0c3 QML-UI: Download screen fixup
Again, mostly related to label change. First, the top button was "glued"
to the top of the screen, so added a little margin there. It
appeared that all the other items on the screen (progressbar,
2 button rows, and the downloaded dive list) where not moving down
due to the add of that little top margin. This was solved by
anchor-ing the items together. Finally, the text of a downloaded
dive was on the top of the delegate lines. Not sure where that came
from, but easily solved by centering it explicitly.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-19 14:55:30 -04:00
Jan Mulder
53ed1c7326 QML-UI: some more layout repair (dive details)
As in a525fff112, also the dive details top data was not nicely positioned
any more due to the deprecated and removed Kirigami.Label.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-19 14:55:30 -04:00
Jan Mulder
a525fff112 QML-UI: repair DiveList
The new SHA for Kirigami did all kinds of nasty things to our DiveList.
This commit tries to repair most of the damage. Nothing more than
some margins, anchors, and even a font that changed.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-18 06:30:51 -04:00
Jan Mulder
d623eccdef mobile: silence deprecated messages in logging about Kirigami.Label
Commit 8f6827ab12 brought a new SHA for Kirigami, but that introduces
a very noisy logging of "Kirigami.Label is deprecated. Use
QtQuickControls2.Label instead".

So, thats what done here.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-17 15:32:27 +02:00
Jan Mulder
16b395a898 mobile: No cloud repo creation more explicit
Before this change, there was only one way to create the local
no cloud repo on the device. The user needed to add at least
one dive to the no cloud account (so that there is something
to save). While this worked in some scenarios, it could also
get things in an inconsistent state: credential status = CS_NOCLOUD
but no local repo. This was a dead end.

In this commit, the creation of the no cloud repo is made more
explicit. When asking for no cloud mode, just create an (empty)
repo for it when it does not yet exist, and otherwise, just
open the existing (possibly empty) repo.

Now, a user can have no cloud repo, next to (any number of)
cloud accounts.

This leaves one functional aspect left: how does a user abandon
the no cloud repo, by merging his data into a true cloud
account. This is code for this, that tries to do this merge in
a smart way. This seems to be broken (too). To be clear: this
is no part of this commit.

Fixes: #667

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-17 14:29:17 +02:00
Lubomir I. Ivanov
49c8c966fc qml-icons: add a third, grayed-out map marker
It can be difficult to distinguish the new marker
which is added on the map and has to be dragged
when editing a new dive location.

By adding a new grayed-out marker it becomes
possible to gray out all other markers, while
the current marker which is being edited is still
bright red.

Suggested-by: Dietrich Meyer <dietrich@sunnynames.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-15 17:28:39 -08:00
Lubomir I. Ivanov
07c91805d9 qml-icons: make mapwidget-marker.png even darker
This is done so that a de-selected marker is better
distinguished from the selected marker.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-15 17:28:39 -08:00
Lubomir I. Ivanov
4c7ce5c1aa mapwidget.qml: fix weird MouseArea bug in MapItemView
The QML map uses MapItemView. MapItemView needs a delagate
in the form of a MapQuickItem. The MapQuickItem needs a
'sourceItem' which would be used as the visual (e.g. marker)
on the map.

If the root sourceItem is of type Item, the marker becomes
non-clickable. If the root sourceItem is an Image, the clicks
work.

This patch removes the root Item, which makes the code
less organized, but at the same time it fixes the bug.

Bug reproduced on the following Qt versions on Ubuntu:
5.5.x, 5.7.x

Bug cannot be reproduced on Qt 5.9.x on Windows.

Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-15 17:28:39 -08:00
Jan Mulder
ba4058667a mobile: enable switching BT on/off during session.
This commit implements possible switching BT on and off during a session,
so not needing a restart of the app when the user forgot to switch
it on when starting the app.

For this, the following needed to be done: 1) create a handler that
reacts on local BT device status changes. 2) repopulate the connection
list in the download screen when a BT status change is detected.

Notice the subtile change of the Q_INVOKABLE btEnabled() function
to a Q_PROPERTY. This gives a nice dynamic behaviour when
switching BT on/off with the app open.

Fixes: #556

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-12 09:43:40 +02:00
Dirk Hohndel
6578588ad9 QML UI: add missing icon
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-09 22:01:12 -07:00
Lubomir I. Ivanov
174b414436 map-widget: don't crash if the map QML failed to load
If the QML modules for QtLocation and QtPositioning are
missing the QML in mapwidget.cpp will fail to load,
which can lead to crashes.

To solve the issue check if the QML has loaded and set
a flag 'isReady' to true. If the loading has failed
load another QML which is for showing a red error text
in the lines of `MapWidget.qml failed to load!`.

If the map QML has failed, use a macro in all relevant
MapWidget members to turn them into a NOP. This approach
leaves the rest of the codebase intact - e.g. no checks
in classes which connect to the MapWidget class.

Fixes #596

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-07 08:09:05 -07:00
Dirk Hohndel
d1a18b36b4 QML UI: open v2 user manual
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07 12:14:08 +03:00
Dirk Hohndel
deff17fa36 Whitespace
This commit is empty when shown with '-w' - it just updates the
indentation after commit c00804eff6 ("QML UI: always start edit at top
of page").

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-05 13:40:31 -07:00
Dirk Hohndel
c00804eff6 QML UI: always start edit at top of page
When starting to edit / add a dive, the Flickable needs to be positioned
at the top of the page, not the last position shown.

For clarity I'll do the re-indentation in the next commit.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-05 13:38:32 -07:00
Dirk Hohndel
3487612337 QML UI: add transition when switching to edit mode
The hard switch was not ideal. This isn't perfect, yet, but a step in
the right direction. The 'transitions' to change the visibility
properties are a bit odd, but that's how it's done in the examples as
well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-05 08:21:55 -07:00
Dirk Hohndel
2dd8a2ad7b QML UI: download icon in main menu
We need a white path drawn on the dark action button, but a black path
drawn for the main menu.

(looks like a white space change snuck in here)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 17:13:46 -07:00
Dirk Hohndel
636904e078 QML UI: make edit page scrollable
And have a tiny bit of space around it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 17:08:58 -07:00
Dirk Hohndel
7f0c7eeb24 QML UI: change the dive edit to not be an overlay
This way the accidental closing of the edit (and loss of data)
should no longer happen.

See: #495

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 17:08:58 -07:00
Dirk Hohndel
41f24f2859 QML UI: top padding for dive details
This used to work without manually adding space here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 17:08:58 -07:00
Dirk Hohndel
ec7a878149 QML UI: avoid warning before currentTheme is set
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 17:08:58 -07:00
Dirk Hohndel
b4b3864f50 QML UI: adjust icon names
These changed in Kirigami.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04 17:08:52 -07:00
Jan Mulder
e2aaa43d8c QML UI: cleanup some whitespace and string formatting
This addresses some review comment on whitespace and translated
string formatting.

In the string formatting, a tiny additional change is made.
I wanted the email address in the explanation text in a bold
font. Using the HTML <b> for this, removed the /n newline
characters in the output. Apparantly, mixing these two
formatting styles does not work. No problem, replaced the
/n to HTML style too.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-29 08:13:25 -07:00
Jan Mulder
dbed88bd81 QML UI: rework single credential page to two pages
This commit tries to implement most of issue #515. It reworks the
one credential page, which its dynamic PIN part, into two pages.
Main driver of selecting one of the two pages is the showPin
boolean. Page 1 contains the email/passwd field (and the
option to use a no cloud setup). Page 2 only contains the PIN
part (and the option to cancel the process).

The Kirigami central button does not seem very handy here. We
need, for example, a cancel, sign-in and register, only register,
etc. buttons, which are not easy to handle in specific icons.
Therefore, normal pushbuttons are chosen to deal with user
interaction, and the Kirigami button is removed from these
pages.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-29 08:13:25 -07:00
Jan Mulder
81eb8466b2 QML UI: rework cloud credentials block
Previously, we could edit the cloud credentials in basically two
places. At startup of the app from a fresh install (and no previous
data on the device), and from the settings. Issue #515 proposes
only one way.

However, we need a way to access the new credential UI pages, so
that the pages at a fresh install of the app can be reused,
for example for account switching.

This commit replaces the settings cloud credentials block by
a simple (not editable) display of the current credentials, and
a button to access the initial pages, for all management tasks
on the credentials.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-29 08:13:25 -07:00
Jan Mulder
2e91de9d95 mobile: initialize credential data in one place
It appears that the onCompleted of the StartPage item is triggered
before the onCompleted of the rootItem. This is logical as the
Startpage is a child of the rootItem. And, yes, this does matter.
As the divelist also contains the logic for initial cloud
registration (and is the default page shown in a state where
the cloud credentials are valid (CS_VERIFIED state)), we need to
know the correct credential state at start of the app.

The move of this one line of code makes sure of that, in addition
to setting the credential state from the preferences. Now, the
setupActions function can reference correct credential data.

This is further preparation for a better cloud creation
process from mobile.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-29 08:13:25 -07:00
Lubomir I. Ivanov
5eeefbff8b mapwidgetcontextmenu: use a QtQuick 2.0 import
Following on beb0d5703a, the context menu seems to work fine
with a much older QtQuick import - version 2.0.

The 2.7 import is technically a development leftover
and a minimal version should have been considered earlier.

On older Qt setups (e.g. 5.5.x) this might throw a:
'module "QtQuick" version 2.6 is not installed'

Reported-by: Stefan Fuchs <sfuchs@gmx.de>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-09-16 08:35:29 -07:00
Jan Mulder
9a2d503d3b Unify credential states
Having two different enums around with more or less the same
definition has lead to unclear code. After removing two not needed
states on the mobile end, the remaining step to one enum for the
credential state becomes almost is simple rename operation.

Unfortunately, I do not know a way to embed a plain C enum
from pref.h into the QMLManager object. So after this, there
are still 2 enums around, but now identical.

This commit is not changing any functionality.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-04 07:38:30 -07:00
Jan Mulder
190d80e509 mobile: remove superfluous state VALID_EMAIL
This is a no-brainer removal of the VALID_EMAIL state used in QMLManager.
All current usage of this state is "if state is VALID or VALID_EMAIL",
so there is no distinction between the two states.

It is even a little different. The comment suggests "when we can open
a local cloud storage, tied to a cloud account (so explicitly not
the no-cloud status), we have at least a valid email". While this
is formally true, this implies that there is also a cloud account
on the cloud server (ie. the cloud account is in a VERIFIED state).
In other words: currently, there can't exist a valid local storage
that is tied to a valid email adress, without valid cloud account
on the server.

Notice that this touches the discussion on GitHub for commit
e76f527fe5 (pull request #520). Can we implement the creation
of a valid cloud account without data link to the cloud server?
Currently, we need the server to confirm the email address (for
example for uniqueness reasons on server side). Obviously, we could
hack our way out of this, but we have a perfect solution already
in place. Create a no-cloud account, and transfer that later to
a true and valid cloud account.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-04 07:38:30 -07:00
Jan Mulder
50891c838e QML UI: set the title of the right object
Intended was here to set the title of the Dive list with id: page,
instead of the startpage object.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-04 07:38:30 -07:00
Dirk Hohndel
0c410aaf5d Adjust signature to match data we need
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26 12:27:12 -07:00
Dirk Hohndel
beb0d5703a MapWidget works with slightly older QtQuick2
This allows building against older Qt.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26 11:52:58 -07:00
Lubomir I. Ivanov
1da4f91cc8 mapwidgethelper: use dynamic creation of the Plugin object
The googlemaps plugin is about to support tile language
via the PluginParameter 'googlemaps.maps.language'.
To be able to pass the subsurface UI language (obtained
from the uiLanguage() helper) the Plugin has to be created
dynamically, only *after* the MapWidgetHelper is created.

MapWidgetHelper::pluginObject() now provides a QString which
contains the Plugin object and also include the uiLanguage
ISO value.

This string is used in mapwidget.qml as:
map.plugin = Qt.createQmlObject(pluginObject, rootItem)

This creates the Plugin object dynamically with the proper
UI language string, but also requires a couple of small changes:
- move the declaration of map.mapType after the
Qt.createQmlObject() call
- assign map.activeMapType after map.mapType has a value

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-24 13:11:39 -07:00
Lubomir I. Ivanov
f21ae69f7b mapwidget.qml: more improvements for the dynamic zoom-in/out
The QML Map has a couple of methods - toCoordinate(someQPointF) and
fromCoordinate(someQGeoCoordinate). Ideally, if one passes a point to
toCoordinate() and then attempts to convert the resulted coordinates
back to the point, the same point in the Map view port with minimal error
should be retrieved. That's not always the case - e.g. near
47.400200 -123.142066, which means that the methods are not exactly
*reliable* and there might be Map class bugs at hand.

The new zoom-in and zoom-out improvements try to work around the above:
- for both centerOnRectangle() and centerOnCoordinate(), if no good
zoom-out level is found (newZoomOut), the zoom-out is set to the default
value of defaultZoomOut. In practice, this prevents the case where the map
does not zoom-out at all when going from one place to another
- centerOnRectangle() now uses rectangle diagonals to estimate a fit,
instead of checking if 2 points (top-left and bottom-right) are visible
in the viewport. The usage of fromCoordinate() was giving bad results
in this case and comparing distances (diagonals) is more reliable
but more expensive on the CPU.

Due to the inconsistencies of toCoordinate() and fromCoordinate()
the dynamic zoom-in and zoom-out are still not ideal, but the current
implementation is somewhat usable with decent accuracy.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-08-10 09:08:28 -07:00
Rick Walsh
1409521eb2 DiveList.qml: set detailsWindow index before deleting dive from list
This appears to fix the mystery crashes that can occur when deleting a dive
from the dive list.

Fixes: #497

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-08-10 09:06:44 -07:00
Joakim Bygdell
3f1a20cbaa QML UI: GPS: remove header
Being the only page that still has an on page header
it makes sens to remove it.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-08-07 00:52:32 -07:00