on bedf8bc help sign in
unity8/qml/DisabledScreenNotice.qml
133 lines 4.1 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 Unity.Screens 0.1
22import QtQuick.Window 2.2
23import "Components"
25Item {
26 id: root
28 property bool infoNoteDisplayed: true
30 // For testing
31 property var screen: Screen
32 property var orientationLock: OrientationLock
34 DeviceConfiguration {
35 id: deviceConfiguration
36 name: applicationArguments.deviceName
37 }
39 Screens {
40 id: screens
41 }
43 Item {
44 id: contentContainer
45 objectName: "contentContainer"
46 anchors.centerIn: parent
47 height: rotation == 90 || rotation == 270 ? parent.width : parent.height
48 width: rotation == 90 || rotation == 270 ? parent.height : parent.width
50 property int savedOrientation: deviceConfiguration.primaryOrientation == deviceConfiguration.useNativeOrientation
51 ? (root.width > root.height ? Qt.LandscapeOrientation : Qt.PortraitOrientation)
52 : deviceConfiguration.primaryOrientation
54 rotation: {
55 var usedOrientation = root.screen.orientation;
57 if (root.orientationLock.enabled) {
58 usedOrientation = savedOrientation;
59 }
61 savedOrientation = usedOrientation;
63 switch (usedOrientation) {
64 case Qt.PortraitOrientation:
65 return 0;
66 case Qt.LandscapeOrientation:
67 return 270;
68 case Qt.InvertedPortraitOrientation:
69 return 180;
70 case Qt.InvertedLandscapeOrientation:
71 return 90;
72 }
74 return 0;
75 }
76 transformOrigin: Item.Center
78 VirtualTouchPad {
79 anchors.fill: parent
81 onPressedChanged: {
82 if (pressed && infoNoteDisplayed) {
83 infoNoteDisplayed = false;
84 }
85 }
86 }
88 Rectangle {
89 anchors.fill: parent
90 color: "#3b3b3b"
91 }
93 Item {
94 objectName: "infoNoticeArea"
95 anchors.fill: parent
96 opacity: infoNoteDisplayed ? 1 : 0
97 visible: opacity > 0
98 Behavior on opacity {
99 UbuntuNumberAnimation { }
100 }
102 Column {
103 anchors.centerIn: parent
104 width: parent.width - (internalGu * 8)
105 spacing: internalGu * 4
107 Label {
108 id: text
109 text: i18n.tr("Your device is now connected to an external display. Use this screen as a touch pad to interact with the pointer.")
110 color: "white"
111 width: parent.width
112 font.pixelSize: 2.5 * internalGu
113 wrapMode: Text.Wrap
114 }
115 Icon {
116 height: internalGu * 8
117 width: height
118 name: "input-touchpad-symbolic"
119 color: "white"
120 anchors.horizontalCenter: parent.horizontalCenter
121 }
122 }
123 }
125 InputMethod {
126 id: inputMethod
127 // Don't resize when there is only one screen to avoid resize clashing with the InputMethod in the Shell.
128 enabled: screens.count > 1
129 objectName: "inputMethod"
130 anchors.fill: parent
131 }
132 }