aboutsummaryrefslogtreecommitdiffstats
path: root/core
AgeCommit message (Collapse)Author
2019-10-14Stop support Qt versions before 5.9Gravatar Dirk Hohndel
There's just no point to testing these outdated versions. Everything we build is now Qt 5.9 or newer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-09Cloud storage: remove outdated certificate hackGravatar Dirk Hohndel
The old server certificates where not recognized on some older platform, so we hardcoded the hex digest of the valid certificate and ignored the error. Those certificates have been replaced last week, so there is no point to this hack anymore - also, we should always show the SSL error, not just in verbose mode. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-05Cleanup: remove bogus code that slipped in earlierGravatar Dirk Hohndel
Commit df4fbf7699 ("Android: force different font on OnePlus devices") inadvertantly added this hunk - let's undo it again. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-03Analyze gasswitches in CCR bailoutGravatar Robert C. Helling
The test if we have to create gas switches wasn't yet aware of the bailout option. Reported-by: Dennis Arreborg <dennis@arreborg.eu> Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-10-02Avoid duplicate debug output from GPS moduleGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-02Import: keep dive and dive site tables in DiveImportedModelGravatar Berthold Stoeger
The DiveImportedModel and DownloadThread used the same table of dives and dive sites. This made it very hard to keep the model consistent: Every modification of the download thread would make the model inconsistent and could lead to memory corruption owing to dangling pointers. Therefore, keep a copy in the model. When updating the model, use move-semantics, i.e. move the data and reset the tables of the thread to zero elements. Since the DiveImportedModel and the DownloadThread are very tightly integrated, remove the accessor-functions of the dive and dive-site tables. They fulfilled no purpose whatsoever as they gave the same access-rights as a public field. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02Cleanup: make table argument to get_dive_from_table() constGravatar Berthold Stoeger
Even though the returned dive is not const, the table is not changed, as it only contains pointers. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02Cleanup: remove dive_table and dive_site_table Q_METATYPEsGravatar Berthold Stoeger
These are not passed through QML anymore. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02Import: remove QML properties from DownloadThreadGravatar Berthold Stoeger
QML doesn't access these directly anymore but goes via the model. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02Core: implement move functions for dive and dive_site tableGravatar Berthold Stoeger
To allow efficient moving of downloaded dives from the download thread to the model, implement a general move function that moves table data. Instantiate that function for the dive and dive_site tables. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-27Revert the singleton PRGravatar Dirk Hohndel
It turns out that this isn't working the way it was intended to. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-25Cleanup: remove GpsLocation::instance() functionGravatar Berthold Stoeger
The last user was removed in 8576edd8d611f06fcbd452d88bbc3d46c39d1b9f. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-25Cleanup: unify idiosyncratic singletonsGravatar Berthold Stoeger
The way we handle singletons in QML, QML insists on allocating the objects. This leads to a very idiosyncratic way of handling singletons: The global instance pointer is set in the constructor. Unify all these by implementing a "SillySingleton" template. All of the weird singleton-classes can derive from this template and don't have to bother with reimplementing the instance() function with all the safety-checks, etc. This serves firstly as documentation but also improves debugging as we will now see wanted and unwanted creation and destruction of these weird singletons. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-25Cleanup: remove GpsLocation::hasInstance()Gravatar Berthold Stoeger
This function was not used anywhere. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-21Core: add unique id to tripGravatar Berthold Stoeger
To make it easier to pass around trips through QML, give each trip a unique id. The id is generated in alloc_trip() and uses the same function to generate unique dive ids. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-21Export: move dive site selection logic to C++Gravatar Berthold Stoeger
When exporting dive sites, the dive sites to be selected were collected in the C-core. But that doesn't have access to the selected dive sites if in dive site mode. Therefore, collect the dive sites in C++ and pass down to the core. Use a std::vector to avoid memory management woes. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-21Cleanup: make location argument to put_location() constGravatar Berthold Stoeger
Since this is an output function, the pointed-to value is not modified. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-21Cleanup: replace is_dive_site_used() by is_dive_site_selected()Gravatar Berthold Stoeger
is_dive_site_used() had a "selected" parameter. If true it would return whether the given dive site had a selected dive. Turns out all callers had this parameter set to true. Therefore, replace by a simplified function without the "selected" parameter and give the function an appropriate name. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-21Cleanup: make two functions in core/save-xml.c of static linkageGravatar Berthold Stoeger
These functions were not used outside of the core/save-xml.c. Make them local. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-21Android: bundle default font for use in OnePlus devicesGravatar Dirk Hohndel
This is working around a Qt Bug https://bugreports.qt.io/browse/QTBUG-69494 which prevents correct rendering of the OnePlus fonts. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21Android: print Android HW informationGravatar Dirk Hohndel
This uses Android methods through JNI. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21Android: add FTDI based DiveSystem / Ratio / Seac dive computersGravatar Dirk Hohndel
This way they can be used on a mobile device that supports our way of doing USB on Android. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-14Grantlee: split out grantlee-only property from DiveObjectHelperGravatar Berthold Stoeger
The cylindersObject list was only used by grantlee but not by the mobile code. Since it is quite heavy, split it out and thus don't generate it for every dive on mobile. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Mobile: transform DiveObjectHelper into value-typeGravatar Berthold Stoeger
Instead of handing a reference-to-dive to QML, prerender all the needed properties and store them as values in DiveObjectHelper. Exception: - date(): generated from timestamp - time(): generated from timestamp - cylinderList(): does not depend on dive anyway and should be made static. This hopefully avoids the random mobile crashes that we are seeing. Clearly, this code needs to be optimized, but it is a start. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Cleanup: make cylinder_t argument to CylinderObjectHelper constGravatar Berthold Stoeger
CylinderObjectHelper copies state from the passed in cylinder_t but does not modify it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-14Cleanup: remove unused function DiveObjectHelper::cylinder(int)Gravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
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: 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: 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-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-08-29 Fix broken windows build with latest MXEGravatar Paul Buxton
Replaces some enums with names that do not clash with windows #defines. Specifically: ERROR -> ERRORED, PASCAL->PASCALS, IGNORE->IGNORED,FLOAT->FLOATVAL Signed-off-by: Paul Buxton <paulbuxton.mail@googlemail.com>
2019-08-28Fix new CNS calculation - remove error with factor of 10Gravatar Stefan Fuchs
Fix a typo in the new CNS calculation which introduced a error of factor 10. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2019-08-28Profile: properly initialize plot_info structuresGravatar Berthold Stoeger
The create_plot_info_new() function releases old plot data. This can only work if the plot_info structure was initialized previously. The ProfileWidget2 did that by a memset, but other parts of the code did not. Therefore, introduce a init_plot_info() function and call that when generating a plot_info struct. Constructors would make this so much easier - but since this is called from C, we can't use them. Fixes #2251 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-08-26Show surface degassing in the planner only when configured time != 0Gravatar Stefan Fuchs
This prevents from useless "Air" tag in profile when this feature is not used. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2019-08-24Update libdivecomputer to support the Aqualung i200cGravatar Linus Torvalds
I got confirmation from Tiago Thedim Dias that my libdivecomputer patch makes BLE downloading work from the i200c, and already pushed out the libdivecomputer changes earlier. This updates the subproject in subsurface to have those changes. This also adds the bluetooth name patterns for the i300c and a few other Aqualung dive computers we hadn't added yet. That should make them show up in the bleutooth device list even without having to check the "Show all bluetooth devices" check-box. Tiago claims he didn't need that, and I wonder if we have some overly permissive match somewhere, but it's the right thing to do regardless. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-08-22Grantlee: generate vector of cylinder data on-demandGravatar Berthold Stoeger
Instead of generating cylinder data in the form of CylinderObjectHelper objects for every DiveObjectHelper, generate it only if needed. DiveObjectHelper is used extensively in the mobile interface, which doesn't use the cylinder data. Let's not generate unnecessary CylinderObjectHelpers in this case! Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>