From 15f6392bcd49ab4562afa96f2ed2827ab6c367a1 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Tue, 30 Aug 2022 13:15:50 +0200 Subject: [PATCH] Fix preview decorations in active speaker. For Active speaker : Workaround about resolving a Qt's bug on refreshing list view layout for inversed vertical direction. --- .../ParticipantDeviceProxyModel.cpp | 2 + .../Linphone/Sticker/DecorationSticker.qml | 4 +- .../views/App/Calls/IncallActiveSpeaker.qml | 75 +++++++++++-------- 3 files changed, 49 insertions(+), 32 deletions(-) diff --git a/linphone-app/src/components/participant/ParticipantDeviceProxyModel.cpp b/linphone-app/src/components/participant/ParticipantDeviceProxyModel.cpp index c38a7eaa3..3fff536b1 100644 --- a/linphone-app/src/components/participant/ParticipantDeviceProxyModel.cpp +++ b/linphone-app/src/components/participant/ParticipantDeviceProxyModel.cpp @@ -87,6 +87,7 @@ void ParticipantDeviceProxyModel::setCallModel(CallModel * callModel){ connect(sourceModel, &ParticipantDeviceListModel::meChanged, this, &ParticipantDeviceProxyModel::meChanged); setSourceModel(sourceModel); emit countChanged(); + emit meChanged(); } void ParticipantDeviceProxyModel::setParticipant(ParticipantModel * participant){ @@ -98,6 +99,7 @@ void ParticipantDeviceProxyModel::setParticipant(ParticipantModel * participant) connect(sourceModel, &ParticipantDeviceListModel::meChanged, this, &ParticipantDeviceProxyModel::meChanged); setSourceModel(sourceModel); emit countChanged(); + emit meChanged(); } void ParticipantDeviceProxyModel::setShowMe(const bool& show){ diff --git a/linphone-app/ui/modules/Linphone/Sticker/DecorationSticker.qml b/linphone-app/ui/modules/Linphone/Sticker/DecorationSticker.qml index a01f93504..f89a44b00 100644 --- a/linphone-app/ui/modules/Linphone/Sticker/DecorationSticker.qml +++ b/linphone-app/ui/modules/Linphone/Sticker/DecorationSticker.qml @@ -125,7 +125,7 @@ Item{ onClicked: mainItem.customButtonClicked() } Rectangle{// Mute - visible: mainItem.currentDevice && mainItem.currentDevice.isMuted + visible: mainItem._currentDevice && mainItem._currentDevice.isMuted Layout.preferredHeight: DecorationStickerStyle.isMuted.button.iconSize Layout.preferredWidth: DecorationStickerStyle.isMuted.button.iconSize radius: width/2 @@ -140,7 +140,7 @@ Item{ BusyIndicator{// Joining spinner Layout.preferredHeight: 20 Layout.preferredWidth: 20 - running: mainItem.currentDevice && (mainItem.currentDevice.state == LinphoneEnums.ParticipantDeviceStateJoining || mainItem.currentDevice.state == LinphoneEnums.ParticipantDeviceStateScheduledForJoining || mainItem.currentDevice.state == LinphoneEnums.ParticipantDeviceStateAlerting) + running: mainItem._currentDevice && (mainItem._currentDevice.state == LinphoneEnums.ParticipantDeviceStateJoining || mainItem._currentDevice.state == LinphoneEnums.ParticipantDeviceStateScheduledForJoining || mainItem._currentDevice.state == LinphoneEnums.ParticipantDeviceStateAlerting) } } } diff --git a/linphone-app/ui/views/App/Calls/IncallActiveSpeaker.qml b/linphone-app/ui/views/App/Calls/IncallActiveSpeaker.qml index 0a7265a8c..003bb6fa2 100644 --- a/linphone-app/ui/views/App/Calls/IncallActiveSpeaker.qml +++ b/linphone-app/ui/views/App/Calls/IncallActiveSpeaker.qml @@ -73,6 +73,7 @@ Item { Item{// Need an item to not override Sticker internal states. States are needed for changing anchors. id: preview anchors.right: parent.right + anchors.bottom: parent.bottom anchors.rightMargin: 30 anchors.bottomMargin: 15 @@ -95,6 +96,7 @@ Item { avatarStickerBackgroundColor: IncallStyle.container.avatar.stickerBackgroundColor avatarBackgroundColor: IncallStyle.container.avatar.backgroundColor } + /* state: 'bottom' states: [State { name: "bottom" @@ -113,43 +115,56 @@ Item { anchors.top: mainItem.top anchors.bottom: undefined } - }] + }]*/ } - ScrollableListView{ - id: miniViews + Item{ anchors.right: parent.right anchors.top: parent.top anchors.bottom: preview.top anchors.rightMargin: 30 - anchors.topMargin: 15 +// WORKAROUND to fix a Qt's bug on not refreshing layout to bottom when loading listview. + property int estimatedHeight: miniViews.count * (miniViews.cellHeight+miniViews.spacing)-miniViews.spacing + property int unusedHeight : Math.max(0, parent.height// Main Height + -preview.height-preview.anchors.topMargin-preview.anchors.bottomMargin// Preview height + -30 // margins + -estimatedHeight)// contents height + anchors.topMargin: 15 + unusedHeight +//--------------- + anchors.bottomMargin: 15 - property int cellHeight: 150 - - width: 16 * cellHeight / 9 - model: mainItem.callModel.isConference && mainItem.participantDevices.count > 1 ? mainItem.participantDevices : [] - onModelChanged: console.log( mainItem.callModel.isConference+"/"+mainItem.callModel.localVideoEnabled + "/" +mainItem.callModel.cameraEnabled + " / " +count) - spacing: 15 - verticalLayoutDirection: ListView.BottomToTop - delegate:Item{ - height: miniViews.cellHeight - width: miniViews.width - clip:false - Sticker{ - id: miniView - anchors.fill: parent - anchors.margins: 3 - deactivateCamera: index <0 || !mainItem.cameraEnabled || (!modelData.videoEnabled) || (callModel && callModel.pausedByUser) - currentDevice: modelData.isPreview ? null : modelData - callModel: modelData.isPreview ? null : mainItem.callModel - isCameraFromDevice: mainItem.callModel.isConference - isPaused: currentDevice && currentDevice.isPaused - showCloseButton: false - showCustomButton: false - showAvatarBorder: true - avatarStickerBackgroundColor: IncallStyle.container.avatar.stickerBackgroundColor - avatarBackgroundColor: IncallStyle.container.avatar.backgroundColor + width: 16 * miniViews.cellHeight / 9 + ScrollableListView{ + id: miniViews + property int cellHeight: 150 + anchors.fill: parent + model : mainItem.callModel.isConference && mainItem.participantDevices.count > 1 ? mainItem.participantDevices : [] + onModelChanged: { + console.log( mainItem.callModel.isConference+"/"+mainItem.callModel.localVideoEnabled + "/" +mainItem.callModel.cameraEnabled + " / " +count) + } - } + spacing: 15 + verticalLayoutDirection: ListView.BottomToTop + delegate:Item{ + height: miniViews.cellHeight + width: miniViews.width + clip:false + Sticker{ + id: miniView + anchors.fill: parent + anchors.margins: 3 + deactivateCamera: index <0 || !mainItem.cameraEnabled || (!modelData.videoEnabled) || (callModel && callModel.pausedByUser) + currentDevice: modelData.isPreview ? null : modelData + callModel: modelData.isPreview ? null : mainItem.callModel + isCameraFromDevice: mainItem.callModel.isConference + isPaused: currentDevice && currentDevice.isPaused + showCloseButton: false + showCustomButton: false + showAvatarBorder: true + avatarStickerBackgroundColor: IncallStyle.container.avatar.stickerBackgroundColor + avatarBackgroundColor: IncallStyle.container.avatar.backgroundColor + } + } + } } }