on 9fa984b help sign in
unity8/qml/DeviceConfiguration.qml
111 lines 4.2 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 var priv: StateGroup {
38 id: priv
40 property int primaryOrientation: root.useNativeOrientation
42 property int supportedOrientations: Qt.PortraitOrientation
43 | Qt.InvertedPortraitOrientation
44 | Qt.LandscapeOrientation
45 | Qt.InvertedLandscapeOrientation
47 property int landscapeOrientation: Qt.LandscapeOrientation
48 property int invertedLandscapeOrientation: Qt.InvertedLandscapeOrientation
49 property int portraitOrientation: Qt.PortraitOrientation
50 property int invertedPortraitOrientation: Qt.InvertedPortraitOrientation
52 // Supported values so far:
53 // "phone", "tablet" or "desktop"
54 property string category: "phone"
56 states: [
57 State {
58 name: "mako"
59 PropertyChanges {
60 target: priv
61 supportedOrientations: Qt.PortraitOrientation
62 | Qt.LandscapeOrientation
63 | Qt.InvertedLandscapeOrientation
64 }
65 },
66 State {
67 name: "krillin"
68 PropertyChanges {
69 target: priv
70 supportedOrientations: Qt.PortraitOrientation
71 | Qt.LandscapeOrientation
72 | Qt.InvertedLandscapeOrientation
73 }
74 },
75 State {
76 name: "arale"
77 PropertyChanges {
78 target: priv
79 supportedOrientations: Qt.PortraitOrientation
80 | Qt.LandscapeOrientation
81 | Qt.InvertedLandscapeOrientation
82 }
83 },
84 State {
85 name: "manta"
86 PropertyChanges {
87 target: priv
88 category: "tablet"
89 }
90 },
91 State {
92 name: "flo"
93 PropertyChanges {
94 target: priv
95 landscapeOrientation: Qt.InvertedLandscapeOrientation
96 invertedLandscapeOrientation: Qt.LandscapeOrientation
97 primaryOrientation: Qt.InvertedLandscapeOrientation
98 category: "tablet"
99 }
100 },
101 State {
102 name: "desktop"
103 PropertyChanges {
104 target: priv
105 category: "desktop"
106 supportedOrientations: root.useNativeOrientation
107 }
108 }
109 ]
110 }