1// Copyright (C) 2022 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 "qqmlsysteminformation_p.h"
5#include <QtCore/qsysinfo.h>
6
7QT_BEGIN_NAMESPACE
8
9/*!
10 \qmltype SystemInformation
11 \inherits QtObject
12 \inqmlmodule QtCore
13 \since 6.4
14 \brief Provides information about the system.
15
16 The SystemInformation singleton type provides information about the system,
17 using a similar API to \l QSysInfo, where each function in QSysInfo is
18 available as a property:
19
20 \qml
21 if (SystemInformation.wordSize === 64) {
22 console.log("64 bit")
23 } else {
24 console.log("32 bit")
25 }
26
27 if (SystemInformation.byteOrder === SystemInformation.Little) {
28 console.log("Little endian")
29 } else {
30 console.log("Big endian")
31 }
32
33 console.log("Currently running on " + SystemInformation.prettyProductName)
34 \endqml
35
36 \sa QSysInfo
37*/
38
39QQmlSystemInformation::QQmlSystemInformation(QObject *parent) : QObject(parent)
40{
41}
42
43int QQmlSystemInformation::wordSize() const
44{
45 return QSysInfo::WordSize;
46}
47
48QQmlSystemInformation::Endian QQmlSystemInformation::byteOrder() const
49{
50 return static_cast<Endian>(QSysInfo::ByteOrder);
51}
52
53QString QQmlSystemInformation::buildCpuArchitecture() const
54{
55 return QSysInfo::buildCpuArchitecture();
56}
57
58QString QQmlSystemInformation::currentCpuArchitecture() const
59{
60 return QSysInfo::currentCpuArchitecture();
61}
62
63QString QQmlSystemInformation::buildAbi() const
64{
65 return QSysInfo::buildAbi();
66}
67
68QString QQmlSystemInformation::kernelType() const
69{
70 return QSysInfo::kernelType();
71}
72
73QString QQmlSystemInformation::kernelVersion() const
74{
75 return QSysInfo::kernelVersion();
76}
77
78QString QQmlSystemInformation::productType() const
79{
80 return QSysInfo::productType();
81}
82
83QString QQmlSystemInformation::productVersion() const
84{
85 return QSysInfo::productVersion();
86}
87
88QString QQmlSystemInformation::prettyProductName() const
89{
90 return QSysInfo::prettyProductName();
91}
92
93QString QQmlSystemInformation::machineHostName() const
94{
95 return QSysInfo::machineHostName();
96}
97
98QByteArray QQmlSystemInformation::machineUniqueId() const
99{
100 return QSysInfo::machineUniqueId();
101}
102
103QByteArray QQmlSystemInformation::bootUniqueId() const
104{
105 return QSysInfo::bootUniqueId();
106}
107
108QT_END_NAMESPACE
109
110#include "moc_qqmlsysteminformation_p.cpp"
111

source code of qtdeclarative/src/core/qqmlsysteminformation.cpp