aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets
AgeCommit message (Collapse)Author
2019-11-11mobile-widget/qml: correct syntax error introduced in e63257f0eGravatar jan Iversen
default parameter values is not supported as this syntax was introduced in ECMA-262 6th edition while QML only implements the fifth edition (as of Qt 5.11). remove default parameter and check for undefined instead. Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-11-10Mobile: add ability to directly open support emailGravatar Dirk Hohndel
This is even easier and more obvious than copying the logs on the About page and then manually creating an email and pasting those logs. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-09Cylinders: access cylinders with get_cylinder()Gravatar Berthold Stoeger
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>
2019-11-09Core: remove MAX_CYLINDERS restrictionGravatar Berthold Stoeger
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>
2019-11-08Mobile: modify filter so that all models get notifiedGravatar Dirk Hohndel
When we change the filter string, we need to make sure that the collapsed model is also aware of the change. Similarly, instead of just calling resetFilter and directly changing the core data structures, we need to set the filter to the empty string which ensures that all three models get notified and the view updates correctly. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: reconnect the correct model after changing filterGravatar Dirk Hohndel
This caused a blank, unusable dive list. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: consistently refer to the dive list modelGravatar Dirk Hohndel
The number of different ways we tried to refer to the model made my head spin. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: ensure there's some space between date and depth/durationGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: use the CollapsedDiveListSortModel for dive listGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: setup CollapsedDiveListSortModelGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: derive the index from the dive idGravatar Dirk Hohndel
The previous code assumes that both the vertical dive list and the list of dive details which allows the horizontal swiping from dive to dive are based on the same model. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: give visual indication that we are saving divesGravatar Dirk Hohndel
Allow showing that the app is busy and showing why at the same time. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: allow message argument to showBusy functionGravatar Dirk Hohndel
When called without arguments, no message is shown. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: add UI feature tests to Developer menuGravatar Dirk Hohndel
Running Subsurface-mobile on iOS, the notification texts are sometimes very hard to read, and in some situations the busy indicator isn't showing up at all. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: let the user know if we can't save changesGravatar Dirk Hohndel
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>
2019-11-08Mobile: remember if we were able to open the local cacheGravatar Dirk Hohndel
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>
2019-11-08Mobile: remove useless attempt to prevent access to the cloudGravatar Dirk Hohndel
This code really made no sense, adding a comment to try to explain that. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: drop extra argument to QStringGravatar Dirk Hohndel
Clearly a cut and paste error. Only creates a harmless warning, still... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-03Mobile: don't dereference the dive list model when it's disconnectedGravatar Dirk Hohndel
This avoids a bunch of annoying warnings. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-03Mobile: disconnect model while updating dive listGravatar Dirk Hohndel
If the dive list is connected to the model while the model is updated with the downloaded dives, sometimes the UI hangs completely. Disconnecting the model and then reconnecting it does add a fairly noticeable delay on longer dive lists, so there are tradeoffs here. Of course the obvious solution is to make reconnecting the model faster... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-03Mobile: use appendTextToLog to get timestamps in logsGravatar Dirk Hohndel
This helps tremendously when tracking down some problems. We should never use console.log. In the process this also updates a couple of the messages to be clearer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-27Mobile: make the GPS service icon work againGravatar Dirk Hohndel
I don't recall when this stopped working. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Mobile: ensure we go back to the dive list after downloadGravatar Dirk Hohndel
The pop() by itself wasn't enough to do that. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Mobile: try harder to get the right dive listGravatar Dirk Hohndel
This should ensure that the dive list correctly repopulates after the model was updated. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Mobile: also show busy spinner when applying GPS fixesGravatar Dirk Hohndel
That's another function that can take a little while. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Mobile: simple message and busy spinner while storing downloaded divesGravatar Dirk Hohndel
Due to some recent changes processing the downloaded dives and re-displaying the dive list can take quite a while. So show a small message and the busy spinner to warn the user. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Mobile: change show/hide busy functionsGravatar Dirk Hohndel
The old code was ill named - this way the busy spinner itself becomes reusable with a reasonable set of function names. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Mobile: provide better tracking of applied GPS fixesGravatar Dirk Hohndel
Also reset the page stack to make sure we don't end up with stale data. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Mobile: more code to deal with undefined elementsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Mobile: reset dive list after applying GPS fixesGravatar Dirk Hohndel
This way new fixes are actually shown when the user looks at the dive list after applying the GPS fixes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Mobile: don't show nothing for the locationGravatar Dirk Hohndel
We use 'Dive details' as page title, everywhere else we use '<unnamed dive site>'. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Mobile: fix incorrect variable dereference for dive siteGravatar Dirk Hohndel
Since we are accessing the model, this is the variable we should use. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Mobile: don't push map page if it's already on the stackGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Mobile: avoid dereferencing undefined valuesGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26Mobile: fix cacheBuffer for log windowGravatar Dirk Hohndel
The old value made no sense at all. Why would we want to cache up to 10k entries of the log? Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-21Mobile: allow editing dive numberGravatar Dirk Hohndel
No checks regarding duplicate numbers - we trust the user knows what they are doing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-20Mobile: remove remaining accesses to DiveObjectHelper from QMLGravatar Dirk Hohndel
Add a couple more roles and remove the dive role that allows accesss to the DiveObjectHelper in the first place. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-20Mobile: get dive details directly from the modelGravatar Dirk Hohndel
By getting a DiveObjectHelper and then dereferencing that we ended up creating hundres and hundreds of these objects, only to immediately destroy them after using a tiny part of the data. Instead make those data available directly from the model, without having to create a DiveObjectHelper forst. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-14Mobile: ensure input fields stay visible after keyboard opensGravatar Dirk Hohndel
When the user taps on a TextField to enter text, usually the virtual keyboard will pop up. This code tries to ensure that the keyboard doesn't cover the entry field that the user was trying to work on. In order to centralize these changes, this introduces a new SsrfTextField type which we use to also remove a few redundant default settings that we previously had for every field. The one TextArea for the Notes field didn't seem worth creating yet another type for, so there the changes are done directly in DiveDetailsEdit. The awkward timer mechanism is necessary as the keyboard pops up asynchronously and then triggers a change of height for the app, so we need to wait a little bit before doing the adjustment. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-14Mobile: pick icons depending on themeGravatar Dirk Hohndel
QML has ways to style icons - and we use that for the main theme color, but it doesn't seem to work (anymore?) for the edit and save icons. Instead of tracking down what changed there, simply switch between icons with different foreground color, depending on theme. All the other icons seem to work well in all three themes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13Mobile: improve helper function to track selected divesGravatar Dirk Hohndel
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>
2019-10-13Mobile: bring back the adaptive size for the tool barGravatar Dirk Hohndel
When switching to the global tool bar this was lost, and then it turned out to be broken and required more patches to fix. Commented out because it doesn't work at all. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13Mobile: ensure consistent path when accessing arrow iconsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13Mobile: implement our own back entry for GlobalDrawerGravatar Dirk Hohndel
This way we'll get a working back icon on Android and also correct font size for the (translated) Back text. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13Mobile: update the map when the selected dive changesGravatar Dirk Hohndel
Now we see the highlighted dive flag match the dive selected in the dive list. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13Mobile: add helper function to keep selection in syncGravatar Dirk Hohndel
Without this the core data structure never gets updated to reflect which dive is currently selected. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13Mobile: move pageIndex function to main.qmlGravatar Dirk Hohndel
This way it can be more easily called from other pages. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13Mobile: when selecting dive via map, expand its tripGravatar Dirk Hohndel
Previously if the dive was in a different trip, we'd scroll to that trip but not expand the trip, which was a confusing user experience. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13Mobile: when selecting dive via map, update details viewGravatar Dirk Hohndel
We updated the selected dive in the dive list, but not the one shown in the details view. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13Mobile: when switching to the details, reuse existing pageGravatar Dirk Hohndel
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>