default_cylinder was moved from PrefGeneral to PrefEquipment,
but Settings was not updated
update Settings.
Signed-off-by: jan Iversen <jan@casacondor.com>
When changing METERS <-> FEET, the text change automatically
between "m/min" and "ft/min".
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Do not use a.set_b(value); it works, but it introduces yet another way of using
the QML/C++ interface, furthermore the function might not be called set_b in
some future, which is the reason the function is define in Q_PROPERTY
Use a.b = value, that respects Q_PROPERTY, and is slightly more performant,
most importantly it's like all the other settings so noone starts wondering why
this is special.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Set the text of ascent/descent rates.
This shows the correct speed units when the user switches between metric and imperial.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
but the proper way, as a direct check on
PrefCloudStorage.
This secures PrefCloudStorage is only tested once and not
n times. As a sideeffect it saves typing and control.
Signed-off-by: Jan Iversen <jan@casacondor.com>
(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>
(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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
cancelCredentialsPinSetup() is no longer used, so remove it.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
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>
These were again copied from the material design icon set and will be used to
differentiate the various help topics.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The global drawer already has a name that can be referenced. This was adding
confusion as now both names were used in the menu structure.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The user is most likely to find out, that he does not remember
the password, when asked for it.
Add "forgot password" button in the signin dialog
(both credentials and pin dialog).
Signed-off-by: Jan Iversen <jan@casacondor.com>
rightPadding seems defined in Kirigami and the default value
causes a binding loop.
set rightPadding directly.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Add "Dive planner" menu entry in GlobalDrawer/Developer
with 4 subitems one for each diveplanner pages.
Developer is chosen in order to allow interested access to
pages, without raising expectations for the normal user.
That allow a step-by-step implementation
Signed-off-by: Jan Iversen <jan@casacondor.com>
Diveplanner consist of 3 pages:
- Edit, creation of the plan
- View, view the plan
- Manager, list/delete/select stored diveplans
With the current navigation system (pageStack)
View needs to be split in multiple pages.
Signed-off-by: Jan Iversen <jan@casacondor.com>
standard font-size as well as color are set
in the template (but can be overwritten in
the object)
Using TemplateComboBox 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>
standard font-size as well as color are set
in the template (but can be overwritten in
the object)
Using TemplateCheckBox 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>
standard font-size as well as color are set
in the template (but can be overwritten in
the object)
Using TemplateRadioButton 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
cloudPassword is no longer used as a temporary variable
Remove cloudPassword from QMLPrefs.
Signed-off-by: Jan Iversen <jani@apache.org>
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>
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>
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>
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>
In order to make the central CMakeLists cleaner and more consistent
add a CMakeLists.txt to mobile-widgets, like in other root directories.
Signed-off-by: Jan Iversen <jan@casacondor.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>