Refactor and reposition participant management in group chat room

This commit is contained in:
Christophe Deschamps 2025-06-23 16:10:47 +02:00
parent 4a1f1a895b
commit 54a3501ddf
7 changed files with 124 additions and 110 deletions

View file

@ -3111,16 +3111,6 @@ Error</extracomment>
</context>
<context>
<name>GroupConversationInfos</name>
<message>
<location filename="../../view/Page/Layout/Chat/GroupConversationInfos.qml" line="178"/>
<source>group_infos_manage_participants</source>
<translation>Participants</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Chat/GroupConversationInfos.qml" line="189"/>
<source>group_infos_participants_edit_apply</source>
<translation>Apply</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Chat/GroupConversationInfos.qml" line="130"/>
<source>group_infos_call</source>
@ -6630,4 +6620,14 @@ Failed to create 1-1 conversation with %1 !</extracomment>
<translation>Ok</translation>
</message>
</context>
<context>
<name>ManageParticipants</name>
<message>
<location filename="../../view/Page/Layout/Chat/ManageParticipants.qml"/>
<source>group_infos_manage_participants</source>
<extracomment>Participants</extracomment>
<translation>Participants</translation>
</message>
</context>
</TS>

View file

@ -3034,16 +3034,6 @@ Only your correspondent can decrypt them.</translation>
</context>
<context>
<name>GroupConversationInfos</name>
<message>
<location filename="../../view/Page/Layout/Chat/GroupConversationInfos.qml" line="178"/>
<source>group_infos_manage_participants</source>
<translation>Participants</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Chat/GroupConversationInfos.qml" line="189"/>
<source>group_infos_participants_edit_apply</source>
<translation>Apply</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Chat/GroupConversationInfos.qml" line="130"/>
<source>group_infos_call</source>
@ -6527,4 +6517,13 @@ Failed to create 1-1 conversation with %1 !</extracomment>
<translation>Ok</translation>
</message>
</context>
<context>
<name>ManageParticipants</name>
<message>
<location filename="../../view/Page/Layout/Chat/ManageParticipants.qml"/>
<source>group_infos_manage_participants</source>
<extracomment>Participants</extracomment>
<translation>Participants</translation>
</message>
</context>
</TS>

View file

@ -3034,16 +3034,6 @@ en bout. Seul votre correspondant peut les déchiffrer.</translation>
</context>
<context>
<name>GroupConversationInfos</name>
<message>
<location filename="../../view/Page/Layout/Chat/GroupConversationInfos.qml" line="178"/>
<source>group_infos_manage_participants</source>
<translation>Participants</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Chat/GroupConversationInfos.qml" line="189"/>
<source>group_infos_participants_edit_apply</source>
<translation>Appliquer</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Chat/GroupConversationInfos.qml" line="130"/>
<source>group_infos_call</source>
@ -6522,4 +6512,15 @@ Failed to create 1-1 conversation with %1 !</extracomment>
<translation>Ok</translation>
</message>
</context>
<context>
<name>ManageParticipants</name>
<message>
<location filename="../../view/Page/Layout/Chat/ManageParticipants.qml"/>
<source>group_infos_manage_participants</source>
<extracomment>Participants</extracomment>
<translation>Participants</translation>
</message>
</context>
</TS>

View file

@ -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

View file

@ -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
}
}
}
}
}

View file

@ -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)

View file

@ -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
}
}
}