mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
157 lines
5.3 KiB
QML
157 lines
5.3 KiB
QML
import QtQuick
|
|
import QtQuick.Effects
|
|
import QtQuick.Layouts
|
|
import QtQuick.Controls.Basic as Control
|
|
import QtMultimedia
|
|
|
|
import Linphone
|
|
import UtilsCpp
|
|
import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils
|
|
|
|
// =============================================================================
|
|
// Simple content display without reply and forward. These modules need to be splitted because of cyclic dependencies.
|
|
// See ChatFullContent
|
|
|
|
ColumnLayout {
|
|
id: mainItem
|
|
property ChatMessageGui chatMessageGui: null
|
|
property bool isRemoteMessage: chatMessageGui? chatMessageGui.core.isRemoteMessage : false
|
|
property ChatGui chatGui: null
|
|
|
|
signal isFileHoveringChanged(bool isFileHovering)
|
|
signal lastSelectedTextChanged(string selectedText)
|
|
// signal conferenceIcsCopied()
|
|
signal mouseEvent(MouseEvent event)
|
|
signal endOfVoiceRecordingReached()
|
|
signal requestAutoPlayVoiceRecording()
|
|
property string selectedText
|
|
|
|
property color textColor
|
|
property string searchedTextPart
|
|
|
|
property int fileBorderWidth : 0
|
|
|
|
spacing: Utils.getSizeWithScreenRatio(5)
|
|
property int padding: Utils.getSizeWithScreenRatio(10)
|
|
|
|
property ChatMessageContentProxy filescontentProxy: ChatMessageContentProxy {
|
|
filterType: ChatMessageContentProxy.FilterContentType.File
|
|
chatMessageGui: mainItem.chatMessageGui
|
|
}
|
|
|
|
// VOICE MESSAGES
|
|
Repeater {
|
|
id: messagesVoicesList
|
|
visible: count > 0
|
|
model: ChatMessageContentProxy {
|
|
filterType: ChatMessageContentProxy.FilterContentType.Voice
|
|
chatMessageGui: mainItem.chatMessageGui
|
|
}
|
|
delegate: ChatAudioContent {
|
|
id: audioContent
|
|
// Layout.fillWidth: true
|
|
width: Utils.getSizeWithScreenRatio(269)
|
|
height: Utils.getSizeWithScreenRatio(48)
|
|
Layout.preferredHeight: height
|
|
chatMessageContentGui: modelData
|
|
onEndOfFileReached: mainItem.endOfVoiceRecordingReached()
|
|
Connections {
|
|
target: mainItem
|
|
function onRequestAutoPlayVoiceRecording() {
|
|
audioContent.requestPlaying()
|
|
}
|
|
}
|
|
// width: conferenceList.width
|
|
// onMouseEvent: (event) => mainItem.mouseEvent(event)
|
|
}
|
|
}
|
|
// CONFERENCE
|
|
Repeater {
|
|
id: conferenceList
|
|
visible: count > 0
|
|
model: ChatMessageContentProxy{
|
|
filterType: ChatMessageContentProxy.FilterContentType.Conference
|
|
chatMessageGui: mainItem.chatMessageGui
|
|
}
|
|
delegate: ChatMessageInvitationBubble {
|
|
Layout.preferredWidth: Utils.getSizeWithScreenRatio(490)
|
|
conferenceInfoGui: modelData.core.conferenceInfo
|
|
onMouseEvent: (event) => mainItem.mouseEvent(event)
|
|
}
|
|
}
|
|
// SINGLE FILE
|
|
ImageFileView {
|
|
id: singleImageFile
|
|
visible: mainItem.filescontentProxy.count === 1 && source !== "" && UtilsCpp.isImage(contentGui.core.filePath)
|
|
contentGui: mainItem.filescontentProxy.count === 1
|
|
? mainItem.filescontentProxy.getChatMessageContentAtIndex(0)
|
|
: null
|
|
width: Utils.getSizeWithScreenRatio(285)
|
|
Layout.alignment: Qt.AlignHCenter
|
|
fillMode: Image.PreserveAspectFit
|
|
}
|
|
AnimatedImageFileView {
|
|
id: singleAnimatedImageFile
|
|
visible: mainItem.filescontentProxy.count === 1 && source !== "" && UtilsCpp.isAnimatedImage(contentGui.core.filePath)
|
|
contentGui: mainItem.filescontentProxy.count === 1
|
|
? mainItem.filescontentProxy.getChatMessageContentAtIndex(0)
|
|
: null
|
|
Layout.preferredWidth: Utils.getSizeWithScreenRatio(285)
|
|
Layout.preferredHeight: paintedHeight
|
|
Layout.alignment: Qt.AlignHCenter
|
|
fillMode: Image.PreserveAspectFit
|
|
}
|
|
VideoFileView {
|
|
id: singleVideoFile
|
|
visible: mainItem.filescontentProxy.count === 1 && UtilsCpp.isVideo(contentGui.core.filePath)
|
|
contentGui: mainItem.filescontentProxy.count === 1
|
|
? mainItem.filescontentProxy.getChatMessageContentAtIndex(0)
|
|
: null
|
|
width: Utils.getSizeWithScreenRatio(285)
|
|
height: Utils.getSizeWithScreenRatio(285)
|
|
Layout.preferredWidth: videoOutput.contentRect.width
|
|
Layout.preferredHeight: videoOutput.contentRect.height
|
|
Layout.alignment: Qt.AlignHCenter
|
|
fillMode: VideoOutput.PreserveAspectFit
|
|
}
|
|
|
|
// FILES
|
|
ChatFilesGridLayout {
|
|
id: messageFilesList
|
|
visible: mainItem.filescontentProxy.count > 0
|
|
&& !singleImageFile.visible
|
|
&& !singleAnimatedImageFile.visible
|
|
&& !singleVideoFile.visible
|
|
Layout.fillWidth: visible
|
|
Layout.fillHeight: visible
|
|
maxWidth: Utils.getSizeWithScreenRatio(115*3)
|
|
// Layout.fillHeight: true
|
|
proxyModel: visible ? mainItem.filescontentProxy : null
|
|
// onIsHoveringFileChanged: mainItem.isFileHoveringChanged(isHoveringFile)
|
|
// borderWidth: mainItem.fileBorderWidth
|
|
// property int availableSection: mainItem.availableWidth / mainItem.filesBestWidth
|
|
// property int bestFitSection: mainItem.bestWidth / mainItem.filesBestWidth
|
|
// columns: Math.max(1, Math.min(availableSection , bestFitSection))
|
|
// columnSpacing: 0
|
|
// rowSpacing: ChatStyle.entry.message.file.spacing
|
|
}
|
|
// TEXTS
|
|
Repeater {
|
|
id: messagesTextsList
|
|
visible: count > 0
|
|
model: ChatMessageContentProxy {
|
|
filterType: ChatMessageContentProxy.FilterContentType.Text
|
|
chatMessageGui: mainItem.chatMessageGui
|
|
}
|
|
delegate: ChatTextContent {
|
|
Layout.fillWidth: true
|
|
horizontalAlignment: mainItem.isRemoteMessage || implicitWidth > mainItem.width ? TextEdit.AlignLeft : TextEdit.AlignRight
|
|
// height: implicitHeight
|
|
contentGui: modelData
|
|
chatGui: mainItem.chatGui
|
|
searchedTextPart: mainItem.searchedTextPart
|
|
onLastTextSelectedChanged: mainItem.selectedText = selectedText
|
|
// onRightClicked: mainItem.rightClicked()
|
|
}
|
|
}
|
|
}
|