Debian Codegraph @

examples/systeminfo/qml-deviceinfo/qml-deviceinfo.qml

raw
1 /****************************************************************************
2 **
3 ** Copyright (C) 2017 The Qt Company Ltd and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtSystems module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:BSD$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** BSD License Usage
18 ** Alternatively, you may use this file under the terms of the BSD license
19 ** as follows:
20 **
21 ** "Redistribution and use in source and binary forms, with or without
22 ** modification, are permitted provided that the following conditions are
23 ** met:
24 ** * Redistributions of source code must retain the above copyright
25 ** notice, this list of conditions and the following disclaimer.
26 ** * Redistributions in binary form must reproduce the above copyright
27 ** notice, this list of conditions and the following disclaimer in
28 ** the documentation and/or other materials provided with the
29 ** distribution.
30 ** * Neither the name of The Qt Company Ltd nor the names of its
31 ** contributors may be used to endorse or promote products derived
32 ** from this software without specific prior written permission.
33 **
34 **
35 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
36 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
37 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
38 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
39 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
42 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
43 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
46 **
47 ** $QT_END_LICENSE$
48 **
49 ****************************************************************************/
50
51 import QtQuick 2.0
52 import QtSystemInfo 5.0
53 import QtQuick.Window 2.0
54
55 Rectangle {
56 width: 320; height: 480
57
58 Flickable {
59 id: flickable
60 anchors.margins: 10
61 anchors.leftMargin: 20
62 anchors.fill: parent
63 contentWidth: column.width; contentHeight: column.height
64 Column {
65 id: column
66 spacing: 10
67 Text {
68 text: "Device Info:"
69 x: -10
70 font.bold: true
71 }
72 Text {
73 text: "Manufacturer: " + devinfo.manufacturer()
74 }
75 Text {
76 text: "Product name: " + devinfo.productName()
77 }
78 Text {
79 text: "Model: " + devinfo.model()
80 }
81 Text {
82 text: "Unique device ID: " + devinfo.uniqueDeviceID()
83 }
84 Text {
85 text: "OS version: " + devinfo.version(DeviceInfo.Os)
86 }
87 Text {
88 text: "Firmware version: " + devinfo.version(DeviceInfo.Firmware)
89 }
90 Text {
91 text: "IMEI :" + devinfo.imei(0)
92 }
93 Text {
94 text: "Thermal state: " + devinfo.thermalState
95 }
96 Text {
97 text: "Screen Info:"
98 x: -10
99 font.bold: true
100 }
101 Text {
102 text: "resolution: " + Screen.width + " x " + Screen.height;
103 }
104 Text {
105 text: "orientation: " + Screen.orientation + " primary " + Screen.primaryOrientation;
106 }
107 }
108 }
109 Rectangle {
110 id: scrollDecoratorV
111 color: "grey"
112 opacity: 0.5
113 width: 5
114 radius: width / 2
115 smooth: true
116 property real ratio: flickable.height / column.height
117 height: flickable.height * ratio
118 y: flickable.anchors.topMargin + flickable.contentY * ratio
119 anchors.right: parent.right
120 anchors.margins: 2
121 visible: flickable.height < column.height
122 }
123 Rectangle {
124 id: scrollDecoratorH
125 color: "grey"
126 opacity: 0.5
127 height: 5
128 radius: height / 2
129 smooth: true
130 property real ratio: flickable.width / column.width
131 width: flickable.width * ratio
132 x: flickable.anchors.topMargin + flickable.contentX * ratio
133 anchors.bottom: parent.bottom
134 anchors.margins: 2
135 visible: flickable.width < column.width
136 }
137
138 DeviceInfo {
139 id: devinfo;
140 }
141 }