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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
This prepares for the smartrack converter webservice.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
"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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Oops. I fixed the previous commit, tested the fix, and then forgot to
update the commit and instead pushed it out. That was dumb.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
But keep the Interface so it's still userfull to create a new
SocialNetwork when needed, but it will be part of the code,
and not a plugin.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Once again compile time enabled. I guess it would be nice to turn this
into a logfile (just like we have with the libdivecomputer backends).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I user had a Uemis that had a dive log entry for a certain internal id but
no dive info for it. This appeared to be one of those dreaded dives when
the Uemis decides to start a dive at the end of a flight and then stays in
dive mode until it runs out of battery.
Anyway, if we see a number above and a number below, just give up and move
on.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If every dive in a download block from the Uemis was deleted we kept
downloading that same block of dives. With this we remember how far we got
even if the dives ended up being deleted.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This drastically improves the time it takes to select a dive
with several pictures at the expense of longer startup and
bigger hash files.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
On the Mac the info on the download dialog isn't shown. So print it on
stderr as well when in verbose mode.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since we can't forbit the plugins to upload more than just the
current dive, it's better to change the name of the call.
also add a stub to make sure it's calling the right method inside
the plugin.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It appears that the default path we tried to use on Android since commit
80056278f7 ("android.cpp: update path retriaval scheme") didn't work -
so let's just go back to what we used to do as that was perfectly fine.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Subsurface-mobile doesn't have a window title with the name of our file
name at this point, so simply don't try to trigger the update.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This fixes the build for me against Qt 5.5. It seems Android is not
Linux anymore, but uses its own CMAKE_SYSTEM_NAME now, so in this case
we also want to compile android.cpp.
This change should be rather safe, since it catches a condition that was
not previously handled.
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This solves the root problem of most of the dpi-depdent sizing in the
mobile Android version.
When setting a custom font size, we circumvent Android's defaults, which
means that we end up setting the font size further down the road to get
readable fonts.
I suppose this was set in order to make the QWidget-based user interface
"work" on Android. Hard-coding a font size at this central point brings
more headache than needed, one could instead consider adding an #ifdef
Q_OS_ANDROID in main window.
Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This required a bit more untangling, but with this it seems we can build
subsurface-mobile again (at least on the desktop).
Interesting is the removal from inside the ImageDownloader of the call to
DivePictureModel::instance()->updateDivePictures() - which actually could
cause some interesting recursion issues. If it turns out we did indeed
need this, it needs to be re-architected.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
ruleritem.cpp throws an error about incomplete type
'struct gas_pressures'.
'struct gas_pressures' is defined in dive.h, so every header
that has usage of the type needs to include dive.h.
Such a header is profile.h which has 'struct gas_pressures pressures'
in 'struct plot_data', by including dive.h on top of profile.h
every source file (e.g. ruleritem.cpp) that includes profile.h will
now receive knowledge of a complete 'struct gas_pressures' type.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
'default_filename' is obtained from system_default_filename()
but system_default_filename() returns a static pointer
the HEAP memory of which is handled in main().
Remove the free() for 'default_filename' free_prefs()
to prevent a double free().
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The introduction of -std=c++11 breaks usage of M_PI in Mingw,
but technically M_PI is not standard C or C++.
Defining M_PI in units.h solves the issue.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Currently we need to copy manually the plugin dynamic library
to the /plugins folder.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The magic happens here: We are iterating over the plugins
and populating the main menu with all actions provided by
them. Currently we can't test this as we don't have a single
plugin. Next patch series of commits will be adding the
Facebook plugin.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This bit of code will try to load all plugins avaliable.
Now I need to port a Facebook plugin for this new system,
then I'll delete the old preferences widget.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This class is currently very small but the reason of existence
is to allow subsurface to be easily extendable via plugins.
The current type of plugin that I'm making is Social Network,
but another possibilities:
- Dive Simulation Algorithm
- Import/Export Filters
- Profile Overlays
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The Social Network plugins need an interface file to describe
the expected behavior of it, this little header file will serve
for that.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since we have now destkop and mobile versions, 'qt-ui' was a very
poor name choice for a folder that contains only destkop-enabled
widgets.
Also, move the graphicsview-common.h/cpp to subsurface-core because
it doesn't depend on qgraphicsview, it merely implements all the
colors that we use throughout Subsurface, and we will use colors on both
desktop and mobile versions
Same thing applies for metrics.h/cpp
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
And adapt a new CMakeLists.txt file for it. On the way I've also
found out that we where double-compilling a few files. I've also
set the subsurface-core as a include_path but that was just to
reduce the noise on this commit, since I plan to remove it from
the include path to make it obligatory to specify something like
include "subsurface-core/dive.h"
for the header files. Since the app is growing quite a bit we ended
up having a few different files with almost same name that did
similar things, I want to kill that (for instance Dive.h, dive.h,
PrintDive.h and such).
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>