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
onClicked: TimelineManager.timeline.input.paste(true)
}
}
ScrollBar.vertical: ScrollBar {

View File

@ -6,11 +6,8 @@ Item {
id: privacyScreen
property var timelineRoot
property var imageSource: ""
property int screenTimeout
anchors.fill: parent
Connections {
target: TimelineManager
onFocusChanged: {
@ -31,22 +28,16 @@ Item {
interval: screenTimeout * 1000
running: true
onTriggered: {
if (MainWindow.visible)
timelineRoot.grabToImage(function(result) {
screenSaver.state = "Visible";
imageSource = result.url;
}, Qt.size(width, height));
screenSaver.state = "Visible";
}
}
Rectangle {
Item {
id: screenSaver
state: "Invisible"
anchors.fill: parent
visible: false
color: "transparent"
states: [
State {
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 {
id: blur
anchors.fill: effectSource
source: effectSource
anchors.fill: parent
source: timelineRoot
radius: 50
}

View File

@ -277,19 +277,21 @@ Page {
MessageInput {
}
}
NhekoDropArea {
anchors.fill: timelineLayout
anchors.fill: parent
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 {