aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2020-04-10undo: refine pasting of cylindersGravatar Berthold Stoeger
When pasting cylinders, the destination dive got a verbatim copy of the cylinders of the source dive. This is not what users want: for example, the start and stop pressures from the dive computer as well as the gas mix may be overwritten. There seems to be no perfect solution, since some times users may want to paste the gas-mix. Therefore, let's choose a heuristic approach for now (in the future we might implement a UI-flag): When copying over existing cylinders, only copy type and maximum pressure. When adding new cylinders (i.e. from-dive has more cylinders than to-dive), copy everything, but reset start- and top-pressure to 0, which represents unkown. Moroever, in the latter case, set "manually added" to true, since obviously this wasn't added by a dive computer. Fixes #2676 Reported-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-08fulltext: don't call words.clear() in FullText::populate()Gravatar Berthold Stoeger
This function was not meant to be called with already existing data. However, if it was, it cleared the words without clearing the fulltext caches of the dives. This lead to crashes. Be more resilient by not clearing the words: Already existing dives are unregistered during the process of populating anyway. So this now *should* work if new dives are added to the dive list and then this function is called. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-08fulltext: rename fulltext_reload() to fulltext_populate()Gravatar Berthold Stoeger
This function was named improperly: it was only used on freshly loaded data. Indeed, attempts to use it to actually reload lead to crashes. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07git: don't check for git sha in parse_file()Gravatar Berthold Stoeger
parse_file() refused to load from a git repository if we already had that repository and there were no changes. However, this only checked the global divelist_changed flag, which does not track undo-commands. Thus, after editing dives the user couldn't reload from git. Remove this check. It is somewhat questionable that the io layer refuses to load from a repository anyway. Let the caller decide. There appears to be a check_git_sha function for that purpose(?). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-06delegate: don't add WSInfo entry in delegateGravatar Berthold Stoeger
The weightsystem info for new weightsystem types is added by the undo command. Remove this redundant code. Use the lookup only to determine the weight and the canonical name (i.e. use the capitalization according to the saved entry, in analogy to tanks). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-06delegates: don't use starts-with search to fetch cylinder/weight dataGravatar Berthold Stoeger
In the wightsystem-type and cylinder-type delegates, when entering data, when entering known weight- or cylinder-types, some ui fields (notably weight, size and working-pressure) are automatically filled out. The search was using the default flags provided by Qt: starts-with and case-insensitive. This had a few strange effects, when entering a string that is the beginning of a known string (e.g. "AL6" when "AL63" already exists): 1) The wrong data was used if the new string didn't exist. 2) For cylinders it was impossible to create new cylinder types whose name is the starting string of a different type. 3) For weights, the new type was not added to the list of known types. This, however, is no problem, because it will be added by the undo command anyway. A future commit will address that redundancy. Therefore use only the case-insensitive flag (which has to be performed by passing the MatchFixedString flag - very weird). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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-04CHANGELOG updateGravatar Dirk Hohndel
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-04build-system: pull newer libxsltGravatar Dirk Hohndel
The older version stopped building for iOS. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04Update CHANGELOGGravatar Dirk Hohndel
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-04core/models: give progress update while populating modelsGravatar Dirk Hohndel
Especially with large dive logs this will prevent the user from thinking that the app is hung. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04core/fulltext: give progress update while populating indexGravatar Dirk Hohndel
Especially with large dive logs this will prevent the user from thinking that the app is hung. 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-04core: add additional notification callbackGravatar Dirk Hohndel
Especially on slower devices with a large dive list the startup time has become really long. This callback allows us to give the user an idea of what the app is doing during that time. 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-04Next mobile version incrementGravatar 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-04-04GitHub Actions: add pkg-config to iOS buildGravatar Dirk Hohndel
Our builds fail because we are missing pkg-config. I'm not quite sure if this is triggered by a new dependency or if pkg-config used to be there and now isn't. Either way, this should hopefully fix things. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04iOS: fix libxslt buildGravatar Dirk Hohndel
We need to build libxml2 without LZMA. We need to make sure that libxslt finds the libxml2 includes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04iOS: clean up build shell scriptGravatar Dirk Hohndel
Address shell linter comments. Follow our usual naming for build dirs. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04iOS: add libxml2 buildGravatar Dirk Hohndel
I don't know why this is suddenly needed and wasn't before, but hopefully this fixes the broken builds on GitHub. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04cleanup: copy saved_git_id, don't use local bufferGravatar Berthold Stoeger
In an attempt to reduce the number of global variables, don't use a local buffer to store the currently loaded git-id. The git-id itself is still a global variable, which in the future can hopefully be encapsulated in a "struct File" or similar. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-01build: use -Wno-inconsistent-missing-override in Subsurface-mobile.proGravatar Berthold Stoeger
The inconsistent-missing-override warning is annoying as it prevents us from adding "override" modifiers: It will warn if we do this only for selected functions. Sadly, this is the default on clang. Therefore, we disable this warning for quite some time in CMakeLists.txt. For consistency also do this in the Subsurface-mobile.pro file. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-01cleanup: explicitly cast to int to silence a compiler warningGravatar Berthold Stoeger
In DivelogsDeWebServices::updateProgress() QProgressBar::setRange() and QProgressBar::setValue() were passed floats even though they expect ints. To silence a compiler warning, cast by hand. Use the lrint() function, since we generally do it this way. However, it is not clear whether this is necessary here. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-31Update CHANGELOGGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>