summary refs log tree commit diff
path: root/resources
diff options
context:
space:
mode:
authorJoseph Donofry <joedonofry@gmail.com>2021-01-11 20:02:39 -0500
committerJoseph Donofry <joedonofry@gmail.com>2021-01-11 20:02:39 -0500
commit9a604d3821bf2f151df92688249e0624774e1646 (patch)
treeefcee69f99ec77c16f7267073320eec47a91cf2c /resources
parentForgot to save res.qrc (diff)
downloadnheko-9a604d3821bf2f151df92688249e0624774e1646.tar.xz
Clean up Avatar click event handling
Diffstat (limited to 'resources')
-rw-r--r--resources/qml/Avatar.qml6
-rw-r--r--resources/qml/Completer.qml1
-rw-r--r--resources/qml/MessageView.qml16
-rw-r--r--resources/qml/TopBar.qml7
-rw-r--r--resources/qml/UserProfile.qml1
-rw-r--r--resources/qml/voip/ActiveCallBar.qml1
-rw-r--r--resources/qml/voip/CallInviteBar.qml1
-rw-r--r--resources/qml/voip/PlaceCall.qml1
8 files changed, 19 insertions, 15 deletions
diff --git a/resources/qml/Avatar.qml b/resources/qml/Avatar.qml
index 2801bd37..a459fe5a 100644
--- a/resources/qml/Avatar.qml
+++ b/resources/qml/Avatar.qml
@@ -11,10 +11,15 @@ Rectangle {
     property string userid
     property string displayName
 
+    signal clicked(var mouse)
+
     width: 48
     height: 48
     radius: Settings.avatarCircles ? height / 2 : 3
     color: colors.alternateBase
+    Component.onCompleted: {
+        mouseArea.clicked.connect(clicked);
+    }
 
     Label {
         anchors.fill: parent
@@ -43,7 +48,6 @@ Rectangle {
             id: mouseArea
 
             anchors.fill: parent
-            onClicked: TimelineManager.openImageOverlay(TimelineManager.timeline.avatarUrl(userid), TimelineManager.timeline.data.id)
 
             Ripple {
                 rippleTarget: mouseArea
diff --git a/resources/qml/Completer.qml b/resources/qml/Completer.qml
index 9703da64..4e8f78aa 100644
--- a/resources/qml/Completer.qml
+++ b/resources/qml/Completer.qml
@@ -104,6 +104,7 @@ Popup {
                             width: 24
                             displayName: model.displayName
                             url: model.avatarUrl.replace("mxc://", "image://MxcImage/")
+                            onClicked: popup.completionClicked(completer.completionAt(model.index))
                         }
 
                         Label {
diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml
index aa222ac5..7799dbf7 100644
--- a/resources/qml/MessageView.qml
+++ b/resources/qml/MessageView.qml
@@ -108,19 +108,19 @@ ListView {
                 spacing: 8
 
                 Avatar {
+                    // MouseArea {
+                    //     anchors.fill: parent
+                    //     onClicked: chat.model.openUserProfile(modelData.userId)
+                    //     cursorShape: Qt.PointingHandCursor
+                    //     propagateComposedEvents: true
+                    // }
+
                     width: avatarSize
                     height: avatarSize
                     url: chat.model.avatarUrl(modelData.userId).replace("mxc://", "image://MxcImage/")
                     displayName: modelData.userName
                     userid: modelData.userId
-
-                    MouseArea {
-                        anchors.fill: parent
-                        onClicked: chat.model.openUserProfile(modelData.userId)
-                        cursorShape: Qt.PointingHandCursor
-                        propagateComposedEvents: true
-                    }
-
+                    onClicked: chat.model.openUserProfile(modelData.userId)
                 }
 
                 Label {
diff --git a/resources/qml/TopBar.qml b/resources/qml/TopBar.qml
index 941f269c..273ed8ab 100644
--- a/resources/qml/TopBar.qml
+++ b/resources/qml/TopBar.qml
@@ -53,12 +53,7 @@ Rectangle {
             height: avatarSize
             url: room ? room.roomAvatarUrl.replace("mxc://", "image://MxcImage/") : ""
             displayName: room ? room.roomName : qsTr("No room selected")
-
-            MouseArea {
-                anchors.fill: parent
-                onClicked: TimelineManager.openRoomSettings()
-            }
-
+            onClicked: TimelineManager.openRoomSettings()
         }
 
         Label {
diff --git a/resources/qml/UserProfile.qml b/resources/qml/UserProfile.qml
index 2e6758ae..3ae03dd4 100644
--- a/resources/qml/UserProfile.qml
+++ b/resources/qml/UserProfile.qml
@@ -37,6 +37,7 @@ ApplicationWindow {
             displayName: profile.displayName
             userid: profile.userid
             Layout.alignment: Qt.AlignHCenter
+            onClicked: TimelineManager.openImageOverlay(TimelineManager.timeline.avatarUrl(userid), TimelineManager.timeline.data.id)
         }
 
         Label {
diff --git a/resources/qml/voip/ActiveCallBar.qml b/resources/qml/voip/ActiveCallBar.qml
index 85da4e3c..949ba277 100644
--- a/resources/qml/voip/ActiveCallBar.qml
+++ b/resources/qml/voip/ActiveCallBar.qml
@@ -31,6 +31,7 @@ Rectangle {
             height: avatarSize
             url: CallManager.callPartyAvatarUrl.replace("mxc://", "image://MxcImage/")
             displayName: CallManager.callParty
+            onClicked: TimelineManager.openImageOverlay(TimelineManager.timeline.avatarUrl(userid), TimelineManager.timeline.data.id)
         }
 
         Label {
diff --git a/resources/qml/voip/CallInviteBar.qml b/resources/qml/voip/CallInviteBar.qml
index e349332f..5c4b8f32 100644
--- a/resources/qml/voip/CallInviteBar.qml
+++ b/resources/qml/voip/CallInviteBar.qml
@@ -38,6 +38,7 @@ Rectangle {
             height: avatarSize
             url: CallManager.callPartyAvatarUrl.replace("mxc://", "image://MxcImage/")
             displayName: CallManager.callParty
+            onClicked: TimelineManager.openImageOverlay(TimelineManager.timeline.avatarUrl(userid), TimelineManager.timeline.data.id)
         }
 
         Label {
diff --git a/resources/qml/voip/PlaceCall.qml b/resources/qml/voip/PlaceCall.qml
index 65f2f350..526f056e 100644
--- a/resources/qml/voip/PlaceCall.qml
+++ b/resources/qml/voip/PlaceCall.qml
@@ -61,6 +61,7 @@ Popup {
                 height: avatarSize
                 url: TimelineManager.timeline.roomAvatarUrl.replace("mxc://", "image://MxcImage/")
                 displayName: TimelineManager.timeline.roomName
+                onClicked: TimelineManager.openImageOverlay(TimelineManager.timeline.avatarUrl(userid), TimelineManager.timeline.data.id)
             }
 
             Button {