Commit graph

136 commits

Author SHA1 Message Date
Dirk Hohndel
4d06e8f7b5 Cloud storage: check connection before connecting
libgit2 takes forever (a minute or so) to figure out that it can't connect
to a remote server.
So if we are using https as connection protocol, quickly check utilizing
RFCs 2324/7168 to make sure we can reach the cloud server (and not some
captive portal or something).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-12 09:22:36 -07:00
Dirk Hohndel
d24de5b72b Don't show all the auto generated dive sites on the globe
When downloading GPS data from the Subsurface webservice we repopulated
the globe before purging all the unused GPS fixes from the list of dive
sites which caused massive clutter (until the next time the user changed
the displayed dive or did anything else that caused the globe to redraw
itself).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-10 07:09:23 -07:00
Dirk Hohndel
8282ed2348 Merge branch 'cloudstorage' 2015-06-09 17:16:31 -07:00
Dirk Hohndel
57507cfb93 Cloud storage: implement confirmation of email address via PIN
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-09 17:04:30 -07:00
Dirk Hohndel
a07376b534 Cloud storage: initial support for confirming the email PIN
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-09 17:03:36 -07:00
Dirk Hohndel
74f3961b05 Discard all temporary sites after merging with dive list
After we import all the GPS fixes from the Subsurfae webservice we delete
the ones that didn't match any dives. The algorithm skipped every other
one by mistake.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-09 14:35:27 -07:00
Dirk Hohndel
e19fa0a9f3 Subsurface GPS webservice: make sure dive log is marked as modified
One of the cases was missing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-09 14:34:37 -07:00
Gehad elrobey
d88da53586 Fix building with NO_MARBLE issue
We can't build with -DNO_MARBLE after some previous commit broke
globe.cpp

- centerOnCurrentDive() is still existing in the code while removed from
header in 6b81fb49d0.

- Some referenced to MainWindow::instance()->globe() even if we are
building with no marble.

- include stdint.h

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-09 11:22:41 -07:00
Dirk Hohndel
318bf5cccc Cloud storage: first stab at creating an account on the backend
This triggers when the email address / password is changed in the
preferences. It opens an https connection with the backend server (the URL
is hardcoded) which should create an account with these credentials.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-07 09:54:35 -07:00
Tomaz Canabrava
6b81fb49d0 Always send the UUID of the coordinates to the globe
We were relying in the current_dive to display the
globe coordinates correctly - but this is not always
the case: you can be inserting a new dive site and it
isn't yet inside of the dive until the user presses
accept. So always pass the uuid of the dive site that
we want to display.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-07 08:04:32 -07:00
Tomaz Canabrava
f88fb74b5b Remove support for Qt4 (part 4)
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-24 09:37:23 -07:00
Dirk Hohndel
3a715c2299 Simplify creation of the upload file for Divelogs.de
Instead of writing each dive out to a file and reading that file back in,
let's just use the internal helper function that places the dive as XML
into a membuffer.

So much simpler, so much faster.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-28 11:28:53 -07:00
Dirk Hohndel
3043114446 Show error if creation of the Divelogs.de upload file fails
Previously we simply failed silently without showing the user any
indication that something went wrong. That seems wrong.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-28 10:42:54 -07:00
Marcos CARDINOT
0bf61844e7 DivelogsDeWebServices::multipart - initializes member
Non-static class member multipart is not initialized in the constructor

Signed-off-by: Marcos CARDINOT <mcardinot@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-25 02:27:53 -07:00
Gehad elrobey
f61b59d961 Change the references to ShowError to the new notification object.
Showing an Error message is better called from the Notification Object,
So for consistency old references to showError is replaced by calling
the notification object.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-27 06:31:10 +01:00
Dirk Hohndel
ddc01e39e7 Move helper functions around
We had a ton of helper functions in qt-gui.cpp which really didn't make
much sense. So I moved them all into qthelper.cpp.

Also moved the UserAgent helper that didn't belong in the UpdateHandler to
begin with - that's a generic helper used in many places...

With this we can successfully build using cmake again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-23 09:31:08 -08:00
Lubomir I. Ivanov
aa7f2eeb8a subsurfacewebservices.cpp: add QDebug include
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-17 14:08:44 -08:00
Dirk Hohndel
6708e06872 Adapt GPS coordinate download from our companion app to dive sites
This is a bit awkward now. We are downloading what looks like fake dives
in the v2 format. So we create a dive site for every single fix.

