Commit graph

10265 commits

Author SHA1 Message Date
Tomaz Canabrava
726e251ffc Simplify Q_FOREACH
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-07 11:16:44 -08:00
Tomaz Canabrava
3a003cb4fa Silence warnings for the GpsLocation
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-07 11:13:11 -08:00
Tomaz Canabrava
f25dce8511 Create a constructor with default parameters for some structs
Structs and classes in C++ are basically the same thing and we want to
create a few zero-initialized values for some of them; Sadly, C++ doesn't
have the nice static struct initialization that C has.

One way to deal with that is to create a constructor and pass default
values to it, another is lambda-initialization, but we don't use C++11,
yet.

Since we initializate stuff on the constructor, we don't need to
re-initializate things again on the initialization list (which is also why
I removed the QStrings from the initialization lists, they are
automatically initialized to empty)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-07 11:13:11 -08:00
Tomaz Canabrava
2745beca5f Silence warning about unused parameter
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-07 11:00:27 -08:00
Dirk Hohndel
1e8b0874ab iOS build: show correct program name on launch screen
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-06 19:35:37 -08:00
Dirk Hohndel
8a96f6e90b iOS build: bundle application icons and Info.plist
This way the iDevice will show the correct name and icon for
Subsurface-mobile.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-06 17:51:09 -08:00
Dirk Hohndel
ba8014eb5c iOS build: restructure build.sh to create fat libraries
This way QtCreator can successfully link and deploy the app.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-06 17:49:35 -08:00
Dirk Hohndel
7ae4eed734 iOS build: more build.sh hacking
This now can create all the support libraries in armv7, but that isn't
sufficient for QtCreator which wants fat libraries with both armv7 and arm64 in
them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-06 15:11:49 -08:00
Dirk Hohndel
8a6728eb08 Revert "iOS build: add the pri file for generating the version"
This reverts commit 7fac2a38b2.

