summary refs log tree commit diff
path: root/resources/qml
diff options
context:
space:
mode:
authorLoren Burkholder <computersemiexpert@outlook.com>2023-02-13 20:44:42 -0500
committerLoren Burkholder <computersemiexpert@outlook.com>2023-02-20 16:35:00 -0500
commit66d8a38c80f39ddaf2954d3400a731ec5c7e4c0b (patch)
tree746bd899d74cf1e50d84823aa9536c048557d2ae /resources/qml
parentMerge branch 'cirrus_updates' into 'master' (diff)
downloadnheko-66d8a38c80f39ddaf2954d3400a731ec5c7e4c0b.tar.xz
Blurhash images when the privacy screen is active
Diffstat (limited to 'resources/qml')
-rw-r--r--resources/qml/ChatPage.qml3
-rw-r--r--resources/qml/PrivacyScreen.qml3
-rw-r--r--resources/qml/RoomList.qml8
-rw-r--r--resources/qml/TimelineView.qml1
-rw-r--r--resources/qml/delegates/ImageMessage.qml26
5 files changed, 24 insertions, 17 deletions
diff --git a/resources/qml/ChatPage.qml b/resources/qml/ChatPage.qml
index 3d76616a..2c0f988f 100644
--- a/resources/qml/ChatPage.qml
+++ b/resources/qml/ChatPage.qml
@@ -128,6 +128,7 @@ Rectangle {
                 TimelineView {
                     id: timeline
 
+                    privacyScreen: privacyScreen
                     showBackButton: adaptiveView.singlePageMode
                     room: Rooms.currentRoom
                     roomPreview: Rooms.currentRoomPreview.roomid ? Rooms.currentRoomPreview : null
@@ -140,6 +141,8 @@ Rectangle {
     }
 
     PrivacyScreen {
+        id: privacyScreen
+
         anchors.fill: parent
         visible: Settings.privacyScreen
         screenTimeout: Settings.privacyScreenTimeout
diff --git a/resources/qml/PrivacyScreen.qml b/resources/qml/PrivacyScreen.qml
index bc128302..11ab27bd 100644
--- a/resources/qml/PrivacyScreen.qml
+++ b/resources/qml/PrivacyScreen.qml
@@ -12,6 +12,7 @@ import im.nheko 1.0
 Item {
     id: privacyScreen
 
+    readonly property bool active: screenSaver.state === "Visible"
     property var timelineRoot
     property int screenTimeout
 
@@ -61,7 +62,6 @@ Item {
                     target: screenSaver
                     opacity: 1
                 }
-
             },
             State {
                 name: "Invisible"
@@ -75,7 +75,6 @@ Item {
                     target: screenSaver
                     visible: false
                 }
-
             }
         ]
         transitions: [
diff --git a/resources/qml/RoomList.qml b/resources/qml/RoomList.qml
index f06fb15e..7dc89cc9 100644
--- a/resources/qml/RoomList.qml
+++ b/resources/qml/RoomList.qml
@@ -110,17 +110,21 @@ Page {
                 }
 
                 TimelineView {
-                    id: timelineView
+                    id: timeline
+
+                    privacyScreen: privacyScreen
                     anchors.fill: parent
                     room: roomWindowW.room
                     roomPreview: roomWindowW.roomPreview.roomid ? roomWindowW.roomPreview : null
                 }
 
                 PrivacyScreen {
+                    id: privacyScreen
+
                     anchors.fill: parent
                     visible: Settings.privacyScreen
                     screenTimeout: Settings.privacyScreenTimeout
-                    timelineRoot: timelineView
+                    timelineRoot: timeline
                     windowTarget: roomWindowW
                 }
 
diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index 0d47746c..9124c158 100644
--- a/resources/qml/TimelineView.qml
+++ b/resources/qml/TimelineView.qml
@@ -26,6 +26,7 @@ Item {
     property var roomPreview: null
     property bool showBackButton: false
     property bool shouldEffectsRun: false
+    required property PrivacyScreen privacyScreen
     clip: true
 
     onRoomChanged: if (room != null) room.triggerSpecialEffects()
diff --git a/resources/qml/delegates/ImageMessage.qml b/resources/qml/delegates/ImageMessage.qml
index af69b983..bb22d0ee 100644
--- a/resources/qml/delegates/ImageMessage.qml
+++ b/resources/qml/delegates/ImageMessage.qml
@@ -32,18 +32,6 @@ AbstractButton {
     property bool fitsMetadata: (parent.width - width) > metadataWidth+4
 
     Image {
-        id: blurhash_
-
-        anchors.fill: parent
-        visible: img.status != Image.Ready
-        source: blurhash ? ("image://blurhash/" + blurhash) : ("image://colorimage/:/icons/icons/ui/image-failed.svg?" + Nheko.colors.buttonText)
-        asynchronous: true
-        fillMode: Image.PreserveAspectFit
-        sourceSize.width: parent.width * Screen.devicePixelRatio
-        sourceSize.height: parent.height * Screen.devicePixelRatio
-    }
-
-    Image {
         id: img
 
         visible: !mxcimage.loaded
@@ -68,7 +56,19 @@ AbstractButton {
         eventId: parent.eventId
     }
 
-    onClicked :Settings.openImageExternal ? room.openMedia(eventId) : TimelineManager.openImageOverlay(room, url, eventId, originalWidth, proportionalHeight);
+    Image {
+        id: blurhash_
+
+        anchors.fill: parent
+        visible: img.status != Image.Ready || timeline.privacyScreen.active
+        source: blurhash ? ("image://blurhash/" + blurhash) : ("image://colorimage/:/icons/icons/ui/image-failed.svg?" + Nheko.colors.buttonText)
+        asynchronous: true
+        fillMode: Image.PreserveAspectFit
+        sourceSize.width: parent.width * Screen.devicePixelRatio
+        sourceSize.height: parent.height * Screen.devicePixelRatio
+    }
+
+    onClicked: Settings.openImageExternal ? room.openMedia(eventId) : TimelineManager.openImageOverlay(room, url, eventId, originalWidth, proportionalHeight);
 
     Item {
         id: overlay