Commit graph

16667 commits

Author SHA1 Message Date
Dirk Hohndel
2f5d37e86e GitHub Actions: add Ubuntu 19.10 / Qt 5.12 build
And run tests for desktop and mobile.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-30 17:43:31 -08:00
Dirk Hohndel
f788311b29 GitHub Actions: run the tests on Mac and Ubuntu 18.04/Qt 5.9 desktop
We lost running the tests when migrating to GitHub Actions...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-30 17:41:07 -08:00
Dirk Hohndel
c2ccbe1f63 GitHub Actions: install missing Homebrew packages to run tests
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-30 17:34:26 -08:00
jan Iversen
d7f87ee93c mobile-widgets/qml: add spinbox values to planner setup
(planning is excluded, due to not finished UI).

Connect all spinboxes with plannerShared.

This change allows live testing and compare with the desktop version.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-31 07:44:51 +09:00
jan Iversen
d83c74606d mobile-widgets/qml: add checkbox values
(planning is excluded, due to not finished UI).

Connect all checkboxes with plannerShared.

This change allows live testing and compare with the desktop version.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-31 07:44:51 +09:00
jan Iversen
e9301690ce tests: corrected typo in CMakeFiles.txt
This typo caused that testplannershared was not available
in neither desktop nor mobil.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-31 07:43:19 +09:00
jan Iversen
80b55b9e85 tests: correct decosac/bottomsac in imperial.
The getter returns alwayes in m/1000, making the calculations
identical, independent if the system is in Metric or Imperial units.

Correct getter test cases.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-31 04:32:34 +09:00
jan Iversen
2f16f7539e tests: correct bestmixend test cases.
When unit system Imperial is properly activated, these test cases
have wrong values, and thus fail.

Use correct values.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-31 04:32:34 +09:00
jan Iversen
24c42b9b55 tests: reactivate test case in testplannershared
reactivate deco2 test case, after problem is solved in plannerShared.

Also add a commit on bottompo2/decopo2 in imperial mode, that do not
use PSI as expected.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-31 04:32:34 +09:00
jan Iversen
694fcffa6e backend: correct deco2() problem in plannerShared
Divided by 1000 (int) instead of 1000.0 (float)
which caused precision problems.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-31 04:32:34 +09:00
Dirk Hohndel
a85b0896b4 tests: fix TestGitStorage in a mobile build
The default behavior of parse_file() is different between a desktop build
and a mobile build. This makes parse_file() always assume that it's ok to
connect to the cloud.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 13:29:08 -08:00
jan Iversen
7641a6263f tests: correct testplannershared
PSI is not implemented for diveplanner
Bestmixend in feet is not implemented for diveplanner

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:32:45 -08:00
jan Iversen
12dc98c359 tests: deactivate testQML
Qt 5.13 (and maybe 5.12) introduced new macros for QUICK_TEST_MAIN_WITH_SETUP
and as testQML is loosely based on this macro it needs to be redesigned.

Before Qt 5.11 it was not possible to do QML testing that depended on
classes being registred with the macro QUICK_TEST_MAIN_WITH_SETUP,
therefore it was nessecary to make an independent implementation of
main().

For now, let the main do a "return 0", to keep the test in the loop.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:32:02 -08:00
jan Iversen
d82840b468 tests: fix testqPrefDisplay
Font size are never stored on disk for the mobile version,
so testing load/save does not make sense.

add #ifndef SUBSURFACE_MOBILE

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:31:54 -08:00
Dirk Hohndel
9be028659e tests: fix TestQPrefLog
There were several issues with these tests, including checking
the value argument against bool values even if the underlying
preference isn't bool.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:31:43 -08:00
Dirk Hohndel
7046bb4f82 tests: fix TestQPrefEquipment
When we actually change the value, the argument to the changed signal
should be true, not false.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:31:31 -08:00
Dirk Hohndel
18fe7b8e9a tests: fix TestQPrefUnits
This clearly never was tested.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:31:20 -08:00
jan Iversen
360add37a8 mobile-widgets: remove qmlprefs.*
class is not longer used, remove it.
(also from qml)

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:20:19 -08:00
jan Iversen
8bc7bef065 QML: remove registration of qmlprefs
It is no longer used.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:20:19 -08:00
jan Iversen
e268af0d9f mobile-widgets: use oldStatus in qmlmanager
Switch oldStatus from qmlprefs to qmlmanager

