on 42301fa help sign in
unity8/qml/DisabledScreenNotice.qml
126 lines 3.9 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 property bool infoNoteDisplayed: true
29 // For testing
30 property var screen: Screen
31 property var orientationLock: OrientationLock
33 DeviceConfiguration {
34 id: deviceConfiguration
35 name: applicationArguments.deviceName
36 }
38 Item {
39 id: contentContainer
40 objectName: "contentContainer"
41 anchors.centerIn: parent
42 height: rotation == 90 || rotation == 270 ? parent.width : parent.height
43 width: rotation == 90 || rotation == 270 ? parent.height : parent.width
45 property int savedOrientation: deviceConfiguration.primaryOrientation == deviceConfiguration.useNativeOrientation
46 ? (root.width > root.height ? Qt.LandscapeOrientation : Qt.PortraitOrientation)
47 : deviceConfiguration.primaryOrientation
49 rotation: {
50 var usedOrientation = root.screen.orientation;
52 if (root.orientationLock.enabled) {
53 usedOrientation = savedOrientation;
54 }
56 savedOrientation = usedOrientation;
58 switch (usedOrientation) {
59 case Qt.PortraitOrientation:
60 return 0;
61 case Qt.LandscapeOrientation:
62 return 270;
63 case Qt.InvertedPortraitOrientation:
64 return 180;
65 case Qt.InvertedLandscapeOrientation:
66 return 90;
67 }
69 return 0;
70 }
71 transformOrigin: Item.Center
73 VirtualTouchPad {
74 anchors.fill: parent
76 onPressedChanged: {
77 if (pressed && infoNoteDisplayed) {
78 infoNoteDisplayed = false;
79 }
80 }
81 }
83 Rectangle {
84 anchors.fill: parent
85 color: "#3b3b3b"
86 }
88 Item {
89 objectName: "infoNoticeArea"
90 anchors.fill: parent
91 opacity: infoNoteDisplayed ? 1 : 0
92 visible: opacity > 0
93 Behavior on opacity {
94 UbuntuNumberAnimation { }
95 }
97 Column {
98 anchors.centerIn: parent
99 width: parent.width - units.gu(8)
100 spacing: units.gu(4)
102 Label {
103 id: text
104 text: i18n.tr("Your device is now connected to an external display. Use this screen as a touch pad to interact with the pointer.")
105 color: "white"
106 width: parent.width
107 fontSize: "large"
108 wrapMode: Text.Wrap
109 }
110 Icon {
111 height: units.gu(8)
112 width: height
113 name: "input-touchpad-symbolic"
114 color: "white"
115 anchors.horizontalCenter: parent.horizontalCenter
116 }
117 }
118 }
120 InputMethod {
121 id: inputMethod
122 objectName: "inputMethod"
123 anchors.fill: parent
124 }
125 }