aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/usersurvey.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-08-08 11:13:05 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-08-08 11:13:05 -0700
commit827d4740c3bc2d449ab32a1ef829191bff20d46f (patch)
treed93378fce52b3456c0438c0f73e876c45fba3b11 /qt-ui/usersurvey.cpp
parenta9f59c0cb3c1aa038a1d0c035d47130ddba58beb (diff)
downloadsubsurface-827d4740c3bc2d449ab32a1ef829191bff20d46f.tar.gz
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>
Diffstat (limited to 'qt-ui/usersurvey.cpp')
-rw-r--r--qt-ui/usersurvey.cpp16
1 files changed, 16 insertions, 0 deletions
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;