aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets
AgeCommit message (Collapse)Author
2020-04-21cleanup: replace constructs of the type &vector[0] by vector.data()Gravatar Berthold Stoeger
It appears that some misguided compiler / library combinations crash on &vector[0] for empty vectors. Even though very unfriendly, they are technically correct, so let's remove these constructs. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-18mobile UI: indicate status of verbose flagGravatar Dirk Hohndel
This way the user can verify that they have set the log to verbose mode in the developer menu. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-13mobile: don't call main loop for notifications once initializedGravatar Berthold Stoeger
Calling qApp->processEvents() in QMLManager::setNotificationText() caused crashes, because it could lead to the context-menu that initialized the call being deleted. Something that QML apparently doesn't like. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-13mobile: remove overwriting of line special case in ui-notificationGravatar Berthold Stoeger
On startup, we showed progress of the population of the fulltext and listmodels for every 100th dive. This worked by overwriting the last line if the new line started with '\r'. Since we don't do that anymore, we can remove this special case. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-04mobile/startup: fix potential crash when switching back and forthGravatar Dirk Hohndel
If the user switches away from Subsurface-mobile and back while we are in our initialization phase, that code might run more than once leading to undesirable results. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04mobile/cleanup: create helper function to hide verbose castsGravatar Dirk Hohndel
The strange enum casts (that apparently we needed in order to have strongly typed enums in QML) are really ugly and confusing in the code. Since we had this three times it seemed worth to create a little helper that hides this nonsense. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04mobile/cloud-storage: correctly transition from no-cloud to cloudGravatar Dirk Hohndel
We know that we have valid credentials, so calling openLocalThenRemote() makes no sense, worse, it doesn't respect the special case of transitioning between accounts. That's the whole point of having a separate loadDivesWithValidCredentials() call. Once we have transitioned state, we need to record the now current state as the old state so that future transitions will work. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04mobile/cloud-storage: fix test for no cloud to cloud transitionGravatar Dirk Hohndel
The noCloud variable contains our desired state, we need to test for the previous state for this to make sense. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04mobile/cleanup: remove outdated comment and fix whitespaceGravatar Dirk Hohndel
We haven't supported the GPS web service for a long time. Also, add another message for the log to be able to more easily trace one error case. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04mobile/undo: set undo stack as clean after saveGravatar Berthold Stoeger
If we're using the undo stack for determining the whether there are unsaved changes, we have to mark the undo stack as clean after save. This duplicates code from desktop. It is planned to unify this in the near future. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-04mobile/undo: consider undo-stack when checking for unsaved changesGravatar Berthold Stoeger
In analogy to desktop, also consider the state of the undo-stack when testing for unsaved changes. This prevents us from missing changes. This adds duplicate code, which will be unified in the near future. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-04mobile/edits: ensure changesNeedSaving is calledGravatar Dirk Hohndel
These appear to be the only cases where we forgot to ensure data is saved. And pastDiveData is currently not called as the UI to use it has been removed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04mobile: when creating gps dive site use the new dive site nameGravatar Berthold Stoeger
The code was using the pre-editing dive site name, which appears weird. Not sure if that was on purpose. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-04mobile: properly recognize changed dive siteGravatar Berthold Stoeger
QMLManager::checkLocation() would only return true if the dive-site itself was changed, not if the dive-site was set to a different site. Thus, in some cases edit events could be lost. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-04mobile/download-from-DC: ensure that changes get actually savedGravatar Dirk Hohndel
Calling saveChangesLocal() seems like the right thing to do, but it doesn't do anything useful if the dive list hasn't been marked as changed. The correct helper function to call is changesNeedSaving() which makes sure we save the changes and update all UI information. [Berthold: since this removes the last QML caller of saveChangesLocal() we can make that function private.] Signed-off-by: Dirk Hohndel <dirk@hohndel.org> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-04mobile/cleanup: fix whitespace and remove verbose messagesGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04mobile UI: delay reading the dive list until app is activeGravatar Dirk Hohndel
This way the launch screen is shown significantly shorter on a device, and instead the user sees our progress notifications. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04mobile UI: only test for plugged in USB serial device on AndroidGravatar Dirk Hohndel
This test makes no sense on other platforms (and the log file text is frankly confusing when not running on Android). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04mobile/core: remove locking for git accessGravatar Dirk Hohndel
We have convinced ourselves that only the main thread will ever trigger a save operation, therefore the locking is not needed (and it has recently started to cause user problems where local changes aren't saved to storage and get lost). Fixes #2718 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04mobile/dive-list: don't use cacheBufferGravatar Dirk Hohndel
QML documentation recommends against using the cacheBuffer for longer lists and doing more testing shows that this really doesn't help at all. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04mobile/dive-list: performance improvement for invalid divesGravatar Dirk Hohndel
Small optimization that reduces the number of accesses to the underlying model. Instead of evaluating the isInvalid member eight times per delegate, we only check it once. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04mobile/dive-list: only show dive list notifications when it is visibleGravatar Dirk Hohndel
Without this check we'll show the 'Please tap the plus botton...' notification during app initialization as we are showing the initial set of messages - which makes no sense. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04mobile/startup: show progress update earlierGravatar Dirk Hohndel
Instead of not showing a notification until after we are done loading the data into our models, tell the user that we are about to do that. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04mobile/startup: show notification directly in the UI windowGravatar Dirk Hohndel
Until the app is initialized, we have problems getting the 'floating' passive notifications to show up and be useful. Instead update the user by filling a text block on the otherwise empty initial page of the app. Delay the switch to the dive list until the app is initialized and then use the passive notifications again. While we are initializing also show a busy spinner so the user doesn't think the app is hung. As a side effect of this change, the dive list isn't shown until our models are initialized. And strangely this causes every single possible delegate to be instantiated. We can prevent that by not setting the dive list model until after we are done setting up the model. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04mobile UI: setup callback for the new notification mechanismGravatar Dirk Hohndel
This simply passes the text to the existing notification text mechanism. The call to processEvents() ensures that Qt processes the UI events after we updated the notification and that the user gets timely updates; otherwise the UI might look like the app is hanging. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04mobile: add indication if the app has finished initializingGravatar Dirk Hohndel
This will help us to ensure that notifications are actually shown on the UI during the startup phase. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04cleanup: update all copyright dates to 2020Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04undo/mobile: keep track of dive sitesGravatar Berthold Stoeger
When editing the dive site of a dive, the dive-table of the corresponding dive site was not properly updated by the undo commands. Try to get this right. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-31mobile/dive-list: try to force focus on filter text fieldGravatar Dirk Hohndel
This was triggered by a change in enabled, but what is really changing is the visible property. This should work better. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-31mobile/dive-summary: make the drop downs smallerGravatar Dirk Hohndel
Especially on smaller screens we had issues fitting this on the screen. And it looks fine on larger screens as well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-31mobile/dive-details: add option to toggle the invalid flagGravatar Dirk Hohndel
Simply for consistency with the dive list. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-31mobile/dive-details: fix incorrect call to create tripGravatar Dirk Hohndel
This was using the myData alias that exists in the dive list but not on the dive details. This might work (because the models both use the same underlying base model), but given that we are using the currentItem of this ListView, I'm guessing that this would just silently fail (maybe with a warning in the log). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-31mobile/dive-details: if menu is open, close that with back buttonGravatar Dirk Hohndel
A second tap on the back button will then end add/edit or close the dive details and get us back to the dive list. This fixes an issue where tapping on back with the context menu open would bring you back to the dive list with the context menu still open, and because then change the text in the context menu as those are designed differently. Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-31cleanup: make QMLManager member functions privateGravatar Berthold Stoeger
The - mergeLocalRepo() - openLocalThenRemote() functions were not invoked from outside QMLManager. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-31mobile: don't call saveChangesLocal() twice on non-iOSGravatar Berthold Stoeger
QMLManager::changesNeedSaving() behaves differently on iOS: it only saves locally with saveChangesLocal(), whereas all other OS save to cloud with saveChangesCloud(). Nevertheless, even for other OS saveChangesLocal() is called even though that will be called in saveChancesCloud anyway. Therefore, compile the saveChangesLocal() call in changesNeedSaving conditionally. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-31mobile/dive-details: don't show virtual keyboard in dive view modeGravatar Dirk Hohndel
At least in 4.9.3.1258/3.0.1 I was able to reproduce a situation where I edit one dive, go back to the dive list, then tap on a different dive and then the keyboard pops up, obscuring a big chunk of the screen. This tries to make sure the keyboard isn't shown in dive view mode. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-31mobile: improve Android back key behaviorGravatar Dirk Hohndel
There are two places where we try to prevemt unintended app exits. Once, in the onBackRequested signal handler on the dive list. This was missing special handling for the situation where one of the drawers was open. The second place is the onClosing signal handler in main.qml. Naively I thought that this was enough to catch all cases where we were about to exit the app, but apparently an explicit manager.quit() is a bit too forceful and doesn't get to that signal handler. With this commit we check for open drawers in both places. Belts and suspenders, I guess. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-31mobile/dive-details: remove the redundant 'map it' buttonGravatar Dirk Hohndel
You can already get to the map by either clicking on the location text or on the left action button. This third way to get there reduces the available space for the location text, and can cause positioning issues with very long location texts creating three or more lines of text, which then overwrites the dateRow below. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-31mobile/dive-list: avoid using undefined value as booleanGravatar Dirk Hohndel
This gets rid of an annoying and noisy warning. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-31cleanup: remove loadFromCloud() declaration from QMLManager.hGravatar Berthold Stoeger
This getter functions was not defined anywhere. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30cleanup: use setPointSizeF() in themeInterface::set_currentScale()Gravatar Berthold Stoeger
The compiler complained that we were passing a float to the QFont::setPointSize() function, which expects an integer. Solve this by using the QFont::setPointSizeF() function. This might introduce a user-visible change, albeit very unlikely: We now may set the point-size to a non-integer number. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30cleanup: fix initialization order in QMLProfile constructorGravatar Berthold Stoeger
The compiler complains that members were initialized out-of-order. Even though this is not an issue here it is correct to emit a warning, since only then it is guaranteed that the objects are destructed in reverse-order with respect to construction. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30cleanup: un-slotify QMLManager functionsGravatar Berthold Stoeger
Some slots in QMLManager were not called from the outside, some only directly from C++-code. Make the former private and the latter public member functions. The idea here is to document which functions are actually called from the outside and which are called from QML or connected to signals. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30cleanup: fold ThemeInterface::setup() into constructorGravatar Berthold Stoeger
There appears to be no reason for two-phase initialization. Let's keep things simple: let the constructor produce a functioning object. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30cleanup: don't send values in changed-signals of ThemeInterfaceGravatar Berthold Stoeger
According to the Qt-docs you *may* send the new values in the NOTIFY signal of Q_PROPERTYs. However, since changes will lead to a reevaluation of a whole expression, this argument will be unused. All it does is make the code more verbose and brittle: What happens if you send the wrong value? Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30coding style: rename themeInterface to ThemeInterfaceGravatar Berthold Stoeger
As per coding style, class names are PascalCase. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30cleanup: make color-constants in themeinterface.cpp staticGravatar Berthold Stoeger
There were no outside users - no point in exporting them. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30cleanup: make members of ThemeInterface non-staticGravatar Berthold Stoeger
We have a singleton class ThemeInterface, which means that it is global and exists only once. It's members are static, i.e. also global. A message from the department of redundancy department? In any case, that makes no sense. Let's just make these members local to the class. I would even rip out the whole singleton thing, since the object is not accessed anywhere outside from QML. Let's keep it for now. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30mobile UI: don't exit when using back button to close drawersGravatar Dirk Hohndel
An Android user might reasonably assume that they can use the back button to close the global or context drawers. So act accordingly. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-30mobile/dive-list: add indicator that dive list is being processedGravatar Dirk Hohndel
This should deal with the rather confusing 'No dive in dive list' shown while loading and processing the dive list. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>