Oops, that should have been dropped in the rebase before pushing the
changes. I did this instead in commit 99d1d8876e ("iOS build: create
ssrf-version.h by hand")
2016-03-06 11:13:04 -08:00
Dirk Hohndel
99d1d8876e iOS build: create ssrf-version.h by hand
It grabs the mobile version from the cmake file via grep.
🤦

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-06 11:03:11 -08:00
Tomaz Canabrava
7fac2a38b2 iOS build: add the pri file for generating the version
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-06 11:03:11 -08:00
Dirk Hohndel
8d9bffff64 iOS build: fix libdivecomputer build
This uses new configure options added to the Subsurface-branch of
libdivecomputer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-06 11:03:11 -08:00
Tomaz Canabrava
c27a2b47f4 iOS build: fix loading icons
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-06 11:03:00 -08:00
Tomaz Canabrava
933b69a7cc qt-gui.h shouldn't include QApplication
[Dirk Hohndel: refactored the iOS patches]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-06 11:03:00 -08:00
Tomaz Canabrava
997ee6fb40 iOS build: don't include CoreServices on iOS
[Dirk Hohndel: refactored the iOS patches]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-06 11:03:00 -08:00
Tomaz Canabrava
39313c5b33 Clean up handling of various include file
This is in the context of the iOS port and shouldn't impact any of the
other builds.

[Dirk Hohndel: refactored the iOS patches]

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-06 11:03:00 -08:00
Tomaz Canabrava
710b3615fe iOS build: add various support files
It's unclear why the build fails if we don't add the sample app files as
well.

[Dirk Hohndel: refactored the patches]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-06 11:02:48 -08:00
Tomaz Canabrava
74e6e0ed37 iOS build: Updated build script
This now only builds all the prerequisits but not the actual Subsurface
binaries - that will be done with qmake (oh the irony) in a later commit.

[Dirk Hohndel: refactored the patches]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-06 11:02:31 -08:00
Dirk Hohndel
e9e453b009 Android build: pass in build nr
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-05 21:23:27 -08:00
Dirk Hohndel
a64eef7f82 Android build: automate setting the right version number
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-05 17:14:33 -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
Dirk Hohndel
5aa94578f7 QML UI: small modification to About screen
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-05 17:00:14 -08:00
Dirk Hohndel
04f3a6f8d5 Rewrite the Subsurface-mobile user manual
This brings the text closer to the current version of Subsurface-mobile,
but a lot more fine tuning will be required (and of course the images need
to be updated to reflect the current UI).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-04 11:38:01 -08:00
Linus Torvalds
afadb6f05c gas model: use virial cubic polynomial form
The "virial" form of the Z compression factor is of the form

   Z = 1.0 + A*p + B*p^2 + C*p^3 + ..

and it's considered the "right" polynomial form to use.  It happens to
also make for one constant less per gas (since the 1.0 can be added
later), and can be used to simplify the expression and avoid a few
floating point operations.

However, in order for that kind of expression simplification to make
sense, we need to make sure that we don't calculate the powers of the
pressure multiple times either, and that means we have to inline all the
actual calculations.

Our compiler options still mean that the generated code isn't optimal,
but that's a separate issue. And it is a lot better than it used to be.

Being clever about this does potentially make the code a tiny bit less
legible, but maybe that's not too bad for something that we'd expect to
not ever touch once we get it right.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-04 10:18:07 -08:00
Dirk Hohndel
a873711cec QML UI: make sure the drawer is closed after going back to dive list
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-03 15:12:09 -08:00
Dirk Hohndel
80f29bd3f6 QML UI: brute force around Qt 5.6.0 bug
With the current release candidate of Qt 5.6.0 we get into an infinite
recursion of the grid layout engine. This had happened before (prior to the 5.6
beta) and it appeared that setting the maximum width of the columns was
sufficient to fix this. But with the RC even that isn't sufficient, so now we
give up on having QML figure out the best possible column width and hard code
both preferred and maximum width to the same, predefined values. That's a total
shame, but at least now we can build against Qt 5.6 without infinite recursions
and crashes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-03 14:36:57 -08:00
Dirk Hohndel
0cad6d206c QML UI: remove commented out / unused code
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-03 14:35:54 -08:00
Dirk Hohndel
2b1812f2cb Build scripts: work with both Qt 5.5 and 5.6
This is all a bit hackish but seems to work

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-03 14:34:03 -08:00
Dirk Hohndel
01ae4af13d Don't access undefined dive
When walking the dive table we need to stop before accessing the
yet-to-be-added new dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-03 14:29:29 -08:00
Dirk Hohndel
bf798390fa Avoid dangling else warnings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-03 14:29:19 -08:00
Linus Torvalds
a173a3ce79 gas model: simplify and improve our Z factor calculations
Lubomir found better compressibility data for the pure gases that we
need for scuba, making the air table superfluous: we get good values
from just regular linear mixing of the Oxygen, Nitrogen and Helium
calculations.

Also, rather than using a quintic polynomial, a cubic one does
sufficiently well, making for smaller code and fewer coefficients.

And judging by the reactions from people on G+ (as well as just looking
at how good the fit is with the air data), this is all the right way to
do this, and this thus removes the Redlich-Kwong equation.

All-credit-goes-to: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-03 14:19:45 -08:00
Dirk Hohndel
12f36c92e1 QML UI: try to avoid binding loop
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-03 10:51:52 -08:00
Marco Martin
d24e5b455f use the global showPassiveNotification function
don't create a local PassiveNotification copy,
use the global show/hidePassiveNotification from
ApplicationWindow, now that it works

Signed-off-by: Marco Martin <notmart@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-03 10:44:41 -08:00
Dirk Hohndel
93f9bcd041 QML UI: remove incorrect statement
Not sure what this was even supposed to do...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-03 06:35:25 -08:00
Dirk Hohndel
6ac4fe7b18 QML UI: show notification for saving dives to cloud as well
Fixes #1014

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-03 06:33:00 -08:00
Dirk Hohndel
c5153fbc10 QML UI: ensure that cloud notification is always cleared
All error cases need to reset it as well.
And it's easier to reset it right after we come back from parse_file()
instead of trying to track all the exit cases after that.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-03 06:32:12 -08:00
Linus Torvalds
055316e4a9 gas model: add polynomials for Z factors of oxygen/nitrogen/helium
.. and use a linear mix of them for arbitrary gas mixes.

For the special case of air, we continue to use the air-specific
polynomial.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02 18:09:41 -08:00
Linus Torvalds
3260dd9c15 gas model: replace Redlich-Kwong with least-square quintic
This goes back to just doing air compressibility, but using the
least-squares quintic polynomial equation that Lubomir generated based
on the Wikipedia table for air at 300K in the 1-500 bar range.

We might be able to do similar things for mixed gases..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02 18:08:28 -08:00
Linus Torvalds
3f30832471 gas model: split up gas compressibility into a file of its own
The gas compressibility is such a specialized thing that I really prefer
having it separate.

This keeps Robert's Redlich-Kwong equation as-is, but let's experiment
with other models soon...

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02 18:08:18 -08:00
Dirk Hohndel
7133216653 QML UI: show notification when cloud is accessed
And hide the notification either after 5 seconds or once we are done.

This requires an extension to the Kirigami components that isn't upstream,
yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02 17:14:47 -08:00
Dirk Hohndel
1f0b716021 QML UI: new property to tell the UI that we are accessing cloud storage
This can then be used to give the user visual feedback (instead of them
just thinking the app is hung).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02 17:13:42 -08:00
Dirk Hohndel
605d085573 QML UI: resolve confusion about dive list model ordering
Oops, I forgot to take the sort model on top of the model into account.
Now everything should stay consistent - ListView order when accessed from
QML, but internal order when accessing the underlying array.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02 09:02:00 -08:00
Dirk Hohndel
cd713d421b QML UI: update profile when editing duration of manually added dive
We need to make sure that a new fake DC is created after the duration was
changed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02 06:28:00 -08:00
Dirk Hohndel
880f1c5644 QML UI: update the correct dive in the model when committing a change
When manually adding a dive and moving it in the dive list (by editing
it's start time) we could create a situation where the dive list
internally was correct, but the dive list model on screen showed an
incorrect dive list with the new dive in two different spots.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02 04:52:44 -08:00
Dirk Hohndel
62f54b54a2 QML UI: create a chronological dive list when manually adding dive
The dive list might contain dives in the future, don't add the new dive to
then end but instead add it at the correct spot in the list

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02 04:50:00 -08:00
Dirk Hohndel
ce83357889 QML UI: after adding a dive, jump to it in the list
Don't do the slow motion scrolling through the list if we previously
showed a different dive in the list.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02 04:47:51 -08:00
Dirk Hohndel
3b37844708 Add helper functions to identify the position of a dive in the dive list
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02 04:46:26 -08:00
Lubomir I. Ivanov
b275e604c1 templatelayout.cpp: fix potential issue in preprocessTemplate()
The function preprocessTemplate(), did not account well
for indexes in Grantlee variables, such as:
dive.weight# (where # is the index)
dive.cylinder#

To solve the issue the list (QList<QPair<QString, QString> >)
for variables to be replaced is populated will all possible
indexes:
0 - MAX_WEIGHTSYSTEM for weights
0 - MAX_CYLINDERS for cylinders

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-29 15:42:33 -08:00
Dirk Hohndel
abab031ed2 QML UI: implement undelete
This code is very similar to the undo code in the desktop UI, but
untangling that from the desktop seemed massive overkill; we don't have
lists of dives to delete and undelete here - so this is actually much
simpler and easier to maintain (I hope).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-29 15:42:33 -08:00
Dirk Hohndel
e39e9eee3b QML UI: present an undo dialog after delete
The dialog gives the user 3 seconds to undo the delete and then disappears
without any user interaction.

This isn't hooked up, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-29 15:41:58 -08:00