After we merge those new dive sites into the existing dives we need to
throw away all the dive sites that weren't used.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13 14:27:34 -08:00
Dirk Hohndel
9edb7811ef Remove redundant function
We had two functions doing exactly the same thing. Let's drop the one with
the highly confusing name.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-11 16:34:02 -08:00
Tomaz Canabrava
6b038c2a9a Remove the ProfileWidget from mainwindow.ui
It is now in mainwindo.cpp

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:45 -08:00
Tomaz Canabrava
238c0573da Remove information panel from mainwindow.ui
Now it's created in the mainwindow.cpp as part of the new
way to configure the interface.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:45 -08:00
Tomaz Canabrava
c30aee1ae5 Remove the Globe from the mainwindow.ui
Now it's started from mainwindo.cpp and it's part of the
new states

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:45 -08:00
Tomaz Canabrava
cf4d55c470 Remove the DiveList from the mainwindow.ui
It's now set up from the mainwindow.cpp file.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:45 -08:00
Dirk Hohndel
02d8dd5d13 Clean up the header files
Lots and lots and lots of header files were being included without being
needed. This attempts to clean some of that crud up.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-17 23:00:43 +13:00
Dirk Hohndel
6f25713408 Add more infrastructure for a separate dive table
This will allow us to download the dives from the dive computer into a
separate table just for that purpose and not into the main dive_table.

I really dislike the code that's in place that dates back to the very
earliest code written for Subsurface. Dumping the dives straight into the
main dive_table seems really stupid to me.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-09 15:06:18 -08:00
Dirk Hohndel
fe2c46a5b7 Move update check and survey to the new domain
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-18 13:01:54 +00:00
Salvo Tomaselli
bff471f98d Typos
This fixes two typos found by lintian.
I guess a bunch of translations will need to be updated or something, I am not
sure how they work so I didn't touch them. I presume in the worst case they
will need to be re-translated at the next iteration

--
Salvo Tomaselli

"Io non mi sento obbligato a credere che lo stesso Dio che ci ha dotato di
senso, ragione ed intelletto intendesse che noi ne facessimo a meno."
                -- Galileo Galilei

http://ltworf.github.io/ltworf/
From a0e5f48349557fcccd82ba8c7555043de140835c Mon Sep 17 00:00:00 2001
From: Salvo 'LtWorf' Tomaselli <tiposchi@tiscali.it>
Signed-off-by: Salvo 'LtWorf' Tomaselli <tiposchi@tiscali.it>
Date: Fri, 12 Sep 2014 18:25:20 +0200
Subject: [PATCH] Fix typos reported by lintian

Fixes two typos reported by lintian.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-18 06:24:05 -07:00
Salvo 'LtWorf' Tomaselli
2a1a640227 Define PATH_MAX if it's not defined
Fixes FTBFS on Hurd.

[Dirk Hohndel: changed PATH_MAX to 4096 for consistency with Linux]

Signed-off-by: Salvo 'LtWorf' Tomaselli <tiposchi@tiscali.it>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-27 15:55:03 -07:00
Dirk Hohndel
827d4740c3 Better User Agent for Subsurface
This one is less verbose and very easy to parse. It's guaranteed to have
five components, separated by ':' with no other ':' in the string:

Subsurface:<version>:<PrettyOSName>:<appCpuArch[/osCpuArch]>:<UILang>

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-08 11:13:05 -07:00
Lubomir I. Ivanov
4bf0d768f9 Web: use subsurface_fopen() for non-ASCII paths on Win32
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-05 07:42:51 -07:00
Dirk Hohndel
3fd8e50044 Don't use tmpfile()
It appears that at least on Win7-64 Windows tries to create the temporary
file in C:\ and fails because of insufficient permissions. How stupid is
that.

Instead we roll our own tempfiles, based on the already existing tempfile
name that is passed in.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-04 22:15:58 -07:00
Miika Turkia
2b100c8c17 Try to fix divelogs upload on Windows
zip_open needs correct directory separators. QFile::encodeName does not
do this conversion, so we must call it explicitly.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-03 13:04:38 -07:00
Dirk Hohndel
526ba82b53 Give Subsurface a distinct User Agent string
When accessing websites (divelogs.de, subsurface website) we shouldn't
pretend to be Mozilla 5.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-31 11:20:11 -07:00
Sergey Starosek
6d5905419e Translate progressbar text
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24 07:29:42 -07:00
Sergey Starosek
458b234920 Align progressbar text to center of the widget
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24 07:29:30 -07:00
Tomaz Canabrava
0dd40b7a51 Rely on QNetworkReply finished() signal instead of AccessManager one
The access manager is only one, while we can make requests from
different parts of the application, so relying on the manager
finished() signal to see if something was done or not was a
not very good move.

The QNetworkReply is created when a get() is invocked on the
AccessManager and that's unique. connect it's finished()
signal instead.

