You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nheko/resources/qml/PrivacyScreen.qml

127 lines
2.8 KiB

import QtGraphicalEffects 1.0
4 years ago
import QtQuick 2.12
import im.nheko 1.0
Item {
id: privacyScreen
property var timelineRoot
property int screenTimeout
4 years ago
Connections {
target: TimelineManager
onFocusChanged: {
if (TimelineManager.isWindowFocused) {
screenSaverTimer.stop();
screenSaver.state = "Invisible";
} else {
if (timelineRoot.visible)
4 years ago
screenSaverTimer.start();
}
}
}
Timer {
id: screenSaverTimer
4 years ago
interval: screenTimeout * 1000
running: true
onTriggered: {
screenSaver.state = "Visible";
}
}
Item {
id: screenSaver
4 years ago
state: "Invisible"
anchors.fill: parent
visible: false
states: [
State {
name: "Visible"
PropertyChanges {
target: screenSaver
visible: true
}
PropertyChanges {
target: screenSaver
opacity: 1
}
},
State {
name: "Invisible"
PropertyChanges {
target: screenSaver
opacity: 0
}
PropertyChanges {
target: screenSaver
visible: false
}
}
]
transitions: [
Transition {
from: "Visible"
to: "Invisible"
SequentialAnimation {
NumberAnimation {
target: screenSaver
property: "opacity"
duration: 250
easing.type: Easing.InQuad
}
NumberAnimation {
target: screenSaver
property: "visible"
duration: 0
}
}
},
Transition {
from: "Invisible"
to: "Visible"
SequentialAnimation {
NumberAnimation {
target: screenSaver
property: "visible"
duration: 0
}
NumberAnimation {
target: screenSaver
property: "opacity"
duration: 500
easing.type: Easing.InQuad
}
}
}
]
4 years ago
FastBlur {
id: blur
4 years ago
anchors.fill: parent
source: timelineRoot
radius: 50
}
}
4 years ago
}