aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2019-09-14Cleanup: remove unused function DiveObjectHelper::weight(int)Gravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: remove DiveObjectHelper to bool castsGravatar Berthold Stoeger
These were temporary functions as long as DiveObjectHelpers were used to access dives. All users now access the core directly and therefore don't have to test DiveObjectHelpers for validity. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: remove DiveObjectHelper::getDive()Gravatar Berthold Stoeger
Don't provide access to the raw dive in DiveObjectHelper. All users now access the core directly. This is a step in making DiveObjectHelper value-based. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: Map directly from source in DiveListSortModel::getIdxForId()Gravatar Berthold Stoeger
Instead of looping over all dives and search the dive with the given id, let the source model determine the index and map that. Thus, we do only one mapping and don't generate a ton of DiveObjectHelpers. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: provide direct access to dives in DiveListModelGravatar Berthold Stoeger
Accesses were via DiveObjectHelpers. Provide a direct access to struct dive *. Use this for the filter - there is no point in mass generating DiveHelperObjects in the filter code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: create DiveObjectHelper only when neededGravatar Berthold Stoeger
In DiveListModel::data() a DiveObjectHelper was created for any data-access. Create it only when a DiveObjectHelper is actually returned. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: remove dive argument from DiveListModel::insertDive()Gravatar Berthold Stoeger
Since DiveListModel does not keep its own list of dives anymore, insertDive() doesn't use the DiveObjectHelper argument. Remove it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: use value semantics for DiveObjectHelper in qmlmanager.cppGravatar Berthold Stoeger
Instead of creating a pointer-to-DiveObjectHelper in commitChanges, use a normal object. Thus, we don't have to think about ownership issues with respect to this object. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: replace clear()/addAllDives() pairs by reload()Gravatar Berthold Stoeger
The clear()/addAllDives() pair was bogus as the former didn't clear the model (this is not possible anymore - the model represents the core dive list) and the latter readded all dives again. Replace this by a reload() function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Cleanup: remove DiveListSortModel::addAllDives()Gravatar Berthold Stoeger
This function was never used. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: Generate DiveObjectHelpers on the flyGravatar Berthold Stoeger
Instead of keeping track of a list of DiveObjectHelpers, generate them on-the-fly in DiveListModel. Thus, there is less danger of model and core getting out of sync. On the flip-side, now the DiveListModel and the DiveListSortModel might get out of sync. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14DiveObjectHelper: Turn DiveObjectHelper into Q_GADGET based objectGravatar Berthold Stoeger
DiveObjectHelper is a tiny wrapper around dive * to allow access to dive data from QML and grantlee. It doesn't have to be a full-fledged QObject with support for signals, etc. Therefore, turn it into a Q_GADGET based object. This allows us passing the object around as object, not as pointer to DiveObjectHelper. This makes memory-management distinctly easier. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: return depthDuration directly from DiveListModelGravatar Berthold Stoeger
We don't want to generate a DiveObjectHelper numerous times for every item in the dive list. Therefore, return this data directly from the model. In this case, don't remove from DiveObjectHelper, as these data might be used by grantlee templates. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: return location directly from DiveListModelGravatar Berthold Stoeger
We don't want to generate a DiveObjectHelper numerous times for every item in the dive list. Therefore, return this datum directly from the model. In this case, don't remove from DiveObjectHelper, as this datum might be used by grantlee templates. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: return dive-number directly from DiveListModelGravatar Berthold Stoeger
We don't want to generate a DiveObjectHelper numerous times for every item in the dive list. Therefore, return this datum directly from the model. In this case, don't remove from DiveObjectHelper, as this datum might be used by grantlee templates. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: return dive-id directly from DiveListModelGravatar Berthold Stoeger
We don't want to generate a DiveObjectHelper numerous times for every item in the dive list. Therefore, return this datum directly from the model. In this case, don't remove from DiveObjectHelper, as this datum might be used by grantlee templates. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: return dateTime directly from DiveListModelGravatar Berthold Stoeger
We don't want to generate a DiveObjectHelper numerous times for every item in the dive list. Therefore, return this data directly from the model. In this case, don't remove from DiveObjectHelper, as these data might be used by grantlee templates. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: move tripNrDive from DiveObjectHelper to DiveListModelGravatar Berthold Stoeger
We don't want to generate a DiveObjectHelper numerous times for every item in the dive list. Therefore, return this datum directly from the model. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: move tripId from DiveObjectHelper to DiveListModelGravatar Berthold Stoeger
The canonical way of displaying lists in Qt is via models. Thus, return the tripId directly from the DiveListModel instead of going indirectly via a DiveObjectHelper. In the future, this will allow us to make the DiveObjectHelper value-based, as it is not generated numerous times for every list item. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: remove full-text properties from DiveObjectHelperGravatar Berthold Stoeger
These properties are not needed anymore, because the full text search was decoupled from the DiveObjectHelper. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: decouple full text search from DiveObjectHelperGravatar Berthold Stoeger
1) The full text search was looping over the DiveListModel when it could simply loop over the core model. Do that instead. 2) Don't generate a DiveObjectHelper to do a full text search. Currently this is harmless as the DiveObjectHelper is only a disguised "dive *". But from a conceptual point of view, it represents the full representation of a dive and we don't want to generate that in a tight loop. This will help in 1) Making the DiveObjectHelper a non-reference object. 2) Moving fulltext search to the core and thus making it available to desktop and more performant. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-11Add 'download_error()' helper for libdivecomputer download error reportingGravatar Linus Torvalds
In the previous commit, we just continued downloading dives when download errors happened, but that also makes problems a lot easier to miss because now they are possibly just transient reports in the progress bar that get overwritten by the next dive being downloaded. So this turns a number of these errors from using 'dev_info()' to use a new 'download_error()' reporting model, which then uses the generic subsurface error reporting functionality that is sticky and can handle multiple errors. It also adds a few 'dev_info()' calls for actual informational messages about the state of downloading, although the new ones will probably mainly end up happening before the progress bar is actually shown. But it might improve on some of the progress messages. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-09-11Keep parsing dives even if one dive parse failedGravatar Linus Torvalds
Eric Charbonnier reported a problem downloading the dives from his OSTC2, and Jef debugged the libdivecomputer log and says: "Your ostc has 75 dives, but subsurface downloaded only one, and then stopped the download. That's because that first dive appears to be corrupt and fails to parse: ERROR: Buffer overflow detected! [in /win/subsurface/libdivecomputer/src/hw_ostc_parser.c:981 (hw_ostc_parser_samples_foreach)] Subsurface (incorrectly) considers that a fatal error and stops the entire download. From a user point of view, it would be much better to ignore the problematic dive, and continue downloading the remaining" Subsurface used to just stop downloading if there were parsing errors, but Jef further says: "How parser errors are handled is up to the application. Aborting the download is probably the worst option here. If a dive fails to parse (because the dive data is corrupt, the parser contains a bug, etc), that does not necessary mean the remaining dives can't be downloaded" so let's change the logic to just continue downloading, and hope other dives work better. We might want to do better error reporting, right now the errors tend to just cause "dev_info()" reports, which just set the progress bar text. So you'll see it in the progress bar as it happens, but it won't get really ever noted as an error, and it's easy to miss. But that error reporting is a separate issue, and this just does the "continue to the next dive" part. Reported-by: Eric Charbonnier <eric.charbonnier69@gmail.com> Suggested-by: Jef Driesen <jef@libdivecomputer.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-09-11Update CHANGELOGGravatar Dirk Hohndel
Forgot to clear this out for the 4.9.3 release; update for the last couple of changes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-11Mobile: deal better with incorrect credentialsGravatar Dirk Hohndel
This could happen if the password was changed from a different Subsurface instance. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-11Mobile: check if credentials are valid before accepting themGravatar Dirk Hohndel
It seems crazy to simply assume that the later code can successfully untangle the various states that the credentials can be in - let's just stay on the credentials enrty page until we have verified credentials. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-11Mobile: add helper function to check cloud credentialsGravatar Dirk Hohndel
This should do the right thing in the various situations of correct & verified credentials, credentials needing PIN verification, invalid email/password combination, incorrect PIN, correct PIN. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-11Mobile: adjust grid unit on very narrow screensGravatar Dirk Hohndel
If the default font size is big enough to leave us fewer than 21 grid units per row, shrink the grid unit. In order for this to create consistent results, we need to reduce the default column width to 21 grid units as well. And with that change, the columnWidth property becomes obsolete. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-11Mobile: reserve space for the hamburger menu on Download pageGravatar Dirk Hohndel
Having a label with no width that can expand wasn't really a great way to do so. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-11Find Qt5WebKitWidgets path and use itGravatar Anton Lundin
When building and installing Qt5WebKitWidgets to a different path than your other qt libraries, you need to actually look for it and find it to be able to use it. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2019-09-11Add the ability to export print template as htmlGravatar Anton Lundin
This way we can view the html generated from a print template, for debugging, validation or printing via your favorite browser. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2019-09-11Use and handle <br/> in DiveObjectHelperGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2019-09-11Cleanup and correct plannernotes htmlGravatar Anton Lundin
This balances the tags to a equal amount of start and end tags in the planner notes html. This also breaks it up with new-lines, so its a bit easier on the eyes, and gives a validator the chance to point out on which line a error is. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2019-09-11Add debug capability to planner notesGravatar Anton Lundin
The output it spits out can be copy-pasted into a html validator like: https://validator.w3.org/nu/#textarea Signed-off-by: Anton Lundin <glance@acc.umu.se>
2019-09-11Show correct notes entry when switching on stopsGravatar Robert C. Helling
When gas switching only on stops is selected, the notes showed an extra line at the not realized stop depth. This eliminates it. It also makes sure there are no 0 second spurious entries. And gas switching takes more than zero time (otherwise we would have to print a line of zero duration for at the gas switch depth). Reported-by: tormento <turment@gmail.com> Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-09-10Cleanup: remove global disclaimer variableGravatar Berthold Stoeger
That was used to store the disclaimer of the last plan. The functionality was disfunctional for a long time, therefore remove the variable. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-10Plan: introduce function that returns disclaimerGravatar Berthold Stoeger
The setting of the disclaimer variable was removed inadvertently some time ago, which removed the disclaimer from the printed plan. Instead, introduce a function that returns the disclaimer with the current deco mode. Use that function to generate the dive notes and for printing. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-10Planner: remove planner disclaimer from old notesGravatar Berthold Stoeger
There used to be code to remove the old planner notes when replanning a dive. It used a global variable and seemed rather brittle. Moreover, the place that set the global variable was inadvertently removed. Therefore has been effectively dead code. Reimplement the functionality, but be more robust by considering that the deco-type may have changed: Split the translated disclaimer string in two parts, before and after the "%s" place-holder. Search for these two parts. Remove the disclaimer and everything after the disclaimer. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-08More translation updatesv4.9.3Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-08Prepare for 4.9.3 releaseGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-08Latest translationsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-07Update libdivecomputer to latest versionGravatar Linus Torvalds
This just merges with Jef's branch, which should hopefully fix the Mares BLUELINK Pro connection issues. Knock wood - I can no longer test it due to lack of hardware. It also improves on the Ratio iDive cylinder pressure transmitter support. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-09-07Dive site: close dive site edit widget when dive site is deletedGravatar Berthold Stoeger
The application could be crashed by 1) Create dive site 2) Edit dive site 3) Undo until dive site is removed 4) Continue editing now non-existing dive site Therefore, hook into the dive-site-deleted signal and if the currently edited dive site is deleted, close the widget. When closing the widget, make sure that the potentially dangling pointer is reset to zero so that there is no other potential use-after-free bug. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Cleanup: remove unused MapWidget::repopulateLabels() functionGravatar Berthold Stoeger
There is the alternative MapWidget::reload() function, which centers on the selected dive-site. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Map: remove MapWidget::repopulateLabels() callGravatar Berthold Stoeger
For historic reasons MapWidget::repopulateLabels() was called in LocationInformationWidget::acceptChanges(). This should not be necessary anymore, as this is done when entering/exiting dive-site-mode. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Map: remove unnecessary MapLocationModel::repopulateLabels() callsGravatar Berthold Stoeger
The LocationInformationWidget repopulated the map labels if the name or location of a site changed. This is unnecessary because the MapLocationModel catches these signals itself. Remove these calls. As an added bonus, calling repopulateLabels() in QML context leads to crashes later on. Therefore this should fix at least one crash condition when dragging a flag on the map while the dive-site-edit-tab is shown. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Cleanup: remove redundant Roles:: qualifier in maplocationmodel.cppGravatar Berthold Stoeger
"Roles" is a C-style enum (i.e. not C++-style enum class). Since that means that the names spill into the outer namespace, the names themselves are prefixed with "Role". Nevertheless the code qualified the names with "Roles::". This is redundant and unnecessary. Remove this redundancy to show that we understand how the language works. Note: we could also transform the enum into an enum class and remove the "Role" prefix from the names. That would arguably be "cleaner", but then the enum doesn't auto-convert to/from int, but Qt uses int to pass the roles to functions. So let's go the simple way that avoids casting. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Cleanup: remove includes from maplocationmodel.cppGravatar Berthold Stoeger
Neither "QDebug" nor "algorithm" were necessary. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Cleanup: remove default constructor from MapLocationGravatar Berthold Stoeger
Since this is no longer a Q_METATYPE, nobody will try to default construct this object. Remove the default constructor and guarantee that there will be no null divesite. Of course, the lack of default constructor means that the default argument to the "selected" member variable should be removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Map: don't derive MapLocation from QObjectGravatar Berthold Stoeger
Map location is 1) A plain value type 2) Never passed to QML Make it a simple C++ class. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>