Commit graph

9577 commits

Author SHA1 Message Date
Dirk Hohndel
ff5bd062f6 Location service: instantiate location provider in the desktop UI
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-18 18:52:44 -08:00
Dirk Hohndel
456cc3955a Location service: move into subsurface-core
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-18 18:34:49 -08:00
Dirk Hohndel
0b804e5b21 Location service: make message delivery configurable
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>
2015-11-18 18:10:58 -08:00
Dirk Hohndel
d70f85ce35 Cloud storage: modify protocol for checking cloud connectivity
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-18 17:57:13 -08:00
Dirk Hohndel
d9ded26b86 Location service: set user agent string
This allows the backend to know which version of Subsurface is
contacting it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-18 14:44:07 -08:00
Dirk Hohndel
4cf20c3448 Cmake: add SUBSURFACE_MOBILE definition earlier
This way it is set when subsurface-core is built.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-18 14:41:47 -08:00
Dirk Hohndel
74b15922f3 Location service: retrieve the userid using the cloud storage API
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>
2015-11-18 13:14:19 -08:00
Dirk Hohndel
18e52c1da4 QML UI: remove manual setting of web service userid
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>
2015-11-18 13:12:34 -08:00
Dirk Hohndel
ddef5650f6 Make Subsurface-mobile compile again
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>
2015-11-16 15:38:29 -08:00
Lubomir I. Ivanov
e6c86700e4 qthelper.cpp: improve getFormattedCylinder()
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-16 15:07:07 -08:00
Lubomir I. Ivanov
7e749e8ea4 qthelper: also support "maxcns" and "otu" in Grantlee HTML
Fixes #962

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-16 15:06:32 -08:00
Lubomir I. Ivanov
c78a560442 templatelayout.h: expose cylinders and weights in Grantlee HTML
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>
2015-11-16 15:04:25 -08:00
Lubomir I. Ivanov
3365a506ef templatelayout.h: expose "dive.suit" as a Grantlee HTML variable
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>
2015-11-16 15:03:59 -08:00
Lubomir I. Ivanov
dd944ab33f qthelper: add means to retreive weight and cylinder info in Dive
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-16 15:03:50 -08:00
Lubomir I. Ivanov
a34dfe8284 qthelper.cpp: define EMPTY_DIVE_STRING
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-16 15:03:35 -08:00
Lubomir I. Ivanov
7de22e69b2 CMakeLists: use correct 'desktop-widgets' path
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-16 09:26:15 -08:00
Lubomir I. Ivanov
1efb747338 dive.c: fix a couple of comment typos
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-16 09:26:08 -08:00
K. \"pestophagous\" Heller
0a2f5d25c0 Parse html links in the Notes section.
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>
2015-11-15 22:22:53 -08:00
K. \"pestophagous\" Heller
99ed01e571 Make "Save Preferences" button mutate "prefs" struct.
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>
2015-11-15 22:22:41 -08:00
K. \"pestophagous\" Heller
f44c98d9c5 Restore proper spin-box/slider behavior for animation setting.
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>
2015-11-15 22:22:34 -08:00
Lubomir I. Ivanov
f5dbc3b44d Planner: support profile in planner print
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>
2015-11-15 21:07:27 -08:00
Lubomir I. Ivanov
1d4075f368 printing_templates: mark 'dive.notes' as 'safe'
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>
2015-11-15 21:07:12 -08:00
Lubomir I. Ivanov
00a085f858 qthelper.cpp: support line breaks for notes when printing
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-15 21:06:46 -08:00
Stephen Hemminger
6cb30ba1b6 simple spelling changes
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-15 12:10:37 -08:00
Lubomir I. Ivanov
84b7a37869 subsurfacestartup.c: leave free_prefs() empty
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-15 10:29:36 -08:00
Lubomir I. Ivanov
e0f4e61030 planner.c: fix 'disclaimer' pointing to stack memory
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>
2015-11-15 10:08:28 -08:00
Dirk Hohndel
3453234a3b Missing half of the previous commit
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>
2015-11-14 10:43:37 -08:00
Dirk Hohndel
b688f417de Location service: send dive site name
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>
2015-11-14 09:39:20 -08:00
Dirk Hohndel
97fa132202 Move proxy initialization into shared code
This way we can use the same code on desktop and mobile app.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-14 09:39:02 -08:00
Dirk Hohndel
76d0763527 Location service: make distance and time threshold configurable
Right now the distance is always in meters, the mobile app doesn't deal
with units at all, anyway.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-14 09:10:06 -08:00
Dirk Hohndel
24404a401d QML UI: userid is stored in General settings
Not inside the CloudStorage group.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-14 09:08:51 -08:00
Dirk Hohndel
df6c73d503 QML UI: actually store the userid setting
Forgot to hook this up.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-14 09:07:14 -08:00
Dirk Hohndel
7afed04520 Location service: upload GPS fixes to webservice
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>
2015-11-13 17:21:43 -08:00
Dirk Hohndel
577da54454 Location service: add ability to delete all stored GPS fixes
This may need an "are you sure" confirmation dialog...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-13 17:20:45 -08:00
Dirk Hohndel
fcbc013cb4 Location service: Correctly access the last stored GPS fix
Now only storing fixes after a certain time / distance actually works.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-13 17:17:47 -08:00
Dirk Hohndel
d65b756c4f QML UI: add preference for webservice user id
This handles the user id for the Subsurface webservice for GPS location
tracking.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-13 17:15:28 -08:00
Dirk Hohndel
6124842b0c Location service: only request a fix once every 5 minutes
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>
2015-11-13 12:09:10 -08:00
Dirk Hohndel
fb06d27593 Location service: make persistant storage work correctly
Ouch that's an embarrassing bug. Oh well. Shift happens.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-13 11:57:02 -08:00
Dirk Hohndel
6a70793ba8 Location service: report number of recorded GPS fixes
This is mostly for debugging, to make sure that the recording of GPS fixes
works as expected.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-13 09:17:13 -08:00
Dirk Hohndel
4b39971978 Location service: apply the saved GPS fixes to dive list
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-12 20:23:00 -08:00
Dirk Hohndel
5873a08197 Location service: add member to apply the gps locations to dives
This is a direct conversion of the existing code in subsurfacewebservices
to the different data structures in use here. I did not try to abstract
this out to have both share a common helper because I assume that the
Subsurface web service will pretty quickly become obsolete (together with
the companion app).

