diff options
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/subsurfacewebservices.cpp | 2 | ||||
-rw-r--r-- | qt-ui/updatemanager.cpp | 2 | ||||
-rw-r--r-- | qt-ui/usersurvey.cpp | 16 | ||||
-rw-r--r-- | qt-ui/usersurvey.h | 1 |
4 files changed, 19 insertions, 2 deletions
diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp index 2b988c7a6..c3661e0ef 100644 --- a/qt-ui/subsurfacewebservices.cpp +++ b/qt-ui/subsurfacewebservices.cpp @@ -223,7 +223,7 @@ WebServices::WebServices(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f ui.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false); timeout.setSingleShot(true); defaultApplyText = ui.buttonBox->button(QDialogButtonBox::Apply)->text(); - userAgent = UserSurvey::getVersion().replace("\n", " "); + userAgent = UserSurvey::getUserAgent(); } void WebServices::hidePassword() diff --git a/qt-ui/updatemanager.cpp b/qt-ui/updatemanager.cpp index 4729998c7..4ea9f188e 100644 --- a/qt-ui/updatemanager.cpp +++ b/qt-ui/updatemanager.cpp @@ -28,7 +28,7 @@ void UpdateManager::checkForUpdates() QNetworkRequest request; request.setUrl(url); request.setRawHeader("Accept", "text/xml"); - QString userAgent = UserSurvey::getVersion().replace("\n", " "); + QString userAgent = UserSurvey::getUserAgent(); request.setRawHeader("User-Agent", userAgent.toUtf8()); connect(SubsurfaceWebServices::manager()->get(request), SIGNAL(finished()), this, SLOT(requestReceived())); } diff --git a/qt-ui/usersurvey.cpp b/qt-ui/usersurvey.cpp index ff55e8133..f436fce47 100644 --- a/qt-ui/usersurvey.cpp +++ b/qt-ui/usersurvey.cpp @@ -47,6 +47,22 @@ QString UserSurvey::getVersion() return sysInfo; } +QString UserSurvey::getUserAgent() +{ + QString arch; + // fill in the system data - use ':' as separator + // replace all other ':' with ' ' so that this is easy to parse + QString userAgent = QString("Subsurface:%1:").arg(VERSION_STRING); + userAgent.append(SubsurfaceSysInfo::prettyOsName().replace(':', ' ') + ":"); + arch = SubsurfaceSysInfo::cpuArchitecture().replace(':', ' '); + userAgent.append(arch); + if (arch == "i386") + userAgent.append("/" + SubsurfaceSysInfo::osArch()); + userAgent.append(":" + uiLanguage(NULL)); + return userAgent; + +} + UserSurvey::~UserSurvey() { delete ui; diff --git a/qt-ui/usersurvey.h b/qt-ui/usersurvey.h index 1dd5aaab3..55140521e 100644 --- a/qt-ui/usersurvey.h +++ b/qt-ui/usersurvey.h @@ -16,6 +16,7 @@ public: explicit UserSurvey(QWidget *parent = 0); ~UserSurvey(); static QString getVersion(); + static QString getUserAgent(); private slots: |