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 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

View file

@ -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 {

View file

@ -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 {

View file

@ -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 {

View file

@ -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 {

View file

@ -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 {

View file

@ -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 {

View file

@ -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 {