Commit graph

35 commits

Author SHA1 Message Date
Dirk Hohndel
7be962bfc2 Move subsurface-core to core and qt-mobile to mobile-widgets
Having subsurface-core as a directory name really messes with
autocomplete and is obviously redundant. Simmilarly, qt-mobile caused an
autocomplete conflict and also was inconsistent with the desktop-widget
name for the directory containing the "other" UI.

And while cleaning up the resulting change in the path name for include
files, I decided to clean up those even more to make them consistent
overall.

This could have been handled in more commits, but since this requires a
make clean before the build, it seemed more sensible to do it all in one.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04 22:33:58 -07:00
Dirk Hohndel
bf798390fa Avoid dangling else warnings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-03 14:29:19 -08:00
Lubomir I. Ivanov
1d06c383a2 DiveHelperObject: add the weightList and cylinderList properties
"weights" and "cylinders" are QStringList Q_PROPERTIES, and Grantlee
should be able to render them, but it doesn't.

To be able to print the whole list of weights and cylinders we
introduce two new QString properties "weightList" and "cylinderList".

The variable replacement in the previous patch deals with the
conversation of the user side HTML, e.g.:

USER                  ->   INTERNAL
"{{ dive.weights }}   ->   {{ dive.weightList }}"
"{{ dive.cylinders }} ->   {{ dive.cylinderList }}"

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-29 07:33:31 -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
06ad45c48f Add dive property to easily test if there isn't an actual dive
Right now this just tests for zero duration, but maybe this should also
return true for positive duration and max depth of 0.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-14 16:26:37 -08:00
Miika Turkia
8e4b4c788a Grab pressures from samples if required
If cylinder does not have start and end pressures assigned, attempt to
grab them from the samples instead.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-14 12:37:37 -08:00
Miika Turkia
8c38dbf3b7 Test cylinder usage properly
It is better to use the proper function to test if cylinder is in use
than just checking the description.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-14 12:37:30 -08:00
Joakim Bygdell
a01bcd82aa Add helper function to retrieve first gas
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-13 10:03:56 -08:00
Joakim Bygdell
f3b35d175a QML UI: add function to get cylinder pressures
Since we only show the first cylinder we can also only edit the first cylinder.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-09 12:10:50 -08:00
Dirk Hohndel
ad7fb80d0a DiveObjectHelper: check if dive has only one weightsystem
The mobile app should only allow editing the weight entry if there is no
second weight defined.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-05 22:53:12 -08:00
Dirk Hohndel
535a6b9b25 Simplify sumWeight function
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-05 22:52:30 -08:00
Joakim Bygdell
9342dedb26 Move helper function to DiveObjectsHelper
As per Tomaz recomendation the helper functions from 19588ce and e072596
are moved from qmlmanager to DiveObjectsHelper.

[Dirk Hohndel: merged with the latest code]

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-27 11:18:44 -08:00
Dirk Hohndel
35e60a7355 QML UI: don't combine multiple trips to the same location into one
The way sectioning of the dive list works is by watching for different strings
in the section.property. In order to be able to tell different trips apart we
combine the address of the dive trip variable with the location (which will
create a new section for a new trip, even if the location text is the same) and
then strip that information out before showing the trip header.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-26 20:06:30 -08:00
Dirk Hohndel
6faf33047e Return a value when getting SAC rate
Obvious "mass edit" error.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-21 12:41:40 -08:00
Tomaz Canabrava
abd05f0d21 Simplify: remove weigths and cylinders.
This finishes the first round of Simplication patches for the QML
basecode. The second one will be about the preferences.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11 15:47:07 -08:00
Tomaz Canabrava
7a740d25a8 Simplify: return date and time directly
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11 15:47:07 -08:00
Tomaz Canabrava
3a72699bfd Simplify: remove the gas variable
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11 15:47:07 -08:00
Tomaz Canabrava
28f4e12725 Simplify: remove variable tags
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11 15:47:07 -08:00
Tomaz Canabrava
9f4bc61f62 Simplify: remove SAC variable
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11 15:47:07 -08:00
Tomaz Canabrava
04704d02c8 Simplify: remove gps variable
And also use existing helper function to get the GPS string

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11 15:47:07 -08:00
Tomaz Canabrava
e2bc3b0e24 Simplify: remove m_notes variable
I didn't understood the logic of the define & replace,
so maybe we want a few comments there.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11 15:47:07 -08:00
Tomaz Canabrava
6f95242ff1 Simplify: remove Maxcns and OTU variables
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11 15:46:59 -08:00
Tomaz Canabrava
75561ff956 Simplify: remove suit and trip
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11 15:46:20 -08:00
Tomaz Canabrava
8929d6eb1a Simplify: remove waterTemp variable
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11 15:46:12 -08:00
Tomaz Canabrava
8e8c32d26e Simplify: removed buddy and airTemp variable
also fixed a bug on the depth

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11 15:46:12 -08:00
Tomaz Canabrava
a6796d9c80 Simplify: removed divemaster
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11 15:46:11 -08:00
Tomaz Canabrava
0bb661c3e1 Simplify: removed duration and depth variables
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11 15:46:11 -08:00
Tomaz Canabrava
ae222f147c Simplify: removed location variable
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11 15:46:11 -08:00
Tomaz Canabrava
8ead18a43a Simplify: removed timestamp variable
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11 15:46:11 -08:00
Tomaz Canabrava
820cd0c28d Simplify: remove uneeded variable, rating.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11 15:46:11 -08:00
Tomaz Canabrava
438b5df089 Simplify: remove uneeded variable: id
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11 15:46:00 -08:00
Tomaz Canabrava
ed97f9f315 Simplify: QML code handling series
The connection between the C++ core and the QML code leaves a lot of room
for improvement; the following series will do small but important updates
on the code regarding QML and QtWidget coexistence and behavior.

First: simplify wrapper class, removing uneeded variable.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11 15:44:10 -08:00
Dirk Hohndel
19e95efd6f Random whitespace cleanup
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11 06:14:45 -08:00
Dirk Hohndel
a3af5331ea Fix bug setting up DiveObjectHelper
Why would we bail there if the notes are empty?

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 21:14:51 -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