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

82 lines
1.7 KiB

import QtGraphicalEffects 1.0
4 years ago
import QtQuick 2.12
Item {
property var timelineRoot
property var imageSource
property int screenTimeout
4 years ago
anchors.fill: parent
Timer {
id: screenSaverTimer
4 years ago
interval: screenTimeout * 1000
running: true
onTriggered: {
timelineRoot.grabToImage(function(result) {
imageSource = result.url;
4 years ago
screenSaver.visible = true;
particles.resume();
}, Qt.size(width, height));
}
}
// Reset screensaver timer when clicks are received
MouseArea {
anchors.fill: parent
// Pass mouse events through
propagateComposedEvents: true
hoverEnabled: true
onClicked: {
screenSaverTimer.restart();
mouse.accepted = false;
}
}
Rectangle {
id: screenSaver
4 years ago
anchors.fill: parent
visible: false
color: "transparent"
Image {
id: image
4 years ago
visible: screenSaver.visible
anchors.fill: parent
source: imageSource
}
ShaderEffectSource {
id: effectSource
sourceItem: image
anchors.fill: image
4 years ago
sourceRect: Qt.rect(0, 0, width, height)
}
4 years ago
FastBlur {
id: blur
4 years ago
anchors.fill: effectSource
source: effectSource
radius: 50
}
MouseArea {
anchors.fill: parent
propagateComposedEvents: true
hoverEnabled: true
4 years ago
onClicked: {
screenSaver.visible = false;
screenSaverTimer.restart();
4 years ago
mouse.accepted = false;
}
}
4 years ago
}
4 years ago
}