Lomiri
Loading...
Searching...
No Matches
DeviceConfiguration.qml
1/*
2 * Copyright (C) 2015-2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.15
18import QtQml 2.15
19import Utils 0.1
20
21QtObject {
22 id: root
23
24 // This allows to override device name, used for convergence
25 // to set screens to desktop "mode"
26 property var overrideName: false
27
28 readonly property int useNativeOrientation: -1
29
30 readonly property alias name: priv.name;
31
32 readonly property alias primaryOrientation: priv.primaryOrientation
33 readonly property alias supportedOrientations: priv.supportedOrientations
34 readonly property alias landscapeOrientation: priv.landscapeOrientation
35 readonly property alias invertedLandscapeOrientation: priv.invertedLandscapeOrientation
36 readonly property alias portraitOrientation: priv.portraitOrientation
37 readonly property alias invertedPortraitOrientation: priv.invertedPortraitOrientation
38
39 readonly property alias category: priv.category
40
41 readonly property bool foldable: deviceConfig.foldable
42 readonly property string foldableSysfsPath: deviceConfig.foldableSysfsPath
43 readonly property int innerGridUnit: deviceConfig.innerGridUnit
44 readonly property int coverGridUnit: deviceConfig.coverGridUnit
45 readonly property int coverOrientationAngle: deviceConfig.coverOrientationAngle
46
47 readonly property var deviceConfig: DeviceConfig {}
48
49 readonly property var binding: Binding {
50 target: priv
51 property: "state"
52 value: root.overrideName ? overrideName : deviceConfig.name
53 restoreMode: Binding.RestoreBinding
54 }
55
56 readonly property var priv: StateGroup {
57 id: priv
58
59 property int primaryOrientation: deviceConfig.primaryOrientation == Qt.PrimaryOrientation ?
60 root.useNativeOrientation : deviceConfig.primaryOrientation
61
62 property int supportedOrientations: deviceConfig.supportedOrientations
63
64 property int landscapeOrientation: deviceConfig.landscapeOrientation
65 property int invertedLandscapeOrientation: deviceConfig.invertedLandscapeOrientation
66 property int portraitOrientation: deviceConfig.portraitOrientation
67 property int invertedPortraitOrientation: deviceConfig.invertedPortraitOrientation
68 property string category: deviceConfig.category
69 property string name: deviceConfig.name
70 property bool supportsMultiColorLed: deviceConfig.supportsMultiColorLed
71
72 states: [
73 State {
74 name: "mako"
75 PropertyChanges {
76 target: priv
77 primaryOrientation: root.useNativeOrientation
78 supportedOrientations: Qt.PortraitOrientation
79 | Qt.LandscapeOrientation
80 | Qt.InvertedLandscapeOrientation
81 landscapeOrientation: Qt.LandscapeOrientation
82 invertedLandscapeOrientation: Qt.InvertedLandscapeOrientation
83 portraitOrientation: Qt.PortraitOrientation
84 invertedPortraitOrientation: Qt.InvertedPortraitOrientation
85 category: "phone"
86 name: "mako"
87 }
88 },
89 State {
90 name: "krillin"
91 PropertyChanges {
92 target: priv
93 primaryOrientation: root.useNativeOrientation
94 supportedOrientations: Qt.PortraitOrientation
95 | Qt.LandscapeOrientation
96 | Qt.InvertedLandscapeOrientation
97 landscapeOrientation: Qt.LandscapeOrientation
98 invertedLandscapeOrientation: Qt.InvertedLandscapeOrientation
99 portraitOrientation: Qt.PortraitOrientation
100 invertedPortraitOrientation: Qt.InvertedPortraitOrientation
101 category: "phone"
102 name: "krillin"
103 }
104 },
105 State {
106 name: "arale"
107 PropertyChanges {
108 target: priv
109 primaryOrientation: root.useNativeOrientation
110 supportedOrientations: Qt.PortraitOrientation
111 | Qt.InvertedPortraitOrientation
112 | Qt.LandscapeOrientation
113 | Qt.InvertedLandscapeOrientation
114 landscapeOrientation: Qt.LandscapeOrientation
115 invertedLandscapeOrientation: Qt.InvertedLandscapeOrientation
116 portraitOrientation: Qt.PortraitOrientation
117 invertedPortraitOrientation: Qt.InvertedPortraitOrientation
118 supportsMultiColorLed: false
119 category: "phone"
120 name: "arale"
121 }
122 },
123 State {
124 name: "manta"
125 PropertyChanges {
126 target: priv
127 primaryOrientation: root.useNativeOrientation
128 supportedOrientations: Qt.PortraitOrientation
129 | Qt.InvertedPortraitOrientation
130 | Qt.LandscapeOrientation
131 | Qt.InvertedLandscapeOrientation
132 landscapeOrientation: Qt.LandscapeOrientation
133 invertedLandscapeOrientation: Qt.InvertedLandscapeOrientation
134 portraitOrientation: Qt.PortraitOrientation
135 invertedPortraitOrientation: Qt.InvertedPortraitOrientation
136 category: "tablet"
137 name: "manta"
138 }
139 },
140 State {
141 name: "flo"
142 PropertyChanges {
143 target: priv
144 primaryOrientation: Qt.InvertedLandscapeOrientation
145 supportedOrientations: Qt.PortraitOrientation
146 | Qt.InvertedPortraitOrientation
147 | Qt.LandscapeOrientation
148 | Qt.InvertedLandscapeOrientation
149 landscapeOrientation: Qt.InvertedLandscapeOrientation
150 invertedLandscapeOrientation: Qt.LandscapeOrientation
151 portraitOrientation: Qt.PortraitOrientation
152 invertedPortraitOrientation: Qt.InvertedPortraitOrientation
153 category: "tablet"
154 name: "flo"
155 }
156 },
157 State {
158 name: "desktop"
159 PropertyChanges {
160 target: priv
161 primaryOrientation: root.useNativeOrientation
162 supportedOrientations: root.useNativeOrientation
163 landscapeOrientation: Qt.LandscapeOrientation
164 invertedLandscapeOrientation: Qt.InvertedLandscapeOrientation
165 portraitOrientation: Qt.PortraitOrientation
166 invertedPortraitOrientation: Qt.InvertedPortraitOrientation
167 category: "desktop"
168 name: "desktop"
169 }
170 },
171 State {
172 name: "turbo"
173 PropertyChanges {
174 target: priv
175 supportsMultiColorLed: false
176 }
177 }
178 ]
179 }
180}