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 alias collapsedPanelHeight: priv.collapsedPanelHeight
42
43 readonly property var deviceConfig: DeviceConfig {}
44
45 readonly property var binding: Binding {
46 target: priv
47 property: "state"
48 value: root.overrideName ? overrideName : deviceConfig.name
49 restoreMode: Binding.RestoreBinding
50 }
51
52 readonly property var priv: StateGroup {
53 id: priv
54
55 property int primaryOrientation: deviceConfig.primaryOrientation == Qt.PrimaryOrientation ?
56 root.useNativeOrientation : deviceConfig.primaryOrientation
57
58 property int supportedOrientations: deviceConfig.supportedOrientations
59
60 property int landscapeOrientation: deviceConfig.landscapeOrientation
61 property int invertedLandscapeOrientation: deviceConfig.invertedLandscapeOrientation
62 property int portraitOrientation: deviceConfig.portraitOrientation
63 property int invertedPortraitOrientation: deviceConfig.invertedPortraitOrientation
64 property string category: deviceConfig.category
65 property string name: deviceConfig.name
66 property bool supportsMultiColorLed: deviceConfig.supportsMultiColorLed
67
68 property int collapsedPanelHeight: deviceConfig.collapsedPanelHeight
69
70 states: [
71 State {
72 name: "mako"
73 PropertyChanges {
74 target: priv
75 primaryOrientation: root.useNativeOrientation
76 supportedOrientations: Qt.PortraitOrientation
77 | Qt.LandscapeOrientation
78 | Qt.InvertedLandscapeOrientation
79 landscapeOrientation: Qt.LandscapeOrientation
80 invertedLandscapeOrientation: Qt.InvertedLandscapeOrientation
81 portraitOrientation: Qt.PortraitOrientation
82 invertedPortraitOrientation: Qt.InvertedPortraitOrientation
83 category: "phone"
84 name: "mako"
85 }
86 },
87 State {
88 name: "krillin"
89 PropertyChanges {
90 target: priv
91 primaryOrientation: root.useNativeOrientation
92 supportedOrientations: Qt.PortraitOrientation
93 | Qt.LandscapeOrientation
94 | Qt.InvertedLandscapeOrientation
95 landscapeOrientation: Qt.LandscapeOrientation
96 invertedLandscapeOrientation: Qt.InvertedLandscapeOrientation
97 portraitOrientation: Qt.PortraitOrientation
98 invertedPortraitOrientation: Qt.InvertedPortraitOrientation
99 category: "phone"
100 name: "krillin"
101 }
102 },
103 State {
104 name: "arale"
105 PropertyChanges {
106 target: priv
107 primaryOrientation: root.useNativeOrientation
108 supportedOrientations: Qt.PortraitOrientation
109 | Qt.InvertedPortraitOrientation
110 | Qt.LandscapeOrientation
111 | Qt.InvertedLandscapeOrientation
112 landscapeOrientation: Qt.LandscapeOrientation
113 invertedLandscapeOrientation: Qt.InvertedLandscapeOrientation
114 portraitOrientation: Qt.PortraitOrientation
115 invertedPortraitOrientation: Qt.InvertedPortraitOrientation
116 supportsMultiColorLed: false
117 category: "phone"
118 name: "arale"
119 }
120 },
121 State {
122 name: "manta"
123 PropertyChanges {
124 target: priv
125 primaryOrientation: root.useNativeOrientation
126 supportedOrientations: Qt.PortraitOrientation
127 | Qt.InvertedPortraitOrientation
128 | Qt.LandscapeOrientation
129 | Qt.InvertedLandscapeOrientation
130 landscapeOrientation: Qt.LandscapeOrientation
131 invertedLandscapeOrientation: Qt.InvertedLandscapeOrientation
132 portraitOrientation: Qt.PortraitOrientation
133 invertedPortraitOrientation: Qt.InvertedPortraitOrientation
134 category: "tablet"
135 name: "manta"
136 }
137 },
138 State {
139 name: "flo"
140 PropertyChanges {
141 target: priv
142 primaryOrientation: Qt.InvertedLandscapeOrientation
143 supportedOrientations: Qt.PortraitOrientation
144 | Qt.InvertedPortraitOrientation
145 | Qt.LandscapeOrientation
146 | Qt.InvertedLandscapeOrientation
147 landscapeOrientation: Qt.InvertedLandscapeOrientation
148 invertedLandscapeOrientation: Qt.LandscapeOrientation
149 portraitOrientation: Qt.PortraitOrientation
150 invertedPortraitOrientation: Qt.InvertedPortraitOrientation
151 category: "tablet"
152 name: "flo"
153 }
154 },
155 State {
156 name: "desktop"
157 PropertyChanges {
158 target: priv
159 primaryOrientation: root.useNativeOrientation
160 supportedOrientations: root.useNativeOrientation
161 landscapeOrientation: Qt.LandscapeOrientation
162 invertedLandscapeOrientation: Qt.InvertedLandscapeOrientation
163 portraitOrientation: Qt.PortraitOrientation
164 invertedPortraitOrientation: Qt.InvertedPortraitOrientation
165 category: "desktop"
166 name: "desktop"
167 }
168 },
169 State {
170 name: "turbo"
171 PropertyChanges {
172 target: priv
173 supportsMultiColorLed: false
174 }
175 }
176 ]
177 }
178
179 readonly property var debugConnections: Connections {
180 target: DebuggingController
181
182 function onDeviceInfoReloadRequested() {
183 deviceConfig.reload();
184 }
185 }
186}