(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>
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>
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 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
[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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>