aboutsummaryrefslogtreecommitdiffstats
path: root/subsurface-core
AgeCommit message (Collapse)Author
2016-01-05Try harder to find the language name that includes country codeGravatar Dirk Hohndel
It seems that the first language in the list of languages isn't always the one that specifies the country code. So try the first three to see which one is the first to contain a country code. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-04Cloud storage: fix potential crash when avoiding reloading dive listGravatar Dirk Hohndel
If we loaded the dive list from cache and then try to figure out if the remote repository had anything different, we were being super stupid if the SHA was identical... we had already cleared the dive list by the time we decided that we didn't need to load things. Granted, the model was still populated (oops), but the backend data structure was cleared and accesses to it (e.g., when drawing the profile) would cause things to crash. The helper function duplicates some code, but trying to not duplicate the code made things even harder to read. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-01Location service: get the current positionGravatar Dirk Hohndel
If we have a fix that is fewer than 5 minutes old, take it, otherwise trigger an update. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-01Location service: support the concept of waiting for a positionGravatar Dirk Hohndel
There may be reasons where we want to get the position even if the criteria aren't met. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-01Location service: restructure the way GpsSource is managedGravatar Dirk Hohndel
It makes much more sense to have this as a private member of the class instead of a static in one of the functions. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-01QML UI: handle editing of depthGravatar Dirk Hohndel
Getting closer to being able to really edit / add dives in the mobile UI. This works for manually added dives - needs a bit more thought for dives downloaded from dive computers as we don't necessarily want to change the maxdepth in conflict with the samples. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-28Git storage: be more careful when checking if this SHA is already loadedGravatar Dirk Hohndel
In commit 8c1cc4524d19 ("Don't reload identical data") I got a little carried away. Before comparing SHAs we need to make sure that a) this is a git repository at all b) we have an actual SHA before we claim to have the data loaded Reported-by: Paul-Erik Törrönen <poltsi@777-team.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-27ftdi: fix memory leak on errorGravatar Stephen Hemminger
Found by cppcheck. Minor memory leak if usb_reset fails Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-27dive: paren error in set point handlingGravatar Stephen Hemminger
This probably is a serious bug, found by cppcheck. Original code had paren's in probably the wrong place! Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-27Don't reload identical dataGravatar Dirk Hohndel
If we already have the same SHA loaded and no changes have been made to the dive list then there is no point in loading the dives again. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-27Cloud storage: check the top commit without loading divesGravatar Dirk Hohndel
This way we can check if the local cache is in sync with the remote without always triggering a load of the dives from git. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-27Add option to not check the remote when loading from git storageGravatar Dirk Hohndel
This way we can first load from cache and then update from the network in the background. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-26Dive list model: add GPS string accessGravatar Dirk Hohndel
If the QML UI needs the GPS information, we need a way to get to it. I'm not convinced that having it as comma separated string is the best way to go, but that's what I need for the Google API so that's what I picked for now. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-20Remove the non-canonical Subusrface versionGravatar Dirk Hohndel
It no longer makes sense to lie about the version. If you are running a product build, then the canonical version is the same version as the plain version used to be. And in either case it makes much more sense to simply log the full version information. We used to have the differently styled versions for different OSs, but I don't think this is needed anymore. Let's hope this doesn't go down as one of these "famous last words" moments... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-19Don't complain about missing GPS source unless mobileGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-15Remove support for older libgit2 - we now require 0.23 or laterGravatar Dirk Hohndel
Also fixes a capitalization error that prevented finding libssh2 in some circumstances. And adds a missing include when building with libzip on Mac. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-08Dive model: use the correct time to set the time zone offsetGravatar Dirk Hohndel
We need to calculate the offset based on the time of the dive - the mobile version doesn't use displayed_dive. This way time stamps are now correct all year round. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-06Uemis downloader: handle yet another corner caseGravatar Dirk Hohndel
If we looking for dive details and are trying to guess the offset between object_id and logfilenr, we need to treat logfilenr 0 as special - it means we read past the end of the list of stored dives and need to walk backwards. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-06Only warn about different number of tanks and gases if there are tanksGravatar Dirk Hohndel
Some backends support giving tank data for some, but not all models that they support (and simply report no tanks for those models that don't support this). The Suunto Vyper is one of the dive computers where this happens and without this change we report angry red warnings after a perfectly correct download. So this changes the logic to only show that error if there actually were tanks reported. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-03Cloud storage: do not store the actual pictures in gitGravatar Dirk Hohndel
Adding pictures to the repository was a big mistake on my part. It's very easy for the git repositories to reach a gigabyte and more making sync times (and especially "first download" times) completely unreasonable. This doesn't solve the problem for existing repositories (as the pictures are already there, in the git history), but at least it prevents us from storing more pictures out there. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-03Crash fix in add_single_dive. No writing to dive_table.dives[-1]Gravatar K. \"pestophagous\" Heller
Signed-off-by: K. Heller <pestophagous@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-03Prevent gaschange tank icons from using garbage coords.Gravatar K. \"pestophagous\" Heller
Tank icons were shown at incorrect spots on the profile when the DiveEventItem object held a pointer to a struct event even after the struct event at that address had been freed. When internalEvent is a pointer to freed memory, internalEvent->time.seconds could have all kinds of crazy values, which get used in member function DiveEventItem::recalculatePos to place the tank at bad x coordinates. The DiveEventItem(s) no longer store a pointer to memory that they do not own. This way, no matter how the path of execution arrives into slot recalculatePos, we never need fear that the DiveEventItem will dereference a garbage pointer to a struct event. Fixes #968 Signed-off-by: K. Heller <pestophagous@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-03Fix compile error on MacGravatar Dirk Hohndel
We need a space between the two string literals. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-03Uemis downloader: ignore leading junk in the dataGravatar Dirk Hohndel
One user's debug log shows valid data, only not in the format we've seen before (with the response starting with '{'). Instead he gets a repeat of the second word in the response to processSync prepended to the expected output. So let's skip the data until the first '{'. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-03Uemis downloader: don't leak memoryGravatar Dirk Hohndel
Don't just clear out the buffer pointer, free the memory, first. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-02Add instance method for GpsLocationGravatar Dirk Hohndel
This way we can call members from different parts of the code. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-01Switch to compile time connect syntaxGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-30Subsurface-mobile: don't create the GPS source until it is neededGravatar Dirk Hohndel
This should accelerate the startup of the UI a little more. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-25Don't overwrite air temperatureGravatar Dirk Hohndel
If we already have an air temperature set, don't overwrite it with potentially less accurate infromation from the first sample. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-24Only close html tags if they were opened beforeGravatar Robert C. Helling
The runtime html table is printed only if printing a verbatim diveplan is disabled. So the closing tags should be printed only in that case. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-24Interpret - as STDOUT on writing xml filesGravatar Robert C. Helling
This prepares for the smartrack converter webservice. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-18libdivecomputer.h: fix warning with DC_VERSION on Win32Gravatar Lubomir I. Ivanov
"warning: "DC_VERSION" redefined" is thrown if a chain of includes previously includes windows.h: In file included from c:/bin/mingw/i686-w64-mingw32/include/windows.h:71:0, from C:/bin/qt/5.5/mingw492_32/include/QtCore/qt_windows.h:63, from C:/bin/qt/5.5/mingw492_32/include/QtGui/qopengl.h:43, from C:/bin/qt/5.5/mingw492_32/include/QtQuick/qquickwindow.h:39, from C:/bin/qt/5.5/mingw492_32/include/QtQuick/QQuickWindow:1, from C:/dev/subsurface/subsurface-core/qt-gui.h:13, from C:\dev\subsurface\subsurface-mobile-main.cpp:9: and which on it's own includes wingdi.h which defines "DC_VERSION 10" (windows printer stack related). To solve the warning DC_VERSION is undefined in subsurface-core/libdivecomputer.h. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-18applyLocations should be a void functionGravatar Dirk Hohndel
Another issue pointed out by Lubomir. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-18gpslocation.cpp: fix signed vs unsinged int comparison warningGravatar Lubomir I. Ivanov
QDateTime::toTime_t() is misleading as it does not return a C time_t type, but a 'unsigned int' or rather the Qt 'uint' typedef. To prevent the warning we cast it to 'time_t' and to comply with the 'lastTime' variable. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-18Location service: when applying GPS locations mark divelist changedGravatar Dirk Hohndel
Lubomir pointed out that this variable was unused. Oops. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-18Location service: check presence of location sourceGravatar Dirk Hohndel
In theory this should only report a location service if this is a satellite based service, but sadly geoclue appears to claim that there is a satellite based service in my Linux VM - so I'm doubtful that this does what the documentation says it does. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-18Location service: instantiate location provider in the desktop UIGravatar Dirk Hohndel
We still aren't doing anything with it, but at least it's there now. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-18Location service: move into subsurface-coreGravatar Dirk Hohndel
While this is primarily something targeted at a mobile device, with many of the 2 in 1 devices it is possible that the user might be running the desktop version of Subsurface on a mobile device. As a first step to make it possible to collect GPS fixes on such a device we need to make the infrastructure to do so available in the desktop application as well. This still needs to be hooked up in the desktop UI. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-18Cloud storage: modify protocol for checking cloud connectivityGravatar Dirk Hohndel
In order to allow the backend to match account in multi user mode, it needs to know if the requests are coming from the same instance of Subsurface. Since I had to change the backend to add the ability to retrieve a location service userid I added this capability at the same time. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-18Location service: set user agent stringGravatar Dirk Hohndel
This allows the backend to know which version of Subsurface is contacting it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-16qthelper.cpp: improve getFormattedCylinder()Gravatar Lubomir I. Ivanov
When the user requests "dive.cylinders" from Grantlee HTML we need to always put at least the default cylinder and mark the description as "unknown" (same as other locations) if it's not set (i.e. when the description pointer is NULL). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-16qthelper: also support "maxcns" and "otu" in Grantlee HTMLGravatar Lubomir I. Ivanov
Fixes #962 Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-16qthelper: add means to retreive weight and cylinder info in DiveGravatar Lubomir I. Ivanov
The Dive helper class only picks the first cylinder and the total weight. This patch adds the option to dump the cylinders and weights as formatted lists (via cylinders() and weights()) or to retrieve a specific cylinder or weight via (cylinder(index) and weight(index)). Each cylinder and weight string contains detailed information: cylinder: - desc. - pressure (+start/end) - gasmix - etc... weight: - desc. - weight (in units e.g. kg) If no description is found for a cylinder or weight the contents for this particular unit is filled with EMPTY_DIVE_STRING ("--"). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-16qthelper.cpp: define EMPTY_DIVE_STRINGGravatar Lubomir I. Ivanov
The macro is used as a common replacer for the "--" string when the Dive class members return no particular information for a "struct dive" property. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-16CMakeLists: use correct 'desktop-widgets' pathGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-16dive.c: fix a couple of comment typosGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-15qthelper.cpp: support line breaks for notes when printingGravatar Lubomir I. Ivanov
The Dive::put_notes() does not handle HTML formatting or line breaks properly. Apparently Grantlee supports HTML variables, but the planned notes (which are HTML) look very bad when inserted in the Grantlee template - e.g. the text is huge and the table box is cut for some odd reason. I don't have a good solution for these issues ATM; especially for the "table cell being cut part". An important feature in the dive notes is to support line breaks. This patch adds support for line breaks both in planned dive notes and non-planned dive notes via the <br> tag. This makes the planned dive notes look tolerable. The next step would be to support the <br> tag, which has to happen in the bundled templates them self. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-15simple spelling changesGravatar Stephen Hemminger
Fix obvious spelling mistakes in comments (and one error message). Yes, this is trivial but I saw one while reviewing some of the code and after that decided to run code through some tools. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-15subsurfacestartup.c: leave free_prefs() emptyGravatar Lubomir I. Ivanov
There is a bug on OSX where free() is called on non-allocated memory in free_prefs(). Most of the preferences are not freed in free_prefs() while copy_string() is used on them, so let's not free() any pointers in free_prefs() and leave them as one-time leaks. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-15planner.c: fix 'disclaimer' pointing to stack memoryGravatar Lubomir I. Ivanov
In add_plan_to_notes() the 'disclaimer' is set to the temporary buffer 'buf'. By making 'buf' static, 'disclaimer' now points to a persistent buffer. Bug was reported as bad characters when printing the planner deco text. Reported-by: Stefan Fuchs <sfuchs@gmx.de> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>