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.12
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 savedOrientation: deviceConfiguration.primaryOrientation == deviceConfiguration.useNativeOrientation
47 ? (root.width > root.height ? Qt.LandscapeOrientation : Qt.PortraitOrientation)
48 : deviceConfiguration.primaryOrientation
49
50 rotation: {
51 var usedOrientation = root.screen.orientation;
52
53 if (root.orientationLock.enabled) {
54 usedOrientation = savedOrientation;
55 }
56
57 savedOrientation = usedOrientation;
58
59 switch (usedOrientation) {
60 case Qt.PortraitOrientation:
61 return 0;
62 case Qt.LandscapeOrientation:
63 return 270;
64 case Qt.InvertedPortraitOrientation:
65 return 180;
66 case Qt.InvertedLandscapeOrientation:
67 return 90;
68 }
69
70 return 0;
71 }
72 transformOrigin: Item.Center
73
74 Rectangle {
75 anchors.fill: parent
76 color: LomiriColors.jet
77 }
78
79 VirtualTouchPad {
80 objectName: "virtualTouchPad"
81 anchors.fill: parent
82 oskEnabled: root.oskEnabled
83 }
84 }
85}