Clean up Avatar click event handling

This commit is contained in:
Joseph Donofry 2021-01-11 20:02:39 -05:00
parent 22f7841848
commit 9a604d3821
No known key found for this signature in database
GPG key ID: E8A1D78EF044B0CB
8 changed files with 19 additions and 15 deletions

View file

@ -11,10 +11,15 @@ Rectangle {
property string userid property string userid
property string displayName property string displayName
signal clicked(var mouse)
width: 48 width: 48
height: 48 height: 48
radius: Settings.avatarCircles ? height / 2 : 3 radius: Settings.avatarCircles ? height / 2 : 3
color: colors.alternateBase color: colors.alternateBase
Component.onCompleted: {
mouseArea.clicked.connect(clicked);
}
Label { Label {
anchors.fill: parent anchors.fill: parent
@ -43,7 +48,6 @@ Rectangle {
id: mouseArea id: mouseArea
anchors.fill: parent anchors.fill: parent
onClicked: TimelineManager.openImageOverlay(TimelineManager.timeline.avatarUrl(userid), TimelineManager.timeline.data.id)
Ripple { Ripple {
rippleTarget: mouseArea rippleTarget: mouseArea

View file

@ -104,6 +104,7 @@ Popup {
width: 24 width: 24
displayName: model.displayName displayName: model.displayName
url: model.avatarUrl.replace("mxc://", "image://MxcImage/") url: model.avatarUrl.replace("mxc://", "image://MxcImage/")
onClicked: popup.completionClicked(completer.completionAt(model.index))
} }
Label { Label {

View file

@ -108,19 +108,19 @@ ListView {
spacing: 8 spacing: 8
Avatar { Avatar {
// MouseArea {
// anchors.fill: parent
// onClicked: chat.model.openUserProfile(modelData.userId)
// cursorShape: Qt.PointingHandCursor
// propagateComposedEvents: true
// }
width: avatarSize width: avatarSize
height: avatarSize height: avatarSize
url: chat.model.avatarUrl(modelData.userId).replace("mxc://", "image://MxcImage/") url: chat.model.avatarUrl(modelData.userId).replace("mxc://", "image://MxcImage/")
displayName: modelData.userName displayName: modelData.userName
userid: modelData.userId userid: modelData.userId
MouseArea {
anchors.fill: parent
onClicked: chat.model.openUserProfile(modelData.userId) onClicked: chat.model.openUserProfile(modelData.userId)
cursorShape: Qt.PointingHandCursor
propagateComposedEvents: true
}
} }
Label { Label {

View file

@ -53,14 +53,9 @@ Rectangle {
height: avatarSize height: avatarSize
url: room ? room.roomAvatarUrl.replace("mxc://", "image://MxcImage/") : "" url: room ? room.roomAvatarUrl.replace("mxc://", "image://MxcImage/") : ""
displayName: room ? room.roomName : qsTr("No room selected") displayName: room ? room.roomName : qsTr("No room selected")
MouseArea {
anchors.fill: parent
onClicked: TimelineManager.openRoomSettings() onClicked: TimelineManager.openRoomSettings()
} }
}
Label { Label {
Layout.fillWidth: true Layout.fillWidth: true
Layout.column: 2 Layout.column: 2

View file

@ -37,6 +37,7 @@ ApplicationWindow {
displayName: profile.displayName displayName: profile.displayName
userid: profile.userid userid: profile.userid
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
onClicked: TimelineManager.openImageOverlay(TimelineManager.timeline.avatarUrl(userid), TimelineManager.timeline.data.id)
} }
Label { Label {

View file

@ -31,6 +31,7 @@ Rectangle {
height: avatarSize height: avatarSize
url: CallManager.callPartyAvatarUrl.replace("mxc://", "image://MxcImage/") url: CallManager.callPartyAvatarUrl.replace("mxc://", "image://MxcImage/")
displayName: CallManager.callParty displayName: CallManager.callParty
onClicked: TimelineManager.openImageOverlay(TimelineManager.timeline.avatarUrl(userid), TimelineManager.timeline.data.id)
} }
Label { Label {

View file

@ -38,6 +38,7 @@ Rectangle {
height: avatarSize height: avatarSize
url: CallManager.callPartyAvatarUrl.replace("mxc://", "image://MxcImage/") url: CallManager.callPartyAvatarUrl.replace("mxc://", "image://MxcImage/")
displayName: CallManager.callParty displayName: CallManager.callParty
onClicked: TimelineManager.openImageOverlay(TimelineManager.timeline.avatarUrl(userid), TimelineManager.timeline.data.id)
} }
Label { Label {

View file

@ -61,6 +61,7 @@ Popup {
height: avatarSize height: avatarSize
url: TimelineManager.timeline.roomAvatarUrl.replace("mxc://", "image://MxcImage/") url: TimelineManager.timeline.roomAvatarUrl.replace("mxc://", "image://MxcImage/")
displayName: TimelineManager.timeline.roomName displayName: TimelineManager.timeline.roomName
onClicked: TimelineManager.openImageOverlay(TimelineManager.timeline.avatarUrl(userid), TimelineManager.timeline.data.id)
} }
Button { Button {