summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
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>
2019-09-06Cleanup: remove accessor functions from MapLocationGravatar Berthold Stoeger
Let's face it: this is a value type. No point in having Java-style getters and setters. Replace by plain old and boring member variables. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Cleanup: remove MapLocation::coordinateChanged signalGravatar Berthold Stoeger
Nobody was listening for that signal. Remove it. This, quite obviously, makse the setCoordinateNoEmit() function redundant. Merge with setCoordinateNoEmit(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Cleanup: remove Q_PROPERTIEs from MapLocationGravatar Berthold Stoeger
We never dish out an object of this type to QML. It is unclear how Q_PROPERTIEs could be of any use. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Cleanup: remove MapLocationModel::count() and the attribute countGravatar Berthold Stoeger
These were not used anywhere and the function was redundant [same result as rowCount()]. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Cleanup: remove MapLocationModel::get() functionGravatar Berthold Stoeger
It was not called anymore. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Cleanup: remove Q_INVOKABLE from MapLocationModel::setSelected()Gravatar Berthold Stoeger
The function does not appear to be called from QML anymore. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Cleanup: remove MapLocationModel::isSelected() functionGravatar Berthold Stoeger
That function was replaced by a model-attribute. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Map: export isSelected as attribute from MapLocationModelGravatar Berthold Stoeger
Recently we changed the MapLocationModel-items to store whether they are selected. Thus, we can directly export an isSelected flag instead of calling a function taking a dive-site argument. 1) This makes the QML easier to read. 2) This avoids passing pointers through QML which has caused us lots of pain. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Cleanup: simplify role handling in MapLocationModelGravatar Berthold Stoeger
To connect a model to QML, one is supposed to provide a QHash<int, QByteArray> MapLocationModel::roleNames() function that returns a role -> attribute-name hash. That was realized by filling the hash in the constructor, storing it as a member variable, using static strings that were declared in the class-definition and defined in the translation unit. Adding a new role was a pain and the whole thing was totally pointless as the attribute names were used nowhere else and the roleNames() function is called only once. Simply do, what we do everywhere else: initialize the hash in the roleNames() function and use normal string literals. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06CHANGELOG.md updateGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Dive site: don't emit divesChanged signals when editing dive siteGravatar Berthold Stoeger
When editing the dive site, for certain fields a divesChanged signal was emitted so that the dive-list can be updated. Arguably it is wrong to decide which fields are relevant to the dive list in the undo-command code. Therefore, let the list catch the dive-site-edited signal and decide itself. But the actual reason for this commit is that if the dive-site field of a dive changes, we might have to reload the dive-location-model because suddenly a new dive site appears. Now if this is done in QML context on some Qt version (notably 5.9) we get crashes later on. But that can happen if the user moves a flag. So in that case only send a diveSiteChanged signal. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Map: highlight correct dive sites in dive site modeGravatar Berthold Stoeger
Since changing the highlighting to use the selected dive, dive sites with no dive were never highlighted in dive site mode. Obviously, because there was no dive to be selected. Therefore special-case all dive-site selection code to recognize when we are in dive site mode. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Filter: reload map on myInvalidateGravatar Berthold Stoeger
Since selection change doesn't to a full map reload, we have to reload the map on filter changes, since the shown dive sites change. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Cleanup: remove TabDiveSite::updateFilter() functionGravatar Berthold Stoeger
This one-liner was called in only one place from the same class. Just fold it into the caller. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Map: calculate the z value in the modelGravatar Berthold Stoeger
Since not fully reloading the map on selection change, the selected sites were not moved to the top. Not calculating the z-value in QML, but making it a simple model property helps. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Selection: properly update selection flag of map locationGravatar Berthold Stoeger
Owing to the recent changes, when the selection flag in the MapLocationModel was not updated correctly when the user manually selected the dive. Do that before raising the divesSelected signal in DiveListView::selectionChanged() because that will cause the MainWindow to repaint the flags. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Desktop: show all selected dive sites on clickGravatar Berthold Stoeger
When clicking a dive site on the map, the QML code would set the selected dive site, but then all dives of dive sites in the vicinity were set. But still only the clicked-on dive site was shown. Therefore, don't set the list of selected dive sites in QML, but later in DiveListView::selectDives(), where we know all the dives that were selected. This, again, gives nasty entanglement of diverse widgets and models. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Map: don't fully reset model on selection changeGravatar Berthold Stoeger
When changing the selection the MapLocationModel was reset. This lead to crashes on Qt-5.9 which are due to QML accessing data that was freed during model reset. This putative Qt bug doesn't happen on newer Qt versions. At least Qt-5.12 is known to work. Instead of fighting the bug, let's simply not reset the model but send a dataChanged() for every element of the MapLocationModel. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Desktop: reload map after refreshing the listGravatar Berthold Stoeger
In MainWindow::refreshDisplay() with doRecreateDiveList=true the map was reset before the dive list was recreated. This makes no sense and only worked because the map was reloaded again when a dive in the list was selected. Reload the map after recreating the dive list. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Map: generate pixmap name in modelGravatar Berthold Stoeger
Experimentation has shown that the image of a flag will only be changed after dataChanged() if it is a simple property. The old code had a complex QML expression and then - for some reason - it didn't work. To give us better control over the flags and avoid full reloads of the map therefore introduce a model-property pixmap name. The name depends on whether the site is selected and if not, whether we are in divesite-edit mode. This makes the code rather convoluted. Firstly, we have to save whether the site is selected in the map-item. Secondly we have to access the global map-widget, which in turn has to go to the map-widget helper (layering violation!). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06Map: explicitly reload selected map on clickGravatar Berthold Stoeger
When clicking on a flag 1) The QML would call MapLocationModel::setSelected() with fromClick = true 2) MapLocationModel::setSelected() would emit a signal selectedLocationChanged() 3) MapWidgetHelper would catch that signal and do the actual processing. Other functions would call MapLocationModel::setSelected() with fromClick = false, which would not emit the selectedLocationChanged() signal. Detangle this a bit by calling the selectedLocationChanged() function directly from QML and remove the fromClick parameter. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>