aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qmlmanager.cpp
AgeCommit message (Collapse)Author
2018-10-29Dive site: replace dive->dive_site_uuid by dive_siteGravatar Berthold Stoeger
Replace the UUID reference of struct dive by a pointer to dive_site. This commit is rather large in lines, but nevertheless quite simple since most of the UUID->pointer work was done in previous commits. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-29Dive site: return pointer to dive_site in create_dive_site_*()Gravatar Berthold Stoeger
This changes more of the dive-site interface to return pointers instead of UUIDs. Currently, most call sites directly extract UUIDs afterwards. Ultimately, the UUIDs will be generally replaced by pointers, which will then simplify these callers. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-29Dive site: return pointer to dive_site in get_dive_site_*()Gravatar Berthold Stoeger
As a first step in removing dive-site uuids, change the interface of the get_dive_site_*() functions to return pointers instead of uuids. This makes code a bit more complicated in places where the uuid is extracted afterwards (needed NULL check). Nevertheless, these places should disappear once pointers instead of uuids are stored in the dive-structures. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-23Mobile/filtering: update filter in separate threadGravatar Dirk Hohndel
We can't use that while the model is shown, which is why this isn't hooked up. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-21Add 'location_t' data structureGravatar Linus Torvalds
Instead of having people treat latitude and longitude as separate things, just add a 'location_t' data structure that contains both. Almost all cases want to always act on them together. This is really just prep-work for adding a few more locations that we track: I want to add a entry/exit location to each dive (independent of the dive site) because of how the Garmin Descent gives us the information (and hopefully, some day, other dive computers too). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-10-11Undo: make diverse trip-related operations undo-ableGravatar Berthold Stoeger
AddDivesToTrip, CreateTrip, AutogroupDives, RemoveAutogenTrips and MergeTrips basically all did the same thing as RemoveDivesFromTrip, which was already implemented. Thus, factor our the common functionality and hook it up to make all these functions undo-able. Don't do the autogroup-call everytime the dive-list is rebuilt (that would create innumberable undo-actions), but only on dive-load / import or if expressly asked by the user [by switching the autogroup flag]. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-09Mobile: factor out syncToCloud [3/3]Gravatar Jan Mulder
After the previous commits, we now have a preference that nicely preserves the state of the UI, and we have the well known git_local_only global, that is used to denote whether we want to use to local repo only, or we want to interact with the online cloud as well. This commit gets rid of the now superfluous syncToCloud logic. Instead we simply set the git_local_only directly. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-09Mobile: mark divelist changed on no-cloud to cloud accountGravatar Jan Mulder
This simple one-liner fixes an actual bug. On switching from a no-cloud account to a actual cloud account, the dives from the no-cloud are added to the actual cloud account. And indeed the dives appear correctly. However, when exiting the app right away, these added dives are not commited to the local storage. Simply, the divelist needs to be marked dirty. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-06Import: pass "downloaded" parameter to process_imported_dives()Gravatar Berthold Stoeger
process_imported_dives() is more efficient for downloaded than for imported (from a file) dives, because it checks only the divecomputer of the first dive. This condition is checked via the "downloaded" flag of the first dive. Instead, pass an argument to process_imported_dives(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-06Core: remove preexisting field from struct dive_tableGravatar Berthold Stoeger
Dives are now in all cases imported via distinct dive_tables. Therefore the "preexisting" marker is useless. Remove. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-29Mobile: don't call clear_dive() on deleteDiveGravatar Berthold Stoeger
clear_dive() will be called anyway in the subsequent call to copy_dive(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-23Core: split process_dives() in post-import and post-load versionsGravatar Berthold Stoeger
process_dives() is used to post-process the dive table after loading or importing. The first parameter states whether this was after load or import. Especially in the light of undo, load and import are fundamentally different things. Notably, that latter should be undo-able, whereas the former is not. Therefore, as a first step to make import undo-able, split the function in two versions and remove the first parameter. It turns out the the load-version is very light. It only sets the DC nicknames and sorts the dive-table. There seems to be no reason to merge dives. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-23Mobile/remember DCs: try to match device namesGravatar Dirk Hohndel
We only store the address part of the connection name, so don't try to find an exact match, try to find the sub-string. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-19Mobile: git prefs overrules localeGravatar Jocke
The unit types are set from system locale when the app starts. We need to explicitly set the units to match the unit system that is saved in the git repo. Or we end up with situations where the preferences and git say "metric" but the units are "imperial". Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-12mobile-widgets: remove setTimeThreshold from systemGravatar jan Iversen
Use qPrefLocationService::set_time_threshold and remove from qmlprefs.cpp and qmlmanager.cpp Remark: mobile UI shows time in minutes, while it is stored (and calculated) in seconds. Therefore a /60 when reading and *60 when setting. Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-12mobile-widgets: move distanceThreshold handling to qPrefGravatar jan Iversen
Remove distanceThreshold from qmlprefs and use qPref instead update qml no user experience change Signed-off-by: Jan Iversen <jani@apache.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-11core/settings ... : remove qPref* includes in qPref.hGravatar jan Iversen
reduce number of includes by removing qPref* includes in qPref.h Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-11core: declare cloud_status in qPrefCloudStorageGravatar jan Iversen
qml declaration of cloud_status (defined in pref.h) does not belong in qPref.h but in qPrefCloudStorage Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-11cleanup[4/6], mobile: remove superfluous code from gpslocationGravatar Jan Mulder
Despite the fast that this code is sitting in core, its used mainly from mobile. In 987e221f8e6b7b, the buttons to interact with the GPS webservice were deleted from the UI. Now, delete all the code that was used under these buttons. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-10prefs: git_local_only is not a preferenceGravatar Dirk Hohndel
It's the current state of the app, so it should be a global variable, not a preference. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-06mobile_widgets: correct cloudCredentials save problemGravatar jan Iversen
When installing for the first time cloudCredentials needs to be added, this commit a problem with updating them correctly this problem was caused by da6e8a4cd5d80a4288129bf44b1efad69de1704f Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25mobile-widgets: remove QSettingsGravatar jan Iversen
update qmlprefs and qmlmanager to use qPref Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-23Parse: pass dive_table argument to parse_file()Gravatar Berthold Stoeger
To enable undo of divelog-importing it is crucial that parse_file() can parse into arbitrary dive tables. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-23Cleanup: user properly typed pointersGravatar Berthold Stoeger
A trivial cleanup: replace void by properly typed pointers in cylinder_none() and weightsystem_none(). Moreover, remove the unused function no_weightsystems(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-15mobile-widgets: remove SettingsObjectWrapper and update qPref callsGravatar jan Iversen
remove use of SettingsObjectWrapper:: remove include of SettingsObjectWrapper.h use qPrefFoo:: for setters and getters replace prefs.foo with qPrefXYZ::foo() where feasible (this expands to the same code, but gives us more control over the variable). Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-14core: activate qPrefGeneralGravatar jan Iversen
remove General from SettingsObjectWrapper and reference qPrefGeneral update files using SettingsObjectWrapper/General to use qPrefGeneral this activated qPrefGeneral and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-12Use hex USB VID/PIDGravatar Dirk Hohndel
Except of course that the Android intent does give us these values in decimal. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-12core: activate qPrefLocationServiceGravatar jan Iversen
remove LocationService from SettingsObjectWrapper and reference qPrefLocationService update files using SettingsObjectWrapper/LocationService to use qPrefLocationService this activated qPrefLocationService and removed the similar class from SettingsObjectWrapper. Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-11Android: recognize OSTC 2N when plugged inGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11Mobile: fix saving new diveGravatar Jocke
With the new setup we need to know which state we are coming from when we are saving cylinder related info. When we are adding a new dive we explicitly should save cylinder data to the first cylinder. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11QlmManager: fix cylinderInitGravatar Jocke
Cylinder init should return all cylinders not only the ones present in the logbook. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11Mobile: save pressuresGravatar Jocke
Save start and end pressures for used cylinders. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11Mobile: save gasmixesGravatar Jocke
Same as for cylinder info, we need to make sure that the gasmixes gets saved to the correct cylinder. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11Mobile: save edited cylindersGravatar Jocke
Save the edited cylinder in the correct slot. Since the cylinder number and the used cylinder number need not be the same we first need to test if the cylinder are used. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2018-08-11Whitespace cleanup, extra braces, and null checksGravatar Dirk Hohndel
Thanks to Lubomir for the review. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11Android: fix typo in OSTC3 FTDI device nameGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11QML UI: add callback to run after app is fully initializedGravatar Dirk Hohndel
And then use that to check for pending Intents on Android. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11QML UI: add another product ID to recognized FTDI cablesGravatar Dirk Hohndel
We aren't sure if this is Aqualung specific or generic. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11QML UI: pass the indices for the combo boxes on the downloadpage to UIGravatar Dirk Hohndel
Parse the device string and try to figure out what was plugged in. In some cases we know exactly which vendor and product was plugged in, in other cases we only know which vendor it was, in some cases we don't even know that (if all we see is a generic FTDI cable). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11Android: notify the UI a dive computer was plugged inGravatar Dirk Hohndel
And try to guess which one from the device string we get from the Intent. The function is named to indicate its future use (because once the user plugs in such a device, we should show the download page). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11QML UI: add property to pass detected device name to UIGravatar Dirk Hohndel
If the user plugs in a device on Android we get a device string that should allow us to figure out which dive computer was plugged in. Make that string available to the QML UI. Right now all we do is log it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-07-10core: make qPref::cloud_status the only version of the enumGravatar jan Iversen
add enum to qPref and remove elsewhere update source core to reference qPref. the enum cannot be in pref.h because it is to be used in qml and Q_ENUM need the enum to be defined as part of the class Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-05mobile-widgets: solve cloudstatus register problemGravatar jan Iversen
Use Q_ENUM instad of Q_ENUMS (which is depreciated) since it does the meta registration for all Qt platforms. Q_ENUM require the enum to be defined in the class and cannot refer to a global class, therefore copied enum to class. This commit is made to get the release to work, with minimal changes, this class will be moved to qPref and the double definition solved Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-04core: remove double definition of enum cloud_storage_statusGravatar jan Iversen
Remove cloud_storage_status from qmlprefs.h. usage to qPref:: enum cloud_storage_status is not used from C, but only from C++, and having the same structure defined multiple times is a maintenance challenge. Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-28Android: limit the amount of data copied to clipboardGravatar Dirk Hohndel
The clipboard fails if we attempt to copy more than 1MB of data. But the data buffer used is shared between all transactions 'in flight' and we cannot tell what else is currently using that buffer. Limiting ourselves to 500k of text for the logfiles seems reasonable and hopefully makes it more likely that the transaction will succeed (sadly, Qt doesn't tell us if it failed). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-28iOS and Android: try more logfile locationsGravatar Dirk Hohndel
On some devices (e.g., a Sony Xperia phone) the GenericDataLocation is not app writeable. Instead of just giving app, try a few other default locations as well (and since all of these are actually string lists, try all of the options that Qt gives us). Reasonably, we should only set the libdivecomputer logfile name if we found a writeable location. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-28QML UI: provide information why logfile couldn't be writtenGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-27QML UI: remove unused propertyGravatar Dirk Hohndel
We always save the libdivecomputer log. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-21mobile: iOS/Android: always delete libdivecomputer.log at startGravatar Dirk Hohndel
This way the user doesn't inadvertantly end up with information from a previous run of Subsurface-mobile when they copy the logs to the clipboard. Not sure we should do the same when building for desktop, so right now it's only when building for a device. Reported-by: Thomas Fänge <thomas.fange@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-06-20QML UI: remove unused propertyGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>