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 {