From 54a3501ddfee2f4517a8e6c06eee4977f0991afd Mon Sep 17 00:00:00 2001 From: Christophe Deschamps Date: Mon, 23 Jun 2025 16:10:47 +0200 Subject: [PATCH] Refactor and reposition participant management in group chat room --- Linphone/data/languages/de.ts | 20 ++--- Linphone/data/languages/en.ts | 19 +++-- Linphone/data/languages/fr_FR.ts | 21 +++--- Linphone/view/CMakeLists.txt | 1 + .../view/Page/Form/Chat/SelectedChatView.qml | 26 +++++-- .../Layout/Chat/GroupConversationInfos.qml | 75 +------------------ .../Page/Layout/Chat/ManageParticipants.qml | 72 ++++++++++++++++++ 7 files changed, 124 insertions(+), 110 deletions(-) create mode 100644 Linphone/view/Page/Layout/Chat/ManageParticipants.qml diff --git a/Linphone/data/languages/de.ts b/Linphone/data/languages/de.ts index 50f0aba58..c19da504e 100644 --- a/Linphone/data/languages/de.ts +++ b/Linphone/data/languages/de.ts @@ -3111,16 +3111,6 @@ Error GroupConversationInfos - - - group_infos_manage_participants - Participants - - - - group_infos_participants_edit_apply - Apply - group_infos_call @@ -6630,4 +6620,14 @@ Failed to create 1-1 conversation with %1 ! Ok + + ManageParticipants + + + group_infos_manage_participants + Participants + Participants + + + diff --git a/Linphone/data/languages/en.ts b/Linphone/data/languages/en.ts index 23846f3e3..cea2ca8ff 100644 --- a/Linphone/data/languages/en.ts +++ b/Linphone/data/languages/en.ts @@ -3034,16 +3034,6 @@ Only your correspondent can decrypt them. GroupConversationInfos - - - group_infos_manage_participants - Participants - - - - group_infos_participants_edit_apply - Apply - group_infos_call @@ -6527,4 +6517,13 @@ Failed to create 1-1 conversation with %1 ! Ok + + ManageParticipants + + + group_infos_manage_participants + Participants + Participants + + diff --git a/Linphone/data/languages/fr_FR.ts b/Linphone/data/languages/fr_FR.ts index d3ea36f05..9792aeaa1 100644 --- a/Linphone/data/languages/fr_FR.ts +++ b/Linphone/data/languages/fr_FR.ts @@ -3034,16 +3034,6 @@ en bout. Seul votre correspondant peut les déchiffrer. GroupConversationInfos - - - group_infos_manage_participants - Participants - - - - group_infos_participants_edit_apply - Appliquer - group_infos_call @@ -6522,4 +6512,15 @@ Failed to create 1-1 conversation with %1 ! Ok + + ManageParticipants + + + group_infos_manage_participants + Participants + Participants + + + + diff --git a/Linphone/view/CMakeLists.txt b/Linphone/view/CMakeLists.txt index be6bfa06f..394390945 100644 --- a/Linphone/view/CMakeLists.txt +++ b/Linphone/view/CMakeLists.txt @@ -160,6 +160,7 @@ list(APPEND _LINPHONEAPP_QML_FILES view/Page/Layout/Chat/OneOneConversationInfos.qml view/Page/Layout/Chat/ChatInfoActionsGroup.qml view/Page/Layout/Chat/GroupChatInfoParticipants.qml + view/Page/Layout/Chat/ManageParticipants.qml view/Page/Main/AbstractMainPage.qml view/Page/Main/Account/AccountListView.qml diff --git a/Linphone/view/Page/Form/Chat/SelectedChatView.qml b/Linphone/view/Page/Form/Chat/SelectedChatView.qml index bd5023537..ed51237ec 100644 --- a/Linphone/view/Page/Form/Chat/SelectedChatView.qml +++ b/Linphone/view/Page/Form/Chat/SelectedChatView.qml @@ -386,15 +386,18 @@ RowLayout { id: contentLoader property bool showingMessageReactions: false property bool showingImdnStatus: false + property bool showingManageParticipants: false anchors.top: parent.top anchors.topMargin: Math.round(39 * DefaultStyle.dp) sourceComponent: showingMessageReactions - ? messageReactionsComponent - : showingImdnStatus - ? messageImdnStatusComponent - : mainItem.chat.core.isGroupChat - ? groupInfoComponent - : oneToOneInfoComponent + ? messageReactionsComponent + : showingImdnStatus + ? messageImdnStatusComponent + : showingManageParticipants + ? manageParticipantsComponents + : mainItem.chat.core.isGroupChat + ? groupInfoComponent + : oneToOneInfoComponent active: detailsPanel.visible onLoaded: { if (contentLoader.item) { @@ -414,6 +417,7 @@ RowLayout { id: groupInfoComponent GroupConversationInfos { chatGui: mainItem.chat + onManageParticipantsRequested: contentLoader.showingManageParticipants = true } } @@ -437,5 +441,13 @@ RowLayout { } } } + + Component { + id: manageParticipantsComponents + ManageParticipants { + chatGui: mainItem.chat + onDone: contentLoader.showingManageParticipants = false + } + } } -} \ No newline at end of file +} diff --git a/Linphone/view/Page/Layout/Chat/GroupConversationInfos.qml b/Linphone/view/Page/Layout/Chat/GroupConversationInfos.qml index 409a6523e..49e40b316 100644 --- a/Linphone/view/Page/Layout/Chat/GroupConversationInfos.qml +++ b/Linphone/view/Page/Layout/Chat/GroupConversationInfos.qml @@ -15,6 +15,7 @@ ColumnLayout { property var chatCore: chatGui.core property var parentView property bool manageParticipants: false + signal manageParticipantsRequested() spacing: 0 @@ -159,77 +160,6 @@ ColumnLayout { } } - Rectangle { - visible: mainItem.manageParticipants - Layout.fillHeight: true - Layout.fillWidth: true - Layout.topMargin: Math.round(9 * DefaultStyle.dp) - Layout.leftMargin: Math.round(17 * DefaultStyle.dp) - Layout.rightMargin: Math.round(10 * DefaultStyle.dp) - color: DefaultStyle.grey_100 - radius: Math.round(15 * DefaultStyle.dp) - height: participantAddColumn.implicitHeight - - ColumnLayout { - id: participantAddColumn - anchors.fill: parent - anchors.leftMargin: Math.round(17 * DefaultStyle.dp) - anchors.rightMargin: Math.round(10 * DefaultStyle.dp) - anchors.topMargin: Math.round(17 * DefaultStyle.dp) - spacing: Math.round(5 * DefaultStyle.dp) - RowLayout { - id: manageParticipantsButtons - spacing: Math.round(10 * DefaultStyle.dp) - Button { - id: manageParticipantsBackButton - style: ButtonStyle.noBackgroundOrange - icon.source: AppIcons.leftArrow - icon.width: Math.round(20 * DefaultStyle.dp) - icon.height: Math.round(20 * DefaultStyle.dp) - onClicked: mainItem.manageParticipants = false - } - Text { - text: qsTr("group_infos_manage_participants") - color: DefaultStyle.main1_500_main - maximumLineCount: 1 - font: Typography.h4 - Layout.fillWidth: true - } - SmallButton { - enabled: manageParticipantsLayout.selectedParticipantsCount.length != 0 - Layout.leftMargin: Math.round(11 * DefaultStyle.dp) - focus: enabled - style: ButtonStyle.main - text: qsTr("group_infos_participants_edit_apply") - KeyNavigation.left: manageParticipantsBackButton - KeyNavigation.down: manageParticipantsLayout - onClicked: { - mainItem.chatCore.participantsAddresses = manageParticipantsLayout.selectedParticipants - mainItem.manageParticipants = false - } - } - } - AddParticipantsForm { - id: manageParticipantsLayout - visible: manageParticipants - Layout.fillWidth: true - Layout.fillHeight: true - Layout.topMargin: Math.round(9 * DefaultStyle.dp) - Layout.bottomMargin: Math.round(17 * DefaultStyle.dp) - Layout.alignment: Qt.AlignVCenter - selectedParticipants: mainItem.chatCore.participantsAddresses - focus: true - onVisibleChanged: { - if (visible) - selectedParticipants = mainItem.chatCore.participantsAddresses - } - } - Item { - Layout.fillHeight: true - } - } - } - Component { id: participantList GroupChatInfoParticipants { @@ -237,14 +167,13 @@ ColumnLayout { title: qsTr("group_infos_participants").arg(mainItem.chatCore.participants.length) participants: mainItem.chatCore.participants chatCore: mainItem.chatCore - onManageParticipantsRequested: mainItem.manageParticipants = true + onManageParticipantsRequested: mainItem.manageParticipantsRequested() } } ScrollView { id: scrollView - visible: !mainItem.manageParticipants Layout.fillHeight: true Layout.fillWidth: true Layout.topMargin: Math.round(30 * DefaultStyle.dp) diff --git a/Linphone/view/Page/Layout/Chat/ManageParticipants.qml b/Linphone/view/Page/Layout/Chat/ManageParticipants.qml new file mode 100644 index 000000000..88ce13d3d --- /dev/null +++ b/Linphone/view/Page/Layout/Chat/ManageParticipants.qml @@ -0,0 +1,72 @@ +import QtCore +import QtQuick +import QtQuick.Controls.Basic as Control +import QtQuick.Dialogs +import QtQuick.Effects +import QtQuick.Layouts +import Linphone +import UtilsCpp +import SettingsCpp +import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle + +Rectangle { + id: mainItem + property ChatGui chatGui + property var chatCore: chatGui.core + Layout.fillHeight: true + Layout.fillWidth: true + Layout.topMargin: Math.round(9 * DefaultStyle.dp) + Layout.leftMargin: Math.round(17 * DefaultStyle.dp) + Layout.rightMargin: Math.round(10 * DefaultStyle.dp) + color: DefaultStyle.grey_0 + radius: Math.round(15 * DefaultStyle.dp) + height: participantAddColumn.implicitHeight + signal done() + + ColumnLayout { + id: participantAddColumn + anchors.fill: parent + anchors.leftMargin: Math.round(17 * DefaultStyle.dp) + anchors.rightMargin: Math.round(10 * DefaultStyle.dp) + anchors.topMargin: Math.round(17 * DefaultStyle.dp) + spacing: Math.round(5 * DefaultStyle.dp) + RowLayout { + id: manageParticipantsButtons + spacing: Math.round(5 * DefaultStyle.dp) + BigButton { + id: manageParticipantsBackButton + style: ButtonStyle.noBackground + icon.source: AppIcons.leftArrow + onClicked: { + mainItem.chatCore.participantsAddresses = manageParticipantsLayout.selectedParticipants + mainItem.done() + } + } + Text { + text: qsTr("group_infos_manage_participants") + color: DefaultStyle.main2_600 + maximumLineCount: 1 + font: Typography.h4 + Layout.fillWidth: true + } + } + AddParticipantsForm { + id: manageParticipantsLayout + visible: manageParticipants + Layout.fillWidth: true + Layout.fillHeight: true + Layout.topMargin: Math.round(9 * DefaultStyle.dp) + Layout.bottomMargin: Math.round(17 * DefaultStyle.dp) + Layout.alignment: Qt.AlignVCenter + selectedParticipants: mainItem.chatCore.participantsAddresses + focus: true + onVisibleChanged: { + if (visible) + selectedParticipants = mainItem.chatCore.participantsAddresses + } + } + Item { + Layout.fillHeight: true + } + } +}