aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qmlmanager.cpp
AgeCommit message (Collapse)Author
2020-03-10mobile: remove selectedDiveTimeStamp logicGravatar Berthold Stoeger
Since the selection is now handled in the core this is not needed anymore. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-10mobile: remove updateSelectedDive logicGravatar Berthold Stoeger
Selection is now be handled by the core. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-10mobile/undo: create EditDive commandGravatar Berthold Stoeger
Command that just swaps two dives. This is rather complex, as for example a dive site might be created. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-10mobile: use undo-command to paste divesGravatar Berthold Stoeger
The UI for this is currently disabled (this was lost in the dive list rewrite). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-10mobile: reduce the number of model reloads when opening cloud dataGravatar Berthold Stoeger
The whole load from cloud thing will have to be audited. It appears to me that there are way too many model resets...? The only thing that is left is dive editing. Let's do that next. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-10mobile UI: use undo-command for adding dive.Gravatar Berthold Stoeger
Instead of using the model, copy the code we have in the desktop version which manually creates a 15m/40min dive and passes that to the addDive undo command. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10mobile/divelist: select dive after swipeGravatar Berthold Stoeger
After swiping through the dive list, select the currently visible dive. Thus, the dive is highlighted in the overview pane. The connection with the QMLManager feels atrocious, but I would prefer to have as little logic in QML as possible. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-10mobile/divelist: don't set currentIndex on undo of dive deletionGravatar Berthold Stoeger
The core sets the current dive when undoing something. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-10mobile/divelist: create memory management class for modelsGravatar Berthold Stoeger
Since we want to add a second model, but not have to manage two models everywhere, create a class MobileModels that contains both of the models. When calling reset() on that class, it will reset both of the models, etc. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10mobile/divelist: when clicking on a row, use select_single_dive()Gravatar Berthold Stoeger
This is a small step in unifying mobile and desktop. I'm unsure whether it is correct to play this via the QMLManager or whether we should call form QML directly into the model? Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-09mobile: use undo-command to apply gps fixesGravatar Berthold Stoeger
The goal is to send the signal for the correct dives / divesites and thus not having to reload the whole model. Right now the mobile UI does not yet catch the diveSiteChanged signals. [Dirk Hohndel: small fix to ensure that we trigger a save to storage] Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-09mobile: correctly reset model instead of disconnecting itGravatar Dirk Hohndel
This is a much better workaround for the invalid accesses to the underlying data while transitioning. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-09mobile/undo: remove deletedDive and deletedTrip from QMLManagerGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-09mobile/undo: create undo-action and connect to undo of dive deletionGravatar Berthold Stoeger
Still buggy: Removing a dive followed by undo shows the wrong dive in the list. But clicking on it gives the correct dive. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-09mobile/undo: compile undo commands and call undo command for deletion.Gravatar Berthold Stoeger
First steps towards full undo on mobile. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-09mobile/divelist: connect click on trip to toggle MobileListModelGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-09mobile: remove collapsed model that we no longer useGravatar Dirk Hohndel
The dive list now uses the mobile list model. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-09cleanup: fix NOCLOUD_LOCALSTORAGE leakGravatar Berthold Stoeger
The macro NOCLOUD_LOCALSTORAGE creates the path to the local git repository as a C-string. None of the users were freeing the string and thus leaking memory. Replace the macro by an inline function that creates a QString and pass down to C-functions using the qPrintable() macro. Note that every qPrintable() invocation does a UTF16->UTF8 conversion. This could be avoided by either using a std::string or a QByteArray. However, we are talking about microseconds of CPU time in operations that typically take seconds. Not worth it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-08usb-serial-for-android: switch detection to usb-serial and add more PID/VIDGravatar Dirk Hohndel
If we detect any of the known PID/VID combinations, use 'usb-serial' instead of 'FTDI'. Also add the now supported additional PID/VID combinations. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-07debug: try to capture changes that don't invalidate git cacheGravatar Dirk Hohndel
At least in those cases where we are sending a divesChanged signal we can easily check if the cache was properly invalidated. Of course this won't help in cases where we don't notify the dive list about changes, either. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-06mobile: allow disabling BT support from the command lineGravatar Dirk Hohndel
This is a quick hack to reduce the noise in the log file when chasing other bugs. Maybe this should not be enabled on release builds, but right now I don't think the harm that having this in would do. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-01filter: don't search in background on mobileGravatar Berthold Stoeger
I experienced weird crashes that seemed timing-related when using the filter. Therefore, remove the multi-threading thing. So far no more crashes, but keep a close eye on that. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01filter: introduce people- and tags-filtering in the mobile UIGravatar Berthold Stoeger
Add a combo-box where the user can switch between "fulltext", "people" and "tags" filtering. Connect the combobox to the already existing filter-code. Dirk: make combo-box smaller by using a smaller font and restricting the width. Setting both maximum and preferred widths gives more consistent results. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-17mobile/export: remove most of the export optionsGravatar Dirk Hohndel
A tablet or phone is not a computer. What would you do with a CSV or TeX/LaTeX file on a phone. Yeah, I get it, feature parity. This should never have been merged. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-09Cleanup: remove exportFunc classGravatar Berthold Stoeger
exportFunc was a collections of functions for exporting dive data. It had no state, therefore there is no reason for it to ever be instantiated. Simply remove the class. Rename the saveProfile function to exportProfile so that all export functions start with "export". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-08mobile: prevent crash adding divesGravatar Dirk Hohndel
When the cylinders became a dynamic data structure, a get_cylinder() call suddenly could return a NULL pointer. So use get_or_create_cylinder() for the first call when parsing the user's data. Also, deal with an oddity where the string lists look different because an empty list technically isn't the same as a list with one empty string. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-04Cleanup: remove capture-all lambda clausesGravatar Berthold Stoeger
These were forgotten the last time. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-26code cleanup: whitespace cleanupGravatar Dirk Hohndel
A lot of whitespace issues have snuck in recently, this just cleans those up so that I don't need to hand-edit patches every time I touch this file (since QtCreator automatically fixes whitespace when I make changes). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-26code cleanup: QLatin1Literal is deprecated in Qt 5.14Gravatar Dirk Hohndel
Simply replace it with QLatin1String. There is a tiny performance penalty, but none of that code would care. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20mobile UI: add ability to unset the default cylinderGravatar Dirk Hohndel
This was requested in a 'bug report' by a user. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20core/settings:: remove string functions for unitsGravatar jan Iversen
Remove string version of unit_system, duration_units, length, pressure, temperature, vertical_speed_time, and volume, including tests and make signals strongly typed in C++ Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10whitespace cleanupGravatar Dirk Hohndel
Since writing the file with QtCreator in the previous commit pointed all these out... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10code cleanup: add empty table structuresGravatar Dirk Hohndel
It seemed to make sense to combine all three types in one commit. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29mobile-widgets: use oldStatus in qmlmanagerGravatar jan Iversen
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>
2019-12-29mobile-widgets: add oldStatus variable to qmlmanagerGravatar jan Iversen
oldStatus() is kept in qmlPrefs during the login process to allow for a couple of special cases: - if a user have added dives in NO_CLOUD mode and changes to use the cloud these dives are copied to the Cloud, instead of being lost. - if a user does a bailout from the login process (this should not happen anymore) the old status is restored. The pure solution would be to have oldStatus at the top level (e.g. a property in qml) and only change it when actually being in the login process, however due to way the qmlmanager is written it proved very difficult and not worth the effort. In order to be able to remove qmlPrefs, oldStatus are moved to qmlManager. This commit only contain the creation of the variable and the supporting code. Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29mobile-widgets: remove showPin from qmlmanagerGravatar jan Iversen
Setting showPin is no longer needed, so remove it. Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29mobile-widgets: remove second setCredentialStatus()Gravatar jan Iversen
call setOldStatus() and set_filename(). saveCredentials() will adjust email and password. Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29mobile-widgets: remove first setCredentialStatus() in finishSetup()Gravatar jan Iversen
This setCredentialStatus() will never do anything, because qPrefCloudStorage is identical to prefs.cloud_verification_status, and can thus be safely removed. Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29mobile-widgets: remove setCredentialStatus() from saveCloudCredentials()Gravatar jan Iversen
Revert to the divelist by setting oldStatus() directly to set_cloud_verification_status() This is done to further limit the use of setCredentialStatus() and prepare to remove qmlPrefs. Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29mobile-widgets: remove setCredentialStatus from revertToNoCloudIfNeededGravatar jan Iversen
Update revertToNoCloudIfNeeded() to not use setCredentialStatus() by adding an extra call to setOldStatus() setOldStatus() is called in setCredentialStatus together with set_cloud_verification_status() therefore these 2 calls need to added when removing setCredentialStatus(). Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29mobile-widgets: replace simple setCredentialStatusGravatar jan Iversen
qmlprefs::setCredentialStatus() basically only does something when called with CS_NOCLOUD. A number of setCredentialStatus() calls happen where status cannot be CS_NOCLOUD, and therefore setCredentialStatus() can be safely replaced with set_cloud_verification_status() This limits the use of qmlprefs::setCredentialStatus(), but there are still a couple of more complicated calls. Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29mobile-widgets: credentialStatus() -> cloud_verification_status()Gravatar jan Iversen
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>
2019-12-28mobile-widgets: remove cloudPin() from qmlmanagerGravatar jan Iversen
cloudPin does only have the values "" and NULL, so replace cloudPin() with "" in csa->backend() call remove setting of cloudPin to "" Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-28mobile-widget: simplify saveCredentials() in qmlmanagerGravatar jan Iversen
cloudPin is only set to "" and NULL, therefore and "if" checking if cloudPin is not empty will never have affect. Remove else part. Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-28mobile-widgets: make saveCredentials() an atomGravatar jan Iversen
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>
2019-12-28mobile-widgets: correct faulty connect.Gravatar jan Iversen
1) add comment line (signal to signal) 2) correct spelling error in comment 3) correct connect Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-24mobile UI/login: replace use of cloudPasswordGravatar jan Iversen
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>
2019-12-24mobile UI/login: replace use of cloudUserNameGravatar jan Iversen
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>
2019-12-25mobile-widgets: make saveCredentials() an atomGravatar jan Iversen
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>
2019-12-25Preferences UI: add dive log tabGravatar willemferguson
This adds a tab for dive log - related preferences. A suitable test programs is still required. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>