diff options
Diffstat (limited to 'qt-ui/updatemanager.cpp')
-rw-r--r-- | qt-ui/updatemanager.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/qt-ui/updatemanager.cpp b/qt-ui/updatemanager.cpp index b920a8ebb..e972c4496 100644 --- a/qt-ui/updatemanager.cpp +++ b/qt-ui/updatemanager.cpp @@ -2,6 +2,7 @@ #include "usersurvey.h" #include <QtNetwork> #include <QMessageBox> +#include <QUuid> #include "subsurfacewebservices.h" #include "ssrf-version.h" #include "mainwindow.h" @@ -47,7 +48,8 @@ void UpdateManager::checkForUpdates(bool automatic) #endif isAutomaticCheck = automatic; QString version = CANONICAL_VERSION_STRING; - QString url = QString("http://subsurface-divelog.org/updatecheck.html?os=%1&version=%2").arg(os, version); + QString uuidString = getUUID(); + QString url = QString("http://subsurface-divelog.org/updatecheck.html?os=%1&version=%2&uuid=%3").arg(os, version, uuidString); QNetworkRequest request; request.setUrl(url); request.setRawHeader("Accept", "text/xml"); @@ -56,6 +58,22 @@ void UpdateManager::checkForUpdates(bool automatic) connect(SubsurfaceWebServices::manager()->get(request), SIGNAL(finished()), this, SLOT(requestReceived()), Qt::UniqueConnection); } +QString UpdateManager::getUUID() +{ + QString uuidString; + QSettings settings; + settings.beginGroup("UpdateManager"); + if (settings.contains("UUID")) { + uuidString = settings.value("UUID").toString(); + } else { + QUuid uuid = QUuid::createUuid(); + uuidString = uuid.toString(); + settings.setValue("UUID", uuidString); + } + uuidString.replace("{", "").replace("}", ""); + return uuidString; +} + void UpdateManager::requestReceived() { bool haveNewVersion = false; |