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>
This commit is contained in:
Berthold Stoeger 2020-10-27 21:03:14 +01:00 committed by Dirk Hohndel
parent 49fc05de7e
commit d747d76762
4 changed files with 26 additions and 121 deletions

View file

@ -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;