Rewrite media caching (old image provider)

- Doesn't use pyotherside's image provider feature, for more flexibility
  and simplicity
- Suitable for supporting matrix media events and more later
- Avoid a lot of duplicate files that the old cache created due to
  server not returning what we expect, mistakes in Python/QML code, etc
- Changed file structure
  (e.g. thumbnails/32x32/<mxc id> instead of
   thumbnails/<mxc id>.32.32.crop)

- Backend.wait_until_account_exist: start issuing warnings if the
  function runs for more than 10s, which means in most case a bad user
  ID was passed

- New HMxcImage QML component, used in H(User/Room)Avatar
This commit is contained in:
miruka
2019-11-03 13:48:12 -04:00
parent 55d4035f60
commit 2f19ff493b
20 changed files with 291 additions and 261 deletions

View File

@@ -36,6 +36,7 @@ Rectangle {
HUserAvatar {
id: bannerAvatar
clientUserId: chatPage.userId
anchors.centerIn: parent
}
}

View File

@@ -11,7 +11,7 @@ Banner {
avatar.userId: inviterId
avatar.displayName: inviterName
avatar.avatarUrl: inviterAvatar
avatar.mxc: inviterAvatar
labelText: qsTr("%1 invited you to this room.").arg(
Utils.coloredNameHtml(inviterName, inviterId)

View File

@@ -8,7 +8,7 @@ Banner {
// TODO: avatar func auto
avatar.userId: chatPage.userId
avatar.displayName: chatPage.userInfo.display_name
avatar.avatarUrl: chatPage.userInfo.avatar_url
avatar.mxc: chatPage.userInfo.avatar_url
labelText: qsTr("You are not part of this room anymore.")
buttonModel: [

View File

@@ -58,9 +58,10 @@ Rectangle {
HUserAvatar {
id: avatar
clientUserId: chatPage.userId
userId: writingUserId
displayName: writingUserInfo.display_name
avatarUrl: writingUserInfo.avatar_url
mxc: writingUserInfo.avatar_url
}
HScrollableTextArea {

View File

@@ -23,8 +23,9 @@ Rectangle {
HRoomAvatar {
id: avatar
clientUserId: chatPage.userId
displayName: chatPage.roomInfo.display_name
avatarUrl: chatPage.roomInfo.avatar_url
mxc: chatPage.roomInfo.avatar_url
Layout.alignment: Qt.AlignTop
}

View File

@@ -7,9 +7,12 @@ HTileDelegate {
backgroundColor: theme.chat.roomSidePane.member.background
image: HUserAvatar {
clientUserId: chatPage.userId
userId: model.user_id
displayName: model.display_name
avatarUrl: model.avatar_url
mxc: model.avatar_url
width: height
height: memberDelegate.height
}
title.text: model.display_name || model.user_id

View File

@@ -52,9 +52,10 @@ HRowLayout {
HUserAvatar {
id: avatar
clientUserId: chatPage.userId
userId: model.sender_id
displayName: model.sender_name
avatarUrl: model.sender_avatar
mxc: model.sender_avatar
width: parent.width
height: collapseAvatar ? 1 : 58
}