Cleanup privacy screen, no more grabImage

This commit is contained in:
Nicolas Werner 2021-02-03 03:12:08 +01:00
parent 724c86e663
commit 3433cc3be7
3 changed files with 13 additions and 35 deletions

View file

@ -273,6 +273,7 @@ Rectangle {
cursorShape: Qt.IBeamCursor cursorShape: Qt.IBeamCursor
onClicked: TimelineManager.timeline.input.paste(true) onClicked: TimelineManager.timeline.input.paste(true)
} }
} }
ScrollBar.vertical: ScrollBar { ScrollBar.vertical: ScrollBar {

View file

@ -6,11 +6,8 @@ Item {
id: privacyScreen id: privacyScreen
property var timelineRoot property var timelineRoot
property var imageSource: ""
property int screenTimeout property int screenTimeout
anchors.fill: parent
Connections { Connections {
target: TimelineManager target: TimelineManager
onFocusChanged: { onFocusChanged: {
@ -31,22 +28,16 @@ Item {
interval: screenTimeout * 1000 interval: screenTimeout * 1000
running: true running: true
onTriggered: { onTriggered: {
if (MainWindow.visible) screenSaver.state = "Visible";
timelineRoot.grabToImage(function(result) {
screenSaver.state = "Visible";
imageSource = result.url;
}, Qt.size(width, height));
} }
} }
Rectangle { Item {
id: screenSaver id: screenSaver
state: "Invisible" state: "Invisible"
anchors.fill: parent anchors.fill: parent
visible: false visible: false
color: "transparent"
states: [ states: [
State { State {
name: "Visible" name: "Visible"
@ -122,27 +113,11 @@ Item {
} }
] ]
Image {
id: image
cache: false
anchors.fill: parent
source: imageSource
}
ShaderEffectSource {
id: effectSource
sourceItem: image
anchors.fill: image
sourceRect: Qt.rect(0, 0, width, height)
}
FastBlur { FastBlur {
id: blur id: blur
anchors.fill: effectSource anchors.fill: parent
source: effectSource source: timelineRoot
radius: 50 radius: 50
} }

View file

@ -277,19 +277,21 @@ Page {
MessageInput { MessageInput {
} }
} }
NhekoDropArea { NhekoDropArea {
anchors.fill: timelineLayout anchors.fill: parent
roomid: TimelineManager.timeline ? TimelineManager.timeline.roomId() : "" roomid: TimelineManager.timeline ? TimelineManager.timeline.roomId() : ""
} }
PrivacyScreen { }
visible: Settings.privacyScreen
screenTimeout: Settings.privacyScreenTimeout
timelineRoot: timelineRoot
}
PrivacyScreen {
anchors.fill: parent
visible: Settings.privacyScreen
screenTimeout: Settings.privacyScreenTimeout
timelineRoot: timelineLayout
} }
systemInactive: SystemPalette { systemInactive: SystemPalette {