2 * Copyright (C) 2016 Canonical, Ltd.
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.
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.
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/>.
18 import QtQuick.Layouts 1.1
19 import Ubuntu.Components 1.3
20 import Unity.Session 0.1
21 import Unity.Screens 0.1
22 import QtQuick.Window 2.2
28 property bool infoNoteDisplayed: true
31 property var screen: Screen
32 property var orientationLock: OrientationLock
35 id: deviceConfiguration
36 name: applicationArguments.deviceName
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
55 var usedOrientation = root.screen.orientation;
57 if (root.orientationLock.enabled) {
58 usedOrientation = savedOrientation;
61 savedOrientation = usedOrientation;
63 switch (usedOrientation) {
64 case Qt.PortraitOrientation:
66 case Qt.LandscapeOrientation:
68 case Qt.InvertedPortraitOrientation:
70 case Qt.InvertedLandscapeOrientation:
76 transformOrigin: Item.Center
82 if (pressed && infoNoteDisplayed) {
83 infoNoteDisplayed = false;
94 objectName: "infoNoticeArea"
96 opacity: infoNoteDisplayed ? 1 : 0
99 UbuntuNumberAnimation { }
103 anchors.centerIn: parent
104 width: parent.width - (internalGu * 8)
105 spacing: internalGu * 4
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.")
112 font.pixelSize: 2.5 * internalGu
116 height: internalGu * 8
118 name: "input-touchpad-symbolic"
120 anchors.horizontalCenter: parent.horizontalCenter
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"