Deprecate QSysInfo::MacVersion, QSysInfo::WindowsVersion, etc
QSysInfo::WinVersion, QSysInfo::WindowsVersion, QSysInfo::windowsVersion(), QSysInfo::MacVersion, QSysInfo::MacintoshVersion, and QSysInfo::macVersion() are now deprecated. QOperatingSystemVersion exists as a more flexible replacement. Change-Id: Ib97d1bfb260f2595ba3c06ff8fd251c5de41cedc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
6005d75c15
commit
8a48d66da9
@ -1090,12 +1090,14 @@ bool qSharedBuild() Q_DECL_NOTHROW
|
||||
*/
|
||||
|
||||
/*!
|
||||
\deprecated
|
||||
\variable QSysInfo::WindowsVersion
|
||||
\brief the version of the Windows operating system on which the
|
||||
application is run.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\deprecated
|
||||
\fn QSysInfo::WindowsVersion QSysInfo::windowsVersion()
|
||||
\since 4.4
|
||||
|
||||
@ -1105,12 +1107,14 @@ bool qSharedBuild() Q_DECL_NOTHROW
|
||||
*/
|
||||
|
||||
/*!
|
||||
\deprecated
|
||||
\variable QSysInfo::MacintoshVersion
|
||||
\brief the version of the Macintosh operating system on which
|
||||
the application is run.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\deprecated
|
||||
\fn QSysInfo::MacVersion QSysInfo::macVersion()
|
||||
|
||||
Returns the version of Darwin (\macos or iOS) on which the
|
||||
@ -1128,6 +1132,7 @@ bool qSharedBuild() Q_DECL_NOTHROW
|
||||
*/
|
||||
|
||||
/*!
|
||||
\deprecated
|
||||
\enum QSysInfo::WinVersion
|
||||
|
||||
This enum provides symbolic names for the various versions of the
|
||||
@ -1178,6 +1183,7 @@ bool qSharedBuild() Q_DECL_NOTHROW
|
||||
*/
|
||||
|
||||
/*!
|
||||
\deprecated
|
||||
\enum QSysInfo::MacVersion
|
||||
|
||||
This enum provides symbolic names for the various versions of the
|
||||
@ -1939,6 +1945,7 @@ QT_BEGIN_INCLUDE_NAMESPACE
|
||||
#include "qnamespace.h"
|
||||
QT_END_INCLUDE_NAMESPACE
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 9)
|
||||
QSysInfo::MacVersion QSysInfo::macVersion()
|
||||
{
|
||||
const auto version = QOperatingSystemVersion::current();
|
||||
@ -1955,6 +1962,7 @@ QSysInfo::MacVersion QSysInfo::macVersion()
|
||||
#endif
|
||||
}
|
||||
const QSysInfo::MacVersion QSysInfo::MacintoshVersion = QSysInfo::macVersion();
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
static const char *osVer_helper(QOperatingSystemVersion version = QOperatingSystemVersion::current())
|
||||
@ -2016,6 +2024,7 @@ QWindowsSockInit::~QWindowsSockInit()
|
||||
Q_GLOBAL_STATIC(QWindowsSockInit, winsockInit)
|
||||
# endif // QT_BOOTSTRAPPED
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 9)
|
||||
QSysInfo::WinVersion QSysInfo::windowsVersion()
|
||||
{
|
||||
const auto version = QOperatingSystemVersion::current();
|
||||
@ -2029,6 +2038,8 @@ QSysInfo::WinVersion QSysInfo::windowsVersion()
|
||||
return QSysInfo::WV_WINDOWS10;
|
||||
return QSysInfo::WV_NT_based;
|
||||
}
|
||||
const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion();
|
||||
#endif
|
||||
|
||||
static QString winSp_helper()
|
||||
{
|
||||
@ -2067,8 +2078,6 @@ static const char *osVer_helper(QOperatingSystemVersion version = QOperatingSyst
|
||||
return 0;
|
||||
}
|
||||
|
||||
const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion();
|
||||
|
||||
#endif
|
||||
#if defined(Q_OS_UNIX)
|
||||
# if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)) || defined(Q_OS_FREEBSD)
|
||||
|
@ -79,7 +79,8 @@ public:
|
||||
# endif
|
||||
};
|
||||
#endif
|
||||
enum WinVersion {
|
||||
#if QT_DEPRECATED_SINCE(5, 9)
|
||||
enum QT_DEPRECATED_X("Use QOperatingSystemVersion") WinVersion {
|
||||
WV_None = 0x0000,
|
||||
|
||||
WV_32s = 0x0001,
|
||||
@ -112,18 +113,18 @@ public:
|
||||
WV_10_0 = WV_WINDOWS10
|
||||
};
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN)
|
||||
static const WinVersion WindowsVersion;
|
||||
static WinVersion windowsVersion();
|
||||
QT_DEPRECATED_X("Use QOperatingSystemVersion::current()") static const WinVersion WindowsVersion;
|
||||
QT_DEPRECATED_X("Use QOperatingSystemVersion::current()") static WinVersion windowsVersion();
|
||||
#else
|
||||
static const WinVersion WindowsVersion = WV_None;
|
||||
static WinVersion windowsVersion() { return WV_None; }
|
||||
QT_DEPRECATED_X("Use QOperatingSystemVersion::current()") static const WinVersion WindowsVersion = WV_None;
|
||||
QT_DEPRECATED_X("Use QOperatingSystemVersion::current()") static WinVersion windowsVersion() { return WV_None; }
|
||||
#endif
|
||||
|
||||
#define Q_MV_OSX(major, minor) (major == 10 ? minor + 2 : (major == 9 ? 1 : 0))
|
||||
#define Q_MV_IOS(major, minor) (QSysInfo::MV_IOS | major << 4 | minor)
|
||||
#define Q_MV_TVOS(major, minor) (QSysInfo::MV_TVOS | major << 4 | minor)
|
||||
#define Q_MV_WATCHOS(major, minor) (QSysInfo::MV_WATCHOS | major << 4 | minor)
|
||||
enum MacVersion {
|
||||
enum QT_DEPRECATED_X("Use QOperatingSystemVersion") MacVersion {
|
||||
MV_None = 0xffff,
|
||||
MV_Unknown = 0x0000,
|
||||
|
||||
@ -193,12 +194,13 @@ public:
|
||||
MV_WATCHOS_3_0 = Q_MV_WATCHOS(3, 0)
|
||||
};
|
||||
#if defined(Q_OS_MAC)
|
||||
static const MacVersion MacintoshVersion;
|
||||
static MacVersion macVersion();
|
||||
QT_DEPRECATED_X("Use QOperatingSystemVersion::current()") static const MacVersion MacintoshVersion;
|
||||
QT_DEPRECATED_X("Use QOperatingSystemVersion::current()") static MacVersion macVersion();
|
||||
#else
|
||||
static const MacVersion MacintoshVersion = MV_None;
|
||||
static MacVersion macVersion() { return MV_None; }
|
||||
QT_DEPRECATED_X("Use QOperatingSystemVersion::current()") static const MacVersion MacintoshVersion = MV_None;
|
||||
QT_DEPRECATED_X("Use QOperatingSystemVersion::current()") static MacVersion macVersion() { return MV_None; }
|
||||
#endif
|
||||
#endif // QT_DEPRECATED_SINCE(5, 9)
|
||||
|
||||
static QString buildCpuArchitecture();
|
||||
static QString currentCpuArchitecture();
|
||||
|
@ -27,11 +27,12 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QOperatingSystemVersion>
|
||||
#include <QSysInfo>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
// I'm lazy
|
||||
#if QT_DEPRECATED_SINCE(5, 9)
|
||||
#define CASE_VERSION(v) case QSysInfo::v: return QT_STRINGIFY(v)
|
||||
|
||||
QByteArray windowsVersionToString(QSysInfo::WinVersion v)
|
||||
@ -108,6 +109,7 @@ QByteArray macVersionToString(QSysInfo::MacVersion v)
|
||||
}
|
||||
return "MacVersion(Q_MV_OSX(10, " + QByteArray::number(v - 2) + "))";
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@ -116,10 +118,12 @@ int main(int argc, char *argv[])
|
||||
printf("QSysInfo::WordSize = %d\n", QSysInfo::WordSize);
|
||||
printf("QSysInfo::ByteOrder = QSysInfo::%sEndian\n",
|
||||
QSysInfo::ByteOrder == QSysInfo::LittleEndian ? "Little" : "Big");
|
||||
#if QT_DEPRECATED_SINCE(5, 9)
|
||||
printf("QSysInfo::WindowsVersion = QSysInfo::%s\n",
|
||||
windowsVersionToString(QSysInfo::WindowsVersion).constData());
|
||||
printf("QSysInfo::MacintoshVersion = QSysInfo::%s\n",
|
||||
macVersionToString(QSysInfo::MacintoshVersion).constData());
|
||||
#endif
|
||||
printf("QSysInfo::buildCpuArchitecture() = %s\n", qPrintable(QSysInfo::buildCpuArchitecture()));
|
||||
printf("QSysInfo::currentCpuArchitecture() = %s\n", qPrintable(QSysInfo::currentCpuArchitecture()));
|
||||
printf("QSysInfo::buildAbi() = %s\n", qPrintable(QSysInfo::buildAbi()));
|
||||
@ -130,5 +134,12 @@ int main(int argc, char *argv[])
|
||||
printf("QSysInfo::prettyProductName() = %s\n", qPrintable(QSysInfo::prettyProductName()));
|
||||
printf("QSysInfo::machineHostName() = %s\n", qPrintable(QSysInfo::machineHostName()));
|
||||
|
||||
const auto osv = QOperatingSystemVersion::current();
|
||||
printf("QOperatingSystemVersion::current() = %s %d.%d.%d\n",
|
||||
qPrintable(osv.name()),
|
||||
osv.majorVersion(),
|
||||
osv.minorVersion(),
|
||||
osv.microVersion());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user