aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets
AgeCommit message (Collapse)Author
2020-10-24devices: add functions to add / remove / check for devicesGravatar Berthold Stoeger
To include the device code in the undo system, we need functions to check for the existence of devices and to add or remove them. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-24parser: add device_table to parser stateGravatar Berthold Stoeger
If we want to avoid the parsers to directly modify global data, we have to provide a device_table to parse into. This adds such a state and the corresponding function parameters. However, for now this is unused. Adding new parameters is very painful and this commit shows that we urgently need a "struct divelog" collecting all those tables! Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-24mobile: show location service warningGravatar Dirk Hohndel
Google play now requires that we show an explicit notification when turning on background location. This is an attempt to fulfill that requirement - we won't know if this is 'good enough' until we submit the app, though. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-24mobile: show text with location service iconGravatar Dirk Hohndel
I don't recall why we removed that text, but this makes it much clearer that the service is active. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-17filter: remove filter_preset_table_tGravatar Berthold Stoeger
We used a typedef "filter_preset_table_t" for the filter preset table, because it is a "std::vector<filter_preset>". However, that is in contrast to all the other global tables (dives, trips, sites) that we have. Therefore, turn this into a standard struct, which simply inherits from "std::vector<filter_preset>". Note that while inheriting from std::vector<> is generally not recommended, it is not a problem here, because we don't modify it in any shape or form. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-06Update translations from TransifexGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-29filter: implement loading of filter presets from git repositoriesGravatar Berthold Stoeger
This is mostly copy and paste of other git loading code. Sadly, it adds a lot of state to the parser-state. I wish we could pass different parser states to the parser_* functions. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: load filter presets from XML filesGravatar Berthold Stoeger
This is a bit painful: since we don't want to modify the filter presets when the user imports (as opposed to opens) a log, we have to provide a table where the parser stores the presets. Calling the parser is getting quite unwieldy, since many tables are passed. We probably should introduce a structure representing a full log-book at one point, which collects all the things that are saved to the log. Apart from that, this is simply the counterpart to saving to XML. The interpretation of the string data is performed by core functions, not the parser itself to avoid code duplication with the git parser. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: unify desktop and mobile filtersGravatar Berthold Stoeger
Switch the mobile code to use the constraint-based filter. The one thing that is still commented out is dive-site mode, since mobile doesn't (yet) have a dive-site edit feature. And even if it had, the dive list probably wouldn't be shown at the same time. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-27mobile/dive-list: correctly update view when changing dive dateGravatar Dirk Hohndel
If the dive timestamp changes, the dive could move in the dive list. But the current dive actually doesn't change (it's still the same dive, right?). Yet we need to update the dive list as well as the shown dive (especially if this is after adding a dive, which is first inserted with the current time and then updated with whatever the user enters). Fixes: #2971 Suggested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-08-16mobile/cleanup: use local variable to simplify codeGravatar Dirk Hohndel
The old code wasn't wrong, and likely the compiler turned this into something that wasn't really terrible... but yeah, 5 unnecessary calls to a helper function just bugged me. And I think the new code is much easier to read. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-08-16mobile/dive-edit: fix incorrect handling of multi tank gas mixesGravatar Dirk Hohndel
A silly copy and paste error caused us to overwrite the gas mixes for all the tanks with the gas mix in the first tank. Fixes #2913 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-07-14mobile/download: don't allow download without connection setGravatar Dirk Hohndel
It appears that multi line attributes silently fail. Without this change, the Download button is enabled if vendor and product are chosen, even if there isn't a connection selected. With this change (having all three conditions on the same line) the code works as expected. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-14mobile: show sync state in menu plateGravatar Dirk Hohndel
This seems like the easiest way to show the state without disrupting the UI elsewhere. Directly below the email address used for cloud storage. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-14mobile: add status text for cloud sync stateGravatar Dirk Hohndel
This allows the mobile UI to reflect the three states that the dive list can be in: - changes that haven't been written to local storage - there potentially are changes in local storage that were not synced with the cloud - dive list is in sync with cloud storage The last state could be misleading if the user access the cloud from a different device and makes changes to the cloud storage from there, but from the point of view of this device, the states are consistent. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-14mobile: track if we have changes that aren't synced to cloudGravatar Dirk Hohndel
If we haven't connected at all to the cloud server we assume that there are local changes. And whenever we save changes only locally, we also set that flag. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-08mobile/dive-details: restrict width of tags fieldGravatar Dirk Hohndel
Having a lot of tags (or more precisely, a tags string that is very long) could cause the width of the dive details view to extend past the width of the the page. The txtTags label was missing a maximum width, and to make the result more useful, I also added correct wrapping and elide to the mix (stupidly, we had the wrap and width for the fixed name of the field ('Tags'), but not for the user determined content of that field). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-07mobile: add option to merge local cloud cache dataGravatar Dirk Hohndel
The UI is ugly, and of course this is hidden in the developer options that have to first be enabled in the advanced settings. As I mentioned in the previous commit, I believe the actual risk that something gets damaged here is very low, but still, explaining this so it makes sense to the casual user may be a bit... difficult. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-07mobile: add helper to import data from local cloud cacheGravatar Dirk Hohndel
If you pass in the repo name, it isn't treated as cloud storage, but simply as local git storage and imported (i.e., added) to the current dive list. This allows the user to work around failed no-cloud->cloud transitions, merge different accounts, and most importantly deal with situations were conflicts on the server caused us to move a cache out of the way and potentially make dives that were on the mobile device inaccessible to the user. Once a UI is added, this allows the user to recover those dives (realistically this is not really all that potentially 'dangerous' to do, but it's definitely something that would best be done after talking to someone who understands the cloud storage and can guide the user...). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-07mobile: make list of local cloud cache directories availableGravatar Dirk Hohndel
This way QML can show those to the user. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-06-07mobile: tiny whitespace updateGravatar Dirk Hohndel
Every time I edit main.qml, QtCreator fixes this for me. And then I filter it from the commit to not mix white space and actual changes. So let's just get this fixed and move on. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-30mobile/dive-edit: fix broken editable combo boxesGravatar Dirk Hohndel
This is a partial revert of commit 99438121c4 ("mobile/dive-edit: use template components and theme colors") Clearly the information given in the Qt documentation on how to theme ComboBox is flat out broken. The trade-off between 'better dark theme' and 'broken user experience' is fairly easy to make. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-25mobile/credentials: email address must be lower caseGravatar Dirk Hohndel
I could have sworn that I have fixed this several times in various places, but apparently (as shown by todays support emails) it's still possible to setup a mixed case email address. So let's try to solve this problem at the very top. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-22cleanup: create common QDateTime -> timestamp conversion functionGravatar Berthold Stoeger
In analogy to the timestamp -> QDateTime conversion, create a common function. 1) For symmetry with the opposite conversion. 2) To remove numerous inconsistencies. 3) To remove use of the deprecated QDateTime::toTime_t() function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-18mobile/dive-edit: use template components and theme colorsGravatar Dirk Hohndel
Another small step to make the dark theme at least marginally useful. We now use our template components and add the necessary elements to have consistent text color. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-18mobile/UI: correctly theme template spin boxGravatar Dirk Hohndel
This was all hard coded and wrong. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-18mobile/dc-download: fix dark theme appearanceGravatar Dirk Hohndel
I noticed that the download from dive computer page looked especially bad in the dark theme (a user sent us some screenshots for a different reason) and a quick look at the sources showed that we weren't using our template label. Switching to that gives us the correct size by default so we can drop all those explicit font size parameters. And we get the correct color as used in the theme. One random whitespace cleanup snuck into this commit. Oh well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-14mobile/dive-details: show tagsGravatar Dirk Hohndel
So far the user can't edit them, but at least they are now shown as part of the dive details. Usage of tags varries widely, I've seen people who use a LOT of tags to classify their dives, so I'm giving this a complete row by itself. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-14mobile/dive-details: less whitespace at the topGravatar Dirk Hohndel
This always seemed odd - the location looked like it sat 'low' on the screen. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-14mobile/dive-details: use our labels to create denser displayGravatar Dirk Hohndel
This makes better use of the screen real estate, without (IMHO) seeming too crowded. This is a tough balance to strike. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-14mobile: reduce vertical white space around labelsGravatar Dirk Hohndel
Our labels all seem to have a lot of empty vertical space around them. Try to be a bit more conservative with space. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-14mobile: add smaller, vertically dense template labelGravatar Dirk Hohndel
By default single line text has too much white space around it. This smaller, denser label works well to more efficiently use screen real estate, I think. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-07cleanup: invert control-flow when resetting the core structuresGravatar Berthold Stoeger
To reset the core data structures, the mobile and desktop UIs were calling into the dive-list models, which then reset the core data structures, themselves and the unrelated locationinformation model. The UI code then reset various other things, such as the TankInformation model or the map. . This was unsatisfying from a control-flow perspective, as the models should display the core data, not act on it. Moreover, this meant lots of intricate intermodule-dependencies. Thus, straighten up the control flow: give the C core the possibility to send a "all data reset" event. And do that in those functions that reset the core data structures. Let each module react to this event by itself. This removes inter-module dependencies. For example, the MainWindow now doesn't have to reset the TankInfoModel or the MapWidget. Then, to reset the core data structures, let the UI code simply directly call the respective core functions. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
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>