aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/subsurfacewebservices.cpp
AgeCommit message (Collapse)Author
2015-07-31Transform GlobeGPS in a static instance() classGravatar Tomaz Canabrava
This is needed to start easing the transition from the completely wrong and bogus MainWindow::instance()->globe() calls. this is still wrong, but with it I removed one level of indirection. I did that now because I wanted to not taint the location management when I use it to deal with the globe. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-22Make password change asynchronousGravatar Dirk Hohndel
This isn't perfect (if you make multiple requests things could go badly), but it's better than just slapping the new password into the settings, even if the update failed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-22Cloud storage: enable password updateGravatar Dirk Hohndel
This now allows the user to set a new password for the cloud service. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-16Change API signature to act on dive_site, not uuidGravatar Dirk Hohndel
This way in the future we can pass in a pointer to a dive site that isn't linked in our dive site list yet (i.e., while we are editing). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-24Rewrite GPS fix matching code for imports from our webserviceGravatar Dirk Hohndel
The longer I stared at the existing code the less it made sense. So instead I rewrote it in a way that seems logical to me. And added a boatload of debugging output (which needs to be removed, of course). I tested this against more than a hundred dives and it seemed to always pick the right fix. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-22Avoid possible use of uninitialized variableGravatar Dirk Hohndel
Errorcode doesn't get set if duppedfd is negative. So let's just issue an error and bail. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-22Better error handlingGravatar Dirk Hohndel
Most of these will likely have no big impact, but it's better not to just ignore them as they could lead to crashes. Uemis downloader: if lseek fails, return 0 Uemis downloader: consistently check for failure to open req.txt Zip file handling: dup could fail Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-22Address uninitialized member warningsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16Move checking the cloud connection into its own filesGravatar Dirk Hohndel
This isn't UI related and shouldn't have been in a file full of UI functionality. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-15Cloud storage: use preference member instead of hard coded stringsGravatar Dirk Hohndel
This creates the basis to allow other backends to be used with the cloud storage infrastructure. So far this should all just transparently continue to work. A user would have to manually add the cloud_base_url entry to the CloudStorage section in their config file in order to use a different backend server. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-14Cloud storage: clear our last error if verification succeedsGravatar Dirk Hohndel
This is cosmetic but makes things friendlier, I think. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-14Cloud storage: show in preferences if cloud account was verifiedGravatar Dirk Hohndel
This should make it easier to figure out what's happening. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-14Cloud storage: clean up handling of cloud storage accountGravatar Dirk Hohndel
Correctly tracking the status of our authentication with the cloud service is non-trivial, especially since the user may quit Subsurface between registering and verifying an account, they might even register on one machine and verify on another. This tries to make sure that when in doubt we check with the cloud service backend. And we show errors in the UI. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-12Cloud storage: check connection before connectingGravatar Dirk Hohndel
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-10Don't show all the auto generated dive sites on the globeGravatar Dirk Hohndel
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-09Merge branch 'cloudstorage'Gravatar Dirk Hohndel
2015-06-09Cloud storage: implement confirmation of email address via PINGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-09Cloud storage: initial support for confirming the email PINGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-09Discard all temporary sites after merging with dive listGravatar Dirk Hohndel
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-09Subsurface GPS webservice: make sure dive log is marked as modifiedGravatar Dirk Hohndel
One of the cases was missing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-09Fix building with NO_MARBLE issueGravatar Gehad elrobey
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 6b81fb49d09. - 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-07Cloud storage: first stab at creating an account on the backendGravatar Dirk Hohndel
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-07Always send the UUID of the coordinates to the globeGravatar Tomaz Canabrava
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-05-24Remove support for Qt4 (part 4)Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-28Simplify creation of the upload file for Divelogs.deGravatar Dirk Hohndel
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-28Show error if creation of the Divelogs.de upload file failsGravatar Dirk Hohndel
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-03-25DivelogsDeWebServices::multipart - initializes memberGravatar Marcos CARDINOT
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-02-27Change the references to ShowError to the new notification object.Gravatar Gehad elrobey
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-23Move helper functions aroundGravatar Dirk Hohndel
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-17subsurfacewebservices.cpp: add QDebug includeGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13Adapt GPS coordinate download from our companion app to dive sitesGravatar Dirk Hohndel
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-11Remove redundant functionGravatar Dirk Hohndel
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-10Remove the ProfileWidget from mainwindow.uiGravatar Tomaz Canabrava
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-10Remove information panel from mainwindow.uiGravatar Tomaz Canabrava
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-10Remove the Globe from the mainwindow.uiGravatar Tomaz Canabrava
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-10Remove the DiveList from the mainwindow.uiGravatar Tomaz Canabrava
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-01-17Clean up the header filesGravatar Dirk Hohndel
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-09Add more infrastructure for a separate dive tableGravatar Dirk Hohndel
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>
2014-11-18Move update check and survey to the new domainGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-18TyposGravatar Salvo Tomaselli
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-08-27Define PATH_MAX if it's not definedGravatar Salvo 'LtWorf' Tomaselli
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-08Better User Agent for SubsurfaceGravatar Dirk Hohndel
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-05Web: use subsurface_fopen() for non-ASCII paths on Win32Gravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-04Don't use tmpfile()Gravatar Dirk Hohndel
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-03Try to fix divelogs upload on WindowsGravatar Miika Turkia
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-07-31Give Subsurface a distinct User Agent stringGravatar Dirk Hohndel
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-24Translate progressbar textGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24Align progressbar text to center of the widgetGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16Rely on QNetworkReply finished() signal instead of AccessManager oneGravatar Tomaz Canabrava
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-16Change in logic while aplying gps fixes to divesGravatar Salvador Cuñat
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>