| 1 | // Copyright (C) 2021 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #include "qoperatingsystemversion.h" |
| 5 | |
| 6 | #if !defined(Q_OS_DARWIN) && !defined(Q_OS_WIN) |
| 7 | #include "qoperatingsystemversion_p.h" |
| 8 | #endif |
| 9 | |
| 10 | #if defined(Q_OS_DARWIN) |
| 11 | #include <QtCore/private/qcore_mac_p.h> |
| 12 | #endif |
| 13 | |
| 14 | #include <qversionnumber.h> |
| 15 | #include <qdebug.h> |
| 16 | |
| 17 | #ifdef Q_OS_ANDROID |
| 18 | #include <QtCore/private/qjnihelpers_p.h> |
| 19 | #include <QJniObject> |
| 20 | #endif |
| 21 | |
| 22 | QT_BEGIN_NAMESPACE |
| 23 | |
| 24 | /*! |
| 25 | \class QOperatingSystemVersion |
| 26 | \inmodule QtCore |
| 27 | \since 5.9 |
| 28 | \brief The QOperatingSystemVersion class provides information about the |
| 29 | operating system version. |
| 30 | |
| 31 | Unlike other version functions in QSysInfo, QOperatingSystemVersion provides |
| 32 | access to the full version number that \a developers typically use to vary |
| 33 | behavior or determine whether to enable APIs or features based on the |
| 34 | operating system version (as opposed to the kernel version number or |
| 35 | marketing version). |
| 36 | |
| 37 | Presently, Android, Apple Platforms (iOS, macOS, tvOS, watchOS, and visionOS), |
| 38 | and Windows are supported. |
| 39 | |
| 40 | The \a majorVersion(), \a minorVersion(), and \a microVersion() functions |
| 41 | return the parts of the operating system version number based on: |
| 42 | |
| 43 | \table |
| 44 | \header |
| 45 | \li Platforms |
| 46 | \li Value |
| 47 | \row |
| 48 | \li Android |
| 49 | \li result of parsing |
| 50 | \l{https://developer.android.com/reference/android/os/Build.VERSION.html#RELEASE}{android.os.Build.VERSION.RELEASE} |
| 51 | using QVersionNumber, with a fallback to |
| 52 | \l{https://developer.android.com/reference/android/os/Build.VERSION.html#SDK_INT}{android.os.Build.VERSION.SDK_INT} |
| 53 | to determine the major and minor version component if the former |
| 54 | fails |
| 55 | \row |
| 56 | \li Apple Platforms |
| 57 | \li majorVersion, minorVersion, and patchVersion from |
| 58 | \l{https://developer.apple.com/reference/foundation/nsprocessinfo/1410906-operatingsystemversion?language=objc}{NSProcessInfo.operatingSystemVersion} |
| 59 | \row |
| 60 | \li Windows |
| 61 | \li dwMajorVersion, dwMinorVersion, and dwBuildNumber from |
| 62 | \l{https://docs.microsoft.com/en-us/windows/win32/devnotes/rtlgetversion} |
| 63 | {RtlGetVersion} - |
| 64 | note that this function ALWAYS return the version number of the |
| 65 | underlying operating system, as opposed to the shim underneath |
| 66 | GetVersionEx that hides the real version number if the |
| 67 | application is not manifested for that version of the OS |
| 68 | \endtable |
| 69 | |
| 70 | Because QOperatingSystemVersion stores both a version number and an OS type, the OS type |
| 71 | can be taken into account when performing comparisons. For example, on a macOS system running |
| 72 | macOS Sierra (v10.12), the following expression will return \c false even though the |
| 73 | major version number component of the object on the left hand side of the expression (10) is |
| 74 | greater than that of the object on the right (9): |
| 75 | |
| 76 | \snippet code/src_corelib_global_qoperatingsystemversion.cpp 0 |
| 77 | |
| 78 | This allows expressions for multiple operating systems to be joined with a logical OR operator |
| 79 | and still work as expected. For example: |
| 80 | |
| 81 | \snippet code/src_corelib_global_qoperatingsystemversion.cpp 1 |
| 82 | |
| 83 | A more naive comparison algorithm might incorrectly return true on all versions of macOS, |
| 84 | including Mac OS 9. This behavior is achieved by overloading the comparison operators to return |
| 85 | \c false whenever the OS types of the QOperatingSystemVersion instances being compared do not |
| 86 | match. Be aware that due to this it can be the case \c x >= y and \c x < y are BOTH \c false |
| 87 | for the same instances of \c x and \c y. |
| 88 | */ |
| 89 | |
| 90 | /*! |
| 91 | \enum QOperatingSystemVersion::OSType |
| 92 | |
| 93 | This enum provides symbolic names for the various operating |
| 94 | system families supported by QOperatingSystemVersion. |
| 95 | |
| 96 | \value Android The Google Android operating system. |
| 97 | \value IOS The Apple iOS operating system. |
| 98 | \value MacOS The Apple macOS operating system. |
| 99 | \value TvOS The Apple tvOS operating system. |
| 100 | \value WatchOS The Apple watchOS operating system. |
| 101 | \value VisionOS The Apple visionOS operating system. |
| 102 | \value Windows The Microsoft Windows operating system. |
| 103 | |
| 104 | \value Unknown An unknown or unsupported operating system. |
| 105 | */ |
| 106 | |
| 107 | /*! |
| 108 | \fn QOperatingSystemVersion::QOperatingSystemVersion(OSType osType, int vmajor, int vminor = -1, int vmicro = -1) |
| 109 | |
| 110 | Constructs a QOperatingSystemVersion consisting of the OS type \a osType, and |
| 111 | major, minor, and micro version numbers \a vmajor, \a vminor and \a vmicro, respectively. |
| 112 | */ |
| 113 | |
| 114 | /*! |
| 115 | \fn QOperatingSystemVersion::current() |
| 116 | Returns a QOperatingSystemVersion indicating the current OS and its version number. |
| 117 | |
| 118 | \sa currentType() |
| 119 | */ |
| 120 | QOperatingSystemVersionBase QOperatingSystemVersionBase::current() |
| 121 | { |
| 122 | static const QOperatingSystemVersionBase v = current_impl(); |
| 123 | return v; |
| 124 | } |
| 125 | |
| 126 | #if !defined(Q_OS_DARWIN) && !defined(Q_OS_WIN) |
| 127 | QOperatingSystemVersionBase QOperatingSystemVersionBase::current_impl() |
| 128 | { |
| 129 | QOperatingSystemVersionBase version; |
| 130 | version.m_os = currentType(); |
| 131 | #ifdef Q_OS_ANDROID |
| 132 | #ifndef QT_BOOTSTRAPPED |
| 133 | const QVersionNumber v = QVersionNumber::fromString(QJniObject::getStaticObjectField( |
| 134 | "android/os/Build$VERSION" , "RELEASE" , "Ljava/lang/String;" ).toString()); |
| 135 | if (!v.isNull()) { |
| 136 | version.m_major = v.majorVersion(); |
| 137 | version.m_minor = v.minorVersion(); |
| 138 | version.m_micro = v.microVersion(); |
| 139 | return version; |
| 140 | } |
| 141 | #endif |
| 142 | |
| 143 | version.m_major = -1; |
| 144 | version.m_minor = -1; |
| 145 | |
| 146 | static const struct { |
| 147 | uint major : 4; |
| 148 | uint minor : 4; |
| 149 | } versions[] = { |
| 150 | { 1, 0 }, // API level 1 |
| 151 | { 1, 1 }, // API level 2 |
| 152 | { 1, 5 }, // API level 3 |
| 153 | { 1, 6 }, // API level 4 |
| 154 | { 2, 0 }, // API level 5 |
| 155 | { 2, 0 }, // API level 6 |
| 156 | { 2, 1 }, // API level 7 |
| 157 | { 2, 2 }, // API level 8 |
| 158 | { 2, 3 }, // API level 9 |
| 159 | { 2, 3 }, // API level 10 |
| 160 | { 3, 0 }, // API level 11 |
| 161 | { 3, 1 }, // API level 12 |
| 162 | { 3, 2 }, // API level 13 |
| 163 | { 4, 0 }, // API level 14 |
| 164 | { 4, 0 }, // API level 15 |
| 165 | { 4, 1 }, // API level 16 |
| 166 | { 4, 2 }, // API level 17 |
| 167 | { 4, 3 }, // API level 18 |
| 168 | { 4, 4 }, // API level 19 |
| 169 | { 4, 4 }, // API level 20 |
| 170 | { 5, 0 }, // API level 21 |
| 171 | { 5, 1 }, // API level 22 |
| 172 | { 6, 0 }, // API level 23 |
| 173 | { 7, 0 }, // API level 24 |
| 174 | { 7, 1 }, // API level 25 |
| 175 | { 8, 0 }, // API level 26 |
| 176 | { 8, 1 }, // API level 27 |
| 177 | { 9, 0 }, // API level 28 |
| 178 | { 10, 0 }, // API level 29 |
| 179 | { 11, 0 }, // API level 30 |
| 180 | { 12, 0 }, // API level 31 |
| 181 | { 12, 0 }, // API level 32 |
| 182 | { 13, 0 }, // API level 33 |
| 183 | }; |
| 184 | |
| 185 | // This will give us at least the first 2 version components |
| 186 | const size_t versionIdx = QtAndroidPrivate::androidSdkVersion() - 1; |
| 187 | if (versionIdx < sizeof(versions) / sizeof(versions[0])) { |
| 188 | version.m_major = versions[versionIdx].major; |
| 189 | version.m_minor = versions[versionIdx].minor; |
| 190 | } |
| 191 | |
| 192 | // API level 6 was exactly version 2.0.1 |
| 193 | version.m_micro = versionIdx == 5 ? 1 : -1; |
| 194 | #else |
| 195 | version.m_major = -1; |
| 196 | version.m_minor = -1; |
| 197 | version.m_micro = -1; |
| 198 | #endif |
| 199 | return version; |
| 200 | } |
| 201 | #endif |
| 202 | |
| 203 | static inline int compareVersionComponents(int lhs, int rhs) noexcept |
| 204 | { |
| 205 | return lhs >= 0 && rhs >= 0 ? lhs - rhs : 0; |
| 206 | } |
| 207 | |
| 208 | int QOperatingSystemVersionBase::compare(QOperatingSystemVersionBase v1, |
| 209 | QOperatingSystemVersionBase v2) noexcept |
| 210 | { |
| 211 | if (v1.m_major == v2.m_major) { |
| 212 | if (v1.m_minor == v2.m_minor) { |
| 213 | return compareVersionComponents(lhs: v1.m_micro, rhs: v2.m_micro); |
| 214 | } |
| 215 | return compareVersionComponents(lhs: v1.m_minor, rhs: v2.m_minor); |
| 216 | } |
| 217 | return compareVersionComponents(lhs: v1.m_major, rhs: v2.m_major); |
| 218 | } |
| 219 | |
| 220 | /*! |
| 221 | \fn QVersionNumber QOperatingSystemVersion::version() const |
| 222 | |
| 223 | \since 6.1 |
| 224 | |
| 225 | Returns the operating system's version number. |
| 226 | |
| 227 | See the main class documentation for what the version number is on a given |
| 228 | operating system. |
| 229 | |
| 230 | \sa majorVersion(), minorVersion(), microVersion() |
| 231 | */ |
| 232 | |
| 233 | /*! |
| 234 | \fn int QOperatingSystemVersion::majorVersion() const |
| 235 | |
| 236 | Returns the major version number, that is, the first segment of the |
| 237 | operating system's version number. |
| 238 | |
| 239 | See the main class documentation for what the major version number is on a given |
| 240 | operating system. |
| 241 | |
| 242 | -1 indicates an unknown or absent version number component. |
| 243 | |
| 244 | \sa version(), minorVersion(), microVersion() |
| 245 | */ |
| 246 | |
| 247 | /*! |
| 248 | \fn int QOperatingSystemVersion::minorVersion() const |
| 249 | |
| 250 | Returns the minor version number, that is, the second segment of the |
| 251 | operating system's version number. |
| 252 | |
| 253 | See the main class documentation for what the minor version number is on a given |
| 254 | operating system. |
| 255 | |
| 256 | -1 indicates an unknown or absent version number component. |
| 257 | |
| 258 | \sa version(), majorVersion(), microVersion() |
| 259 | */ |
| 260 | |
| 261 | /*! |
| 262 | \fn int QOperatingSystemVersion::microVersion() const |
| 263 | |
| 264 | Returns the micro version number, that is, the third segment of the |
| 265 | operating system's version number. |
| 266 | |
| 267 | See the main class documentation for what the micro version number is on a given |
| 268 | operating system. |
| 269 | |
| 270 | -1 indicates an unknown or absent version number component. |
| 271 | |
| 272 | \sa version(), majorVersion(), minorVersion() |
| 273 | */ |
| 274 | |
| 275 | /*! |
| 276 | \fn int QOperatingSystemVersion::segmentCount() const |
| 277 | |
| 278 | Returns the number of integers stored in the version number. |
| 279 | */ |
| 280 | |
| 281 | /*! |
| 282 | \fn QOperatingSystemVersion::OSType QOperatingSystemVersion::type() const |
| 283 | |
| 284 | Returns the OS type identified by the QOperatingSystemVersion. |
| 285 | |
| 286 | \sa name() |
| 287 | */ |
| 288 | |
| 289 | /*! |
| 290 | \fn QOperatingSystemVersion::OSType QOperatingSystemVersion::currentType() |
| 291 | |
| 292 | Returns the current OS type without constructing a QOperatingSystemVersion instance. |
| 293 | |
| 294 | \since 5.10 |
| 295 | |
| 296 | \sa current() |
| 297 | */ |
| 298 | |
| 299 | /*! |
| 300 | \fn QString QOperatingSystemVersion::name() const |
| 301 | |
| 302 | Returns a string representation of the OS type identified by the QOperatingSystemVersion. |
| 303 | |
| 304 | \sa type() |
| 305 | */ |
| 306 | QString QOperatingSystemVersionBase::name(QOperatingSystemVersionBase osversion) |
| 307 | { |
| 308 | switch (osversion.type()) { |
| 309 | case QOperatingSystemVersionBase::Windows: |
| 310 | return QStringLiteral("Windows" ); |
| 311 | case QOperatingSystemVersionBase::MacOS: { |
| 312 | if (osversion.majorVersion() < 10) |
| 313 | return QStringLiteral("Mac OS" ); |
| 314 | if (osversion.majorVersion() == 10 && osversion.minorVersion() < 8) |
| 315 | return QStringLiteral("Mac OS X" ); |
| 316 | if (osversion.majorVersion() == 10 && osversion.minorVersion() < 12) |
| 317 | return QStringLiteral("OS X" ); |
| 318 | return QStringLiteral("macOS" ); |
| 319 | } |
| 320 | case QOperatingSystemVersionBase::IOS: { |
| 321 | if (osversion.majorVersion() < 4) |
| 322 | return QStringLiteral("iPhone OS" ); |
| 323 | return QStringLiteral("iOS" ); |
| 324 | } |
| 325 | case QOperatingSystemVersionBase::TvOS: |
| 326 | return QStringLiteral("tvOS" ); |
| 327 | case QOperatingSystemVersionBase::WatchOS: |
| 328 | return QStringLiteral("watchOS" ); |
| 329 | case QOperatingSystemVersionBase::VisionOS: |
| 330 | return QStringLiteral("visionOS" ); |
| 331 | case QOperatingSystemVersionBase::Android: |
| 332 | return QStringLiteral("Android" ); |
| 333 | case QOperatingSystemVersionBase::Unknown: |
| 334 | default: |
| 335 | return QString(); |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | /*! |
| 340 | \fn bool QOperatingSystemVersion::isAnyOfType(std::initializer_list<OSType> types) const |
| 341 | |
| 342 | Returns whether the OS type identified by the QOperatingSystemVersion |
| 343 | matches any of the OS types in \a types. |
| 344 | */ |
| 345 | bool QOperatingSystemVersion::isAnyOfType(std::initializer_list<OSType> types) const |
| 346 | { |
| 347 | // ### Qt7: Remove this function |
| 348 | return std::find(first: types.begin(), last: types.end(), val: type()) != types.end(); |
| 349 | } |
| 350 | |
| 351 | bool QOperatingSystemVersionBase::isAnyOfType(std::initializer_list<OSType> types, OSType type) |
| 352 | { |
| 353 | return std::find(first: types.begin(), last: types.end(), val: type) != types.end(); |
| 354 | } |
| 355 | |
| 356 | #ifndef QT_BOOTSTRAPPED |
| 357 | |
| 358 | /*! |
| 359 | \variable QOperatingSystemVersion::Windows7 |
| 360 | \brief a version corresponding to Windows 7 (version 6.1). |
| 361 | \since 5.9 |
| 362 | */ |
| 363 | const QOperatingSystemVersion QOperatingSystemVersion::Windows7 = |
| 364 | QOperatingSystemVersion(QOperatingSystemVersion::Windows, 6, 1); |
| 365 | |
| 366 | /*! |
| 367 | \variable QOperatingSystemVersion::Windows8 |
| 368 | \brief a version corresponding to Windows 8 (version 6.2). |
| 369 | \since 5.9 |
| 370 | */ |
| 371 | const QOperatingSystemVersion QOperatingSystemVersion::Windows8 = |
| 372 | QOperatingSystemVersion(QOperatingSystemVersion::Windows, 6, 2); |
| 373 | |
| 374 | /*! |
| 375 | \variable QOperatingSystemVersion::Windows8_1 |
| 376 | \brief a version corresponding to Windows 8.1 (version 6.3). |
| 377 | \since 5.9 |
| 378 | */ |
| 379 | const QOperatingSystemVersion QOperatingSystemVersion::Windows8_1 = |
| 380 | QOperatingSystemVersion(QOperatingSystemVersion::Windows, 6, 3); |
| 381 | |
| 382 | /*! |
| 383 | \variable QOperatingSystemVersion::Windows10 |
| 384 | \brief a version corresponding to general Windows 10 (version 10.0). |
| 385 | \since 5.9 |
| 386 | */ |
| 387 | const QOperatingSystemVersion QOperatingSystemVersion::Windows10 = |
| 388 | QOperatingSystemVersion(QOperatingSystemVersion::Windows, 10); |
| 389 | |
| 390 | /*! |
| 391 | \variable QOperatingSystemVersion::Windows10_1809 |
| 392 | \brief a version corresponding to Windows 10 October 2018 Update |
| 393 | Version 1809 (version 10.0.17763). |
| 394 | \since 6.3 |
| 395 | */ |
| 396 | const QOperatingSystemVersionBase QOperatingSystemVersion::Windows10_1809; |
| 397 | |
| 398 | /*! |
| 399 | \variable QOperatingSystemVersion::Windows10_1903 |
| 400 | \brief a version corresponding to Windows 10 May 2019 Update |
| 401 | Version 1903 (version 10.0.18362). |
| 402 | \since 6.3 |
| 403 | */ |
| 404 | const QOperatingSystemVersionBase QOperatingSystemVersion::Windows10_1903; |
| 405 | |
| 406 | /*! |
| 407 | \variable QOperatingSystemVersion::Windows10_1909 |
| 408 | \brief a version corresponding to Windows 10 November 2019 Update |
| 409 | Version 1909 (version 10.0.18363). |
| 410 | \since 6.3 |
| 411 | */ |
| 412 | const QOperatingSystemVersionBase QOperatingSystemVersion::Windows10_1909; |
| 413 | |
| 414 | /*! |
| 415 | \variable QOperatingSystemVersion::Windows10_2004 |
| 416 | \brief a version corresponding to Windows 10 May 2020 Update |
| 417 | Version 2004 (version 10.0.19041). |
| 418 | \since 6.3 |
| 419 | */ |
| 420 | const QOperatingSystemVersionBase QOperatingSystemVersion::Windows10_2004; |
| 421 | |
| 422 | /*! |
| 423 | \variable QOperatingSystemVersion::Windows10_20H2 |
| 424 | \brief a version corresponding to Windows 10 October 2020 Update |
| 425 | Version 20H2 (version 10.0.19042). |
| 426 | \since 6.3 |
| 427 | */ |
| 428 | const QOperatingSystemVersionBase QOperatingSystemVersion::Windows10_20H2; |
| 429 | |
| 430 | /*! |
| 431 | \variable QOperatingSystemVersion::Windows10_21H1 |
| 432 | \brief a version corresponding to Windows 10 May 2021 Update |
| 433 | Version 21H1 (version 10.0.19043). |
| 434 | \since 6.3 |
| 435 | */ |
| 436 | const QOperatingSystemVersionBase QOperatingSystemVersion::Windows10_21H1; |
| 437 | |
| 438 | /*! |
| 439 | \variable QOperatingSystemVersion::Windows10_21H2 |
| 440 | \brief a version corresponding to Windows 10 November 2021 Update |
| 441 | Version 21H2 (version 10.0.19044). |
| 442 | \since 6.3 |
| 443 | */ |
| 444 | const QOperatingSystemVersionBase QOperatingSystemVersion::Windows10_21H2; |
| 445 | |
| 446 | /*! |
| 447 | \variable QOperatingSystemVersion::Windows10_22H2 |
| 448 | \brief a version corresponding to Windows 10 October 2022 Update |
| 449 | Version 22H2 (version 10.0.19045). |
| 450 | \since 6.5 |
| 451 | */ |
| 452 | const QOperatingSystemVersionBase QOperatingSystemVersion::Windows10_22H2; |
| 453 | |
| 454 | /*! |
| 455 | \variable QOperatingSystemVersion::Windows11 |
| 456 | \brief a version corresponding to the initial release of Windows 11 |
| 457 | (version 10.0.22000). |
| 458 | \since 6.3 |
| 459 | */ |
| 460 | const QOperatingSystemVersionBase QOperatingSystemVersion::Windows11; |
| 461 | |
| 462 | /*! |
| 463 | \variable QOperatingSystemVersion::Windows11_21H2 |
| 464 | \brief a version corresponding to Windows 11 Version 21H2 (version 10.0.22000). |
| 465 | \since 6.4 |
| 466 | */ |
| 467 | const QOperatingSystemVersionBase QOperatingSystemVersion::Windows11_21H2; |
| 468 | |
| 469 | /*! |
| 470 | \variable QOperatingSystemVersion::Windows11_22H2 |
| 471 | \brief a version corresponding to Windows 11 Version 22H2 (version 10.0.22621). |
| 472 | \since 6.4 |
| 473 | */ |
| 474 | const QOperatingSystemVersionBase QOperatingSystemVersion::Windows11_22H2; |
| 475 | |
| 476 | /*! |
| 477 | \variable QOperatingSystemVersion::Windows11_23H2 |
| 478 | \brief a version corresponding to Windows 11 Version 23H2 (version 10.0.22631). |
| 479 | \since 6.6 |
| 480 | */ |
| 481 | |
| 482 | /*! |
| 483 | \variable QOperatingSystemVersion::Windows11_24H2 |
| 484 | \brief a version corresponding to Windows 11 Version 24H2 (version 10.0.26100). |
| 485 | \since 6.8.1 |
| 486 | */ |
| 487 | |
| 488 | /*! |
| 489 | \variable QOperatingSystemVersion::OSXMavericks |
| 490 | \brief a version corresponding to OS X Mavericks (version 10.9). |
| 491 | \since 5.9 |
| 492 | */ |
| 493 | const QOperatingSystemVersion QOperatingSystemVersion::OSXMavericks = |
| 494 | QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 9); |
| 495 | |
| 496 | /*! |
| 497 | \variable QOperatingSystemVersion::OSXYosemite |
| 498 | \brief a version corresponding to OS X Yosemite (version 10.10). |
| 499 | \since 5.9 |
| 500 | */ |
| 501 | const QOperatingSystemVersion QOperatingSystemVersion::OSXYosemite = |
| 502 | QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 10); |
| 503 | |
| 504 | /*! |
| 505 | \variable QOperatingSystemVersion::OSXElCapitan |
| 506 | \brief a version corresponding to OS X El Capitan (version 10.11). |
| 507 | \since 5.9 |
| 508 | */ |
| 509 | const QOperatingSystemVersion QOperatingSystemVersion::OSXElCapitan = |
| 510 | QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 11); |
| 511 | |
| 512 | /*! |
| 513 | \variable QOperatingSystemVersion::MacOSSierra |
| 514 | \brief a version corresponding to macOS Sierra (version 10.12). |
| 515 | \since 5.9 |
| 516 | */ |
| 517 | const QOperatingSystemVersion QOperatingSystemVersion::MacOSSierra = |
| 518 | QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 12); |
| 519 | |
| 520 | /*! |
| 521 | \variable QOperatingSystemVersion::MacOSHighSierra |
| 522 | \brief a version corresponding to macOS High Sierra (version 10.13). |
| 523 | \since 5.9.1 |
| 524 | */ |
| 525 | const QOperatingSystemVersion QOperatingSystemVersion::MacOSHighSierra = |
| 526 | QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 13); |
| 527 | |
| 528 | /*! |
| 529 | \variable QOperatingSystemVersion::MacOSMojave |
| 530 | \brief a version corresponding to macOS Mojave (version 10.14). |
| 531 | \since 5.11.2 |
| 532 | */ |
| 533 | const QOperatingSystemVersion QOperatingSystemVersion::MacOSMojave = |
| 534 | QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 14); |
| 535 | |
| 536 | /*! |
| 537 | \variable QOperatingSystemVersion::MacOSCatalina |
| 538 | \brief a version corresponding to macOS Catalina (version 10.15). |
| 539 | \since 5.12.5 |
| 540 | */ |
| 541 | const QOperatingSystemVersion QOperatingSystemVersion::MacOSCatalina = |
| 542 | QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 15); |
| 543 | |
| 544 | /*! |
| 545 | \variable QOperatingSystemVersion::MacOSBigSur |
| 546 | \brief a version corresponding to macOS Big Sur (version 11). |
| 547 | \since 6.0 |
| 548 | */ |
| 549 | const QOperatingSystemVersion QOperatingSystemVersion::MacOSBigSur = |
| 550 | QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 11); |
| 551 | |
| 552 | /*! |
| 553 | \variable QOperatingSystemVersion::MacOSMonterey |
| 554 | \brief a version corresponding to macOS Monterey (version 12). |
| 555 | \since 6.3 |
| 556 | */ |
| 557 | const QOperatingSystemVersion QOperatingSystemVersion::MacOSMonterey = |
| 558 | QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 12); |
| 559 | |
| 560 | /*! |
| 561 | \variable QOperatingSystemVersion::MacOSVentura |
| 562 | \brief a version corresponding to macOS Ventura (version 13). |
| 563 | \since 6.4 |
| 564 | */ |
| 565 | const QOperatingSystemVersionBase QOperatingSystemVersion::MacOSVentura; |
| 566 | |
| 567 | /*! |
| 568 | \variable QOperatingSystemVersion::MacOSSonoma |
| 569 | \brief a version corresponding to macOS Sonoma (version 14). |
| 570 | \since 6.5 |
| 571 | */ |
| 572 | |
| 573 | /*! |
| 574 | \variable QOperatingSystemVersion::MacOSSequoia |
| 575 | \brief a version corresponding to macOS Sequoia (version 15). |
| 576 | \since 6.8 |
| 577 | */ |
| 578 | |
| 579 | /*! |
| 580 | \variable QOperatingSystemVersion::MacOSTahoe |
| 581 | \brief a version corresponding to macOS Tahoe (version 26). |
| 582 | \since 6.10 |
| 583 | */ |
| 584 | |
| 585 | /*! |
| 586 | \variable QOperatingSystemVersion::AndroidJellyBean |
| 587 | \brief a version corresponding to Android Jelly Bean (version 4.1, API level 16). |
| 588 | \since 5.9 |
| 589 | */ |
| 590 | const QOperatingSystemVersion QOperatingSystemVersion::AndroidJellyBean = |
| 591 | QOperatingSystemVersion(QOperatingSystemVersion::Android, 4, 1); |
| 592 | |
| 593 | /*! |
| 594 | \variable QOperatingSystemVersion::AndroidJellyBean_MR1 |
| 595 | \brief a version corresponding to Android Jelly Bean, maintenance release 1 |
| 596 | (version 4.2, API level 17). |
| 597 | \since 5.9 |
| 598 | */ |
| 599 | const QOperatingSystemVersion QOperatingSystemVersion::AndroidJellyBean_MR1 = |
| 600 | QOperatingSystemVersion(QOperatingSystemVersion::Android, 4, 2); |
| 601 | |
| 602 | /*! |
| 603 | \variable QOperatingSystemVersion::AndroidJellyBean_MR2 |
| 604 | \brief a version corresponding to Android Jelly Bean, maintenance release 2 |
| 605 | (version 4.3, API level 18). |
| 606 | \since 5.9 |
| 607 | */ |
| 608 | const QOperatingSystemVersion QOperatingSystemVersion::AndroidJellyBean_MR2 = |
| 609 | QOperatingSystemVersion(QOperatingSystemVersion::Android, 4, 3); |
| 610 | |
| 611 | /*! |
| 612 | \variable QOperatingSystemVersion::AndroidKitKat |
| 613 | \brief a version corresponding to Android KitKat (versions 4.4 & 4.4W, API levels 19 & 20). |
| 614 | \since 5.9 |
| 615 | */ |
| 616 | const QOperatingSystemVersion QOperatingSystemVersion::AndroidKitKat = |
| 617 | QOperatingSystemVersion(QOperatingSystemVersion::Android, 4, 4); |
| 618 | |
| 619 | /*! |
| 620 | \variable QOperatingSystemVersion::AndroidLollipop |
| 621 | \brief a version corresponding to Android Lollipop (version 5.0, API level 21). |
| 622 | \since 5.9 |
| 623 | */ |
| 624 | const QOperatingSystemVersion QOperatingSystemVersion::AndroidLollipop = |
| 625 | QOperatingSystemVersion(QOperatingSystemVersion::Android, 5, 0); |
| 626 | |
| 627 | /*! |
| 628 | \variable QOperatingSystemVersion::AndroidLollipop_MR1 |
| 629 | \brief a version corresponding to Android Lollipop, maintenance release 1 |
| 630 | (version 5.1, API level 22). |
| 631 | \since 5.9 |
| 632 | */ |
| 633 | const QOperatingSystemVersion QOperatingSystemVersion::AndroidLollipop_MR1 = |
| 634 | QOperatingSystemVersion(QOperatingSystemVersion::Android, 5, 1); |
| 635 | |
| 636 | /*! |
| 637 | \variable QOperatingSystemVersion::AndroidMarshmallow |
| 638 | \brief a version corresponding to Android Marshmallow (version 6.0, API level 23). |
| 639 | \since 5.9 |
| 640 | */ |
| 641 | const QOperatingSystemVersion QOperatingSystemVersion::AndroidMarshmallow = |
| 642 | QOperatingSystemVersion(QOperatingSystemVersion::Android, 6, 0); |
| 643 | |
| 644 | /*! |
| 645 | \variable QOperatingSystemVersion::AndroidNougat |
| 646 | \brief a version corresponding to Android Nougat (version 7.0, API level 24). |
| 647 | \since 5.9 |
| 648 | */ |
| 649 | const QOperatingSystemVersion QOperatingSystemVersion::AndroidNougat = |
| 650 | QOperatingSystemVersion(QOperatingSystemVersion::Android, 7, 0); |
| 651 | |
| 652 | /*! |
| 653 | \variable QOperatingSystemVersion::AndroidNougat_MR1 |
| 654 | \brief a version corresponding to Android Nougat, maintenance release 1 |
| 655 | (version 7.0, API level 25). |
| 656 | \since 5.9 |
| 657 | */ |
| 658 | const QOperatingSystemVersion QOperatingSystemVersion::AndroidNougat_MR1 = |
| 659 | QOperatingSystemVersion(QOperatingSystemVersion::Android, 7, 1); |
| 660 | |
| 661 | /*! |
| 662 | \variable QOperatingSystemVersion::AndroidOreo |
| 663 | \brief a version corresponding to Android Oreo (version 8.0, API level 26). |
| 664 | \since 5.9.2 |
| 665 | */ |
| 666 | const QOperatingSystemVersion QOperatingSystemVersion::AndroidOreo = |
| 667 | QOperatingSystemVersion(QOperatingSystemVersion::Android, 8, 0); |
| 668 | |
| 669 | /*! |
| 670 | \variable QOperatingSystemVersion::AndroidOreo_MR1 |
| 671 | \brief a version corresponding to Android Oreo_MR1 (version 8.1, API level 27). |
| 672 | \since 6.1 |
| 673 | */ |
| 674 | const QOperatingSystemVersion QOperatingSystemVersion::AndroidOreo_MR1 = |
| 675 | QOperatingSystemVersion(QOperatingSystemVersion::Android, 8, 1); |
| 676 | |
| 677 | /*! |
| 678 | \variable QOperatingSystemVersion::AndroidPie |
| 679 | \brief a version corresponding to Android Pie (version 9.0, API level 28). |
| 680 | \since 6.1 |
| 681 | */ |
| 682 | const QOperatingSystemVersion QOperatingSystemVersion::AndroidPie = |
| 683 | QOperatingSystemVersion(QOperatingSystemVersion::Android, 9, 0); |
| 684 | |
| 685 | /*! |
| 686 | \variable QOperatingSystemVersion::Android10 |
| 687 | \brief a version corresponding to Android 10 (version 10.0, API level 29). |
| 688 | \since 6.1 |
| 689 | */ |
| 690 | const QOperatingSystemVersion QOperatingSystemVersion::Android10 = |
| 691 | QOperatingSystemVersion(QOperatingSystemVersion::Android, 10, 0); |
| 692 | |
| 693 | /*! |
| 694 | \variable QOperatingSystemVersion::Android11 |
| 695 | \brief a version corresponding to Android 11 (version 11.0, API level 30). |
| 696 | \since 6.1 |
| 697 | */ |
| 698 | const QOperatingSystemVersion QOperatingSystemVersion::Android11 = |
| 699 | QOperatingSystemVersion(QOperatingSystemVersion::Android, 11, 0); |
| 700 | |
| 701 | /*! |
| 702 | \variable QOperatingSystemVersion::Android12 |
| 703 | \brief a version corresponding to Android 12 (version 12.0, API level 31). |
| 704 | \since 6.5 |
| 705 | */ |
| 706 | const QOperatingSystemVersionBase QOperatingSystemVersion::Android12; |
| 707 | |
| 708 | /*! |
| 709 | \variable QOperatingSystemVersion::Android12L |
| 710 | \brief a version corresponding to Android 12L (version 12.0, API level 32). |
| 711 | \since 6.5 |
| 712 | */ |
| 713 | const QOperatingSystemVersionBase QOperatingSystemVersion::Android12L; |
| 714 | |
| 715 | /*! |
| 716 | \variable QOperatingSystemVersion::Android13 |
| 717 | \brief a version corresponding to Android 13 (version 13.0, API level 33). |
| 718 | \since 6.5 |
| 719 | */ |
| 720 | const QOperatingSystemVersionBase QOperatingSystemVersion::Android13; |
| 721 | |
| 722 | /*! |
| 723 | \variable QOperatingSystemVersion::Android14 |
| 724 | \brief a version corresponding to Android 14 (version 14.0, API level 34). |
| 725 | \since 6.7 |
| 726 | */ |
| 727 | |
| 728 | #endif // !QT_BOOTSTRAPPED |
| 729 | |
| 730 | #ifndef QT_NO_DEBUG_STREAM |
| 731 | QDebug operator<<(QDebug debug, const QOperatingSystemVersion &ov) |
| 732 | { |
| 733 | QDebugStateSaver saver(debug); |
| 734 | debug.nospace(); |
| 735 | debug << "QOperatingSystemVersion(" << ov.name() |
| 736 | << ", " << ov.majorVersion() << '.' << ov.minorVersion() |
| 737 | << '.' << ov.microVersion() << ')'; |
| 738 | return debug; |
| 739 | } |
| 740 | #endif // !QT_NO_DEBUG_STREAM |
| 741 | |
| 742 | QT_END_NAMESPACE |
| 743 | |