feat: adds emoji contentType support
This commit is contained in:
parent
7440b5beb1
commit
2af0b0bc6a
|
@ -22,8 +22,9 @@ Item {
|
||||||
property string authorCurrentMsg: "authorCurrentMsg"
|
property string authorCurrentMsg: "authorCurrentMsg"
|
||||||
property string authorPrevMsg: "authorPrevMsg"
|
property string authorPrevMsg: "authorPrevMsg"
|
||||||
|
|
||||||
property bool isMessage: contentType == Constants.messageType || contentType == Constants.stickerType || contentType == Constants.emojiType
|
property bool isEmoji: contentType === Constants.emojiType
|
||||||
property bool isStatusMessage: contentType == Constants.systemMessagePrivateGroupType
|
property bool isMessage: contentType === Constants.messageType || contentType === Constants.stickerType
|
||||||
|
property bool isStatusMessage: contentType === Constants.systemMessagePrivateGroupType
|
||||||
|
|
||||||
property var profileClick: function () {}
|
property var profileClick: function () {}
|
||||||
|
|
||||||
|
@ -185,7 +186,7 @@ Item {
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
source: identicon
|
source: identicon
|
||||||
visible: isMessage && authorCurrentMsg != authorPrevMsg && !isCurrentUser
|
visible: (isMessage || isEmoji) && authorCurrentMsg != authorPrevMsg && !isCurrentUser
|
||||||
mipmap: true
|
mipmap: true
|
||||||
smooth: false
|
smooth: false
|
||||||
antialiasing: true
|
antialiasing: true
|
||||||
|
@ -211,7 +212,7 @@ Item {
|
||||||
readOnly: true
|
readOnly: true
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
visible: isMessage && authorCurrentMsg != authorPrevMsg && !isCurrentUser
|
visible: (isMessage || isEmoji) && authorCurrentMsg != authorPrevMsg && !isCurrentUser
|
||||||
MouseArea {
|
MouseArea {
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -229,7 +230,7 @@ Item {
|
||||||
height: (2 * chatVerticalPadding) + (contentType == Constants.stickerType ? stickerId.height : chatText.height)
|
height: (2 * chatVerticalPadding) + (contentType == Constants.stickerType ? stickerId.height : chatText.height)
|
||||||
color: isCurrentUser ? Theme.blue : Theme.lightBlue
|
color: isCurrentUser ? Theme.blue : Theme.lightBlue
|
||||||
border.color: Theme.transparent
|
border.color: Theme.transparent
|
||||||
width: contentType == Constants.stickerType ? (stickerId.width + (2 * chatHorizontalPadding)) : (message.length > 52 ? 380 : chatText.width + 2 * chatHorizontalPadding)
|
width: contentType === Constants.stickerType ? (stickerId.width + (2 * chatHorizontalPadding)) : (message.length > 52 ? 380 : chatText.width + 2 * chatHorizontalPadding)
|
||||||
radius: 16
|
radius: 16
|
||||||
anchors.left: !isCurrentUser ? chatImage.right : undefined
|
anchors.left: !isCurrentUser ? chatImage.right : undefined
|
||||||
anchors.leftMargin: !isCurrentUser ? 8 : 0
|
anchors.leftMargin: !isCurrentUser ? 8 : 0
|
||||||
|
@ -237,7 +238,7 @@ Item {
|
||||||
anchors.rightMargin: !isCurrentUser ? 0 : Theme.padding
|
anchors.rightMargin: !isCurrentUser ? 0 : Theme.padding
|
||||||
anchors.top: authorCurrentMsg != authorPrevMsg && !isCurrentUser ? chatImage.top : parent.top
|
anchors.top: authorCurrentMsg != authorPrevMsg && !isCurrentUser ? chatImage.top : parent.top
|
||||||
anchors.topMargin: 0
|
anchors.topMargin: 0
|
||||||
visible: isMessage
|
visible: isMessage || isEmoji
|
||||||
|
|
||||||
// Thi`s rectangle's only job is to mask the corner to make it less rounded... yep
|
// Thi`s rectangle's only job is to mask the corner to make it less rounded... yep
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -266,11 +267,12 @@ Item {
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.topMargin: chatBox.chatVerticalPadding
|
anchors.topMargin: chatBox.chatVerticalPadding
|
||||||
font.pixelSize: 15
|
font.pixelSize: isEmoji ? 40 : 15
|
||||||
readOnly: true
|
readOnly: true
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
color: !isCurrentUser ? Theme.black : Theme.white
|
color: !isCurrentUser ? Theme.black : Theme.white
|
||||||
visible: contentType == Constants.messageType
|
visible: contentType == Constants.messageType || isEmoji
|
||||||
|
textFormat: TextEdit.RichText
|
||||||
onLinkActivated: Qt.openUrlExternally(link)
|
onLinkActivated: Qt.openUrlExternally(link)
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -288,15 +290,15 @@ Item {
|
||||||
anchors.topMargin: chatBox.chatVerticalPadding
|
anchors.topMargin: chatBox.chatVerticalPadding
|
||||||
width: 140
|
width: 140
|
||||||
height: 140
|
height: 140
|
||||||
source: contentType == Constants.stickerType ? ("https://ipfs.infura.io/ipfs/" + sticker) : ""
|
source: contentType === Constants.stickerType ? ("https://ipfs.infura.io/ipfs/" + sticker) : ""
|
||||||
visible: contentType == Constants.stickerType
|
visible: contentType === Constants.stickerType
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledTextEdit {
|
StyledTextEdit {
|
||||||
id: chatTime
|
id: chatTime
|
||||||
color: Theme.darkGrey
|
color: Theme.darkGrey
|
||||||
text: timestamp
|
text: timestamp
|
||||||
anchors.top: contentType == Constants.stickerType ? stickerId.bottom : chatText.bottom
|
anchors.top: contentType === Constants.stickerType ? stickerId.bottom : chatText.bottom
|
||||||
anchors.bottomMargin: Theme.padding
|
anchors.bottomMargin: Theme.padding
|
||||||
anchors.right: !isCurrentUser ? parent.right : undefined
|
anchors.right: !isCurrentUser ? parent.right : undefined
|
||||||
anchors.rightMargin: !isCurrentUser ? Theme.padding : 0
|
anchors.rightMargin: !isCurrentUser ? Theme.padding : 0
|
||||||
|
|
Binary file not shown.
|
@ -7,6 +7,7 @@ QtObject {
|
||||||
property QtObject fontBold: FontLoader { id: _fontBold; source: "../fonts/InterStatus/InterStatus-Bold.otf"; }
|
property QtObject fontBold: FontLoader { id: _fontBold; source: "../fonts/InterStatus/InterStatus-Bold.otf"; }
|
||||||
property QtObject fontLight: FontLoader { id: _fontLight; source: "../fonts/InterStatus/InterStatus-Light.otf"; }
|
property QtObject fontLight: FontLoader { id: _fontLight; source: "../fonts/InterStatus/InterStatus-Light.otf"; }
|
||||||
property QtObject fontRegular: FontLoader { id: _fontRegular; source: "../fonts/InterStatus/InterStatus-Regular.otf"; }
|
property QtObject fontRegular: FontLoader { id: _fontRegular; source: "../fonts/InterStatus/InterStatus-Regular.otf"; }
|
||||||
|
property QtObject fontEmoji: FontLoader { id: _fontEmoji; source: "../fonts/TwitterEmoji.ttf"; }
|
||||||
|
|
||||||
readonly property color white: "#FFFFFF"
|
readonly property color white: "#FFFFFF"
|
||||||
readonly property color white2: "#FCFCFC"
|
readonly property color white2: "#FCFCFC"
|
||||||
|
|
|
@ -2,5 +2,5 @@ import QtQuick 2.13
|
||||||
import "../imports"
|
import "../imports"
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
font.family: Theme.fontRegular.name
|
font.family: Theme.fontEmoji.name + "," + Theme.fontRegular.name
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,5 +2,5 @@ import QtQuick 2.13
|
||||||
import "../imports"
|
import "../imports"
|
||||||
|
|
||||||
TextEdit {
|
TextEdit {
|
||||||
font.family: Theme.fontRegular.name
|
font.family: Theme.fontEmoji.name + "," + Theme.fontRegular.name
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,5 +3,5 @@ import QtQuick.Controls 2.13
|
||||||
import "../imports"
|
import "../imports"
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
font.family: Theme.fontRegular.name
|
font.family: Theme.fontEmoji.name + "," + Theme.fontRegular.name
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue