2021-03-05 02:35:15 +03:00
|
|
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
2022-01-01 06:57:53 +03:00
|
|
|
// SPDX-FileCopyrightText: 2022 Nheko Contributors
|
2021-03-07 07:57:56 +03:00
|
|
|
//
|
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
|
2021-01-27 01:23:28 +03:00
|
|
|
import im.nheko 1.0
|
2021-01-26 07:46:55 +03:00
|
|
|
|
|
|
|
Item {
|
2021-01-27 01:23:28 +03:00
|
|
|
id: privacyScreen
|
|
|
|
|
2021-01-26 07:46:55 +03:00
|
|
|
property var timelineRoot
|
|
|
|
property int screenTimeout
|
2021-01-26 08:03:09 +03:00
|
|
|
|
2021-01-27 01:23:28 +03:00
|
|
|
Connections {
|
2021-07-27 23:35:38 +03:00
|
|
|
function onFocusChanged() {
|
2022-01-12 21:09:46 +03:00
|
|
|
if (MainWindow.active) {
|
2021-01-27 01:23:28 +03:00
|
|
|
screenSaverTimer.stop();
|
|
|
|
screenSaver.state = "Invisible";
|
|
|
|
} else {
|
2021-02-02 19:37:10 +03:00
|
|
|
if (timelineRoot.visible)
|
2021-02-02 02:57:59 +03:00
|
|
|
screenSaverTimer.start();
|
2021-02-02 19:37:10 +03:00
|
|
|
|
2021-01-27 01:23:28 +03:00
|
|
|
}
|
|
|
|
}
|
2021-07-27 23:35:38 +03:00
|
|
|
|
2022-01-13 06:16:11 +03:00
|
|
|
target: TimelineManager
|
2021-01-27 01:23:28 +03:00
|
|
|
}
|
|
|
|
|
2021-01-26 07:46:55 +03:00
|
|
|
Timer {
|
|
|
|
id: screenSaverTimer
|
2021-01-26 08:03:09 +03:00
|
|
|
|
2021-01-26 07:46:55 +03:00
|
|
|
interval: screenTimeout * 1000
|
2022-01-12 21:09:46 +03:00
|
|
|
running: !MainWindow.active
|
2021-01-26 07:46:55 +03:00
|
|
|
onTriggered: {
|
2021-02-03 05:12:08 +03:00
|
|
|
screenSaver.state = "Visible";
|
2021-01-26 07:46:55 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-03 05:12:08 +03:00
|
|
|
Item {
|
2021-01-26 07:46:55 +03:00
|
|
|
id: screenSaver
|
2021-01-26 08:03:09 +03:00
|
|
|
|
2021-01-27 01:23:28 +03:00
|
|
|
state: "Invisible"
|
2021-01-26 07:46:55 +03:00
|
|
|
anchors.fill: parent
|
|
|
|
visible: false
|
2021-01-27 01:23:28 +03:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
]
|
2021-01-26 07:46:55 +03:00
|
|
|
|
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 07:46:55 +03:00
|
|
|
|
|
|
|
}
|
2021-01-26 08:03:09 +03:00
|
|
|
|
|
|
|
}
|