Lomiri
Loading...
Searching...
No Matches
DisabledScreenNotice.qml
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 */
16
17import QtQuick 2.15
18import QtQuick.Layouts 1.1
19import Lomiri.Components 1.3
20import Lomiri.Session 0.1
21import QtQuick.Window 2.2
22import WindowManager 1.0
23import "Components"
24
25Item {
26 id: root
27
28 property var screen: null
29 property var orientationLock: OrientationLock
30 property alias overrideDeviceName: root.deviceConfiguration.overrideName
31
32 property bool oskEnabled: false
33
34 property alias deviceConfiguration: _deviceConfiguration
35 DeviceConfiguration {
36 id: _deviceConfiguration
37 }
38
39 Item {
40 id: contentContainer
41 objectName: "contentContainer"
42 anchors.centerIn: parent
43 height: rotation == 90 || rotation == 270 ? parent.width : parent.height
44 width: rotation == 90 || rotation == 270 ? parent.height : parent.width
45
46 property int angleFromPrimary: Screen.angleBetween(Screen.primaryOrientation, Screen.orientation)
47 readonly property bool rotatedToPhysical: rotation === angleFromPrimary
48
49 function matchPhysicalOrientation() {
50 rotation = angleFromPrimary;
51 }
52
53 transformOrigin: Item.Center
54
55 Rectangle {
56 anchors.fill: parent
57 color: LomiriColors.jet
58 }
59
60 VirtualTouchPad {
61 objectName: "virtualTouchPad"
62 anchors.fill: parent
63 oskEnabled: root.oskEnabled
64 showRotateButton: !contentContainer.rotatedToPhysical
65
66 onRotate: contentContainer.matchPhysicalOrientation();
67 }
68 }
69}