Remove usages of QSysInfo's deprecated APIs
- Replaced QOperatingSystemVersion::WindowsVersion, QSysInfo::windowsVersion(), QSysInfo::macVersion(), QSysInfo::MacintoshVersion with QOperatingSystemVersion::current(). - Added QOperatingSystemVersion::WindowsVista for convenience, as it is used in lots of places. Change-Id: If9c4ac496005b2e70b5c70be160747afa74b98c1 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
9b3e8b32f2
commit
b0cd007335
@ -355,6 +355,14 @@ bool QOperatingSystemVersion::isAnyOfType(std::initializer_list<OSType> types) c
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
\variable QOperatingSystemVersion::WindowsVista
|
||||
\brief a version corresponding to Windows Vista (version 6.0).
|
||||
\since 6.0
|
||||
*/
|
||||
const QOperatingSystemVersion QOperatingSystemVersion::WindowsVista =
|
||||
QOperatingSystemVersion(QOperatingSystemVersion::Windows, 6, 0);
|
||||
|
||||
/*!
|
||||
\variable QOperatingSystemVersion::Windows7
|
||||
\brief a version corresponding to Windows 7 (version 6.1).
|
||||
|
@ -60,6 +60,7 @@ public:
|
||||
Android
|
||||
};
|
||||
|
||||
static const QOperatingSystemVersion WindowsVista;
|
||||
static const QOperatingSystemVersion Windows7;
|
||||
static const QOperatingSystemVersion Windows8;
|
||||
static const QOperatingSystemVersion Windows8_1;
|
||||
|
@ -68,6 +68,7 @@
|
||||
#include <QtCore/qfile.h>
|
||||
#include <QtCore/qmutex.h>
|
||||
#include <QtCore/qlibrary.h>
|
||||
#include <QtCore/qoperatingsystemversion.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -147,7 +148,7 @@ void QSslSocketPrivate::ensureCiphersAndCertsLoaded()
|
||||
//its own cert bundle rather than the system one.
|
||||
//Same logic that disables the unix on demand cert loading.
|
||||
//Unlike unix, we do preload the certificates from the cert store.
|
||||
if ((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) >= QSysInfo::WV_6_0)
|
||||
if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::WindowsVista)
|
||||
s_loadRootCertsOnDemand = true;
|
||||
#endif
|
||||
}
|
||||
|
@ -177,6 +177,7 @@ void QSslSocketPrivate::ensureInitialized()
|
||||
|
||||
long QSslSocketPrivate::sslLibraryVersionNumber()
|
||||
{
|
||||
// ### Qt 6: Find a proper replacement for the deprecated method below.
|
||||
return QSysInfo::windowsVersion();
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,7 @@
|
||||
|
||||
#include <QtCore/qstringlist.h>
|
||||
#include <QtCore/qcoreapplication.h>
|
||||
#include <QtCore/qoperatingsystemversion.h>
|
||||
|
||||
#include <QtCore/qdebug.h>
|
||||
|
||||
@ -612,7 +613,8 @@ bool QNativeWifiEngine::requiresPolling() const
|
||||
{
|
||||
// On Windows XP SP2 and SP3 only connection and disconnection notifications are available.
|
||||
// We need to poll for changes in available wireless networks.
|
||||
return QSysInfo::WindowsVersion <= QSysInfo::WV_2003;
|
||||
return QOperatingSystemVersion::current()
|
||||
<= QOperatingSystemVersion(QOperatingSystemVersion::Windows, 5, 2);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -84,9 +84,8 @@ static const int windowsRightBorder = 15; // right border on windows
|
||||
*/
|
||||
bool QWindowsVistaStylePrivate::useVista()
|
||||
{
|
||||
return (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
|
||||
&& (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
|
||||
&& QWindowsVistaStylePrivate::useXP();
|
||||
return QOperatingSystemVersion::current() >= QOperatingSystemVersion::WindowsVista
|
||||
&& QWindowsVistaStylePrivate::useXP();
|
||||
}
|
||||
|
||||
/* \internal
|
||||
|
@ -1917,7 +1917,8 @@ void tst_QFileInfo::owner()
|
||||
DWORD bufSize = 1024;
|
||||
if (GetUserNameW(usernameBuf, &bufSize)) {
|
||||
userName = QString::fromWCharArray(usernameBuf);
|
||||
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && IsUserAdmin()) {
|
||||
if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::WindowsVista
|
||||
&& IsUserAdmin()) {
|
||||
// Special case : If the user is a member of Administrators group, all files
|
||||
// created by the current user are owned by the Administrators group.
|
||||
LPLOCALGROUP_USERS_INFO_0 pBuf = NULL;
|
||||
|
@ -496,7 +496,7 @@ void tst_QLockFile::noPermissionsWindows()
|
||||
QSKIP("This test is for desktop Windows only");
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
if (QSysInfo::windowsVersion() < QSysInfo::WV_WINDOWS7)
|
||||
if (QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows7)
|
||||
QSKIP("This test requires at least Windows 7");
|
||||
#endif
|
||||
if (const int p = processProperties()) {
|
||||
|
@ -882,7 +882,7 @@ void tst_QTcpServer::serverAddress_data()
|
||||
QTest::addColumn<QHostAddress>("listenAddress");
|
||||
QTest::addColumn<QHostAddress>("serverAddress");
|
||||
#ifdef Q_OS_WIN
|
||||
if (QSysInfo::windowsVersion() < QSysInfo::WV_6_0)
|
||||
if (QOperatingSystemVersion::current() < QOperatingSystemVersion::WindowsVista)
|
||||
QTest::newRow("Any") << QHostAddress(QHostAddress::Any) << QHostAddress(QHostAddress::AnyIPv4); //windows XP doesn't support dual stack sockets
|
||||
else
|
||||
#endif
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include <qrandom.h>
|
||||
#include <qtoolbar.h>
|
||||
#include <qtoolbutton.h>
|
||||
#include <QtCore/qoperatingsystemversion.h>
|
||||
#include <QtGui/qpaintengine.h>
|
||||
#include <QtGui/qbackingstore.h>
|
||||
#include <QtGui/qguiapplication.h>
|
||||
@ -7654,7 +7655,7 @@ void tst_QWidget::moveWindowInShowEvent()
|
||||
void tst_QWidget::repaintWhenChildDeleted()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
if (QSysInfo::WindowsVersion & QSysInfo::WV_VISTA) {
|
||||
if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::WindowsVista) {
|
||||
QTest::qWait(1000);
|
||||
}
|
||||
#endif
|
||||
@ -8853,7 +8854,7 @@ void tst_QWidget::translucentWidget()
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
QWidget *desktopWidget = QApplication::desktop()->screen(0);
|
||||
if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA)
|
||||
if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::WindowsVista)
|
||||
widgetSnapshot = grabWindow(desktopWidget->windowHandle(), labelPos.x(), labelPos.y(), label.width(), label.height());
|
||||
else
|
||||
#endif
|
||||
|
@ -353,7 +353,10 @@ void tst_QStyle::testWindowsVistaStyle()
|
||||
QStyle *vistastyle = QStyleFactory::create("WindowsVista");
|
||||
QVERIFY(testAllFunctions(vistastyle));
|
||||
|
||||
if (QSysInfo::WindowsVersion == QSysInfo::WV_VISTA)
|
||||
if (QOperatingSystemVersion::current().majorVersion()
|
||||
== QOperatingSystemVersion::WindowsVista.majorVersion()
|
||||
&& QOperatingSystemVersion::current().minorVersion()
|
||||
== QOperatingSystemVersion::WindowsVista.minorVersion())
|
||||
testPainting(vistastyle, "vista");
|
||||
delete vistastyle;
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ void tst_QProgressBar::format()
|
||||
#ifndef Q_OS_MAC
|
||||
// Animated scroll bars get paint events all the time
|
||||
#ifdef Q_OS_WIN
|
||||
if (QSysInfo::WindowsVersion < QSysInfo::WV_VISTA)
|
||||
if (QOperatingSystemVersion::current() < QOperatingSystemVersion::WindowsVista)
|
||||
#endif
|
||||
QVERIFY(!bar.repainted);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user