Commit graph

9990 commits

Author SHA1 Message Date
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
9e85d76766 GPS data: create divesite when missing for applied GPS data
Otherwise things will of course crash.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11 10:02:58 -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
3c1a111404 Fix potential compile error
This compiled just fine for me but apparently the QStringList needs to be
explicitly included on Ubuntu 15.10.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-11 06:09:27 -08:00
Dirk Hohndel
602d1227a7 Compile fix for older compilers
Not every compiler supports non-trivial initializers.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 22:24:30 -08:00
Dirk Hohndel
82b2b709bc QML UI: Store the dive duration in dive and (fake) divecomputer
This is needed so that our heuristics for fixing up dives don't mess up the
data.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 22:08:42 -08:00
Dirk Hohndel
0d9892645c QML UI: only store the new date/time if they are valid
Otherwise we are overwriting valid data with midnight, Jan 1, 1970.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 22:07:58 -08:00
Dirk Hohndel
56b3ecb3f6 QML UI: show dive time again
In commit 25aa80846b ("Move Dive class from qthelper.h/cpp to it's own file")
the meaning of getting the "date" of a dive was changed to just be the date and
not the date and time. That's not what the QML code expected.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 22:07:31 -08:00
Dirk Hohndel
a27d78af03 Save a dive has to mean "save to local storage" on mobile
While it makes sense to have the concept of "what's in memory" and "what's on
disk" in a desktop application, on a mobile device that seems like the wrong
approach. If the user edits a dive and taps on "save", they reasonably expect
this to be saved to storage (so our local cache of the remote git repository).
And "Upload to cloud" then pushes the data to the cloud server. It may even be
reasonable to do that automagically, but that I'm not so sure about.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 21:40:03 -08:00
Dirk Hohndel
60d5463311 Remember in settings if we ever synced with the cloud
Otherwise, if the device is offline we would not be able to store changes in
the local cache, completely defeating the purpose.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 21:38:44 -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
Dirk Hohndel
4f10f7f7ae QML UI: refresh divelist after GPS data was successfully applied
And create a helper to do so to make the code simpler.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 20:44:22 -08:00
Dirk Hohndel
956b864319 GPS data: if deleting on server fails, remember to try again
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 20:44:22 -08:00
Dirk Hohndel
4d4f5ed89b GPS data: don't try to track what's uploaded
This has been the cause of issues in several cases. We should simply always try
to push all data to the server - it deals with redundant uploads quite nicely.
(previous commits already stopped responding to this flag, this simply removes
all mention of it)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 20:44:22 -08:00
Dirk Hohndel
69619ef5aa GPS data: delete fixes on the server
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 20:44:21 -08:00
Dirk Hohndel
88291f605c GPS data: more fixes
- load the data from settings as we start
- improve upload to server
- keep settings and in memory model in sync

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 20:44:21 -08:00
Dirk Hohndel
33142ed7f8 Reimplement the internal repesentation of GPS fixes
Instead of using the Settings as our data structure and constantly accessing
them, we now have a QMap for the GPS fixes and only access the Settings to keep
them in sync with the QMap. This should significantly speed things up.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 20:44:21 -08:00
Miika Turkia
7701975d98 Support for imperial depth on worldmap export
This will use the depth units from user preferences when exporting the
worldmap.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 14:13:58 -08:00
Robert C. Helling
82c87204e4 If all else fails try loading images from cloud server
Of course, as of this writing, there are no images on the server.

In addition, this patch adds comments to explain the by now convoluted
image retrieval logic (local file, filename as URL, by hash, cloud server).

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 14:12:36 -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
Salvador Cuñat
09c854fee0 Renumber dive list after manual dive merging
As Linus pointed out in mail list, user is forced to manually renumber
his dives after doing a merge, unless the merged dives were those at
the list tail.

This patch try to manage the more usual cases, letting the user to deal
with those more complex, based on some assumptions:

1.- We are working on an time ordered list of type:
      dive_table.nr           ... 100 -- 101 -- 102 -- 103 -- 104 ...
      dive_table.dives.number ... 234 -- 235 -- 236 -- 245 -- 246 ...
2.- It's unlikely to merge no consecutive dives, as merging is time
    based.
3.- It's unlikely (although possible) to find consecutive dives with
    no consecutive numbers.
4.- It would be rather bizarre to find that newer dive,of those to
    merge, has lower number than older.
5.- It can be found that one (or both) dives to merge are zero
    numbered.
6.- There is only need to renumber from merged dives in advance.

A variable, "factor", is fixed before reworking the dive table. This
number will be substracted from the original dive number.
If we are in point 5.- case, "factor" will be set to zero, meaning
that dive numbers will not change (if older dive is zero, merged one
will be numbered zero too and will let the user to manage this; if
newer dive is zero there won't be need of renumbering as following
dives will be correctly numbered, e.g. after splitting a dive which
is not at the tail of the table).

In most cases, "factor" *should* be set to 1.

While renumbering it can be found a dive with it's number set to zero,
this won't be changed and will remain zeroed to avoid negative
numbers. It, mostly, means that the user has pending work on his
dives.

I don't know why I've written such a big explanation for such a tiny
patch :-)

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 14:11:32 -08:00
Jan Mulder
aa6aa416bf show dive.number instead of double location
Small error was introduced in commit 25aa80846b. The dive.location was
shown in the DiveList instead of the intended dive.number

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 14:09:31 -08:00
Dirk Hohndel
b1f90b6aa0 QML UI: partial, slow and incomplete implementation of delete GPS fix
This only deletes the fix on the mobile device, not on the server.
And it is really really slow. Re-reading the data from the settings just isn't
a smart way to do this.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08 23:18:41 -08:00
Dirk Hohndel
038cfcba91 QML UI: add second action to GPS list entries
This one will allow people to see the location on a map. Also not implemented,
yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08 23:17:48 -08:00
Dirk Hohndel
f61b83301a QML UI: better icon for delete
The cancel picture was odd - the trash can is much more typical.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08 23:16:19 -08:00
Dirk Hohndel
249a2c2c09 Gps list: include the time_t timestamp in the model
Just having the string means we lost the unique value that we can use as key to
indentify a specific GPS fix.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08 23:13:30 -08:00
Dirk Hohndel
b34a507d51 QML UI: support sliding action to allow the user to delete GPS fixes
This is just the UI, the actual deletion is not yet implemented.

