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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
This adds a tab for dive log - related preferences.
A suitable test programs is still required.
Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
WARNING: multi directory commit, needed to secure it builds.
move the core/exportfuncs.* to backend-shared.
update backend-shared/CMakeLists.txt to generate backend-shared lib
update CMakeLists.txt to include backend-shared lib in link process.
update ios project to reflect new directory
Signed-off-by: Jan Iversen <jan@casacondor.com>
LOG_STP is on longer providing the data needed, since a lot of the startup
is indirectly in QML, furthermore using the xcode project and running profiler
gives much more detailed information
Signed-off-by: Jan Iversen <jani@apache.org>
Remove "TO BE IMPLEMENTED" and add call doUpload
Connect signal to signal in QMLManager to avoid registring the
upload class.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Since we now have a selection.c translation unit, put the selection-
related functions there.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Add enum with different export types (used to signal which type
of export QML desires).
Add QML export functions (one for file and one for upload to web)
Signed-off-by: Jan Iversen <jan@casacondor.com>
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>
Instead of accessing the cylinder table directly, use the get_cylinder()
function. This gives less unwieldy expressions. But more importantly,
the function does bound checking. This is crucial for now as the code
hasn't be properly audited since the change to arbitrarily sized
cylinder tables. Accesses of invalid cylinder indexes may lead to
silent data-corruption that is sometimes not even noticed by
valgrind. Returning NULL instead of an invalid pointer will make
debugging much easier.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Instead of using fixed size arrays, use a new cylinder_table structure.
The code copies the weightsystem code, but is significantly more complex
because cylinders are such an integral part of the core.
Two functions to access the cylinders were added:
get_cylinder() and get_or_create_cylinder()
The former does a simple array access and supposes that the cylinder
exists. The latter is used by the parser(s) and if a cylinder with
the given id does not exist, cylinders up to that id are generated.
One point will make C programmers cringe: the cylinder structure is
passed by value. This is due to the way the table-macros work. A
refactoring of the table macros is planned. It has to be noted that
the size of a cylinder_t is 64 bytes, i.e. 8 long words on a 64-bit
architecture, so passing on the stack is probably not even significantly
slower than passing as reference.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
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>
While the error that caused this to happen should be fixed, we should at least
let the user know if things failed catastrophically and we can't figure out how
to save their data.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If there is a local cache, we at least once successfully accessed the cloud, so
this is a valid cloud based git tree.
Without this change we run into a subtle bug: after a fresh install, or when
switching users, when the cloud data is accessed the very first time, we don't
remember that this was indeed loaded from the cloud. So if we then download
from a dive computer or make any other changes to the dive log, we cannot save
those dives to cloud storage - but we fail silently doing so. Which to the user
would look that inexplicable data loss.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
While on mobile there should always be only one selected dive, it's very
cheap to make sure that amount_selected is tracked correctly. The
incrementing of amount_selected is done in case an invalid id is passed
in.
Suggested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
To make this class available from QMLManager, the run_ui()
function would create the object and then set a pointer in
QMLManager. It works, but is inconsistent with the rest of
the code. Therefore, make it a classical singleton class,
which is generated on demand.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Clearing the dive data directly in the core leaves us with an
inconsistent model. Therefore, clear via the model.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Instead of using the GpsLocation singleton in GpsListModel::update()
to extract the gpsTrackers, pass the gpsTrackers as function argument.
The caller has direct access to the GpsLocation object anyway and this
make things less entangled.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The way we handle singletons in QML, QML insists on allocating the
objects. This leads to a very idiosyncratic way of handling
singletons: The global instance pointer is set in the constructor.
Unify all these by implementing a "SillySingleton" template. All
of the weird singleton-classes can derive from this template and
don't have to bother with reimplementing the instance() function
with all the safety-checks, etc.
This serves firstly as documentation but also improves debugging
as we will now see wanted and unwanted creation and destruction
of these weird singletons.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This addresses the following warning when running the mobile app:
INFO: QQmlExpression: Expression qrc:/qml/DownloadFromDiveComputer.qml:339:5 depends on non-NOTIFYable properties:
INFO: QMLManager::DC_forceDownload
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Instead of handing a reference-to-dive to QML, prerender all the needed
properties and store them as values in DiveObjectHelper. Exception:
- date(): generated from timestamp
- time(): generated from timestamp
- cylinderList(): does not depend on dive anyway and should be made
static.
This hopefully avoids the random mobile crashes that we are seeing.
Clearly, this code needs to be optimized, but it is a start.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Since DiveListModel does not keep its own list of dives anymore,
insertDive() doesn't use the DiveObjectHelper argument. Remove it.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>