From 439ad968c60d7cf44cc05cda72ebfdb1f8741045 Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Thu, 6 Dec 2018 19:23:13 +0100 Subject: Use QSysInfo for client OS in VersionManager The QXmppVersionManager will use QSysInfo in Qt 5.4 or later to determine the client's OS, so it will also contain the OS version or some codenames. --- src/client/QXmppVersionManager.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/client/QXmppVersionManager.cpp') diff --git a/src/client/QXmppVersionManager.cpp b/src/client/QXmppVersionManager.cpp index e32c72c2..894799fc 100644 --- a/src/client/QXmppVersionManager.cpp +++ b/src/client/QXmppVersionManager.cpp @@ -23,6 +23,9 @@ #include #include +#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) +#include +#endif #include "QXmppClient.h" #include "QXmppConstants_p.h" @@ -45,7 +48,9 @@ QXmppVersionManager::QXmppVersionManager() if (d->clientName.isEmpty()) d->clientName = "Based on QXmpp"; -#if defined(Q_OS_LINUX) +#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) + d->clientOs = QSysInfo::prettyProductName(); +#elif defined(Q_OS_LINUX) d->clientOs = QString::fromLatin1("Linux"); #elif defined(Q_OS_MAC) d->clientOs = QString::fromLatin1("Mac OS"); @@ -129,8 +134,8 @@ QString QXmppVersionManager::clientVersion() const /// Returns the local XMPP client's operating system. /// -/// By default this is "Linux", "Mac OS", "Symbian" or "Windows" depending -/// on the platform QXmpp was compiled for. +/// By default this equals to QSysInfo::prettyProductName() which contains the +/// OS name and version (e.g. "Windows 8.1" or "Debian GNU/Linux buster"). QString QXmppVersionManager::clientOs() const { -- cgit v1.2.3