I really like this interaction with the list items. Slide them to the left and
you see icons for actions. Right now we have just one and that may seem like
overkill (hey, we could just have the delete icon instead of the application
menu icon, right?) but once we allow the ability to show the GPS location on a
map we'll have two operations and this will make more sense.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08 21:48:53 -08:00
Dirk Hohndel
7c459f87cd Consolidate scripts
Since commit c496d5fa05 ("Add helper script to pull Plasma Mobile Components
and icons") we had three different spots where we retrieved the Plasma Mobile
Components. That's a wee bit of overkill. So instead have the other two scripts
just call this one.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08 21:46:44 -08:00
Tomaz Canabrava
04d4da50c4 Fix memory leak on the printing system
We forgot to delete the Grantlee object before creating a new one

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08 10:03:12 -08:00
Tomaz Canabrava
f07a9fa09f Simplify Finding the Templates
We don't need a list of QFileInfo if we are not using it
much better to have a list of the files directly

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08 10:03:06 -08:00
Tomaz Canabrava
a809eec853 Don't iterate over the dive_table to discover the number of dives
dive_table.nr is exactly that.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08 10:02:35 -08:00
Tomaz Canabrava
dec2572ec6 Don't if true then true
Set the values directly, seems much more sane.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08 10:02:20 -08:00
Tomaz Canabrava
1210d4b575 Simplify code on the printingDialog
instead of duplicate the code that only chaged the QList that it
would access, create a temporary list and use it for dealing
with the code.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08 10:01:51 -08:00
Dirk Hohndel
c496d5fa05 Add helper script to pull Plasma Mobile Components and icons
Normally this is done in the build.sh script when building
Subsurface-mobile - but some people might have set up their build
enviroment differently and for them this allows to pull (and update) these
components from upstream without having to run build.sh

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08 09:55:32 -08:00
Tomaz Canabrava
a13fa83046 Removed grantlee template code to deal with non-Qobject
Since we alreday have a Q_PROPERTY on the DiveObjectHelper,
grantlee introspection can use that directly to access it's
data, so there's no need for us to redeclare everything.

More QObject Introspection, Less handmade boilerplate for
Grantlee, QML, and a few other things.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08 08:05:36 -08:00
Tomaz Canabrava
19dee335e4 Lazy Initialize QPrinter
it was taking 3 - 4 secs here to open the print dialog,
first I tought it was a bug in our side, but it looks like
it's a Qt bug, and by lazy initializing it we don't actually
solve this, since it will still take 3 - 4 secs for the printer
to start, but the dialog will appear much quicker.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08 08:04:58 -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
Tomaz Canabrava
c022f5c4f7 Force the creation of some soft-links
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08 08:04:31 -08:00
Tomaz Canabrava
219299dc01 Correctly handle SubsurfaceMobile
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08 08:04:24 -08:00
Tomaz Canabrava
89eed5d36e Untangle Library Linkage
with the adittion of gpslistmodel/location, the libraries
qt-models had a direct dependency on subsurface-core, and
subsurface-core had a direct dependency on qt-models, this is
bad.

Moving a bit of code around I'v managed to clean this out, and
also to clear a bit of uneeded code (GpsTracker and gpsTracker where
basically the same thing.)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-08 08:04:04 -08:00
Dirk Hohndel
7b155774c5 Compile fix
This makes the desktop version compile again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-07 22:43:13 -08:00
Dirk Hohndel
6c0259d540 Compile fix
While the conversion of uint64_t to QVariant works fine with some Qt /
compiler combinations, it fails on others. Use Qt's type instead.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-07 22:41:13 -08:00
Miika Turkia
1a78033ac5 Add automake to the list of Debian dependencies
automake is recommended by autoconf, but depending on the
configuration, the recommended packages might not be installed. Thus
it is better to have it explicitly listed.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-07 22:32:37 -08:00
Jan Mulder
78eacb6a0c mobile: allow save when local store is actual
When starting ssrf-mobile, and the local divelist is identical to the
cloud version (so same sha1), a save of local modifications to the
cloud should be possible. This fix enables this by pretending
that a suppressed load from cloud on start is still a valid load
from cloud.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-07 22:32:24 -08:00
Dirk Hohndel
624e44e73d QML UI: clean up notes field after edit
We don't want any of the rich text markup to sneak into our fields.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-07 22:30:58 -08:00
Dirk Hohndel
a0d3480bbe QML UI: fix manual add dive
This had been broken by mistake in commit e5f95daee8 ("QML UI: reimplement
context menu for dive details").

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-07 22:29:50 -08:00
Dirk Hohndel
c62baea032 Correctly adjust time stamp of GPS fixes
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-07 22:08:04 -08:00
Dirk Hohndel
1eda61e115 Merge branch 'gpsList' 2016-01-07 21:43:22 -08:00
Dirk Hohndel
b6ae6979e5 QML UI: show the available GPS fixes
So far the user can't interact with these. We should implement an ability to
visualize the GPS fix and to delete it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-07 21:41:52 -08:00
Dirk Hohndel
06dcc9ab8d Populate the model with the GPS fixes
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-07 21:41:52 -08:00