Don't do stuff which is not needed ;)
This commit is contained in:
parent
391dd597e2
commit
a527009f86
8 changed files with 32 additions and 42 deletions
|
@ -52,7 +52,7 @@ Item {
|
|||
}
|
||||
|
||||
function updateAudioThumbnail() {
|
||||
if (typeof audioData === "object") {
|
||||
if (audioData) {
|
||||
audioType = ( audioData['@type'] === "voiceNote" ) ? "voice" : "audio";
|
||||
audioFileId = audioData[audioType].id;
|
||||
if (typeof audioData.album_cover_thumbnail !== "undefined") {
|
||||
|
|
|
@ -33,7 +33,7 @@ Item {
|
|||
}
|
||||
|
||||
function updateDocument() {
|
||||
if (typeof documentData === "object") {
|
||||
if (documentData) {
|
||||
if (documentData.document.local.is_downloading_completed) {
|
||||
downloadDocumentButton.visible = false;
|
||||
openDocumentButton.visible = true;
|
||||
|
@ -47,8 +47,8 @@ Item {
|
|||
Connections {
|
||||
target: tdLibWrapper
|
||||
onFileUpdated: {
|
||||
if (typeof documentData !== "undefined" && fileId === documentData.document.id) {
|
||||
if (fileInformation.local.is_downloading_completed) {
|
||||
if (documentData) {
|
||||
if (fileId === documentData.document.id && fileInformation.local.is_downloading_completed) {
|
||||
downloadBusyIndicator.running = false;
|
||||
documentData.document = fileInformation;
|
||||
downloadDocumentButton.visible = false;
|
||||
|
|
|
@ -32,7 +32,7 @@ Item {
|
|||
}
|
||||
|
||||
function updatePicture() {
|
||||
if (typeof photoData === "object") {
|
||||
if (photoData) {
|
||||
// Check first which size fits best...
|
||||
for (var i = 0; i < photoData.sizes.length; i++) {
|
||||
imagePreviewItem.pictureFileInformation = photoData.sizes[i].photo;
|
||||
|
@ -52,9 +52,8 @@ Item {
|
|||
Connections {
|
||||
target: tdLibWrapper
|
||||
onFileUpdated: {
|
||||
if (typeof imagePreviewItem.pictureFileInformation !== "undefined" && fileId === imagePreviewItem.pictureFileInformation.id) {
|
||||
console.log("File updated, completed? " + fileInformation.local.is_downloading_completed);
|
||||
if (fileInformation.local.is_downloading_completed) {
|
||||
if (imagePreviewItem.pictureFileInformation) {
|
||||
if (fileId === imagePreviewItem.pictureFileInformation.id && fileInformation.local.is_downloading_completed) {
|
||||
imagePreviewItem.pictureFileInformation = fileInformation;
|
||||
singleImage.source = fileInformation.local.path;
|
||||
}
|
||||
|
|
|
@ -29,15 +29,12 @@ Row {
|
|||
width: parent.width
|
||||
|
||||
property string myUserId;
|
||||
property variant inReplyToMessage: "";
|
||||
property variant inReplyToMessage;
|
||||
|
||||
onInReplyToMessageChanged: {
|
||||
if (typeof inReplyToRow.inReplyToMessage === "object") {
|
||||
if (inReplyToMessage) {
|
||||
inReplyToUserText.text = (inReplyToRow.inReplyToMessage.sender_user_id !== inReplyToRow.myUserId) ? Emoji.emojify(Functions.getUserName(tdLibWrapper.getUserInformation(inReplyToRow.inReplyToMessage.sender_user_id)), inReplyToUserText.font.pixelSize) : qsTr("You");
|
||||
inReplyToMessageText.text = Emoji.emojify(Functions.getMessageText(inReplyToRow.inReplyToMessage, true), inReplyToMessageText.font.pixelSize);
|
||||
} else {
|
||||
inReplyToUserText.text = "";
|
||||
inReplyToMessageText.text = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ Item {
|
|||
}
|
||||
|
||||
function updateSticker() {
|
||||
if (typeof stickerData === "object") {
|
||||
if (stickerData) {
|
||||
if (stickerData.is_animated) {
|
||||
// Use thumbnail until we can decode TGS files
|
||||
usedFileId = stickerData.thumbnail.photo.id;
|
||||
|
@ -58,10 +58,8 @@ Item {
|
|||
Connections {
|
||||
target: tdLibWrapper
|
||||
onFileUpdated: {
|
||||
if (typeof stickerData === "object") {
|
||||
if (fileId === usedFileId) {
|
||||
console.log("File updated, completed? " + fileInformation.local.is_downloading_completed);
|
||||
if (fileInformation.local.is_downloading_completed) {
|
||||
if (stickerData) {
|
||||
if (fileId === usedFileId && fileInformation.local.is_downloading_completed) {
|
||||
if (stickerData.is_animated) {
|
||||
stickerData.thumbnail.photo = fileInformation;
|
||||
} else {
|
||||
|
@ -72,7 +70,6 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
id: singleImage
|
||||
|
|
|
@ -73,7 +73,7 @@ Item {
|
|||
}
|
||||
|
||||
function updateVideoThumbnail() {
|
||||
if (typeof videoData === "object") {
|
||||
if (videoData) {
|
||||
videoType = videoData['@type'];
|
||||
videoFileId = videoData[videoType].id;
|
||||
if (typeof videoData.thumbnail !== "undefined") {
|
||||
|
@ -104,13 +104,12 @@ Item {
|
|||
Connections {
|
||||
target: tdLibWrapper
|
||||
onFileUpdated: {
|
||||
if (typeof videoData === "object") {
|
||||
if (fileInformation.local.is_downloading_completed) {
|
||||
if (fileId === previewFileId) {
|
||||
if (videoData) {
|
||||
if (fileInformation.local.is_downloading_completed && fileId === previewFileId) {
|
||||
videoData.thumbnail.photo = fileInformation;
|
||||
placeholderImage.source = fileInformation.local.path;
|
||||
}
|
||||
if (fileId === videoFileId) {
|
||||
if (fileInformation.local.is_downloading_completed && fileId === videoFileId) {
|
||||
videoDownloadBusyIndicator.running = false;
|
||||
videoData[videoType] = fileInformation;
|
||||
videoUrl = fileInformation.local.path;
|
||||
|
@ -121,7 +120,6 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
id: placeholderImage
|
||||
|
|
|
@ -280,7 +280,7 @@ Page {
|
|||
MenuItem {
|
||||
onClicked: {
|
||||
newMessageInReplyToRow.inReplyToMessage = display;
|
||||
sendMessageColumn.focus = true;
|
||||
newMessageTextField.focus = true;
|
||||
}
|
||||
text: qsTr("Reply to Message")
|
||||
}
|
||||
|
@ -475,7 +475,7 @@ Page {
|
|||
InReplyToRow {
|
||||
onInReplyToMessageChanged: {
|
||||
console.log("This is a reply!");
|
||||
if (typeof newMessageInReplyToRow.inReplyToMessage === "object") {
|
||||
if (inReplyToMessage) {
|
||||
newMessageColumn.replyToMessageId = newMessageInReplyToRow.inReplyToMessage.id.toString()
|
||||
newMessageInReplyToRow.visible = true;
|
||||
} else {
|
||||
|
@ -509,7 +509,7 @@ Page {
|
|||
labelVisible: false
|
||||
onFocusChanged: {
|
||||
if (!focus) {
|
||||
newMessageInReplyToRow.inReplyToMessage = "";
|
||||
newMessageInReplyToRow.inReplyToMessage = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,6 @@ CoverBackground {
|
|||
|
||||
right: parent.right
|
||||
rightMargin: Theme.paddingMedium
|
||||
asynchronous: true
|
||||
}
|
||||
|
||||
fillMode: Image.PreserveAspectFit
|
||||
|
|
Loading…
Reference in a new issue