This is the last use of QMLPrefs, which can later be safely removed.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:20:19 -08:00
jan Iversen
3d6d71aa9f mobile-widgets: add oldStatus variable to qmlmanager
oldStatus() is kept in qmlPrefs during the login process to allow
for a couple of special cases:
- if a user have added dives in NO_CLOUD mode and changes to use the
  cloud these dives are copied to the Cloud, instead of being lost.
- if a user does a bailout from the login process (this should not
  happen anymore) the old status is restored.

The pure solution would be to have oldStatus at the top level (e.g.
a property in qml) and only change it when actually being in the
login process, however due to way the qmlmanager is written it proved
very difficult and not worth the effort.

In order to be able to remove qmlPrefs, oldStatus are moved to
qmlManager.

This commit only contain the creation of the variable and the supporting
code.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:20:19 -08:00
jan Iversen
25e17443f9 mobile-widgets: remove showPin from qmlprefs
showPin is no longer used so remove it.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:20:19 -08:00
jan Iversen
a729d1a576 mobile-widgets: remove showPin from qmlmanager
Setting showPin is no longer needed, so remove it.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:20:19 -08:00
jan Iversen
b92c2d280c mobile-widgets/qml: remove prefs.showPin
prefs.showpin is the same as
PrefCloudStorage.cloud_verification_status === CloudStatus.CS_NEED_TO_VERIFY
but is actually implemented as a separate variable.

Removing showPin in order to limit use of QMLPrefs, which is the overall goal.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:20:19 -08:00
jan Iversen
5b3ecea4a0 mobile-widgets: remove setCredentialStatus() from qmlprefs
Remove no longer used function setCredentialStatus() from qmlprefs.

This is done to secure there are no missing setCredentialStatus calls
in the code.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:20:19 -08:00
jan Iversen
1fd6b59a21 mobile-widgets: remove second setCredentialStatus()
call setOldStatus() and set_filename().

saveCredentials() will adjust email and password.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:20:19 -08:00
jan Iversen
6084a27229 mobile-widgets: remove first setCredentialStatus() in finishSetup()
This setCredentialStatus() will never do anything, because qPrefCloudStorage
is identical to prefs.cloud_verification_status, and can thus be
safely removed.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:20:19 -08:00
jan Iversen
0c840ba22a mobile-widgets: remove setCredentialStatus() from saveCloudCredentials()
Revert to the divelist by setting oldStatus() directly to
set_cloud_verification_status()

This is done to further limit the use of setCredentialStatus() and
prepare to remove qmlPrefs.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:20:19 -08:00
jan Iversen
814f6b3579 mobile-widgets: remove setCredentialStatus from revertToNoCloudIfNeeded
Update revertToNoCloudIfNeeded() to not use setCredentialStatus() by adding an
extra call to setOldStatus()

setOldStatus() is called in setCredentialStatus together with
set_cloud_verification_status() therefore these 2 calls need to added when
removing setCredentialStatus().

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:20:19 -08:00
jan Iversen
dc98b0a2ac mobile-widgets: replace simple setCredentialStatus
qmlprefs::setCredentialStatus() basically only does something when called with
CS_NOCLOUD.

A number of setCredentialStatus() calls happen where status cannot be
CS_NOCLOUD, and therefore setCredentialStatus() can be safely replaced with
set_cloud_verification_status()

This limits the use of qmlprefs::setCredentialStatus(), but there are still a
couple of more complicated calls.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:20:19 -08:00
jan Iversen
783332561a mobile-widgets: credentialStatus() -> cloud_verification_status()
Replace all credentialStatus() with cloud_verification_status()

Where both prefs.credentialStatus and
PrefCloudStorage.cloud_verification_status are being set, remove
prefs.credentialStatus.

These replacements are valid since credentialStatus() is a simple
envelope over cloud_verification_status().

Also remove qmlPrefs::credentialStatus() from qmlPrefs (mostly to ensure no
replacements was forgotten).

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:20:19 -08:00
jan Iversen
beacc00f2d mobile-widgets: remove m_cloudCredentialStatus in qmlpref
Remove m_credentialStatus in qmlpref, but let the setter/getter
stay, using qPrefCloudStorage::cloud_verification_status()
instead.

This change ensures that qmlPrefs:credentialStatus() returns the
same as qPrefCloudStorage::cloud_verification_status(), and the
setter/getter of credentialStatus can later be removed safely.

