fix #LINQT-1498 + #LINQT-1510 conf layout + screen sharing when alone in conf

This commit is contained in:
Gaelle Braud 2025-01-02 13:51:30 +01:00
parent 80b119b2ca
commit 0648c3bb61
5 changed files with 97 additions and 109 deletions

View file

@ -9,14 +9,10 @@ import UtilsCpp
import SettingsCpp
// =============================================================================
Item{
Item {
id: mainItem
property alias call: allDevices.currentCall
property ConferenceGui conference: call && call.core.conference || null
property int participantDeviceCount: allDevices.count
onParticipantDeviceCountChanged: {
setUpMainItem()
}
property var callState: call && call.core.state || undefined
onCallStateChanged: if (callState === LinphoneEnums.CallState.End || callState === LinphoneEnums.CallState.Released) preview.visible = false
property string localAddress: call
@ -34,95 +30,28 @@ Item{
onCountChanged: console.log("Device count changed : " +count)
Component.onCompleted: console.log("Loaded : " +allDevices)
}
Component.onCompleted: setUpMainItem()
onVisibleChanged: if (visible) setUpMainItem()
function setUpMainItem() {
if (mainItem.conference && mainItem.participantDeviceCount <= 1) {
mainStackView.replace(waitingForOthersComponent)
} else {
mainStackView.replace(activeSpeakerComp)
}
}
RowLayout{
anchors.fill: parent
anchors.rightMargin: 10 * DefaultStyle.dp
spacing: 16 * DefaultStyle.dp
Control.StackView {
id: mainStackView
// initialItem: waitingForOthersComponent
Sticker {
id: activeSpeakerSticker
Layout.fillWidth: true
Layout.fillHeight: true
}
Component {
id: waitingForOthersComponent
Rectangle {
color: DefaultStyle.grey_600
radius: 15 * DefaultStyle.dp
ColumnLayout {
anchors.centerIn: parent
spacing: 22 * DefaultStyle.dp
width: waitText.implicitWidth
Text {
id: waitText
text: qsTr("Waiting for other participants...")
Layout.preferredHeight: 67 * DefaultStyle.dp
Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Text.AlignHCenter
color: DefaultStyle.grey_0
font {
pixelSize: 30 * DefaultStyle.dp
weight: 300 * DefaultStyle.dp
}
}
Item {
Layout.fillWidth: true
Button {
color: "transparent"
borderColor: DefaultStyle.main2_400
icon.source: AppIcons.shareNetwork
contentImageColor: DefaultStyle.main2_400
text: qsTr("Share invitation")
topPadding: 11 * DefaultStyle.dp
bottomPadding: 11 * DefaultStyle.dp
leftPadding: 20 * DefaultStyle.dp
rightPadding: 20 * DefaultStyle.dp
anchors.centerIn: parent
textColor: DefaultStyle.main2_400
onClicked: {
if (mainItem.conference) {
UtilsCpp.copyToClipboard(mainItem.call.core.remoteAddress)
showInformationPopup(qsTr("Copié"), qsTr("Le lien de la réunion a été copié dans le presse-papier"), true)
}
}
}
}
}
}
}
Component {
id: activeSpeakerComp
Sticker {
id: activeSpeakerSticker
previewEnabled: false
call: mainItem.call
width: mainStackView.width
height: mainStackView.height
displayAll: !mainItem.conference
participantDevice: mainItem.conference && mainItem.conference.core.activeSpeaker
property var address: participantDevice && participantDevice.core.address
videoEnabled: (participantDevice && participantDevice.core.videoEnabled) || (!participantDevice && call && call.core.remoteVideoEnabled)
qmlName: 'AS'
displayPresence: false
Binding {
target: mainItem
property: "activeSpeakerAddress"
value: activeSpeakerSticker.address
when: true
}
previewEnabled: false
call: mainItem.call
displayAll: !mainItem.conference
participantDevice: mainItem.conference && mainItem.conference.core.activeSpeaker
property var address: participantDevice && participantDevice.core.address
videoEnabled: (participantDevice && participantDevice.core.videoEnabled) || (!participantDevice && call && call.core.remoteVideoEnabled)
qmlName: 'AS'
displayPresence: false
Binding {
target: mainItem
property: "activeSpeakerAddress"
value: activeSpeakerSticker.address
when: true
}
}
ListView{
@ -197,5 +126,4 @@ Item{
onRequestResetPosition: resetPosition()
}
}
}
}

View file

@ -1,5 +1,5 @@
import QtQuick
import QtQuick.Layouts as Layout
import QtQuick.Layouts
import QtQuick.Effects
import QtQml.Models
import QtQuick.Controls.Basic as Control
@ -14,24 +14,35 @@ Item {
property CallGui call
property ConferenceGui conference: call && call.core.conference
property bool callTerminatedByUser: false
property bool callStarted: call ? call.core.isStarted : false
readonly property var callState: call?.core.state
property int conferenceLayout: call ? call.core.conferenceVideoLayout : LinphoneEnums.ConferenceLayout.ActiveSpeaker
// property int participantDeviceCount: conference ? conference.core.participantDeviceCount : -1
// onParticipantDeviceCountChanged: {
// setConferenceLayout()
// }
property bool callStarted: call? call.core.isStarted : false
readonly property var callState: call?.core.state
property int conferenceLayout: call ? call.core.conferenceVideoLayout : LinphoneEnums.ConferenceLayout.ActiveSpeaker
property int participantDeviceCount: conference ? conference.core.participantDeviceCount : -1
onParticipantDeviceCountChanged: {
setConferenceLayout()
}
Component.onCompleted: setConferenceLayout()
onConferenceLayoutChanged: {
console.log("CallLayout change : " +conferenceLayout)
setConferenceLayout()
}
Connections {
target: mainItem.conference? mainItem.conference.core : null
function onIsScreenSharingEnabledChanged() {
setConferenceLayout()
}
}
function setConferenceLayout() {
callLayout.sourceComponent = undefined // unload old view before opening the new view to avoid conflicts in Video UI.
callLayout.sourceComponent = !conference || mainItem.conferenceLayout == LinphoneEnums.ConferenceLayout.ActiveSpeaker
? activeSpeakerComponent
: gridComponent
callLayout.sourceComponent = conference
? conference.core.isScreenSharingEnabled || (mainItem.conferenceLayout == LinphoneEnums.ConferenceLayout.ActiveSpeaker && participantDeviceCount > 1)
? activeSpeakerComponent
: participantDeviceCount <= 1
? waitingForOthersComponent
: gridComponent
: activeSpeakerComponent
}
Text {
@ -62,20 +73,67 @@ Item {
? waitingForOthersComponent
: activeSpeakerComponent
}
Component {
id: waitingForOthersComponent
Rectangle {
color: DefaultStyle.grey_600
radius: 15 * DefaultStyle.dp
ColumnLayout {
anchors.centerIn: parent
spacing: 22 * DefaultStyle.dp
width: waitText.implicitWidth
Text {
id: waitText
text: qsTr("Waiting for other participants...")
Layout.preferredHeight: 67 * DefaultStyle.dp
Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Text.AlignHCenter
color: DefaultStyle.grey_0
font {
pixelSize: 30 * DefaultStyle.dp
weight: 300 * DefaultStyle.dp
}
}
Item {
Layout.fillWidth: true
Button {
color: "transparent"
borderColor: DefaultStyle.main2_400
icon.source: AppIcons.shareNetwork
contentImageColor: DefaultStyle.main2_400
text: qsTr("Share invitation")
topPadding: 11 * DefaultStyle.dp
bottomPadding: 11 * DefaultStyle.dp
leftPadding: 20 * DefaultStyle.dp
rightPadding: 20 * DefaultStyle.dp
anchors.centerIn: parent
textColor: DefaultStyle.main2_400
onClicked: {
if (mainItem.conference) {
UtilsCpp.copyToClipboard(mainItem.call.core.remoteAddress)
showInformationPopup(qsTr("Copié"), qsTr("Le lien de la réunion a été copié dans le presse-papier"), true)
}
}
}
}
}
}
}
Component{
id: activeSpeakerComponent
ActiveSpeakerLayout{
Layout.Layout.fillWidth: true
Layout.Layout.fillHeight: true
Layout.fillWidth: true
Layout.fillHeight: true
call: mainItem.call
}
}
Component{
id: gridComponent
CallGridLayout{
Layout.Layout.fillWidth: true
Layout.Layout.fillHeight: true
Layout.fillWidth: true
Layout.fillHeight: true
call: mainItem.call
}
}

View file

@ -32,9 +32,11 @@ Loader{
: displayNameObj
? displayNameObj.value
: ""
property bool haveAvatar: (account && account.core.pictureUri)
|| (contact && contact.core.pictureUri)
|| computedAvatarUri.length != 0
property bool haveAvatar: account
? account.core.pictureUri
: contact
? contact.core.pictureUri
: computedAvatarUri.length != 0
property var avatarObj: UtilsCpp.findAvatarByAddress(_address)
property string computedAvatarUri: avatarObj ? avatarObj.value : ''

View file

@ -32,7 +32,7 @@ Item {
: callState === LinphoneEnums.CallState.PausedByRemote
property string remoteAddress: account
? account.core.identityAddress
? account.core.identityAddress
: participantDevice
? participantDevice.core.address
: call

View file

@ -332,7 +332,7 @@ AbstractWindow {
id: callStatusText
property string remoteName: mainWindow.callState === LinphoneEnums.CallState.Connected || mainWindow.callState === LinphoneEnums.CallState.StreamsRunning
? mainWindow.call.core.remoteName
: qsTr("Appel %1").arg(EnumsToStringCpp.dirToString(mainWindow.call.core.dir))
: qsTr("Appel %1").arg(mainWindow.call ? EnumsToStringCpp.dirToString(mainWindow.call.core.dir) : "")
text: (mainWindow.callState === LinphoneEnums.CallState.End || mainWindow.callState === LinphoneEnums.CallState.Released)
? qsTr("Fin d'appel")
: mainWindow.call && (mainWindow.call.core.paused