Right now this is not hooked up anywhere.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-12 14:57:27 -08:00
Dirk Hohndel
a8b0e9aa19 Location service: move GPS data to separate QSettings instance
This way we don't clutter the main settings and we don't have to deal with
making sure we are reading and writing from/to the right group.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-12 13:04:23 -08:00
Wendie Fisher
1b0938034e Next batch of language updates for the user manual
Signed-off-by: Wendie Fisher <wendie@divedad.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-12 11:08:44 -08:00
Salvador Cuñat
19fffba327 SmartTrak import - Add example divelog file
This is the example divelog shipped with Subgear products (OEMs for
Scubapro/Uwatec), just changed the name to be meaningful for the reader
of the dives directory.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-12 07:39:21 -08:00
Salvador Cuñat
427c696c70 SmartTrak import - Add build capability to cmake
This enables posibility of building standalone import tool via cmake.
Adds an option SMARTRAK_IMPORT (defaults to OFF) which, if turned ON,
will require glib-2.0 and libmdb libraries to be installed, and, calling
will produce an executable with the highly original name of smtk2ssrf.

I have no capability to cross-compile to windows, so I haven't even
tried to put this in Win, less say in Mac. I expect linux users which
may be actual users of SmartTrak, to test this before trying to build on
windows, although the target public will probably be the windows users (or
at least, ex windows user).

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-12 07:39:18 -08:00
Salvador Cuñat
ddc7784514 SmartTrak import - CLI parser and GUI files
The tool can be called from CLI with or without arguments, if called with a
single argument (this is, no destination file specified) an usage message will
be displayed on the terminal; if called with arguments, these should be the .slg
file(s) to be imported and a single .xml file to store the resulting Subsurface
formatted data; if called without arguments a GUI will display to select the
file(s) to import and to store.
WARNING, if destination file exists, its previous content will be erased.

The GUI is pretty simple and don't think any more is needed but, as this is my
first QT thing, I expect those with much better knowledge of QT/C++ will
improve it as needed.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-12 07:39:14 -08:00
Salvador Cuñat
dc4d8f26ec SmartTrak import - Support for .slg files import
SmartTrak is a Windows based propietary dive log software by Uwatec, which has
been the reference software for every Scubapro/Uwatec IRda based devices,
ranging from Smart to Galileo. It has just been recently that began to be
substituted by newer softwares like LogTrak and JTrak (these only supports
Galileo or newer devices and don't import SmartTrak's .slg files).i

SmartTrak also supports importing dives from older DataTrak software (oldest
Aladin series, serial based DCs) so most divers using Scubapro/Uwatec products
have probably their dives registered in this log, even those who have just moved
to newest Scubapro/Uwatec DCs.

SmartTrak is based in MS Access database with support for recreational and
technical dives up to 10 tanks, trimix (in later versions, prior versions had
support for just 3 tanks with Nitrox) and SCR/CCR.

In Linux, MsAccess databases are supported via libmdb which in turn depends on
libglib2, so this work has a hard dependency on these two libraries.
Libmdb sees very little (or null) development activity today so it can be
considered a mature library, which, in my opinion, makes it independent of
progresses of libglib2, this way, the tool should build on most Linux
distributions, even oldest ones (well, this will actually be false because of
the other dependencies of Subsurface).

Final note: It hasn't been until very recently that libdivecomputer has included
support for some of the data downloaded from Galileo devices, even today
understanding some of these data is WIP (e.g. alarms, are interpreted as
bookmarks at this moment, and there is a lot of noise coming from the
tanks/gases area in libdc)

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-12 07:39:10 -08:00
Sebastian Kügler
973b68c304 Fix label overflow in divelist
- anchor the label to the left of the date field
- elide the text instead

This fixes the bug in the dive list where the dive's location overflowed
over the date, especially visible on phones in portrait mode.

Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-11 19:06:07 -08:00
Sebastian Kügler
3da912cda8 Cache diveprofile widget in the diveprofile QtQuick item
- paint() can become a hot path, especially when we think about
  repainting the item on size changes. In general, it's a really good
  idea to keep this function as fast as possible, as we want to be able to
  repaint the item when needed. Also, ProfileWidget is pretty heavy to
  set up, so rather spend a bit of memory there.

- Rename profile to m_profileWidget, it already was member var.

- Sizing ... I have to admit I don't understand the rendering of the
  ProfileWidget. I'd like it to do the following things:
	- render at native resolution, we don't want to resize it
	- react to item changes - we want to reset the size and
	  re-render the widget into the item in those cases
	- perhaps be able to use a couple more of the profilewidget's
	  features

Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-11 19:06:00 -08:00
Sebastian Kügler
52b8cb5aa9 profilewidget2: Only add actions in desktop version
This fixes a bunch of warnings in the mobile version where these slots
are not defined (see the corresponding header's conditionals).

Signed-off-by: Sebastian Kügler <sebas@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-11 19:05:33 -08:00