on bbccae6 help sign in
unity8/qml/DeviceConfiguration.qml
116 lines 4.3 kB history raw
1/*
2 * Copyright (C) 2015 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 */
17import QtQuick 2.4
19QtObject {
20 id: root
22 readonly property int useNativeOrientation: -1
24 // The only writable property in the API
25 // all other properties are set according to the device name
26 property alias name: priv.state
28 readonly property alias primaryOrientation: priv.primaryOrientation
29 readonly property alias supportedOrientations: priv.supportedOrientations
30 readonly property alias landscapeOrientation: priv.landscapeOrientation
31 readonly property alias invertedLandscapeOrientation: priv.invertedLandscapeOrientation
32 readonly property alias portraitOrientation: priv.portraitOrientation
33 readonly property alias invertedPortraitOrientation: priv.invertedPortraitOrientation
35 readonly property alias category: priv.category
37 readonly property alias ignoredMice: priv.ignoredMice
39 readonly property var priv: StateGroup {
40 id: priv
42 property int primaryOrientation: root.useNativeOrientation
44 property int supportedOrientations: Qt.PortraitOrientation
45 | Qt.InvertedPortraitOrientation
46 | Qt.LandscapeOrientation
47 | Qt.InvertedLandscapeOrientation
49 property int landscapeOrientation: Qt.LandscapeOrientation
50 property int invertedLandscapeOrientation: Qt.InvertedLandscapeOrientation
51 property int portraitOrientation: Qt.PortraitOrientation
52 property int invertedPortraitOrientation: Qt.InvertedPortraitOrientation
54 // Supported values so far:
55 // "phone", "tablet" or "desktop"
56 property string category: "phone"
58 property int ignoredMice: 0
60 states: [
61 State {
62 name: "mako"
63 PropertyChanges {
64 target: priv
65 supportedOrientations: Qt.PortraitOrientation
66 | Qt.LandscapeOrientation
67 | Qt.InvertedLandscapeOrientation
68 }
69 },
70 State {
71 name: "krillin"
72 PropertyChanges {
73 target: priv
74 supportedOrientations: Qt.PortraitOrientation
75 | Qt.LandscapeOrientation
76 | Qt.InvertedLandscapeOrientation
77 }
78 },
79 State {
80 name: "arale"
81 PropertyChanges {
82 target: priv
83 supportedOrientations: Qt.PortraitOrientation
84 | Qt.LandscapeOrientation
85 | Qt.InvertedLandscapeOrientation
86 ignoredMice: 1
87 }
88 },
89 State {
90 name: "manta"
91 PropertyChanges {
92 target: priv
93 category: "tablet"
94 }
95 },
96 State {
97 name: "flo"
98 PropertyChanges {
99 target: priv
100 landscapeOrientation: Qt.InvertedLandscapeOrientation
101 invertedLandscapeOrientation: Qt.LandscapeOrientation
102 primaryOrientation: Qt.InvertedLandscapeOrientation
103 category: "tablet"
104 }
105 },
106 State {
107 name: "desktop"
108 PropertyChanges {
109 target: priv
110 category: "desktop"
111 supportedOrientations: root.useNativeOrientation
112 }
113 }
114 ]
115 }