Fix UI glitches in forward info, support video notes

This commit is contained in:
Sebastian Wolf 2020-11-14 20:02:34 +01:00
parent 07aa92ffcc
commit d994f8f102
14 changed files with 120 additions and 8 deletions

View file

@ -279,8 +279,8 @@ ListItem {
forwardedThumbnail.photoData = (typeof otherUserInformation.profile_photo !== "undefined") ? otherUserInformation.profile_photo.small : "";
forwardedChannelText.text = Emoji.emojify(Functions.getUserName(otherUserInformation), Theme.fontSizeExtraSmall);
} else {
forwardedThumbnail.photoData = "";
forwardedChannelText.text = Emoji.emojify(myMessage.forward_info.origin.sender_user_name, Theme.fontSizeExtraSmall);
forwardedChannelText.text = Emoji.emojify(myMessage.forward_info.origin.sender_name, Theme.fontSizeExtraSmall);
forwardedThumbnail.photoData = {};
}
}
@ -293,7 +293,7 @@ ListItem {
Column {
spacing: Theme.paddingSmall
width: parent.width
width: parent.width - forwardedThumbnail.width - Theme.paddingSmall
Text {
font.pixelSize: Theme.fontSizeExtraSmall
color: Theme.primaryColor

View file

@ -27,7 +27,7 @@ Item {
property ListItem messageListItem
property var rawMessage: messageListItem.myMessage
property var videoData: ( rawMessage.content['@type'] === "messageVideo" ) ? rawMessage.content.video : ( ( rawMessage.content['@type'] === "messageAnimation" ) ? rawMessage.content.animation : "")
property var videoData: ( rawMessage.content['@type'] === "messageVideo" ) ? rawMessage.content.video : ( ( rawMessage.content['@type'] === "messageAnimation" ) ? rawMessage.content.animation : rawMessage.content.video_note )
property string videoUrl;
property int previewFileId;
property int videoFileId;
@ -37,7 +37,7 @@ Item {
property bool playRequested: false;
width: parent.width
height: Functions.getVideoHeight(width, videoData)
height: ( rawMessage.content['@type'] === "messageVideoNote" ) ? width : Functions.getVideoHeight(width, videoData)
Timer {
id: screensaverTimer
@ -78,7 +78,11 @@ Item {
function updateVideoThumbnail() {
if (videoData) {
if (rawMessage.content['@type'] === "messageVideoNote") {
videoType = "video";
} else {
videoType = videoData['@type'];
}
videoFileId = videoData[videoType].id;
if (typeof videoData.thumbnail !== "undefined") {
previewFileId = videoData.thumbnail.photo.id;

View file

@ -48,6 +48,9 @@ function getMessageText(message, simple, myself) {
return simple ? (myself ? qsTr("sent a video", "myself") : qsTr("sent a video")) : "";
}
}
if (message.content['@type'] === 'messageVideoNote') {
return simple ? (myself ? qsTr("sent a video note", "myself") : qsTr("sent a video note")) : "";
}
if (message.content['@type'] === 'messageAnimation') {
if (message.content.caption.text !== "") {
return simple ? qsTr("Animation: %1").arg(message.content.caption.text) : enhanceMessageText(message.content.caption)

View file

@ -590,6 +590,7 @@ Page {
messageSticker: "StickerPreview",
messagePhoto: "ImagePreview",
messageVideo: "VideoPreview",
messageVideoNote: "VideoPreview",
messageAnimation: "VideoPreview",
messageAudio: "AudioPreview",
messageVoiceNote: "AudioPreview",
@ -605,7 +606,7 @@ Page {
case "LocationPreview":
return parentWidth * 0.66666666; // 2 / 3;
case "VideoPreview":
return Functions.getVideoHeight(parentWidth, ( content['@type'] === "messageVideo" ) ? content.video : content.animation);
return ( content['@type'] === "messageVideoNote" ) ? content.video_note.length : ( Functions.getVideoHeight(parentWidth, ( content['@type'] === "messageVideo" ) ? content.video : content.animation) );
case "AudioPreview":
return parentWidth / 2;
case "DocumentPreview":
@ -615,7 +616,21 @@ Page {
}
}
readonly property var simpleDelegateMessages: ["messageBasicGroupChatCreate", "messageChatAddMembers", "messageChatChangePhoto", "messageChatChangeTitle", "messageChatDeleteMember", "messageChatDeletePhoto", "messageChatJoinByLink", "messageChatSetTtl", "messageChatUpgradeFrom", "messageChatUpgradeTo", "messageCustomServiceAction", "messagePinMessage", "messageScreenshotTaken", "messageSupergroupChatCreate", "messageUnsupported"]
readonly property var simpleDelegateMessages: ["messageBasicGroupChatCreate",
"messageChatAddMembers",
"messageChatChangePhoto",
"messageChatChangeTitle",
"messageChatDeleteMember",
"messageChatDeletePhoto",
"messageChatJoinByLink",
"messageChatSetTtl",
"messageChatUpgradeFrom",
"messageChatUpgradeTo",
"messageCustomServiceAction",
"messagePinMessage",
"messageScreenshotTaken",
"messageSupergroupChatCreate",
"messageUnsupported"]
delegate: Loader {
width: chatView.width
Component {

View file

@ -1468,5 +1468,14 @@
<source>Unable to find user %1</source>
<translation>Konnte Benutzer %1 nicht finden</translation>
</message>
<message>
<source>sent a video note</source>
<comment>myself</comment>
<translation>haben eine Videonachricht geschicht</translation>
</message>
<message>
<source>sent a video note</source>
<translation>hat eine Videonachricht geschickt</translation>
</message>
</context>
</TS>

View file

@ -1462,5 +1462,14 @@
<source>Unable to find user %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>sent a video note</source>
<comment>myself</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>sent a video note</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -1469,5 +1469,14 @@
<source>Unable to find user %1</source>
<translation>Käyttäjää ei löydy: %1</translation>
</message>
<message>
<source>sent a video note</source>
<comment>myself</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>sent a video note</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -1462,5 +1462,14 @@
<source>Unable to find user %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>sent a video note</source>
<comment>myself</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>sent a video note</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -1468,5 +1468,14 @@
<source>Unable to find user %1</source>
<translation>Impossibile trovare l&apos;utente %1</translation>
</message>
<message>
<source>sent a video note</source>
<comment>myself</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>sent a video note</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -1474,5 +1474,14 @@
<source>Unable to find user %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>sent a video note</source>
<comment>myself</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>sent a video note</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -1474,5 +1474,14 @@
<source>Unable to find user %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>sent a video note</source>
<comment>myself</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>sent a video note</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -1468,5 +1468,14 @@
<source>Unable to find user %1</source>
<translation>Kan inte hitta användare %1</translation>
</message>
<message>
<source>sent a video note</source>
<comment>myself</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>sent a video note</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -1462,5 +1462,14 @@
<source>Unable to find user %1</source>
<translation> %1</translation>
</message>
<message>
<source>sent a video note</source>
<comment>myself</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>sent a video note</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -1462,5 +1462,14 @@
<source>Unable to find user %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>sent a video note</source>
<comment>myself</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>sent a video note</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>