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.12
18import Utils 0.1
19
20QtObject {
21 id: root
22
23 // This allows to override device name, used for convergence
24 // to set screens to desktop "mode"
25 property var overrideName: false
26
27 readonly property int useNativeOrientation: -1
28
29 readonly property alias name: priv.name;
30
31 readonly property alias primaryOrientation: priv.primaryOrientation
32 readonly property alias supportedOrientations: priv.supportedOrientations
33 readonly property alias landscapeOrientation: priv.landscapeOrientation
34 readonly property alias invertedLandscapeOrientation: priv.invertedLandscapeOrientation
35 readonly property alias portraitOrientation: priv.portraitOrientation
36 readonly property alias invertedPortraitOrientation: priv.invertedPortraitOrientation
37
38 readonly property alias category: priv.category
39
40 readonly property var deviceConfig: DeviceConfig {}
41
42 readonly property var binding: Binding {
43 target: priv
44 property: "state"
45 value: root.overrideName ? overrideName : deviceConfig.name
46 }
47
48 readonly property var priv: StateGroup {
49 id: priv
50
51 property int primaryOrientation: deviceConfig.primaryOrientation == Qt.PrimaryOrientation ?
52 root.useNativeOrientation : deviceConfig.primaryOrientation
53
54 property int supportedOrientations: deviceConfig.supportedOrientations
55
56 property int landscapeOrientation: deviceConfig.landscapeOrientation
57 property int invertedLandscapeOrientation: deviceConfig.invertedLandscapeOrientation
58 property int portraitOrientation: deviceConfig.portraitOrientation
59 property int invertedPortraitOrientation: deviceConfig.invertedPortraitOrientation
60 property string category: deviceConfig.category
61 property string name: deviceConfig.name
62 property bool supportsMultiColorLed: deviceConfig.supportsMultiColorLed
63
64 states: [
65 State {
66 name: "mako"
67 PropertyChanges {
68 target: priv
69 primaryOrientation: root.useNativeOrientation
70 supportedOrientations: Qt.PortraitOrientation
71 | Qt.LandscapeOrientation
72 | Qt.InvertedLandscapeOrientation
73 landscapeOrientation: Qt.LandscapeOrientation
74 invertedLandscapeOrientation: Qt.InvertedLandscapeOrientation
75 portraitOrientation: Qt.PortraitOrientation
76 invertedPortraitOrientation: Qt.InvertedPortraitOrientation
77 category: "phone"
78 name: "mako"
79 }
80 },
81 State {
82 name: "krillin"
83 PropertyChanges {
84 target: priv
85 primaryOrientation: root.useNativeOrientation
86 supportedOrientations: Qt.PortraitOrientation
87 | Qt.LandscapeOrientation
88 | Qt.InvertedLandscapeOrientation
89 landscapeOrientation: Qt.LandscapeOrientation
90 invertedLandscapeOrientation: Qt.InvertedLandscapeOrientation
91 portraitOrientation: Qt.PortraitOrientation
92 invertedPortraitOrientation: Qt.InvertedPortraitOrientation
93 category: "phone"
94 name: "krillin"
95 }
96 },
97 State {
98 name: "arale"
99 PropertyChanges {
100 target: priv
101 primaryOrientation: root.useNativeOrientation
102 supportedOrientations: Qt.PortraitOrientation
103 | Qt.InvertedPortraitOrientation
104 | Qt.LandscapeOrientation
105 | Qt.InvertedLandscapeOrientation
106 landscapeOrientation: Qt.LandscapeOrientation
107 invertedLandscapeOrientation: Qt.InvertedLandscapeOrientation
108 portraitOrientation: Qt.PortraitOrientation
109 invertedPortraitOrientation: Qt.InvertedPortraitOrientation
110 supportsMultiColorLed: false
111 category: "phone"
112 name: "arale"
113 }
114 },
115 State {
116 name: "manta"
117 PropertyChanges {
118 target: priv
119 primaryOrientation: root.useNativeOrientation
120 supportedOrientations: Qt.PortraitOrientation
121 | Qt.InvertedPortraitOrientation
122 | Qt.LandscapeOrientation
123 | Qt.InvertedLandscapeOrientation
124 landscapeOrientation: Qt.LandscapeOrientation
125 invertedLandscapeOrientation: Qt.InvertedLandscapeOrientation
126 portraitOrientation: Qt.PortraitOrientation
127 invertedPortraitOrientation: Qt.InvertedPortraitOrientation
128 category: "tablet"
129 name: "manta"
130 }
131 },
132 State {
133 name: "flo"
134 PropertyChanges {
135 target: priv
136 primaryOrientation: Qt.InvertedLandscapeOrientation
137 supportedOrientations: Qt.PortraitOrientation
138 | Qt.InvertedPortraitOrientation
139 | Qt.LandscapeOrientation
140 | Qt.InvertedLandscapeOrientation
141 landscapeOrientation: Qt.InvertedLandscapeOrientation
142 invertedLandscapeOrientation: Qt.LandscapeOrientation
143 portraitOrientation: Qt.PortraitOrientation
144 invertedPortraitOrientation: Qt.InvertedPortraitOrientation
145 category: "tablet"
146 name: "flo"
147 }
148 },
149 State {
150 name: "desktop"
151 PropertyChanges {
152 target: priv
153 primaryOrientation: root.useNativeOrientation
154 supportedOrientations: root.useNativeOrientation
155 landscapeOrientation: Qt.LandscapeOrientation
156 invertedLandscapeOrientation: Qt.InvertedLandscapeOrientation
157 portraitOrientation: Qt.PortraitOrientation
158 invertedPortraitOrientation: Qt.InvertedPortraitOrientation
159 category: "desktop"
160 name: "desktop"
161 }
162 },
163 State {
164 name: "turbo"
165 PropertyChanges {
166 target: priv
167 supportsMultiColorLed: false
168 }
169 }
170 ]
171 }
172}