This is a "checkpoint" to ensure everything works without a temporary
credentialStatus. No code part depend on the difference between
qmlPrefs::credentialStatus() and
qPrefCloudStorage::cloud_verification_status(), but the code reference
both.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:20:19 -08:00
jan Iversen
b7730d3813 backendShared: correct set_verbatim_plan in plannerShared.
Correct copy/paste error, set_verbatim_plan() should not call
setSacFactor() but setVerbatim().

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-30 04:46:57 +09:00
Dirk Hohndel
cb3561ae85 tests: fix cmake syntax confusion
You cannot have a conditional in the middle of a list. I should have
caught this in review.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-28 08:46:45 -08:00
jan Iversen
e80c27a2bd mobile-widgets/qml: correct missing parm in saveCredentials() call
Add missing empty pin ("") in saveCredentials() call.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-28 08:36:55 -08:00
jan Iversen
07ad455ea2 mobile-widgets/qml: prefs.credentialStatus -> PrefCloudStorage
Remove use of prefs. (apart from instanciating the object) in
main.qml

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-28 08:36:55 -08:00
jan Iversen
7e0e489d45 mobile-widgets/qml: "Add dive manually" is always allowed
Since the divelist is only visible if online/offline (CS_VERIFIED/CS_NOCLOUD),
there is no need to check that to enable "Add dive manually".

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-28 08:36:20 -08:00
jan Iversen
a73ce80eee mobile-widgets/qml: don't offer manual sync to cloud in no-cloud mode
Manual sync was enabled both for CS_VERIFIED (online) and CS_NOCLOUD (offline)
and then in the trigger CS_NOCLOUD lead to a login screen, potentially
confusing the user.

Only enable manual sync with verified cloud credentials.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-28 08:35:45 -08:00
jan Iversen
bdbaf72d27 mobile-widgets/qml: remove use of prefs. in DiveList.qml
prefs. is only important during the signin process, so use the standard
PrefCloudStorage variable

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-28 08:34:56 -08:00
jan Iversen
3cca6b9e9b mobile-widgets: remove cloudPin from qmlprefs
cloudPin is no longer used, remove it.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-28 08:34:56 -08:00
jan Iversen
e3a9166f46 mobile-widgets: remove cloudPin() from qmlmanager
cloudPin does only have the values "" and NULL, so replace cloudPin()
with "" in csa->backend() call

remove setting of cloudPin to ""

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-28 08:34:56 -08:00
jan Iversen
f1a48d7f79 mobile-widget: simplify saveCredentials() in qmlmanager
cloudPin is only set to "" and NULL, therefore and "if" checking if
cloudPin is not empty will never have affect.

Remove else part.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-28 08:34:56 -08:00
jan Iversen
3155b03917 mobile-widgets: make verifyCredentials() an internal function
Move verifyCredentials() from public slots to private, eliminating
the need to MOC and making the C++/QML interface on function less
complicated.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-28 08:34:56 -08:00
jan Iversen
096f9773f0 mobile-widgets: make saveCredentials() an atom
Add pin parameter to saveCredentials() thereby having all info about
credentials in one function call.

Add "" as pin in saveCredentials() - main.qml, when verifying
credentials.

replace verifyCredentials() with saveCredentials() in the register
button on the pin page.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-28 08:34:56 -08:00
jan Iversen
ad1c3892f9 mobile-widgets: remove clearCredentials()
clearCredentials() was only called from one place (in the same file), copy
functionality and remove function.

It was declared as a public slot, so this saves a little bit of overhead too.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-28 08:34:56 -08:00
jan Iversen
e944a93050 mobile-widgets: remove cancelCredentialsPinSetup() from qmlprefs
cancelCredentialsPinSetup() is no longer used, so remove it.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-28 08:34:56 -08:00
jan Iversen
de4e1c1efa mobile-widgets/qml: don't call cancelCredentialsPinSetup()
Copy functionality from cancelCredentialsPinSetup() into Cancel in
CloudCredentials.qml, this is part of the general qmlprefs cleanup.

Remove rootItem.returnTopPage() since the user stays on this page
(sees credentials again).

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-28 08:34:56 -08:00
jan Iversen
dc018cd77d mobile-widgets/qml: remove cancelCredentialsPinSetup() from Settings
For now just copy the functionality into Settings.qml, this is part
of the qmlprefs cleanup.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-28 08:34:56 -08:00
jan Iversen
baec098eb3 mobile-widgets/qml: correct reference to credentialStatus
PrefCloudStorage uses cloud_verification_status where qmlprefs uses
credentialStatus

Corrected reference.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-28 08:34:56 -08:00
jan Iversen
944455a821 mobile-widgets/qml: remove property credentialStatus
Property is unused, remove it.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-28 08:34:56 -08:00