This prepares for the smartrack converter webservice.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The INSTALL file was updated to reflect the need to install
qtlocation5-dev (and similar packages on various Linux distros) to prevent
build errors with latest master.
Signed-off-by: Pedro Neves <nevesdiver@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Testing the mobile application on Win32 desktop results
in a crash.
Using ApplicationWindow for some reason makes the executable
enter an inifinity loop on startup until it runs out of RAM.
The output is:
setGeometryDp: Unable to set geometry 160x1200+720+426 on ApplicationWindow_
QMLTYPE_12_QML_111/''. Resulting geometry: 160x885+720+426 (frame: 4, 23, 4,
4, custom margin: 0, 0, 0, 0, minimum size: 0x47, maximum size: 16777215x
16777215).
To fix the crash use "Window" instead of "ApplicationWindow".
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
ACKed-by: Sebastian Kügler <sebas@kde.org>
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>
And disable it if there is no satellite based location service (but see
the comment in the previous commit - this doesn't appear to work
reliably).
Nothing happens when you use the menu entry. This just allows us to hook
this up later.
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>
Instead of directly using the status output for the QML UI, set up the
function used to display messages to the user as part of the constructor.
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>
This should actually not be in the mobile section at all. This needs to be
available on the desktop as well.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It's just not user friendly to have two different user IDs for two
different web services that we provide. Instead in the following commits
we'll add a way to retrieve the location service web service userid with
your cloud storage user id.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is a quick fix but it changes semantice. Previously weight() gave you
the total weight carried, now it just gives you the first weight item on
the list.
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>
This patch adds the following HTML variables:
"dive.cylinders" -> Dive::cylinders()
"dive.cylinderX" -> Dive::cylinder(X)
"dive.weights" -> Dive::weights()
"dive.weightX" -> Dive::weight(X)
The patch also creates some macros to ease the Dive variable
lookup visually.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Having {{ dive.suit }} in the HTML will now return the
suit as QString (from struct dive->suit).
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>
In the spirit of "Do the simplest thing that could
possibly work": capture Ctrl+leftclick mouse events
in the Notes area. If the string under the clicked
position is a valid url, then launch it.
Many common URI schemes will work. Typing a url that
starts with https:// will work. So will mailto: and
file://
See #733
Signed-off-by: K. Heller <pestophagous@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Clicking Save in the preferences dialog will now cause
the GUI to immediately reflect the latest settings (just
as it behaved in 4.5).
Signed-off-by: K. Heller <pestophagous@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In 4.5 the signal-to-slot connections between the QSlider
and the QSpinBox were bidirectional. That setup is still
desirable; it must have been broken accidentally during
preferences refactorings.
Signed-off-by: K. Heller <pestophagous@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The "Print" button in the planner dumps the QTextEdit to
a QPrinter via ::print(). This patch renders the Profile
to a Pixmap which is inserted as Base64 stream in an <img>
tag and fed on top of the QTextEdit HTML contents.
This route preserves the planner notes as text in PDF prints.
The quick alternative is to render the QTextDocument to
a QPixmap as well, but that will not preserve the text
and pagination becomes manual.
Possibly the QTextDocument can be rendered as a QPicture
but pagination is still an issue, while so far there is exactly
one user requesting this feature!
Related small change in ProfileWidget2:
Explicitly hide the tooltip when printMode is true.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Grantlee has a way to display a variable as HTML by
marking it as 'safe' e.g.:
{{ dive.notes|safe }}
This allows any HTML to be preserved when printing.
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>
Right now this always sends the default name for GPS fixes created by the
location service. There isn't much point in making this configurable.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
With this Subsurface-mobile should be able to mostly replace the companion
app. This needs some more testing and fine tuning (for example the minimum
time / distance should be configurable, there should be a location name),
but I think the hard part is done now.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This should prevent the device from draining battery like crazy.
This is not the same as the interval at which we record fixes - getting a
fix every 5 minutes gives us a better chance to notice when we moved the
minimum distance.
Also add some more comments to the code that does the actual handling of
storing the data.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>