bonus: code cleanup.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 13:56:46 -07:00
Salvador Cuñat
7eb422d988 Change in logic while aplying gps fixes to dives
We were actually searching dives which match the dowloaded position
fixes. So we're also trying to take into account if the fix is automatic
or no based on a limited amount of predefined strings (bad idea, as the
user can change in companion app settings the predefined string).
This way, in actual implementation, if program concludes that a fix has
been manually got or, simply, the user is unlucky enough to have all the
position fixes out of the dive time, find_dive_n_near() function will
pair fix and dive in an ordered way (1st fix -> 1st dive; 2nd fix -> 2nd
dive ...) which is probably erroneous, except for manual position fixes.

BTW actual implementation can't pair the same gps position with more
than one dive, which would be the case, e.g. in repetitive dives while at
anchor in the same point.

The patch changes the logic:

- Search positions for defined dives (instead of dives for defined
positions) without care if position has manually or  automatically been
set.
- Only take care of those dives that don't have a position yet.
- It makes two assumptions:
   a.- If the position fix has been taken during the dive time, is
correct. If there are more than one inside the dive time, takes the
first one (closest to the DC's reported time).
   b.- If not during diving time, the correct one is the nearest fix
before the dive begins (also the usual case if manually fixed from the
smartphone just before jump into the water). But will work too if there
is only one fix *in SAME_GROUP range* after the dive (another usual
case).
- Finally, as copy_gps_location() in dive.h is used only here, let it
take care of naming the dive if user hasn't named it yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 07:38:31 -07:00
Tomaz Canabrava
e38595f684 Use QObject::tr instead of OurClasses::tr for functions
This will make more easy to move code around in the future.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-15 17:05:46 -07:00
Tim Wootton
9dd484b63f Misc UI capitalisation consitencies and other text changes
Capitalisation consitencies
A typo correction
A readability improvement (IMHO)

Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 10:44:09 -07:00
Dirk Hohndel
635a7ab771 UI restructure: updateDiveInfo shows the selected dive by default
So don't be redundant.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03 09:37:55 -07:00
Dirk Hohndel
b2f473d927 User survey: actually collect and send the data to the backend
This switches the QTextEdit fields to QPlainTextEdit (I don't see a reason
why we should allow HTML here), no longer tries to have a default text but
instead adds labels for the two fields, connects the UI so th data is
collected and uses a bastardized WebServices subclass to send the data to
our backend.

Fixes #546

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-30 12:30:46 -07:00
Salvador Cuñat
2ae6f8078a Look around DCs dive time for automatically fixed positions.
dive = find_dive_including(gpsfix->when);

only finds dives which have a fix during the underwater time.  If the positions have
been fixed before or after the dive, fails quietly.  So let's test this situation and, in case,
pass the job to  find_dive_n_near().

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-24 21:59:18 +08:00
Dirk Hohndel
5ba573240f Gratuitous whitespace changes
I keep trying to get to consistenct.
Completely hopeless.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 11:40:22 -07:00
Miika Turkia
7dc642860d Implementing export dialog
As our menus are getting many export entries, it is better to create a
single export dialog where user is able to select the export type and
whether to export selected dives or all of them. This should also be
more intuitive than the current way when export from file menu export
all dives and right click menu on divelist exports only selected dives.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-21 03:31:43 +09:00
Dirk Hohndel
09e7c61fee Consistently use for_each_dive (and use it correctly)
The way the macro is written there is no need to test the dive against
NULL before dereferencing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20 06:37:19 +09:00
Dirk Hohndel
2bc76beb65 Globe: we always center on the current dive
Simplify the API (we'll take advantage of this in the next commit).
We always center the globe on the current dive, so no point in passing
that dive in.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-07 15:17:47 -07:00
Dirk Hohndel
155eac11d2 Ctrl-W and -Q support for GPS, divelogs.de, divecomputer and CVS import
Getting closer to consistent behavior.

See #489

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-25 10:47:44 -07:00
Tomaz Canabrava
9598462830 Removed the globals 'userid' and 'save_userid_local' variables
This is a preferences setting, it should belong to the preferences
structure.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-17 08:37:31 -07:00
Tomaz Canabrava
f14c14c383 Mark a lot of TODO's where I think it should be moved to C code.
This marks a lot of todo's where I think there's core stuff being mangled
on the interface - we should remove this from the interface to make
testing and maintenability easier.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-17 08:33:51 -07:00
Venkatesh Shukla
3abcde9a2a Add option to save userid in data files
The userid of Subsurface Webservice can be included in locally saved xml
files and git repository.
For xml files, it is stored in userid tag. For git repo, it is stored
in 00-Subsurface file present in the repo.
Preference dialog and webservice dialog modified to include option
for saving userid locally.

In case of difference in default userid and userid in local file,
some semantics are followed. These can be referred to here:
http://lists.hohndel.org/pipermail/subsurface/2014-April/011422.html

Fixes #473

Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-14 09:40:30 -07:00