From fd57221713a928a4219047ba9ddc4de3ce189a46 Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Thu, 4 Apr 2024 16:03:44 +0200 Subject: [PATCH] add share link button participant list --- Linphone/view/App/CallsWindow.qml | 70 ++++++++++++++ Linphone/view/App/Main.qml | 96 +------------------ Linphone/view/CMakeLists.txt | 1 + .../view/Item/Call/OngoingCallRightPanel.qml | 4 + Linphone/view/Item/InformationPopup.qml | 90 +++++++++++++++++ 5 files changed, 169 insertions(+), 92 deletions(-) create mode 100644 Linphone/view/Item/InformationPopup.qml diff --git a/Linphone/view/App/CallsWindow.qml b/Linphone/view/App/CallsWindow.qml index 00b1b4a5..c82ee46d 100644 --- a/Linphone/view/App/CallsWindow.qml +++ b/Linphone/view/App/CallsWindow.qml @@ -40,6 +40,12 @@ Window { callObj = UtilsCpp.createCall(conferenceInfo.core.uri, withVideo) } } + + Component { + id: popupComp + InformationPopup{} + } + function showInformationPopup(title, description, isSuccess) { var infoPopup = popupComp.createObject(popupLayout, {"title": title, "description": description, "isSuccess": isSuccess}) infoPopup.index = popupLayout.popupList.length @@ -47,6 +53,23 @@ Window { infoPopup.open() } + ColumnLayout { + id: popupLayout + anchors.fill: parent + Layout.alignment: Qt.AlignBottom + property int nextY: mainWindow.height + property list popupList + property int popupCount: popupList.length + spacing: 15 + onPopupCountChanged: { + nextY = mainWindow.height + for(var i = 0; i < popupCount; ++i) { + popupList[i].y = nextY - popupList[i].height + nextY = nextY - popupList[i].height - 15 + } + } + } + function changeLayout(layoutIndex) { if (layoutIndex == 0) { console.log("Set Grid layout") @@ -394,6 +417,7 @@ Window { Layout.rightMargin: 10 * DefaultStyle.dp visible: false function replace(id) { + rightPanel.customHeaderButtons = null contentStackView.replace(id, Control.StackView.Immediate) } headerStack.currentIndex: 0 @@ -669,6 +693,33 @@ Window { id: participantListComp ParticipantListView { id: participantList + Component { + id: headerbutton + PopupButton { + popup.contentItem: Button { + background: Item{} + contentItem: RowLayout { + EffectImage { + colorizationColor: DefaultStyle.main2_600 + imageSource: AppIcons.shareNetwork + Layout.preferredWidth: 24 * DefaultStyle.dp + Layout.preferredHeight: 24 * DefaultStyle.dp + } + Text { + text: qsTr("Partager le lien de la réunion") + font.pixelSize: 14 * DefaultStyle.dp + } + } + onClicked: { + UtilsCpp.copyToClipboard(mainWindow.conference.core.uri) + UtilsCpp.showInformationPopup(qsTr("Copié"), qsTr("Le lien de la réunion a été copié dans le presse-papier"), true, mainWindow) + } + } + } + } + Control.StackView.onActivated: { + rightPanel.customHeaderButtons = headerbutton.createObject(rightPanel) + } call: mainWindow.call onAddParticipantRequested: participantsStack.push(addParticipantComp) onCountChanged: if (participantsStack.Control.StackView.status === Control.StackView.Active && participantsStack.currentItem == participantList) { @@ -938,6 +989,25 @@ Window { } } } + CheckableButton { + visible: false + checkable: false + checkedColor: DefaultStyle.main2_400 + iconUrl: AppIcons.handWaving + Layout.preferredWidth: 55 * DefaultStyle.dp + Layout.preferredHeight: 55 * DefaultStyle.dp + icon.width: 32 * DefaultStyle.dp + icon.height: 32 * DefaultStyle.dp + } + CheckableButton { + visible: false + iconUrl: AppIcons.smiley + checkedColor: DefaultStyle.main2_400 + Layout.preferredWidth: 55 * DefaultStyle.dp + Layout.preferredHeight: 55 * DefaultStyle.dp + icon.width: 32 * DefaultStyle.dp + icon.height: 32 * DefaultStyle.dp + } CheckableButton { visible: mainWindow.conference iconUrl: AppIcons.usersTwo diff --git a/Linphone/view/App/Main.qml b/Linphone/view/App/Main.qml index 9c6db9c3..f1e63f4e 100644 --- a/Linphone/view/App/Main.qml +++ b/Linphone/view/App/Main.qml @@ -33,105 +33,17 @@ ApplicationWindow { mainWindowStackView.currentItem.transferCallSucceed() } + Component { + id: popupComp + InformationPopup{} + } function showInformationPopup(title, description, isSuccess) { var infoPopup = popupComp.createObject(popupLayout, {"title": title, "description": description, "isSuccess": isSuccess}) - // informationPopup.title = title - // informationPopup.description = description - // informationPopup.isSuccess = isSuccess - // infoPopup.y = popupLayout.nextY - infoPopup.height infoPopup.index = popupLayout.popupList.length popupLayout.popupList.push(infoPopup) infoPopup.open() } - Component { - id: popupComp - Popup { - id: informationPopup - property bool isSuccess: true - property string title - property string description - property int index - onAboutToShow: { - autoClosePopup.restart() - } - onAboutToHide: { - popupLayout.popupList.splice(informationPopup.index, 1) - } - closePolicy: Popup.NoAutoClose - x : parent.x + parent.width - width - // y : parent.y + parent.height - height - rightMargin: 20 * DefaultStyle.dp - bottomMargin: 20 * DefaultStyle.dp - padding: 20 * DefaultStyle.dp - underlineColor: informationPopup.isSuccess ? DefaultStyle.success_500main : DefaultStyle.danger_500main - radius: 0 - onHoveredChanged: { - if (hovered) autoClosePopup.stop() - else autoClosePopup.restart() - } - Timer { - id: autoClosePopup - interval: 5000 - onTriggered: { - informationPopup.close() - } - } - contentItem: RowLayout { - spacing: 15 * DefaultStyle.dp - EffectImage { - imageSource: informationPopup.isSuccess ? AppIcons.smiley : AppIcons.smileySad - colorizationColor: informationPopup.isSuccess ? DefaultStyle.success_500main : DefaultStyle.danger_500main - Layout.preferredWidth: 32 * DefaultStyle.dp - Layout.preferredHeight: 32 * DefaultStyle.dp - width: 32 * DefaultStyle.dp - height: 32 * DefaultStyle.dp - } - Rectangle { - Layout.preferredWidth: 1 * DefaultStyle.dp - Layout.preferredHeight: parent.height - color: DefaultStyle.main2_200 - } - ColumnLayout { - RowLayout { - Layout.fillWidth: true - Text { - Layout.fillWidth: true - text: informationPopup.title - color: informationPopup.isSuccess ? DefaultStyle.success_500main : DefaultStyle.danger_500main - font { - pixelSize: 16 * DefaultStyle.dp - weight: 800 * DefaultStyle.dp - } - } - Button { - Layout.preferredWidth: 20 * DefaultStyle.dp - Layout.preferredHeight: 20 * DefaultStyle.dp - icon.width: 20 * DefaultStyle.dp - icon.height: 20 * DefaultStyle.dp - Layout.alignment: Qt.AlignTop | Qt.AlignRight - visible: informationPopup.hovered || hovered - background: Item{} - icon.source: AppIcons.closeX - onClicked: informationPopup.close() - } - } - Text { - Layout.alignment: Qt.AlignHCenter - Layout.fillWidth: true - Layout.maximumWidth: 300 * DefaultStyle.dp - text: informationPopup.description - wrapMode: Text.WordWrap - color: DefaultStyle.main2_500main - font { - pixelSize: 12 * DefaultStyle.dp - weight: 300 * DefaultStyle.dp - } - } - } - } - } - } ColumnLayout { id: popupLayout diff --git a/Linphone/view/CMakeLists.txt b/Linphone/view/CMakeLists.txt index fd400a5a..ca80930d 100644 --- a/Linphone/view/CMakeLists.txt +++ b/Linphone/view/CMakeLists.txt @@ -58,6 +58,7 @@ list(APPEND _LINPHONEAPP_QML_FILES view/Item/EffectImage.qml view/Item/ErrorText.qml view/Item/IconLabelButton.qml + view/Item/InformationPopup.qml view/Item/MovableMouseArea.qml view/Item/NumericPad.qml view/Item/PhoneNumberComboBox.qml diff --git a/Linphone/view/Item/Call/OngoingCallRightPanel.qml b/Linphone/view/Item/Call/OngoingCallRightPanel.qml index 5413e474..af17d3d3 100644 --- a/Linphone/view/Item/Call/OngoingCallRightPanel.qml +++ b/Linphone/view/Item/Call/OngoingCallRightPanel.qml @@ -7,6 +7,7 @@ Control.Page { id: mainItem property alias headerStack: headerStack property alias contentStackView: contentStackView + property alias customHeaderButtons: customButtonLayout.children property bool closeButtonVisible: true clip: true @@ -62,6 +63,9 @@ Control.Page { weight: 800 * DefaultStyle.dp } } + RowLayout { + id: customButtonLayout + } Button { id: closeButton visible: mainItem.closeButtonVisible diff --git a/Linphone/view/Item/InformationPopup.qml b/Linphone/view/Item/InformationPopup.qml new file mode 100644 index 00000000..c07a793a --- /dev/null +++ b/Linphone/view/Item/InformationPopup.qml @@ -0,0 +1,90 @@ +import QtQuick 2.15 +import QtQuick.Layouts 1.3 +import QtQuick.Controls +import Linphone + +Popup { + id: mainItem + property bool isSuccess: true + property string title + property string description + property int index + onAboutToShow: { + autoClosePopup.restart() + } + onAboutToHide: { + popupLayout.popupList.splice(mainItem.index, 1) + } + closePolicy: Popup.NoAutoClose + x : parent.x + parent.width - width + // y : parent.y + parent.height - height + rightMargin: 20 * DefaultStyle.dp + bottomMargin: 20 * DefaultStyle.dp + padding: 20 * DefaultStyle.dp + underlineColor: mainItem.isSuccess ? DefaultStyle.success_500main : DefaultStyle.danger_500main + radius: 0 + onHoveredChanged: { + if (hovered) autoClosePopup.stop() + else autoClosePopup.restart() + } + Timer { + id: autoClosePopup + interval: 5000 + onTriggered: { + mainItem.close() + } + } + contentItem: RowLayout { + spacing: 15 * DefaultStyle.dp + EffectImage { + imageSource: mainItem.isSuccess ? AppIcons.smiley : AppIcons.smileySad + colorizationColor: mainItem.isSuccess ? DefaultStyle.success_500main : DefaultStyle.danger_500main + Layout.preferredWidth: 32 * DefaultStyle.dp + Layout.preferredHeight: 32 * DefaultStyle.dp + width: 32 * DefaultStyle.dp + height: 32 * DefaultStyle.dp + } + Rectangle { + Layout.preferredWidth: 1 * DefaultStyle.dp + Layout.preferredHeight: parent.height + color: DefaultStyle.main2_200 + } + ColumnLayout { + RowLayout { + Layout.fillWidth: true + Text { + Layout.fillWidth: true + text: mainItem.title + color: mainItem.isSuccess ? DefaultStyle.success_500main : DefaultStyle.danger_500main + font { + pixelSize: 16 * DefaultStyle.dp + weight: 800 * DefaultStyle.dp + } + } + Button { + Layout.preferredWidth: 20 * DefaultStyle.dp + Layout.preferredHeight: 20 * DefaultStyle.dp + icon.width: 20 * DefaultStyle.dp + icon.height: 20 * DefaultStyle.dp + Layout.alignment: Qt.AlignTop | Qt.AlignRight + visible: mainItem.hovered || hovered + background: Item{} + icon.source: AppIcons.closeX + onClicked: mainItem.close() + } + } + Text { + Layout.alignment: Qt.AlignHCenter + Layout.fillWidth: true + Layout.maximumWidth: 300 * DefaultStyle.dp + text: mainItem.description + wrapMode: Text.WordWrap + color: DefaultStyle.main2_500main + font { + pixelSize: 12 * DefaultStyle.dp + weight: 300 * DefaultStyle.dp + } + } + } + } +}