2 * Copyright (C) 2016 Canonical, Ltd.
3 * Copyright (C) 2025 UBports Foundation
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 3.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19import Lomiri.Components 1.3
20import QtQuick.Window 2.2 as QtQuickWindow
25 readonly property int screenPhysicalOrientation: QtQuickWindow.Screen.orientation
26 readonly property bool rotateAvailable: screenOrientationLocked && screenPhysicalOrientation !== screenOrientation
28 property real visibleOpacity: 0.8
29 property int screenOrientation: Qt.PortraitOrientation
30 property bool screenOrientationLocked: false
34 anchors.margins: units.gu(3)
37 when: !root.rotateAvailable
40 anchors.right: parent.left
41 anchors.top: parent.bottom
45 when: root.rotateAvailable && root.screenPhysicalOrientation == Qt.InvertedLandscapeOrientation
48 anchors.left: parent.left
49 anchors.bottom: parent.bottom
53 when: root.rotateAvailable && root.screenPhysicalOrientation == Qt.LandscapeOrientation
56 anchors.right: parent.right
57 anchors.top: parent.top
61 when: root.rotateAvailable && root.screenPhysicalOrientation == Qt.PortraitOrientation
64 anchors.right: parent.right
65 anchors.bottom: parent.bottom
69 when: root.rotateAvailable && root.screenPhysicalOrientation == Qt.InvertedPortraitOrientation
72 anchors.left: parent.left
73 anchors.top: parent.top
83 color: theme.palette.normal.background
86 color: theme.palette.normal.backgroundText
96 hideAnimation.restart()
103 implicitWidth: units.gu(3)
104 implicitHeight: implicitWidth
105 anchors.centerIn: parent
107 color: theme.palette.normal.backgroundText
118 LomiriNumberAnimation {
125 to: root.visibleOpacity
126 duration: LomiriAnimation.SlowDuration
129 LomiriNumberAnimation {
137 duration: LomiriAnimation.FastDuration
140 SequentialAnimation {
141 running: root.visible
145 duration: LomiriAnimation.SnapDuration
147 direction: RotationAnimation.Shortest
149 NumberAnimation { target: icon; duration: LomiriAnimation.SnapDuration; property: "opacity"; to: 1 }
150 PauseAnimation { duration: LomiriAnimation.SlowDuration }
153 duration: LomiriAnimation.SlowDuration
154 to: root.screenOrientationLocked ? QtQuickWindow.Screen.angleBetween(root.screenOrientation, root.screenPhysicalOrientation) : 0
155 direction: RotationAnimation.Shortest
157 PauseAnimation { duration: LomiriAnimation.SlowDuration }
158 NumberAnimation { target: icon; duration: LomiriAnimation.SnapDuration; property: "opacity"; to: 0 }
160 onFinished: root.hide()
169 showAnimation.restart()
178 onTriggered: root.hide()