Merge pull request #114 from jgibbon/feature/speed-up-chatpage

Reduce ChatPage.qml jit compile time
This commit is contained in:
Sebastian Wolf 2020-11-01 17:59:06 +01:00 committed by GitHub
commit ea33c81331
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 219 additions and 322 deletions

View file

@ -24,15 +24,18 @@ import "../js/functions.js" as Functions
Item { Item {
id: audioMessageComponent id: audioMessageComponent
property variant audioData; property ListItem messageListItem
property variant rawMessage: messageListItem.myMessage
property variant audioData: ( rawMessage.content['@type'] === "messageVoiceNote" ) ? rawMessage.content.voice_note : ( ( rawMessage.content['@type'] === "messageAudio" ) ? rawMessage.content.audio : "");
property string audioUrl; property string audioUrl;
property int previewFileId; property int previewFileId;
property int audioFileId; property int audioFileId;
property bool onScreen; property bool onScreen: messageListItem.page.status === PageStatus.Active
property string audioType : "voiceNote"; property string audioType : "voiceNote";
width: parent.width width: parent.width
height: parent.height height: width / 2
function getTimeString(rawSeconds) { function getTimeString(rawSeconds) {
var minutes = Math.floor( rawSeconds / 60 ); var minutes = Math.floor( rawSeconds / 60 );

View file

@ -26,7 +26,10 @@ Item {
width: parent.width width: parent.width
height: Theme.itemSizeLarge height: Theme.itemSizeLarge
property variant documentData; property ListItem messageListItem
property variant rawMessage: messageListItem.myMessage
property variant documentData: rawMessage.content.document
property bool openRequested: false; property bool openRequested: false;
Component.onCompleted: { Component.onCompleted: {

View file

@ -24,9 +24,14 @@ Item {
id: imagePreviewItem id: imagePreviewItem
property variant photoData; property ListItem messageListItem
property variant rawMessage: messageListItem.myMessage
property variant photoData: rawMessage.content.photo;
property variant pictureFileInformation; property variant pictureFileInformation;
width: parent.width
height: width * 2 / 3
Component.onCompleted: { Component.onCompleted: {
updatePicture(); updatePicture();
} }

View file

@ -23,9 +23,16 @@ import Sailfish.Silica 1.0
Item { Item {
id: imagePreviewItem id: imagePreviewItem
property variant locationData;
property int chatId; property ListItem messageListItem
property variant rawMessage: messageListItem.myMessage
property variant locationData : ( rawMessage.content['@type'] === "messageLocation" ) ? rawMessage.content.location : ( ( rawMessage.content['@type'] === "messageVenue" ) ? rawMessage.content.venue.location : "" )
property string chatId: messageListItem.page.chatInformation.id
property variant pictureFileInformation; property variant pictureFileInformation;
width: parent.width
height: width / 2
Component.onCompleted: { Component.onCompleted: {
updatePicture(); updatePicture();

View file

@ -27,13 +27,16 @@ import "../js/twemoji.js" as Emoji
Item { Item {
id: pollMessageComponent id: pollMessageComponent
property string chatId
property var message:({})
property bool isOwnMessage
property string messageId: message.id property ListItem messageListItem
property bool canEdit: message.can_be_edited property variant rawMessage: messageListItem.myMessage
property var pollData: message.content.poll property string chatId: messageListItem.page.chatInformation.id
property bool isOwnMessage: messageListItem.isOwnMessage
property string messageId: rawMessage.id
property bool canEdit: rawMessage.can_be_edited
property var pollData: rawMessage.content.poll
property var chosenPollData:({}) property var chosenPollData:({})
property var chosenIndexes: [] property var chosenIndexes: []
property bool hasAnswered: { property bool hasAnswered: {
@ -43,7 +46,7 @@ Item {
} }
property bool canAnswer: !hasAnswered && !pollData.is_closed property bool canAnswer: !hasAnswered && !pollData.is_closed
property bool isQuiz: pollData.type['@type'] === "pollTypeQuiz" property bool isQuiz: pollData.type['@type'] === "pollTypeQuiz"
property Item messageItem width: parent.width
height: pollColumn.height height: pollColumn.height
opacity: 0 opacity: 0
Behavior on opacity { FadeAnimation {} } Behavior on opacity { FadeAnimation {} }
@ -286,9 +289,9 @@ Item {
Component.onCompleted: { Component.onCompleted: {
opacity = 1; opacity = 1;
if(messageItem && messageItem.menu ) { // workaround to add menu entries if(messageListItem && messageListItem.menu ) { // workaround to add menu entries
closePollMenuItemComponent.createObject(messageItem.menu._contentColumn); closePollMenuItemComponent.createObject(messageListItem.menu._contentColumn);
resetAnswerMenuItemComponent.createObject(messageItem.menu._contentColumn); resetAnswerMenuItemComponent.createObject(messageListItem.menu._contentColumn);
} }
} }
} }

View file

@ -20,7 +20,11 @@ import QtQuick 2.5
import Sailfish.Silica 1.0 import Sailfish.Silica 1.0
Item { Item {
property variant stickerData;
property ListItem messageListItem
property variant rawMessage: messageListItem.myMessage
property variant stickerData: rawMessage.content.sticker;
property int usedFileId; property int usedFileId;
width: stickerData.width width: stickerData.width

View file

@ -24,17 +24,20 @@ import "../js/functions.js" as Functions
Item { Item {
id: videoMessageComponent id: videoMessageComponent
property variant videoData; property ListItem messageListItem
property variant rawMessage: messageListItem.myMessage
property variant videoData: ( rawMessage.content['@type'] === "messageVideo" ) ? rawMessage.content.video : ( ( rawMessage.content['@type'] === "messageAnimation" ) ? rawMessage.content.animation : "")
property string videoUrl; property string videoUrl;
property int previewFileId; property int previewFileId;
property int videoFileId; property int videoFileId;
property bool fullscreen : false; property bool fullscreen : false;
property bool onScreen; property bool onScreen: messageListItem.page.status === PageStatus.Active;
property string videoType : "video"; property string videoType : "video";
property bool playRequested: false; property bool playRequested: false;
width: parent.width width: parent.width
height: parent.height height: Functions.getVideoHeight(width, videoData)
Timer { Timer {
id: screensaverTimer id: screensaverTimer

View file

@ -225,8 +225,6 @@ Page {
chatPage.isInitialized = true; chatPage.isInitialized = true;
} }
break; break;
// case PageStatus.Deactivating:
// tdLibWrapper.closeChat(chatInformation.id);
} }
} }
@ -314,6 +312,10 @@ Page {
chatView.lastReadSentIndex = lastReadSentIndex; chatView.lastReadSentIndex = lastReadSentIndex;
chatViewCooldownTimer.start(); chatViewCooldownTimer.start();
} }
onNotificationSettingsUpdated: {
chatInformation = chatModel.getChatInformation();
muteChatMenuItem.text = chatInformation.notification_settings.mute_for > 0 ? qsTr("Unmute Chat") : qsTr("Mute Chat");
}
} }
Timer { Timer {
@ -348,9 +350,9 @@ Page {
SilicaFlickable { SilicaFlickable {
id: chatContainer id: chatContainer
contentHeight: parent.height
contentWidth: parent.width
anchors.fill: parent anchors.fill: parent
contentHeight: height
contentWidth: width
PullDownMenu { PullDownMenu {
visible: chatInformation.id !== chatPage.myUserId && !stickerPickerLoader.active visible: chatInformation.id !== chatPage.myUserId && !stickerPickerLoader.active
@ -369,13 +371,6 @@ Page {
} }
} }
Connections {
target: chatModel
onNotificationSettingsUpdated: {
chatInformation = chatModel.getChatInformation();
muteChatMenuItem.text = chatInformation.notification_settings.mute_for > 0 ? qsTr("Unmute Chat") : qsTr("Mute Chat");
}
}
BackgroundItem { BackgroundItem {
id: headerMouseArea id: headerMouseArea
height: headerRow.height height: headerRow.height
@ -463,16 +458,6 @@ Page {
previousHeight = height; previousHeight = height;
} }
Timer {
id: chatViewLoadingTimer
interval: 100
repeat: false
running: false
onTriggered: {
chatPage.loading = false;
}
}
Timer { Timer {
id: chatViewCooldownTimer id: chatViewCooldownTimer
interval: 2000 interval: 2000
@ -484,6 +469,7 @@ Page {
} }
} }
SilicaListView { SilicaListView {
id: chatView id: chatView
@ -519,25 +505,48 @@ Page {
} }
model: chatModel model: chatModel
delegate: ListItem { property variant contentComponentNames: ({
messageSticker: "StickerPreview",
messagePhoto: "ImagePreview",
messageVideo: "VideoPreview",
messageAnimation: "VideoPreview",
messageAudio: "AudioPreview",
messageVoiceNote: "AudioPreview",
messageDocument: "DocumentPreview",
messageLocation: "LocationPreview",
messageVenue: "LocationPreview",
messagePoll: "PollPreview"
})
function getContentComponentHeight(componentName, content, parentWidth) {
switch(componentName) {
case "StickerPreview": return content.sticker.height;
case "ImagePreview":
case "LocationPreview":
return parentWidth * 0.66666666; // 2 / 3;
case "VideoPreview":
return Functions.getVideoHeight(parentWidth, ( content['@type'] === "messageVideo" ) ? content.video : content.animation);
case "AudioPreview":
return parentWidth / 2;
case "DocumentPreview":
return Theme.itemSizeSmall;
case "PollPreview":
return Theme.itemSizeSmall * (4 + content.poll.options);
}
}
delegate: ListItem {
id: messageListItem id: messageListItem
contentHeight: messageBackground.height + Theme.paddingMedium contentHeight: messageBackground.height + Theme.paddingMedium
contentWidth: parent.width contentWidth: parent.width
property variant myMessage: display property variant myMessage: display
property variant userInformation: tdLibWrapper.getUserInformation(display.sender_user_id) property variant userInformation: tdLibWrapper.getUserInformation(display.sender_user_id)
property bool isOwnMessage: chatPage.myUserId === display.sender_user_id property Page page: chatPage
property bool isForwarded: typeof display.forward_info !== "undefined"
property bool containsImage: display.content['@type'] === "messagePhoto"
property bool containsSticker: display.content['@type'] === "messageSticker"
property bool containsWebPage: typeof display.content.web_page !== "undefined"
property bool containsVideo: (( display.content['@type'] === "messageVideo" ) || ( display.content['@type'] === "messageAnimation" ));
property bool containsAudio: (( display.content['@type'] === "messageVoiceNote" ) || ( display.content['@type'] === "messageAudio" ));
property bool containsDocument: ( display.content['@type'] === "messageDocument" )
property bool containsLocation: ( display.content['@type'] === "messageLocation" || ( display.content['@type'] === "messageVenue" ))
property bool containsPoll: display.content['@type'] === "messagePoll"
property bool isOwnMessage: chatPage.myUserId === display.sender_user_id
property string extraContentComponentName: typeof display.content !== "undefined"
&& chatView.contentComponentNames.hasOwnProperty(display.content['@type']) ?
chatView.contentComponentNames[display.content['@type']] : ""
menu: ContextMenu { menu: ContextMenu {
MenuItem { MenuItem {
onClicked: { onClicked: {
@ -557,7 +566,9 @@ Page {
} }
MenuItem { MenuItem {
onClicked: { onClicked: {
deleteMessageRemorseItem.execute(messageListItem, qsTr("Deleting message"), function() { tdLibWrapper.deleteMessages(chatInformation.id, [ display.id ]); } ); var chatId = chatInformation.id;
var messageId = display.id;
Remorse.itemAction(messageListItem, qsTr("Message deleted"), function() { tdLibWrapper.deleteMessages(chatId, [ messageId]); })
} }
text: qsTr("Delete Message") text: qsTr("Delete Message")
visible: display.can_be_deleted_for_all_users || (display.can_be_deleted_only_for_self && display.chat_id === chatPage.myUserId) visible: display.can_be_deleted_for_all_users || (display.can_be_deleted_only_for_self && display.chat_id === chatPage.myUserId)
@ -574,6 +585,32 @@ Page {
messageBackground.color = index > ( chatView.count - chatInformation.unreadCount - 1 ) ? Theme.secondaryHighlightColor : Theme.secondaryColor; messageBackground.color = index > ( chatView.count - chatInformation.unreadCount - 1 ) ? Theme.secondaryHighlightColor : Theme.secondaryColor;
messageBackground.opacity = index > ( chatView.count - chatInformation.unreadCount - 1 ) ? 0.5 : 0.2; messageBackground.opacity = index > ( chatView.count - chatInformation.unreadCount - 1 ) ? 0.5 : 0.2;
} }
onLastReadSentMessageUpdated: {
console.log("[ChatModel] Messages in this chat were read, new last read: " + lastReadSentIndex + ", updating description for index " + index + ", status: " + (index <= lastReadSentIndex));
messageDateText.text = getMessageStatusText(display, index, lastReadSentIndex);
}
onMessageUpdated: {
if (index === modelIndex) {
console.log("[ChatModel] This message was updated, index " + index + ", updating content...");
messageDateText.text = getMessageStatusText(display, index, chatView.lastReadSentIndex);
messageText.text = Emoji.emojify(Functions.getMessageText(display, false, messageListItem.isOwnMessage), messageText.font.pixelSize);
if(locationPreviewLoader.active && locationPreviewLoader.status === Loader.Ready) {
locationPreviewLoader.item.locationData = display.content.location;
locationPreviewLoader.item.updatePicture()
}
}
}
}
Connections {
target: tdLibWrapper
onReceivedMessage: {
if (messageId === display.reply_to_message_id.toString()) {
messageInReplyToRow.inReplyToMessage = message;
messageInReplyToRow.visible = true;
}
}
} }
Component.onCompleted: { Component.onCompleted: {
@ -587,22 +624,21 @@ Page {
running: false running: false
onTriggered: { onTriggered: {
if (typeof display.content !== "undefined") { if (typeof display.content !== "undefined") {
webPagePreviewLoader.active = messageListItem.containsWebPage; if(messageListItem.extraContentComponentName !== "") {
imagePreviewLoader.active = messageListItem.containsImage; extraContentLoader.setSource(
stickerPreviewLoader.active = messageListItem.containsSticker; "../components/" +messageListItem.extraContentComponentName +".qml",
videoPreviewLoader.active = messageListItem.containsVideo; {
audioPreviewLoader.active = messageListItem.containsAudio; messageListItem: messageListItem
documentPreviewLoader.active = messageListItem.containsDocument; })
locationPreviewLoader.active = messageListItem.containsLocation; } else {
pollPreviewLoader.active = messageListItem.containsPoll; if(typeof display.content.web_page !== "undefined") { // only in messageText
forwardedInformationLoader.active = messageListItem.isForwarded; webPagePreviewLoader.active = true;
}
}
} }
} }
} }
RemorseItem {
id: deleteMessageRemorseItem
}
Row { Row {
id: messageTextRow id: messageTextRow
@ -611,18 +647,6 @@ Page {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
Component {
id: profileThumbnailComponent
ProfileThumbnail {
id: messagePictureThumbnail
photoData: (typeof messageListItem.userInformation.profile_photo !== "undefined") ? messageListItem.userInformation.profile_photo.small : ""
replacementStringHint: userText.text
width: visible ? Theme.itemSizeSmall : 0
height: visible ? Theme.itemSizeSmall : 0
visible: ( chatPage.isBasicGroup || chatPage.isSuperGroup ) && !chatPage.isChannel
}
}
Loader { Loader {
id: profileThumbnailLoader id: profileThumbnailLoader
active: (( chatPage.isBasicGroup || chatPage.isSuperGroup ) && !chatPage.isChannel) active: (( chatPage.isBasicGroup || chatPage.isSuperGroup ) && !chatPage.isChannel)
@ -631,7 +655,16 @@ Page {
height: active ? Theme.itemSizeSmall : 0 height: active ? Theme.itemSizeSmall : 0
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: Theme.paddingSmall anchors.bottomMargin: Theme.paddingSmall
sourceComponent: profileThumbnailComponent sourceComponent: Component {
ProfileThumbnail {
id: messagePictureThumbnail
photoData: (typeof messageListItem.userInformation.profile_photo !== "undefined") ? messageListItem.userInformation.profile_photo.small : ""
replacementStringHint: userText.text
width: visible ? Theme.itemSizeSmall : 0
height: visible ? Theme.itemSizeSmall : 0
visible: ( chatPage.isBasicGroup || chatPage.isSuperGroup ) && !chatPage.isChannel
}
}
} }
Item { Item {
@ -654,7 +687,7 @@ Page {
color: index > ( chatView.count - chatInformation.unread_count - 1 ) ? Theme.secondaryHighlightColor : Theme.secondaryColor color: index > ( chatView.count - chatInformation.unread_count - 1 ) ? Theme.secondaryHighlightColor : Theme.secondaryColor
radius: parent.width / 50 radius: parent.width / 50
opacity: index > ( chatView.count - chatInformation.unread_count - 1 ) ? 0.5 : 0.2 opacity: index > ( chatView.count - chatInformation.unread_count - 1 ) ? 0.5 : 0.2
visible: appSettings.showStickersAsImages || !messageListItem.containsSticker visible: appSettings.showStickersAsImages || display.content['@type'] !== "messageSticker"
} }
Column { Column {
@ -671,15 +704,6 @@ Page {
} }
} }
Connections {
target: tdLibWrapper
onReceivedMessage: {
if (messageId === display.reply_to_message_id.toString()) {
messageInReplyToRow.inReplyToMessage = message;
messageInReplyToRow.visible = true;
}
}
}
Text { Text {
id: userText id: userText
@ -704,10 +728,10 @@ Page {
Loader { Loader {
id: forwardedInformationLoader id: forwardedInformationLoader
active: false active: typeof display.forward_info !== "undefined"
asynchronous: true asynchronous: true
width: parent.width width: parent.width
height: messageListItem.isForwarded ? ( item ? item.height : Theme.itemSizeExtraSmall ) : 0 // height: active ? ( item ? item.height : Theme.itemSizeExtraSmall ) : 0
sourceComponent: Component { sourceComponent: Component {
Row { Row {
id: forwardedMessageInformationRow id: forwardedMessageInformationRow
@ -817,128 +841,12 @@ Page {
} }
} }
} }
Loader { Loader {
id: imagePreviewLoader id: extraContentLoader
active: false width: parent.width
asynchronous: true asynchronous: true
width: parent.width property int heightPreset: messageListItem.extraContentComponentName !== "" ? chatView.getContentComponentHeight(messageListItem.extraContentComponentName, display.content, width) : 0
height: messageListItem.containsImage ? (item ? item.height : (parent.width * 2 / 3)) : 0 height: item ? item.height : heightPreset
sourceComponent: Component {
id: imagePreviewComponent
ImagePreview {
id: messageImagePreview
photoData: messageListItem.containsImage ? display.content.photo : ""
width: parent.width
height: parent.width * 2 / 3
}
}
}
Loader
{
id: stickerPreviewLoader
active: false
asynchronous: true
x: messageListItem.isOwnMessage ? (parent.width - width) : 0
width: (appSettings.showStickersAsImages || !item) ? parent.width : item.width
height: messageListItem.containsSticker ? display.content.sticker.height : 0
sourceComponent: Component {
id: stickerPreviewComponent
StickerPreview {
id: messageStickerPreview
stickerData: messageListItem.containsSticker ? display.content.sticker : ""
}
}
}
Loader {
id: videoPreviewLoader
active: false
asynchronous: true
width: parent.width
height: messageListItem.containsVideo ? Functions.getVideoHeight(width, ( display.content['@type'] === "messageVideo" ) ? display.content.video : display.content.animation) : 0
sourceComponent: Component {
id: videoPreviewComponent
VideoPreview {
id: messageVideoPreview
videoData: ( display.content['@type'] === "messageVideo" ) ? display.content.video : ( ( display.content['@type'] === "messageAnimation" ) ? display.content.animation : "")
width: parent.width
height: Functions.getVideoHeight(width, ( display.content['@type'] === "messageVideo" ) ? display.content.video : display.content.animation)
onScreen: chatPage.status === PageStatus.Active
}
}
}
Loader {
id: audioPreviewLoader
active: false
asynchronous: true
width: parent.width
height: messageListItem.containsAudio ? (parent.width / 2) : 0
sourceComponent: Component {
id: audioPreviewComponent
AudioPreview {
id: messageAudioPreview
audioData: ( display.content['@type'] === "messageVoiceNote" ) ? display.content.voice_note : ( ( display.content['@type'] === "messageAudio" ) ? display.content.audio : "")
width: parent.width
height: parent.width / 2
onScreen: chatPage.status === PageStatus.Active
}
}
}
Loader {
id: documentPreviewLoader
active: false
asynchronous: true
width: parent.width
height: messageListItem.containsDocument ? (item ? item.height : Theme.itemSizeSmall) : 0
sourceComponent: Component {
id: documentPreviewComponent
DocumentPreview {
id: messageDocumentPreview
documentData: messageListItem.containsDocument ? display.content.document : ""
}
}
}
Loader {
id: locationPreviewLoader
active: false
asynchronous: true
width: parent.width
height: messageListItem.containsLocation ? (item ? item.height : (parent.width * 2 / 3)) : 0
sourceComponent: Component {
id: locationPreviewComponent
LocationPreview {
id: messageLocationPreview
width: parent.width
height: parent.width * 2 / 3
chatId: display.id
locationData: ( display.content['@type'] === "messageLocation" ) ? display.content.location : ( ( display.content['@type'] === "messageVenue" ) ? display.content.venue.location : "" )
}
}
}
Loader {
id: pollPreviewLoader
active: false
asynchronous: true
width: parent.width
// height: messageListItem.containsLocation ? (item ? item.height : (parent.width * 2 / 3)) : 0
sourceComponent: Component {
id: pollPreviewComponent
PollPreview {
id: messageLocationPreview
width: parent.width
chatId: chatInformation.id
isOwnMessage: messageListItem.isOwnMessage
message: display
messageItem: messageListItem
}
}
} }
Timer { Timer {
@ -951,24 +859,6 @@ Page {
} }
} }
Connections {
target: chatModel
onLastReadSentMessageUpdated: {
console.log("[ChatModel] Messages in this chat were read, new last read: " + lastReadSentIndex + ", updating description for index " + index + ", status: " + (index <= lastReadSentIndex));
messageDateText.text = getMessageStatusText(display, index, lastReadSentIndex);
}
onMessageUpdated: {
if (index === modelIndex) {
console.log("[ChatModel] This message was updated, index " + index + ", updating content...");
messageDateText.text = getMessageStatusText(display, index, chatView.lastReadSentIndex);
messageText.text = Emoji.emojify(Functions.getMessageText(display, false, messageListItem.isOwnMessage), messageText.font.pixelSize);
if(locationPreviewLoader.active && locationPreviewLoader.status === Loader.Ready) {
locationPreviewLoader.item.locationData = display.content.location;
locationPreviewLoader.item.updatePicture()
}
}
}
}
Text { Text {
width: parent.width width: parent.width
@ -1003,7 +893,7 @@ Page {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
opacity: chatPage.loading ? 1 : 0 opacity: chatPage.loading ? 1 : 0
Behavior on opacity { NumberAnimation {} } Behavior on opacity { FadeAnimation {} }
visible: chatPage.loading visible: chatPage.loading
InfoLabel { InfoLabel {
@ -1066,6 +956,7 @@ Page {
Column { Column {
id: newMessageColumn id: newMessageColumn
spacing: Theme.paddingSmall spacing: Theme.paddingSmall
width: parent.width - ( 2 * Theme.horizontalPageMargin ) width: parent.width - ( 2 * Theme.horizontalPageMargin )
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
visible: !chatPage.isChannel visible: !chatPage.isChannel
@ -1073,48 +964,6 @@ Page {
property string replyToMessageId: "0"; property string replyToMessageId: "0";
property string editMessageId: "0"; property string editMessageId: "0";
Component {
id: imagePickerPage
ImagePickerPage {
onSelectedContentPropertiesChanged: {
attachmentOptionsRow.visible = false;
console.log("Selected photo: " + selectedContentProperties.filePath );
attachmentPreviewRow.fileProperties = selectedContentProperties;
attachmentPreviewRow.isPicture = true;
attachmentPreviewRow.visible = true;
controlSendButton();
}
}
}
Component {
id: videoPickerPage
VideoPickerPage {
onSelectedContentPropertiesChanged: {
attachmentOptionsRow.visible = false;
console.log("Selected video: " + selectedContentProperties.filePath );
attachmentPreviewRow.fileProperties = selectedContentProperties;
attachmentPreviewRow.isVideo = true;
attachmentPreviewRow.visible = true;
controlSendButton();
}
}
}
Component {
id: documentPickerPage
DocumentPickerPage {
onSelectedContentPropertiesChanged: {
attachmentOptionsRow.visible = false;
console.log("Selected document: " + selectedContentProperties.filePath );
attachmentPreviewRow.fileProperties = selectedContentProperties;
attachmentPreviewRow.isDocument = true;
attachmentPreviewRow.visible = true;
controlSendButton();
}
}
}
InReplyToRow { InReplyToRow {
onInReplyToMessageChanged: { onInReplyToMessageChanged: {
if (inReplyToMessage) { if (inReplyToMessage) {
@ -1134,7 +983,6 @@ Page {
id: newMessageInReplyToRow id: newMessageInReplyToRow
myUserId: chatPage.myUserId myUserId: chatPage.myUserId
anchors.horizontalCenter: parent.horizontalCenter
visible: false visible: false
} }
@ -1149,21 +997,45 @@ Page {
id: imageAttachmentButton id: imageAttachmentButton
icon.source: "image://theme/icon-m-image" icon.source: "image://theme/icon-m-image"
onClicked: { onClicked: {
pageStack.push(imagePickerPage); var picker = pageStack.push("Sailfish.Pickers.ImagePickerPage");
picker.selectedContentPropertiesChanged.connect(function(){
attachmentOptionsRow.visible = false;
console.log("Selected document: " + picker.selectedContentProperties.filePath );
attachmentPreviewRow.fileProperties = picker.selectedContentProperties;
attachmentPreviewRow.isPicture = true;
attachmentPreviewRow.visible = true;
controlSendButton();
})
} }
} }
IconButton { IconButton {
id: videoAttachmentButton id: videoAttachmentButton
icon.source: "image://theme/icon-m-video" icon.source: "image://theme/icon-m-video"
onClicked: { onClicked: {
pageStack.push(videoPickerPage); var picker = pageStack.push("Sailfish.Pickers.VideoPickerPage");
picker.selectedContentPropertiesChanged.connect(function(){
attachmentOptionsRow.visible = false;
console.log("Selected video: " + picker.selectedContentProperties.filePath );
attachmentPreviewRow.fileProperties = picker.selectedContentProperties;
attachmentPreviewRow.isVideo = true;
attachmentPreviewRow.visible = true;
controlSendButton();
})
} }
} }
IconButton { IconButton {
id: documentAttachmentButton id: documentAttachmentButton
icon.source: "image://theme/icon-m-document" icon.source: "image://theme/icon-m-document"
onClicked: { onClicked: {
pageStack.push(documentPickerPage); var picker = pageStack.push("Sailfish.Pickers.DocumentPickerPage");
picker.selectedContentPropertiesChanged.connect(function(){
attachmentOptionsRow.visible = false;
console.log("Selected document: " + picker.selectedContentProperties.filePath );
attachmentPreviewRow.fileProperties = picker.selectedContentProperties;
attachmentPreviewRow.isDocument = true;
attachmentPreviewRow.visible = true;
controlSendButton();
})
} }
} }
@ -1180,7 +1052,7 @@ Page {
} }
} }
IconButton { IconButton {
visible: !chatPage.isPrivateChat && visible: !chatPage.isPrivateChat && chatGroupInformation &&
(chatGroupInformation.status["@type"] === "chatMemberStatusCreator" (chatGroupInformation.status["@type"] === "chatMemberStatusCreator"
|| chatGroupInformation.status["@type"] === "chatMemberStatusAdministrator" || chatGroupInformation.status["@type"] === "chatMemberStatusAdministrator"
|| (chatGroupInformation.status["@type"] === "chatMemberStatusMember" && chatInformation.permissions.can_send_polls)) || (chatGroupInformation.status["@type"] === "chatMemberStatusMember" && chatInformation.permissions.can_send_polls))
@ -1222,15 +1094,15 @@ Page {
sourceSize.height: height sourceSize.height: height
fillMode: Thumbnail.PreserveAspectCrop fillMode: Thumbnail.PreserveAspectCrop
mimeType: typeof attachmentPreviewRow.fileProperties !== "undefined" ? attachmentPreviewRow.fileProperties.mimeType : "" mimeType: typeof attachmentPreviewRow.fileProperties !== "undefined" ? attachmentPreviewRow.fileProperties.mimeType || "" : ""
source: typeof attachmentPreviewRow.fileProperties !== "undefined" ? attachmentPreviewRow.fileProperties.url : "" source: typeof attachmentPreviewRow.fileProperties !== "undefined" ? attachmentPreviewRow.fileProperties.url || "" : ""
visible: attachmentPreviewRow.isPicture || attachmentPreviewRow.isVideo visible: attachmentPreviewRow.isPicture || attachmentPreviewRow.isVideo
} }
Text { Text {
id: attachmentPreviewText id: attachmentPreviewText
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
text: typeof attachmentPreviewRow.fileProperties !== "undefined" ? attachmentPreviewRow.fileProperties.fileName : ""; text: typeof attachmentPreviewRow.fileProperties !== "undefined" ? attachmentPreviewRow.fileProperties.fileName || "" : "";
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
maximumLineCount: 1 maximumLineCount: 1
@ -1407,11 +1279,8 @@ Page {
newMessageTextField.focus = false; newMessageTextField.focus = false;
} }
} }
} }
} }
} }
} }

View file

@ -281,10 +281,6 @@
<source>edited</source> <source>edited</source>
<translation>bearbeitet</translation> <translation>bearbeitet</translation>
</message> </message>
<message>
<source>Deleting message</source>
<translation>Lösche Nachricht</translation>
</message>
<message> <message>
<source>Delete Message</source> <source>Delete Message</source>
<translation>Nachricht löschen</translation> <translation>Nachricht löschen</translation>
@ -301,6 +297,10 @@
<source>This chat is empty.</source> <source>This chat is empty.</source>
<translation>Dieser Chat ist leer.</translation> <translation>Dieser Chat ist leer.</translation>
</message> </message>
<message>
<source>Message deleted</source>
<translation>Nachricht gelöscht</translation>
</message>
</context> </context>
<context> <context>
<name>CoverPage</name> <name>CoverPage</name>

View file

@ -281,10 +281,6 @@
<source>edited</source> <source>edited</source>
<translation>editado</translation> <translation>editado</translation>
</message> </message>
<message>
<source>Deleting message</source>
<translation>Borrando mensaje</translation>
</message>
<message> <message>
<source>Delete Message</source> <source>Delete Message</source>
<translation>Borrar</translation> <translation>Borrar</translation>
@ -301,6 +297,10 @@
<source>This chat is empty.</source> <source>This chat is empty.</source>
<translation>Esta charla está vacía.</translation> <translation>Esta charla está vacía.</translation>
</message> </message>
<message>
<source>Message deleted</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CoverPage</name> <name>CoverPage</name>

View file

@ -281,10 +281,6 @@
<source>edited</source> <source>edited</source>
<translation>muokattu</translation> <translation>muokattu</translation>
</message> </message>
<message>
<source>Deleting message</source>
<translation>Poistetaan viestiä</translation>
</message>
<message> <message>
<source>Delete Message</source> <source>Delete Message</source>
<translation>Poista viesti</translation> <translation>Poista viesti</translation>
@ -301,6 +297,10 @@
<source>This chat is empty.</source> <source>This chat is empty.</source>
<translation>Tämä keskustelu on tyhjä.</translation> <translation>Tämä keskustelu on tyhjä.</translation>
</message> </message>
<message>
<source>Message deleted</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CoverPage</name> <name>CoverPage</name>

View file

@ -281,10 +281,6 @@
<source>edited</source> <source>edited</source>
<translation>Szerkesztett</translation> <translation>Szerkesztett</translation>
</message> </message>
<message>
<source>Deleting message</source>
<translation>Üzenet törlése</translation>
</message>
<message> <message>
<source>Delete Message</source> <source>Delete Message</source>
<translation>Üzenet törlése</translation> <translation>Üzenet törlése</translation>
@ -301,6 +297,10 @@
<source>This chat is empty.</source> <source>This chat is empty.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Message deleted</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CoverPage</name> <name>CoverPage</name>

View file

@ -277,10 +277,6 @@
<source>edited</source> <source>edited</source>
<translation>modificato</translation> <translation>modificato</translation>
</message> </message>
<message>
<source>Deleting message</source>
<translation>Cancellazione del messaggio</translation>
</message>
<message> <message>
<source>Delete Message</source> <source>Delete Message</source>
<translation>Cancella messaggio</translation> <translation>Cancella messaggio</translation>
@ -301,6 +297,10 @@
<source>Uploading...</source> <source>Uploading...</source>
<translation>Carica...</translation> <translation>Carica...</translation>
</message> </message>
<message>
<source>Message deleted</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CoverPage</name> <name>CoverPage</name>

View file

@ -281,10 +281,6 @@
<source>edited</source> <source>edited</source>
<translation>edytowana</translation> <translation>edytowana</translation>
</message> </message>
<message>
<source>Deleting message</source>
<translation>Usuwanie wiadomości</translation>
</message>
<message> <message>
<source>Delete Message</source> <source>Delete Message</source>
<translation>Usuń wiadomość</translation> <translation>Usuń wiadomość</translation>
@ -301,6 +297,10 @@
<source>This chat is empty.</source> <source>This chat is empty.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Message deleted</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CoverPage</name> <name>CoverPage</name>

View file

@ -281,10 +281,6 @@
<source>edited</source> <source>edited</source>
<translation>изменено</translation> <translation>изменено</translation>
</message> </message>
<message>
<source>Deleting message</source>
<translation>Удаление сообщения</translation>
</message>
<message> <message>
<source>Delete Message</source> <source>Delete Message</source>
<translation>Удалить</translation> <translation>Удалить</translation>
@ -301,6 +297,10 @@
<source>This chat is empty.</source> <source>This chat is empty.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Message deleted</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CoverPage</name> <name>CoverPage</name>

View file

@ -281,10 +281,6 @@
<source>edited</source> <source>edited</source>
<translation>redigerade</translation> <translation>redigerade</translation>
</message> </message>
<message>
<source>Deleting message</source>
<translation>Tar bort meddelande</translation>
</message>
<message> <message>
<source>Delete Message</source> <source>Delete Message</source>
<translation>Ta bort meddelandet</translation> <translation>Ta bort meddelandet</translation>
@ -301,6 +297,10 @@
<source>This chat is empty.</source> <source>This chat is empty.</source>
<translation>Denna chatt är tom.</translation> <translation>Denna chatt är tom.</translation>
</message> </message>
<message>
<source>Message deleted</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CoverPage</name> <name>CoverPage</name>

View file

@ -281,10 +281,6 @@
<source>edited</source> <source>edited</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>Deleting message</source>
<translation></translation>
</message>
<message> <message>
<source>Delete Message</source> <source>Delete Message</source>
<translation></translation> <translation></translation>
@ -301,6 +297,10 @@
<source>This chat is empty.</source> <source>This chat is empty.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Message deleted</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CoverPage</name> <name>CoverPage</name>

View file

@ -281,10 +281,6 @@
<source>edited</source> <source>edited</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Deleting message</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Delete Message</source> <source>Delete Message</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -301,6 +297,10 @@
<source>This chat is empty.</source> <source>This chat is empty.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Message deleted</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CoverPage</name> <name>CoverPage</name>