linphone-desktop/Linphone/view/Control/Popup/Notification/NotificationReceivedMessage.qml
Gaelle Braud 9b67794752 imdn on each chat message
imdn on chat last message

change message notification ui

press enter to send message
2025-05-13 12:39:30 +02:00

129 lines
3.8 KiB
QML

import QtQuick
import QtQuick.Layouts
import Linphone
import UtilsCpp
import QtQuick.Controls as Control
import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle
// =============================================================================
Notification {
id: mainItem
radius: Math.round(10 * DefaultStyle.dp)
backgroundColor: DefaultStyle.grey_600
backgroundOpacity: 0.8
overriddenWidth: Math.round(400 * DefaultStyle.dp)
overriddenHeight: content.height
property string avatarUri: notificationData ? notificationData.avatarUri : ""
property string chatRoomName: notificationData ? notificationData.chatRoomName : ""
property string remoteAddress: notificationData ? notificationData.remoteAddress : ""
property string message: notificationData ? notificationData.message : ""
Popup {
id: content
visible: mainItem.visible
width: parent.width
leftPadding: Math.round(18 * DefaultStyle.dp)
rightPadding: Math.round(18 * DefaultStyle.dp)
topPadding: Math.round(32 * DefaultStyle.dp)
bottomPadding: Math.round(18 * DefaultStyle.dp)
background: Item {
anchors.fill: parent
RowLayout {
anchors.top: parent.top
anchors.topMargin: Math.round(9 * DefaultStyle.dp)
anchors.horizontalCenter: parent.horizontalCenter
spacing: Math.round(4 * DefaultStyle.dp)
Image {
Layout.preferredWidth: Math.round(12 * DefaultStyle.dp)
Layout.preferredHeight: Math.round(12 * DefaultStyle.dp)
source: AppIcons.logo
}
Text {
text: "Linphone"
color: DefaultStyle.grey_0
font {
pixelSize: Math.round(12 * DefaultStyle.dp)
weight: Typography.b3.weight
capitalization: Font.Capitalize
}
}
}
Button {
anchors.top: parent.top
anchors.right: parent.right
anchors.topMargin: Math.round(9 * DefaultStyle.dp)
anchors.rightMargin: Math.round(12 * DefaultStyle.dp)
padding: 0
z: mousearea.z + 1
background: Item{anchors.fill: parent}
icon.source: AppIcons.closeX
width: Math.round(14 * DefaultStyle.dp)
height: Math.round(14 * DefaultStyle.dp)
icon.width: Math.round(14 * DefaultStyle.dp)
icon.height: Math.round(14 * DefaultStyle.dp)
contentImageColor: DefaultStyle.grey_0
onPressed: {
mainItem._close()
}
}
MouseArea {
id: mousearea
anchors.fill: parent
onClicked: {
console.log("notif clicked, open chat")
}
}
}
contentItem: ColumnLayout {
spacing: Math.round(9 * DefaultStyle.dp)
RowLayout {
spacing: Math.round(14 * DefaultStyle.dp)
Avatar {
Layout.preferredWidth: Math.round(60 * DefaultStyle.dp)
Layout.preferredHeight: Math.round(60 * DefaultStyle.dp)
// Layout.alignment: Qt.AlignHCenter
property var contactObj: UtilsCpp.findFriendByAddress(mainItem.remoteAddress)
contact: contactObj?.value || null
displayNameVal: contact ? "" : mainItem.avatarUri
}
ColumnLayout {
spacing: 0
Text {
text: mainItem.chatRoomName
color: DefaultStyle.grey_100
Layout.fillWidth: true
maximumLineCount: 1
font {
pixelSize: Typography.h4.pixelSize
weight: Typography.h4.weight
capitalization: Font.Capitalize
}
}
Text {
text: mainItem.remoteAddress
color: DefaultStyle.main2_100
Layout.fillWidth: true
maximumLineCount: 1
font {
pixelSize: Typography.p4.pixelSize
weight: Typography.p4.weight
}
}
Text {
text: mainItem.message
Layout.fillWidth: true
maximumLineCount: 2
color: DefaultStyle.grey_300
font {
pixelSize: Typography.p1s.pixelSize
weight: Typography.p1s.weight
}
}
}
}
}
}
}