Remorse.itemAction; content Loader height preset
This commit is contained in:
parent
1fa7192728
commit
fb5cf0d382
12 changed files with 67 additions and 49 deletions
|
@ -28,10 +28,6 @@ ApplicationWindow
|
|||
cover: Qt.resolvedUrl("pages/CoverPage.qml")
|
||||
allowedOrientations: defaultAllowedOrientations
|
||||
|
||||
RemorseItem {
|
||||
id: deleteMessageRemorseItem
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: dBusAdaptor
|
||||
onPleaseOpenMessage: {
|
||||
|
|
|
@ -517,6 +517,23 @@ Page {
|
|||
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
|
||||
contentHeight: messageBackground.height + Theme.paddingMedium
|
||||
|
@ -527,7 +544,9 @@ Page {
|
|||
property Page page: chatPage
|
||||
|
||||
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 {
|
||||
MenuItem {
|
||||
onClicked: {
|
||||
|
@ -546,9 +565,10 @@ Page {
|
|||
visible: display.can_be_edited
|
||||
}
|
||||
MenuItem {
|
||||
enabled: !deleteMessageRemorseItem.pending
|
||||
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")
|
||||
visible: display.can_be_deleted_for_all_users || (display.can_be_deleted_only_for_self && display.chat_id === chatPage.myUserId)
|
||||
|
@ -604,9 +624,9 @@ Page {
|
|||
running: false
|
||||
onTriggered: {
|
||||
if (typeof display.content !== "undefined") {
|
||||
if(chatView.contentComponentNames.hasOwnProperty(display.content['@type'])) {
|
||||
if(messageListItem.extraContentComponentName !== "") {
|
||||
extraContentLoader.setSource(
|
||||
"../components/" +chatView.contentComponentNames[display.content['@type']] +".qml",
|
||||
"../components/" +messageListItem.extraContentComponentName +".qml",
|
||||
{
|
||||
messageListItem: messageListItem
|
||||
})
|
||||
|
@ -825,6 +845,8 @@ Page {
|
|||
id: extraContentLoader
|
||||
width: parent.width
|
||||
asynchronous: true
|
||||
property int heightPreset: messageListItem.extraContentComponentName !== "" ? chatView.getContentComponentHeight(messageListItem.extraContentComponentName, display.content, width) : 0
|
||||
height: item ? item.height : heightPreset
|
||||
}
|
||||
|
||||
Timer {
|
||||
|
|
|
@ -281,10 +281,6 @@
|
|||
<source>edited</source>
|
||||
<translation>bearbeitet</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Deleting message</source>
|
||||
<translation>Lösche Nachricht</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Delete Message</source>
|
||||
<translation>Nachricht löschen</translation>
|
||||
|
@ -301,6 +297,10 @@
|
|||
<source>This chat is empty.</source>
|
||||
<translation>Dieser Chat ist leer.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Message deleted</source>
|
||||
<translation>Nachricht gelöscht</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CoverPage</name>
|
||||
|
|
|
@ -281,10 +281,6 @@
|
|||
<source>edited</source>
|
||||
<translation>editado</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Deleting message</source>
|
||||
<translation>Borrando mensaje</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Delete Message</source>
|
||||
<translation>Borrar</translation>
|
||||
|
@ -301,6 +297,10 @@
|
|||
<source>This chat is empty.</source>
|
||||
<translation>Esta charla está vacía.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Message deleted</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CoverPage</name>
|
||||
|
|
|
@ -281,10 +281,6 @@
|
|||
<source>edited</source>
|
||||
<translation>muokattu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Deleting message</source>
|
||||
<translation>Poistetaan viestiä</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Delete Message</source>
|
||||
<translation>Poista viesti</translation>
|
||||
|
@ -301,6 +297,10 @@
|
|||
<source>This chat is empty.</source>
|
||||
<translation>Tämä keskustelu on tyhjä.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Message deleted</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CoverPage</name>
|
||||
|
|
|
@ -281,10 +281,6 @@
|
|||
<source>edited</source>
|
||||
<translation>Szerkesztett</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Deleting message</source>
|
||||
<translation>Üzenet törlése</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Delete Message</source>
|
||||
<translation>Üzenet törlése</translation>
|
||||
|
@ -301,6 +297,10 @@
|
|||
<source>This chat is empty.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Message deleted</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CoverPage</name>
|
||||
|
|
|
@ -277,10 +277,6 @@
|
|||
<source>edited</source>
|
||||
<translation>modificato</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Deleting message</source>
|
||||
<translation>Cancellazione del messaggio</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Delete Message</source>
|
||||
<translation>Cancella messaggio</translation>
|
||||
|
@ -301,6 +297,10 @@
|
|||
<source>Uploading...</source>
|
||||
<translation>Carica...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Message deleted</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CoverPage</name>
|
||||
|
|
|
@ -281,10 +281,6 @@
|
|||
<source>edited</source>
|
||||
<translation>edytowana</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Deleting message</source>
|
||||
<translation>Usuwanie wiadomości</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Delete Message</source>
|
||||
<translation>Usuń wiadomość</translation>
|
||||
|
@ -301,6 +297,10 @@
|
|||
<source>This chat is empty.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Message deleted</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CoverPage</name>
|
||||
|
|
|
@ -281,10 +281,6 @@
|
|||
<source>edited</source>
|
||||
<translation>изменено</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Deleting message</source>
|
||||
<translation>Удаление сообщения</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Delete Message</source>
|
||||
<translation>Удалить</translation>
|
||||
|
@ -301,6 +297,10 @@
|
|||
<source>This chat is empty.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Message deleted</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CoverPage</name>
|
||||
|
|
|
@ -281,10 +281,6 @@
|
|||
<source>edited</source>
|
||||
<translation>redigerade</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Deleting message</source>
|
||||
<translation>Tar bort meddelande</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Delete Message</source>
|
||||
<translation>Ta bort meddelandet</translation>
|
||||
|
@ -301,6 +297,10 @@
|
|||
<source>This chat is empty.</source>
|
||||
<translation>Denna chatt är tom.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Message deleted</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CoverPage</name>
|
||||
|
|
|
@ -281,10 +281,6 @@
|
|||
<source>edited</source>
|
||||
<translation>已编辑</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Deleting message</source>
|
||||
<translation>正在删除消息</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Delete Message</source>
|
||||
<translation>删除消息</translation>
|
||||
|
@ -301,6 +297,10 @@
|
|||
<source>This chat is empty.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Message deleted</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CoverPage</name>
|
||||
|
|
|
@ -281,10 +281,6 @@
|
|||
<source>edited</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Deleting message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Delete Message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -301,6 +297,10 @@
|
|||
<source>This chat is empty.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Message deleted</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CoverPage</name>
|
||||
|
|
Loading…
Reference in a new issue