on 19a9ecd help sign in
unity8/qml/DisabledScreenNotice.qml
81 lines 2.5 kB history raw
1/*
2 * Copyright (C) 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 */
17import QtQuick 2.4
18import QtQuick.Layouts 1.1
19import Ubuntu.Components 1.3
20import Unity.Session 0.1
21import QtQuick.Window 2.2
22import "Components"
24Item {
25 id: root
27 // For testing
28 property var screen: Screen
29 property var orientationLock: OrientationLock
31 DeviceConfiguration {
32 id: deviceConfiguration
33 name: applicationArguments.deviceName
34 }
36 Item {
37 id: contentContainer
38 objectName: "contentContainer"
39 anchors.centerIn: parent
40 height: rotation == 90 || rotation == 270 ? parent.width : parent.height
41 width: rotation == 90 || rotation == 270 ? parent.height : parent.width
43 property int savedOrientation: deviceConfiguration.primaryOrientation == deviceConfiguration.useNativeOrientation
44 ? (root.width > root.height ? Qt.LandscapeOrientation : Qt.PortraitOrientation)
45 : deviceConfiguration.primaryOrientation
47 rotation: {
48 var usedOrientation = root.screen.orientation;
50 if (root.orientationLock.enabled) {
51 usedOrientation = savedOrientation;
52 }
54 savedOrientation = usedOrientation;
56 switch (usedOrientation) {
57 case Qt.PortraitOrientation:
58 return 0;
59 case Qt.LandscapeOrientation:
60 return 270;
61 case Qt.InvertedPortraitOrientation:
62 return 180;
63 case Qt.InvertedLandscapeOrientation:
64 return 90;
65 }
67 return 0;
68 }
69 transformOrigin: Item.Center
71 Rectangle {
72 anchors.fill: parent
73 color: UbuntuColors.jet
74 }
76 VirtualTouchPad {
77 objectName: "virtualTouchPad"
78 anchors.fill: parent
79 }
80 }