Commit graph

33 commits

Author SHA1 Message Date
Tomaz Canabrava
5bf0e48700 Remove unused variable
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-07 11:17:16 -08:00
Dirk Hohndel
d42b7f55c4 Introduce separate version number for Subsurface-mobile
This is hard coded in version.cmake for now. The intent is to go to 1.0 in
the first release version and to increment from there whenever we create
an update.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-05 17:00:14 -08:00
Linus Torvalds
288aff9dbb Don't use "get_volume_string()" for cylinder size string
We had two totally different usage cases for "get_volume_string()": one
that did the obvious "show this volume as a string", and one that tried
to show a cylinder size.

The function used a magic third argument (the working pressure of the
cylinder) to distinguish between the two cases, but it still got it
wrong.

A metric cylinder doesn't necessarily have a working pressure at all,
and the size is a wet size in liters.  We'd pass in zero as the working
pressure, and if the volume units were set to cubic feet, the logic in
"get_volume_string()" would happily convert the metric wet size into the
wet size in cubic feet.

But that's completely wrong.  An imperial cylinder size simply isn't a
wet size.  If you don't have a working pressure, you cannot convert the
cylinder size to cubic feet.  End of story.

So instead of having "get_volume_string()" have magical behavior
depending on working pressure, and getting it wrong anyway, just make
get_volume_string do a pure volume conversion, and create a whole new
function for showing the size of a cylinder.

Now, if the cylinder doesn't have a working pressure, we just show the
metric size, even if the user had asked for cubic feet.

[Dirk Hohndel: added call to translation functions for the units]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-25 00:58:09 +01:00
Dirk Hohndel
86ec3d06a2 Correctly round total weight displayed
The code was wrong (and in the case of metric display for weights >= 20kg,
spectacularly wrong) in more or less all cases.

Rounding. It's good for the sole.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-24 08:20:24 +01:00
Dirk Hohndel
a550467e8b QML UI: make unit matching case insensitive
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-20 22:00:07 -08:00
Dirk Hohndel
75bd37e3e5 Clean up conversion helpers
- coding style (ugh - I should have fixed that when I first committed them)
- remove redundant variables
- add similar code to the length and temperature helpers

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-15 07:50:30 -08:00
Joakim Bygdell
8cc4463a1a Add helper function to parse gasmix strings
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-13 10:04:00 -08:00
Joakim Bygdell
6252d0cd3b While parsing weight and pressure we should not change the users settings.
Now it is possible to enter a specific unit that is different from the
unit stored in the preferences. If only numbers are inputed the unit will
be the same as specified by the users preferences.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-13 10:03:50 -08:00
Joakim Bygdell
9c5b97e6cf Add helper to parse pressure strings.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-09 12:10:36 -08:00
Dirk Hohndel
587456190f Add helper function to parse weight strings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-05 22:51:46 -08:00
Tomaz Canabrava
411f455291 Fix bug on the visibility of the Ruler Graph
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-25 13:04:39 -08:00
Tomaz Canabrava
c3137cf07c Language Settings Wrapper
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-24 21:26:45 -08:00
Robert C. Helling
3ae6326847 Simplify image hashing logic
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 14:12:23 -08:00
Tomaz Canabrava
25aa80846b Move Dive class from qthelper.h/cpp to it's own file
and rename it to DiveObjectHelper, since it should be an QObject
based class to make it easier on the QML, grantlee and widgets
side to display the dive's internal data.

each Q_PROPERTY defined in the DiveObjectHelper.h file
can be acessed directly via it's name.

So, if you are on a model that  returns a dive, acess it's name
by dive.name

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08 08:04:44 -08:00
Dirk Hohndel
701f91e4fe Try harder to find the language name that includes country code
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-05 23:41:30 -08:00
Dirk Hohndel
a0aa27e864 QML UI: handle editing of depth
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>
2016-01-01 00:55:34 -08:00
Dirk Hohndel
7ffe7a8c8a Dive list model: add GPS string access
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-26 13:33:10 -08:00
Dirk Hohndel
2882a1ef41 Remove the non-canonical Subusrface version
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-20 07:59:50 -08:00
Dirk Hohndel
729ac7619e Dive model: use the correct time to set the time zone offset
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-08 06:20:51 -08:00
Dirk Hohndel
774f45b98b Fix compile error on Mac
We need a space between the two string literals.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-03 10:42:24 -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
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
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
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
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
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
Robert C. Helling
2075038de1 Store Thumbnails with image hashes
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>
2015-11-09 10:18:10 -08:00
Dirk Hohndel
8a3fb854c2 Preferences: hook up the UI page with the preferences structure
With this the new date and time formats mostly work

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-02 12:51:31 -08:00
Dirk Hohndel
f85883c707 Create date and time formats preferences
Now we can actually change them in preferences instead of just deriving
them from the language set.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-02 12:51:31 -08:00
Tomaz Canabrava
4c0156e3d5 Move all core-functionality to subsurface-core
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>
2015-10-30 10:36:48 -07:00
Renamed from qthelper.cpp (Browse further)