Remove more needless usages of makeMediaUrl
This is only really needed in specific cases, e.g. localUser which isn't attached to a connection and thus needs a little help. Notes for when this is needed is added for future readers.
This commit is contained in:
@@ -109,7 +109,8 @@ Kirigami.Page {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.topMargin: Kirigami.Units.gridUnit
|
||||
name: delegate.text
|
||||
source: delegate.connection.localUser.avatarMediaId ? delegate.connection.makeMediaUrl("mxc://" + delegate.connection.localUser.avatarMediaId) : ""
|
||||
// Note: User::avatarUrl does not set user_id, and thus cannot be used directly here. Hence the makeMediaUrl.
|
||||
source: delegate.connection.localUser.avatarUrl.toString().length > 0 ? delegate.connection.makeMediaUrl(delegate.connection.localUser.avatarUrl) : ""
|
||||
implicitWidth: Kirigami.Units.iconSizes.medium
|
||||
implicitHeight: Kirigami.Units.iconSizes.medium
|
||||
}
|
||||
|
||||
@@ -27,7 +27,8 @@ QQC2.Menu {
|
||||
text: "https://matrix.to/#/" + root.connection.localUser.id,
|
||||
title: root.connection.localUser.displayName,
|
||||
subtitle: root.connection.localUser.id,
|
||||
avatarSource: root.connection.makeMediaUrl(root.connection.localUser.avatarUrl)
|
||||
// Note: User::avatarUrl does not set user_id, and thus cannot be used directly here. Hence the makeMediaUrl.
|
||||
avatarSource: root.connection.localUser.avatarUrl.toString().length > 0 ? root.connection.makeMediaUrl(root.connection.localUser.avatarUrl) : ""
|
||||
});
|
||||
if (typeof root.closeDialog === "function") {
|
||||
root.closeDialog();
|
||||
|
||||
@@ -125,7 +125,7 @@ Kirigami.Dialog {
|
||||
width: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing
|
||||
height: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing
|
||||
}
|
||||
source: userDelegate.connection.localUser.avatarMediaId ? userDelegate.connection.makeMediaUrl("mxc://" + userDelegate.connection.localUser.avatarMediaId) : ""
|
||||
source: userDelegate.connection.localUser.avatarUrl.toString().length > 0 ? userDelegate.connection.makeMediaUrl(userDelegate.connection.localUser.avatarUrl) : ""
|
||||
name: userDelegate.connection.localUser.displayName ?? userDelegate.connection.localUser.id
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ Components.AbstractMaximizeComponent {
|
||||
|
||||
required property string text
|
||||
property color avatarColor
|
||||
required property string avatarSource
|
||||
required property url avatarSource
|
||||
|
||||
onOpened: forceActiveFocus()
|
||||
|
||||
|
||||
@@ -37,14 +37,15 @@ RowLayout {
|
||||
}
|
||||
KirigamiComponents.AvatarButton {
|
||||
id: accountButton
|
||||
readonly property string mediaId: root.connection.localUser.avatarMediaId
|
||||
readonly property url avatarUrl: root.connection.localUser.avatarUrl
|
||||
|
||||
Layout.preferredWidth: Kirigami.Units.iconSizes.medium
|
||||
Layout.preferredHeight: Kirigami.Units.iconSizes.medium
|
||||
Layout.leftMargin: Kirigami.Units.largeSpacing
|
||||
|
||||
text: i18n("Edit this account")
|
||||
source: mediaId ? root.connection.makeMediaUrl("mxc://" + mediaId) : ""
|
||||
// Note: User::avatarUrl does not set user_id, and thus cannot be used directly here. Hence the makeMediaUrl.
|
||||
source: avatarUrl.toString().length > 0 ? root.connection.makeMediaUrl(avatarUrl) : ""
|
||||
name: root.connection.localUser.displayName
|
||||
|
||||
activeFocusOnTab: true
|
||||
|
||||
@@ -34,7 +34,8 @@ FormCard.FormCardPage {
|
||||
|
||||
padding: 0
|
||||
|
||||
source: root.connection && root.connection.localUser.avatarMediaId ? root.connection.makeMediaUrl("mxc://" + root.connection.localUser.avatarMediaId) : ""
|
||||
// Note: User::avatarUrl does not set user_id, and thus cannot be used directly here. Hence the makeMediaUrl.
|
||||
source: root.connection && (root.connection.localUser.avatarUrl.toString().length > 0 ? root.connection.makeMediaUrl(root.connection.localUser.avatarUrl) : "")
|
||||
name: root.connection.localUser.displayName
|
||||
|
||||
onClicked: {
|
||||
@@ -122,7 +123,8 @@ FormCard.FormCardPage {
|
||||
text: "https://matrix.to/#/" + root.connection.localUser.id,
|
||||
title: root.connection.localUser.displayName,
|
||||
subtitle: root.connection.localUser.id,
|
||||
avatarSource: root.connection.makeMediaUrl(root.connection.localUser.avatarUrl)
|
||||
// Note: User::avatarUrl does not set user_id, and thus cannot be used directly here. Hence the makeMediaUrl.
|
||||
avatarSource: root.connection && (root.connection.localUser.avatarUrl.toString().length > 0 ? root.connection.makeMediaUrl(root.connection.localUser.avatarUrl) : "")
|
||||
});
|
||||
if (typeof root.closeDialog === "function") {
|
||||
root.closeDialog();
|
||||
|
||||
@@ -53,7 +53,8 @@ FormCard.FormCardPage {
|
||||
contentItem: RowLayout {
|
||||
KirigamiComponents.Avatar {
|
||||
name: accountDelegate.connection.localUser.displayName
|
||||
source: accountDelegate.connection.localUser.avatarMediaId ? accountDelegate.connection.makeMediaUrl("mxc://" + accountDelegate.connection.localUser.avatarMediaId) : ""
|
||||
// Note: User::avatarUrl does not set user_id, and thus cannot be used directly here. Hence the makeMediaUrl.
|
||||
source: accountDelegate.connection.localUser.avatarUrl.toString().length > 0 ? accountDelegate.connection.makeMediaUrl(accountDelegate.connection.localUser.avatarUrl) : ""
|
||||
|
||||
Layout.rightMargin: Kirigami.Units.largeSpacing
|
||||
implicitWidth: Kirigami.Units.iconSizes.medium
|
||||
|
||||
@@ -169,7 +169,7 @@ FormCard.FormCardPage {
|
||||
id: userListItem
|
||||
|
||||
required property string userId
|
||||
required property string avatar
|
||||
required property url avatar
|
||||
required property string name
|
||||
required property int powerLevel
|
||||
required property string powerLevelString
|
||||
@@ -180,7 +180,7 @@ FormCard.FormCardPage {
|
||||
KirigamiComponents.Avatar {
|
||||
Layout.preferredWidth: Kirigami.Units.iconSizes.medium
|
||||
Layout.preferredHeight: Kirigami.Units.iconSizes.medium
|
||||
source: userListItem.avatar ? root.room.connection.makeMediaUrl(userListItem.avatar) : ""
|
||||
source: userListItem.avatar
|
||||
name: userListItem.name
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ TimelineDelegate {
|
||||
Layout.preferredHeight: Kirigami.Units.iconSizes.large
|
||||
|
||||
name: root.room ? root.room.displayName : ""
|
||||
source: root.room && root.room.avatarMediaId ? root.room.connection.makeMediaUrl("mxc://" + root.room.avatarMediaId) : ""
|
||||
source: root.room ? root.room.avatarMediaUrl : ""
|
||||
|
||||
Rectangle {
|
||||
visible: room.usesEncryption
|
||||
|
||||
Reference in New Issue
Block a user