linphone-desktop/linphone-app/ui/modules/Linphone/Chat/ChatFilePreview.qml
Julien Wadel ce5ced320f WARNING: commit to be checked (backup)
Add sanitizer mode.
Fix crashes on QmlEngine.
New ProxyListModel to manage QAbstractListModel.
Fix uninitialized variables.
Replace parent Qt's managment into QSharedPointer for Qt Objects and keep shared_ptr for linphone objects.
Fix OpenH264 Linux URL for 32bits.
Differentiate Qt modelData from app $modelData.
2022-05-13 17:38:43 +02:00

86 lines
No EOL
2.1 KiB
QML

import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import Common 1.0
import Linphone 1.0
import Linphone.Styles 1.0
import Utils 1.0
import UtilsCpp 1.0
import Units 1.0
import 'Chat.js' as Logic
// =============================================================================
Item{
visible: mainListView.count > 0
Layout.preferredHeight: visible ? ChatFilePreviewStyle.height : 0
function addFile(path){
contents.addFile(path)
}
ScrollableListView{
id: mainListView
spacing: ChatFilePreviewStyle.filePreview.closeButton.iconSize
anchors.fill: parent
anchors.rightMargin: ChatStyle.rightButtonMargin + ChatStyle.rightButtonLMargin + ChatStyle.rightButtonSize
orientation: Qt.Horizontal
model: ContentProxyModel{
id: contents
}
header:Component{
Item{
width: ChatFilePreviewStyle.filePreview.closeButton.iconSize/2
height:mainListView.height
}
}
footer: Component{
Item{
width: ChatFilePreviewStyle.filePreview.closeButton.iconSize
height:mainListView.height
}
}
delegate:
FileView{
height:mainListView.height-ChatFilePreviewStyle.filePreview.heightMargins
width: height * ChatFilePreviewStyle.filePreview.format
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: 7
//anchors.horizontalCenter: parent.horizontalCenter
thumbnail: $modelData.thumbnail
name: $modelData.name
animationScale: 1.1
onClickOnFile: {
$modelData.openFile()
}
ActionButton{
anchors.bottom: parent.top
anchors.bottomMargin: -height/2
anchors.left: parent.right
anchors.leftMargin: -width/2
isCustom: true
backgroundRadius: width
colorSet: ChatFilePreviewStyle.filePreview.removeButton
z: parent.z+1
onClicked:{
contents.remove($modelData)
}
}
}
}
ActionButton{
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: ChatStyle.rightButtonMargin
isCustom: true
backgroundRadius: width
colorSet: ChatFilePreviewStyle.filePreview.closeButton
z: parent.z+1
onClicked:{
contents.clear()
}
}
}