set some properties readonly
This commit is contained in:
parent
c3ccaa069d
commit
68e2dab715
2 changed files with 26 additions and 27 deletions
|
@ -25,19 +25,19 @@ import QtQml.Models 2.3
|
||||||
ListItem {
|
ListItem {
|
||||||
id: messageListItem
|
id: messageListItem
|
||||||
contentHeight: messageBackground.height + Theme.paddingMedium
|
contentHeight: messageBackground.height + Theme.paddingMedium
|
||||||
property var myMessage: display
|
readonly property var myMessage: display
|
||||||
property var userInformation: tdLibWrapper.getUserInformation(myMessage.sender_user_id)
|
readonly property var userInformation: tdLibWrapper.getUserInformation(myMessage.sender_user_id)
|
||||||
property QtObject precalculatedValues: ListView.view.precalculatedValues
|
property QtObject precalculatedValues: ListView.view.precalculatedValues
|
||||||
property color textColor: isOwnMessage ? Theme.highlightColor : Theme.primaryColor
|
readonly property color textColor: isOwnMessage ? Theme.highlightColor : Theme.primaryColor
|
||||||
property int textAlign: isOwnMessage ? Text.AlignRight : Text.AlignLeft
|
readonly property int textAlign: isOwnMessage ? Text.AlignRight : Text.AlignLeft
|
||||||
property Page page: precalculatedValues.page
|
readonly property Page page: precalculatedValues.page
|
||||||
|
|
||||||
property bool isOwnMessage: page.myUserId === myMessage.sender_user_id
|
readonly property bool isOwnMessage: page.myUserId === myMessage.sender_user_id
|
||||||
property string extraContentComponentName: typeof myMessage.content !== "undefined"
|
readonly property string extraContentComponentName: typeof myMessage.content !== "undefined"
|
||||||
&& typeof chatView.contentComponentNames[myMessage.content['@type']] !== "undefined" ?
|
&& typeof chatView.contentComponentNames[myMessage.content['@type']] !== "undefined" ?
|
||||||
chatView.contentComponentNames[myMessage.content['@type']] : ""
|
chatView.contentComponentNames[myMessage.content['@type']] : ""
|
||||||
|
|
||||||
property ObjectModel additionalContextItems: ObjectModel {}
|
readonly property ObjectModel additionalContextItems: ObjectModel {}
|
||||||
|
|
||||||
onPressAndHold: {
|
onPressAndHold: {
|
||||||
contextMenuLoader.active = true;
|
contextMenuLoader.active = true;
|
||||||
|
|
|
@ -32,7 +32,7 @@ Page {
|
||||||
|
|
||||||
property bool loading: true;
|
property bool loading: true;
|
||||||
property bool isInitialized: false;
|
property bool isInitialized: false;
|
||||||
property int myUserId: tdLibWrapper.getUserInformation().id;
|
readonly property int myUserId: tdLibWrapper.getUserInformation().id;
|
||||||
property var chatInformation;
|
property var chatInformation;
|
||||||
property bool isPrivateChat: false;
|
property bool isPrivateChat: false;
|
||||||
property bool isBasicGroup: false;
|
property bool isBasicGroup: false;
|
||||||
|
@ -42,7 +42,7 @@ Page {
|
||||||
property var chatGroupInformation;
|
property var chatGroupInformation;
|
||||||
property int chatOnlineMemberCount: 0;
|
property int chatOnlineMemberCount: 0;
|
||||||
property var emojiProposals;
|
property var emojiProposals;
|
||||||
property bool userIsMember: (isPrivateChat && chatInformation["@type"]) || // should be optimized
|
readonly property bool userIsMember: (isPrivateChat && chatInformation["@type"]) || // should be optimized
|
||||||
(isBasicGroup || isSuperGroup) && (
|
(isBasicGroup || isSuperGroup) && (
|
||||||
(chatGroupInformation.status["@type"] === "chatMemberStatusMember")
|
(chatGroupInformation.status["@type"] === "chatMemberStatusMember")
|
||||||
|| (chatGroupInformation.status["@type"] === "chatMemberStatusAdministrator")
|
|| (chatGroupInformation.status["@type"] === "chatMemberStatusAdministrator")
|
||||||
|
@ -82,11 +82,11 @@ Page {
|
||||||
chatPartnerInformation = tdLibWrapper.getUserInformation(chatInformation.type.user_id);
|
chatPartnerInformation = tdLibWrapper.getUserInformation(chatInformation.type.user_id);
|
||||||
updateChatPartnerStatusText();
|
updateChatPartnerStatusText();
|
||||||
}
|
}
|
||||||
if (isBasicGroup) {
|
else if (isBasicGroup) {
|
||||||
chatGroupInformation = tdLibWrapper.getBasicGroup(chatInformation.type.basic_group_id);
|
chatGroupInformation = tdLibWrapper.getBasicGroup(chatInformation.type.basic_group_id);
|
||||||
updateGroupStatusText();
|
updateGroupStatusText();
|
||||||
}
|
}
|
||||||
if (isSuperGroup) {
|
else if (isSuperGroup) {
|
||||||
chatGroupInformation = tdLibWrapper.getSuperGroup(chatInformation.type.supergroup_id);
|
chatGroupInformation = tdLibWrapper.getSuperGroup(chatInformation.type.supergroup_id);
|
||||||
isChannel = chatGroupInformation.is_channel;
|
isChannel = chatGroupInformation.is_channel;
|
||||||
updateGroupStatusText();
|
updateGroupStatusText();
|
||||||
|
@ -232,7 +232,6 @@ Page {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
|
@ -535,18 +534,18 @@ Page {
|
||||||
property bool inCooldown: false
|
property bool inCooldown: false
|
||||||
property bool manuallyScrolledToBottom
|
property bool manuallyScrolledToBottom
|
||||||
property QtObject precalculatedValues: QtObject {
|
property QtObject precalculatedValues: QtObject {
|
||||||
property alias page: chatPage
|
readonly property alias page: chatPage
|
||||||
property bool showUserInfo: page.isBasicGroup || ( page.isSuperGroup && !page.isChannel)
|
readonly property bool showUserInfo: page.isBasicGroup || ( page.isSuperGroup && !page.isChannel)
|
||||||
property int profileThumbnailDimensions: showUserInfo ? Theme.itemSizeSmall : 0
|
readonly property int profileThumbnailDimensions: showUserInfo ? Theme.itemSizeSmall : 0
|
||||||
property int pageMarginDouble: 2 * Theme.horizontalPageMargin
|
readonly property int pageMarginDouble: 2 * Theme.horizontalPageMargin
|
||||||
property int paddingMediumDouble: 2 * Theme.paddingMedium
|
readonly property int paddingMediumDouble: 2 * Theme.paddingMedium
|
||||||
property int entryWidth: chatView.width - pageMarginDouble
|
readonly property int entryWidth: chatView.width - pageMarginDouble
|
||||||
property int textItemWidth: entryWidth - profileThumbnailDimensions - Theme.paddingSmall
|
readonly property int textItemWidth: entryWidth - profileThumbnailDimensions - Theme.paddingSmall
|
||||||
property int backgroundWidth: textItemWidth - pageMarginDouble
|
readonly property int backgroundWidth: textItemWidth - pageMarginDouble
|
||||||
property int backgroundRadius: textItemWidth/50
|
readonly property int backgroundRadius: textItemWidth/50
|
||||||
property int textColumnWidth: backgroundWidth - Theme.horizontalPageMargin
|
readonly property int textColumnWidth: backgroundWidth - Theme.horizontalPageMargin
|
||||||
property int messageInReplyToHeight: Theme.fontSizeExtraSmall * 2.571428571 + Theme.paddingSmall;
|
readonly property int messageInReplyToHeight: Theme.fontSizeExtraSmall * 2.571428571 + Theme.paddingSmall;
|
||||||
property int webPagePreviewHeight: ( (textColumnWidth * 2 / 3) + (6 * Theme.fontSizeExtraSmall) + ( 7 * Theme.paddingSmall) )
|
readonly property int webPagePreviewHeight: ( (textColumnWidth * 2 / 3) + (6 * Theme.fontSizeExtraSmall) + ( 7 * Theme.paddingSmall) )
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleScrollPositionChanged() {
|
function handleScrollPositionChanged() {
|
||||||
|
@ -593,7 +592,7 @@ Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
model: chatModel
|
model: chatModel
|
||||||
property var contentComponentNames: ({
|
readonly property var contentComponentNames: ({
|
||||||
messageSticker: "StickerPreview",
|
messageSticker: "StickerPreview",
|
||||||
messagePhoto: "ImagePreview",
|
messagePhoto: "ImagePreview",
|
||||||
messageVideo: "VideoPreview",
|
messageVideo: "VideoPreview",
|
||||||
|
@ -622,7 +621,7 @@ Page {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
delegate: Loader {
|
||||||
width: chatView.width
|
width: chatView.width
|
||||||
Component {
|
Component {
|
||||||
|
|
Loading…
Reference in a new issue