Warning, /rolisteam/rolisteam/src/libraries/qml_views/InstantMessaging/TextMessageDelegate.qml is written in an unsupported language. File is not indexed.

0001 import QtQuick
0002 import QtQuick.Controls
0003 import QtQuick.Layouts
0004 import Customization
0005 import org.rolisteam.InstantMessaging
0006 
0007 
0008 Column {
0009     id: root
0010     property string writerId : writerIdldr
0011     property string text: messageTextldr
0012     property bool local: localldr
0013     property string time: timeldr
0014     property string writerName: writerNameldr
0015     property real parentWidth: windowWidthldr
0016     property url imageLink: imageLinkldr
0017 
0018     property QtObject styleSheet: Theme.styleSheet("TextMessage")
0019     spacing: root.styleSheet.spacing
0020     signal linkClicked(string link)
0021     Row {
0022         id: messageRow
0023         spacing: root.styleSheet.textAvatarSpacing
0024         anchors.right: local ? parent.right : undefined
0025 
0026         Image {
0027             id: avatar
0028             source: "image://avatar/%1".arg(root.writerId)
0029             visible: !root.local
0030             fillMode: Image.PreserveAspectFit
0031             sourceSize.width:  root.styleSheet.imageSize
0032             sourceSize.height: root.styleSheet.imageSize
0033         }
0034 
0035         Rectangle {
0036             id: rect
0037             width: messageLyt.implicitWidth + root.styleSheet.textTopMargin
0038             height: messageLyt.implicitHeight + root.styleSheet.textTopMargin
0039             color: root.local ? root.styleSheet.localMsgColor : root.styleSheet.RemoteMsgColor
0040             radius: root.styleSheet.radiusSize
0041             ColumnLayout {
0042                 id: messageLyt
0043                 x: root.styleSheet.textTopMargin/2
0044                 y: root.styleSheet.textTopMargin/2
0045                 Label {
0046                     id: messageId
0047                     text: root.text
0048                     visible: root.text
0049                     font: Theme.imFont
0050                     Layout.preferredWidth: contentWidth > root.parentWidth ? (root.parentWidth - 10) : contentWidth
0051 
0052                     wrapMode: Text.WordWrap
0053                     onLinkActivated: InstantMessagerManager.ctrl.openLink(link)
0054                 }
0055                 Image {
0056                     id: imagePanel
0057                     fillMode: Image.PreserveAspectFit
0058                     source: root.imageLink
0059                     visible: root.imageLink
0060                     sourceSize.width: root.parentWidth*0.8
0061 
0062                     MouseArea {
0063                         anchors.fill: parent
0064                         onClicked: InstantMessagerManager.ctrl.openLink(root.imageLink)
0065                     }
0066                 }
0067             }
0068         }
0069     }
0070     Label {
0071         id: timestamp
0072         text: root.local ? root.time : "%1 - %2".arg(root.time).arg(root.writerName)
0073         anchors.right: root.local ? parent.right : undefined
0074         font.pixelSize: root.styleSheet.fontSizeTime * root.factor
0075         opacity: root.styleSheet.opacityTime
0076     }
0077 }