diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-10-27 21:03:14 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-10-27 16:18:09 -0700 |
commit | d747d76762ad745b510c645706c2dd708fe20302 (patch) | |
tree | e08fef51e339416bac144a77fd7dc690fba700dd /core/qthelper.cpp | |
parent | 49fc05de7ebdc3f402b76072a34e3aa53b3b7d4d (diff) | |
download | subsurface-d747d76762ad745b510c645706c2dd708fe20302.tar.gz |
cleanup: refactor subsurfacesysinfo.cpp
This used to be a copy of QSysInfo. However, once the requirement
was raised to Qt5.4, this was replaced by a subclass of the original
QSysInfo - which made the whole file mostly obsolete.
Just use QSysInfo directly where needed.
Only for windows.c, which can't call directly into Qt, keep the
isWin7Or8() helper function.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/qthelper.cpp')
-rw-r--r-- | core/qthelper.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/core/qthelper.cpp b/core/qthelper.cpp index 1dacbab38..5e375997a 100644 --- a/core/qthelper.cpp +++ b/core/qthelper.cpp @@ -8,7 +8,6 @@ #include "gettextfromc.h" #include "statistics.h" #include "membuffer.h" -#include "subsurfacesysinfo.h" #include "version.h" #include "errorhelper.h" #include "planner.h" @@ -40,6 +39,9 @@ #include <QProgressDialog> // TODO: remove with convertThumbnails() #include <cstdarg> #include <cstdint> +#ifdef Q_OS_UNIX +#include <sys/utsname.h> +#endif #include <libxslt/documents.h> @@ -420,11 +422,19 @@ QString getUserAgent() #else QString userAgent = QString("Subsurface:%1:").arg(subsurface_canonical_version()); #endif - userAgent.append(SubsurfaceSysInfo::prettyOsName().replace(':', ' ') + ":"); - arch = SubsurfaceSysInfo::buildCpuArchitecture().replace(':', ' '); + QString prettyOsName = QSysInfo::prettyProductName(); +#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_ANDROID) + // QSysInfo::kernelType() returns lowercase ("linux" instead of "Linux") + struct utsname u; + if (uname(&u) == 0) + prettyOsName = QString::fromLatin1(u.sysname) + QLatin1String(" (") + prettyOsName + QLatin1Char(')'); +#endif + + userAgent.append(prettyOsName.replace(':', ' ') + ":"); + arch = QSysInfo::buildCpuArchitecture().replace(':', ' '); userAgent.append(arch); if (arch == "i386") - userAgent.append("/" + SubsurfaceSysInfo::currentCpuArchitecture()); + userAgent.append("/" + QSysInfo::currentCpuArchitecture()); userAgent.append(":" + getUiLanguage()); return userAgent; |