Lomiri
Loading...
Searching...
No Matches
UDFPSComponent.qml
1/*
2 * Copyright 2025-2026 Volla Systeme GmbH
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.4
18import QtQuick.Window 2.2
19import Lomiri.Components 1.3
20import Biometryd 0.0
21import Utils 0.1
22
23Item {
24 id: udfps
25
26 DeviceConfig{
27 id: deviceConfig
28 }
29
30 visible: Powerd.highBrightnessModeEnabled
31
32 // TODO: read from deviceinfo or biometryd?
33 property real baseX: deviceConfig.sensorLocationX
34 property real baseY: deviceConfig.sensorLocationY
35 property real sensorRadius: deviceConfig.sensorRadius
36
37 property real sensorLocationX : {
38 switch (Screen.orientation) {
39 case Qt.PortraitOrientation:
40 return baseX
41 case Qt.LandscapeOrientation:
42 return baseY
43 case Qt.InvertedPortraitOrientation:
44 return parent.width - baseX
45 case Qt.InvertedLandscapeOrientation:
46 return parent.height - baseY
47 default:
48 return baseX
49 }
50 }
51
52 property real sensorLocationY: {
53 switch (Screen.orientation) {
54 case Qt.PortraitOrientation:
55 return baseY
56 case Qt.LandscapeOrientation:
57 return parent.width - baseX
58 case Qt.InvertedPortraitOrientation:
59 return parent.height - baseY
60 case Qt.InvertedLandscapeOrientation:
61 return baseX
62 default:
63 return baseY
64 }
65 }
66
67 Rectangle{
68 anchors.fill: parent
69 color: "black"
70 opacity: 0.9
71 }
72
73 Rectangle {
74 id: indicator
75 width: udfps.sensorRadius * 2
76 height: width
77 radius: width / 2
78 color: "white"
79 x: udfps.sensorLocationX - udfps.sensorRadius
80 y: udfps.sensorLocationY - udfps.sensorRadius
81 }
82}