Call from chat room

This commit is contained in:
Christophe Deschamps 2025-06-12 18:17:16 +02:00
parent ff78a5abf1
commit f4e3db8a07
6 changed files with 63 additions and 35 deletions

View file

@ -4500,6 +4500,11 @@ Pour les activer dans un projet commercial, merci de nous contacter.</source>
</context>
<context>
<name>SelectedChatView</name>
<message>
<source>chat_view_group_call_toast_message</source>
<extracomment>&quot;Start a group call ?&quot;</extracomment>
<translation>Start a group call ?</translation>
</message>
<message>
<location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="229"/>
<source>chat_view_send_area_placeholder_text</source>
@ -6305,11 +6310,6 @@ Failed to create 1-1 conversation with %1 !</extracomment>
<extracomment>All the messages will be removed from the chat room. Do you want to continue ?</extracomment>
<translation>Alle Nachrichten werden aus dem Chat entfernt. Möchten Sie fortfahren?</translation>
</message>
<message>
<source>group_infos_group_call_toast_message</source>
<extracomment>&quot;Start a group call ?&quot;</extracomment>
<translation>Start a group call ?</translation>
</message>
</context>
<context>
<name>GroupChatInfoParticipants</name>

View file

@ -4401,6 +4401,11 @@ To enable them in a commercial project, please contact us.</translation>
</context>
<context>
<name>SelectedChatView</name>
<message>
<source>chat_view_group_call_toast_message</source>
<extracomment>&quot;Start a group call ?&quot;</extracomment>
<translation>Start a group call ?</translation>
</message>
<message>
<source>Dites quelque chose</source>
<extracomment>Say something : placeholder text for sending message text area</extracomment>
@ -6314,11 +6319,6 @@ Failed to create 1-1 conversation with %1 !</extracomment>
<extracomment>All the messages will be removed from the chat room. Do you want to continue ?</extracomment>
<translation>All the messages will be removed from the chat room. Do you want to continue ?</translation>
</message>
<message>
<source>group_infos_group_call_toast_message</source>
<extracomment>&quot;Start a group call ?&quot;</extracomment>
<translation>Start a group call ?</translation>
</message>
</context>
<context>
<name>GroupChatInfoParticipants</name>

View file

@ -4401,6 +4401,11 @@ Pour les activer dans un projet commercial, merci de nous contacter.</translatio
</context>
<context>
<name>SelectedChatView</name>
<message>
<source>chat_view_group_call_toast_message</source>
<extracomment>&quot;Start a group call ?&quot;</extracomment>
<translation>Démarrer un appel de groupe ?</translation>
</message>
<message>
<location filename="../../view/Page/Form/Chat/SelectedChatView.qml" line="229"/>
<source>chat_view_send_area_placeholder_text</source>
@ -6211,11 +6216,6 @@ Failed to create 1-1 conversation with %1 !</extracomment>
<extracomment>All the messages will be removed from the chat room. Do you want to continue ?</extracomment>
<translation>Vous ne recevrez ni pourrez envoyer des messages dans cette conversation, quitter ?</translation>
</message>
<message>
<source>group_infos_group_call_toast_message</source>
<extracomment>&quot;Start a group call ?&quot;</extracomment>
<translation>Démarrer un appel de groupe ?</translation>
</message>
</context>
<context>
<name>GroupChatInfoParticipants</name>

View file

@ -12,9 +12,39 @@ import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle
RowLayout {
id: mainItem
property ChatGui chat
property var contactObj: chat ? UtilsCpp.findFriendByAddress(mainItem.chat.core.peerAddress) : null
property var contact: contactObj?.value || null
property CallGui call
property alias callHeaderContent: splitPanel.headerContent
spacing: 0
signal oneOneCall(bool video)
signal groupCall()
onOneOneCall: {
if (contact)
mainWindow.startCallWithContact(contact, video, mainItem)
else
UtilsCpp.createCall(mainItem.chat?.core.peerAddress, {'localVideoEnabled':video})
}
onGroupCall: {
mainWindow.showConfirmationLambdaPopup(qsTr(""),
qsTr("chat_view_group_call_toast_message"),
"",
function(confirmed) {
if (confirmed) {
const sourceList = mainItem.chat?.core.participants
let addresses = [];
for (let i = 0; i < sourceList.length; ++i) {
const participantGui = sourceList[i]
const participantCore = participantGui.core
addresses.push(participantCore.sipAddress)
}
UtilsCpp.createGroupCall(mainItem.chat?.core.title, addresses)
}
})
}
//onEventChanged: {
// TODO : call when all messages read after scroll to unread feature available
@ -59,10 +89,19 @@ RowLayout {
BigButton {
style: ButtonStyle.noBackground
icon.source: AppIcons.phone
onPressed: {
if (mainItem.chat.core.isGroupChat) {
mainItem.groupCall()
} else {
mainItem.oneOneCall(false)
}
}
}
BigButton {
style: ButtonStyle.noBackground
icon.source: AppIcons.videoCamera
visible: !mainItem.chat.core.isGroupChat
onPressed: mainItem.oneOneCall(true)
}
BigButton {
style: ButtonStyle.noBackground
@ -269,6 +308,11 @@ RowLayout {
anchors.topMargin: Math.round(39 * DefaultStyle.dp)
sourceComponent: mainItem.chat.core.isGroupChat ? groupInfoComponent : oneToOneInfoComponent
active: detailsPanel.visible
onLoaded: {
if (contentLoader.item) {
contentLoader.item.parentView = mainItem
}
}
}
Component {

View file

@ -13,6 +13,7 @@ ColumnLayout {
id: mainItem
property ChatGui chatGui
property var chatCore: chatGui.core
property var parentView
spacing: 0
Avatar {
@ -126,23 +127,7 @@ ColumnLayout {
button.icon.source: AppIcons.phone
//: "Appel"
label: qsTr("group_infos_call")
button.onClicked: {
mainWindow.showConfirmationLambdaPopup(qsTr("group_infos_call"),
qsTr("group_infos_group_call_toast_message"),
"",
function(confirmed) {
if (confirmed) {
const sourceList = mainItem.chatCore.participants
let addresses = [];
for (let i = 0; i < sourceList.length; ++i) {
const participantGui = sourceList[i]
const participantCore = participantGui.core
addresses.push(participantCore.sipAddress)
}
UtilsCpp.createGroupCall(mainItem.chatCore.title, addresses)
}
})
}
button.onClicked: parentView.groupCall()
}
LabelButton {
width: Math.round(56 * DefaultStyle.dp)

View file

@ -14,6 +14,7 @@ ColumnLayout {
property ChatGui chatGui
property var chatCore: chatGui.core
property var contactObj: chat ? UtilsCpp.findFriendByAddress(mainItem.chatCore.peerAddress) : null
property var parentView
spacing: 0
Avatar {
@ -61,9 +62,7 @@ ColumnLayout {
button.icon.source: AppIcons.phone
//: "Appel"
label: qsTr("one_one_infos_call")
button.onClicked: {
mainWindow.startCallWithContact(contactObj.value, false, mainItem)
}
button.onClicked: parentView.oneOneCall(false)
}
LabelButton {
width: Math.round(56 * DefaultStyle.dp)