matrixion/qml/PrivacyScreen.qml

118 lines
3 KiB
QML
Raw Permalink Normal View History

2021-03-05 02:35:15 +03:00
// SPDX-FileCopyrightText: 2021 Nheko Contributors
// SPDX-FileCopyrightText: 2022 Nheko Contributors
2021-03-05 02:35:15 +03:00
// SPDX-License-Identifier: GPL-3.0-or-later
2022-04-11 04:37:15 +03:00
//import QtGraphicalEffects 1.0
2021-01-26 08:03:09 +03:00
import QtQuick 2.12
2022-01-12 21:09:46 +03:00
import QtQuick.Window 2.2
import im.nheko
Item {
id: privacyScreen
property int screenTimeout
2022-04-16 03:13:01 +03:00
property var timelineRoot
2021-01-26 08:03:09 +03:00
Connections {
function onFocusChanged() {
2022-01-12 21:09:46 +03:00
if (MainWindow.active) {
screenSaverTimer.stop();
screenSaver.state = "Invisible";
} else {
if (timelineRoot.visible)
2021-02-02 02:57:59 +03:00
screenSaverTimer.start();
}
}
target: TimelineManager
}
Timer {
id: screenSaverTimer
interval: screenTimeout * 1000
2022-01-12 21:09:46 +03:00
running: !MainWindow.active
2022-04-16 03:13:01 +03:00
onTriggered: {
screenSaver.state = "Visible";
}
}
Item {
id: screenSaver
anchors.fill: parent
2022-04-16 03:13:01 +03:00
state: "Invisible"
visible: false
2022-04-16 03:13:01 +03:00
states: [
State {
name: "Visible"
PropertyChanges {
target: screenSaver
visible: true
}
PropertyChanges {
opacity: 1
2022-04-16 03:13:01 +03:00
target: screenSaver
}
},
State {
name: "Invisible"
PropertyChanges {
opacity: 0
2022-04-16 03:13:01 +03:00
target: screenSaver
}
PropertyChanges {
target: screenSaver
visible: false
}
}
]
transitions: [
Transition {
from: "Visible"
to: "Invisible"
SequentialAnimation {
NumberAnimation {
duration: 250
easing.type: Easing.InQuad
2022-04-16 03:13:01 +03:00
property: "opacity"
target: screenSaver
}
NumberAnimation {
duration: 0
2022-04-16 03:13:01 +03:00
property: "visible"
target: screenSaver
}
}
},
Transition {
from: "Invisible"
to: "Visible"
SequentialAnimation {
NumberAnimation {
duration: 0
2022-04-16 03:13:01 +03:00
property: "visible"
target: screenSaver
}
NumberAnimation {
duration: 500
easing.type: Easing.InQuad
2022-04-16 03:13:01 +03:00
property: "opacity"
target: screenSaver
}
}
}
]
2022-04-11 04:37:15 +03:00
//FastBlur {
// id: blur
2021-01-26 08:03:09 +03:00
2022-04-11 04:37:15 +03:00
// anchors.fill: parent
// source: timelineRoot
// radius: 50
//}
}
2021-01-26 08:03:09 +03:00
}