fix #LINQT-1250 call group form ui

This commit is contained in:
Gaelle Braud 2024-09-30 14:40:54 +02:00
parent 651ddd35d5
commit b853747c19
3 changed files with 157 additions and 134 deletions

View file

@ -58,7 +58,8 @@ ListView {
signal contactStarredChanged() signal contactStarredChanged()
signal contactDeletionRequested(FriendGui contact) signal contactDeletionRequested(FriendGui contact)
signal contactAddedToSelection() signal contactAddedToSelection(string address)
signal contactRemovedFromSelection(string address)
signal clicked() signal clicked()
function selectContact(address) { function selectContact(address) {
@ -73,15 +74,25 @@ ListView {
var indexInSelection = selectedContacts.indexOf(address) var indexInSelection = selectedContacts.indexOf(address)
if (indexInSelection == -1) { if (indexInSelection == -1) {
selectedContacts.push(address) selectedContacts.push(address)
contactAddedToSelection() contactAddedToSelection(address)
} }
} }
} }
function removeContactFromSelection(indexInSelection) { function removeContactFromSelection(indexInSelection) {
var addressToRemove = selectedContacts[indexInSelection]
if (indexInSelection != -1) { if (indexInSelection != -1) {
selectedContacts.splice(indexInSelection, 1) selectedContacts.splice(indexInSelection, 1)
contactRemovedFromSelection(addressToRemove)
} }
} }
function removeSelectedContactByAddress(address) {
var index = selectedContacts.indexOf(address)
if (index != -1) {
selectedContacts.splice(index, 1)
contactRemovedFromSelection(address)
}
}
onActiveFocusChanged: if(activeFocus && (!footerItem || !footerItem.activeFocus)) { onActiveFocusChanged: if(activeFocus && (!footerItem || !footerItem.activeFocus)) {
currentIndex = 0 currentIndex = 0
} }
@ -159,6 +170,7 @@ ListView {
id: contactDelegate id: contactDelegate
anchors.left: initial.visible ? initial.right : parent.left anchors.left: initial.visible ? initial.right : parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 5 * DefaultStyle.dp
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
spacing: 16 * DefaultStyle.dp spacing: 16 * DefaultStyle.dp
z: 1 z: 1
@ -189,6 +201,12 @@ ListView {
} }
} }
} }
Item{Layout.fillWidth: true}
RowLayout {
id: actionsRow
z: 1
visible: actionButtons || friendPopup.visible || mainItem.multiSelectionEnabled
spacing: visible ? 16 * DefaultStyle.dp : 0
EffectImage { EffectImage {
id: isSelectedCheck id: isSelectedCheck
// visible: mainItem.multiSelectionEnabled && (mainItem.confInfoGui.core.getParticipantIndex(modelData.core.defaultAddress) != -1) // visible: mainItem.multiSelectionEnabled && (mainItem.confInfoGui.core.getParticipantIndex(modelData.core.defaultAddress) != -1)
@ -203,18 +221,10 @@ ListView {
function onSelectedContactCountChanged(){ isSelectedCheck.visible = (mainItem.selectedContacts.indexOf(modelData.core.defaultAddress) != -1)} function onSelectedContactCountChanged(){ isSelectedCheck.visible = (mainItem.selectedContacts.indexOf(modelData.core.defaultAddress) != -1)}
} }
} }
Item{Layout.fillWidth: true}
RowLayout {
id: actionsRow
z: 1
// anchors.right: parent.right
Layout.rightMargin: 5 * DefaultStyle.dp
// anchors.verticalCenter: parent.verticalCenter
spacing: 16 * DefaultStyle.dp
RowLayout{ RowLayout{
id: actionButtons id: actionButtons
visible: mainItem.actionLayoutVisible visible: mainItem.actionLayoutVisible
spacing: 10 * DefaultStyle.dp spacing: visible ? 10 * DefaultStyle.dp : 0
Button { Button {
id: callButton id: callButton
Layout.preferredWidth: 45 * DefaultStyle.dp Layout.preferredWidth: 45 * DefaultStyle.dp

View file

@ -10,11 +10,9 @@ FocusScope{
id: mainItem id: mainItem
property string placeHolderText: qsTr("Rechercher des contacts") property string placeHolderText: qsTr("Rechercher des contacts")
property list<string> selectedParticipants: contactList.selectedContacts property list<string> selectedParticipants: suggestionList.selectedContacts
property int selectedParticipantsCount: selectedParticipants.length property int selectedParticipantsCount: selectedParticipants.length
property ConferenceInfoGui conferenceInfoGui property ConferenceInfoGui conferenceInfoGui
property bool nameGroupCall: false
readonly property string groupName: groupCallName.text
property color searchBarColor: DefaultStyle.grey_100 property color searchBarColor: DefaultStyle.grey_100
property color searchBarBorderColor: "transparent" property color searchBarBorderColor: "transparent"
@ -26,46 +24,15 @@ FocusScope{
ColumnLayout { ColumnLayout {
anchors.fill: parent anchors.fill: parent
spacing: 15 * DefaultStyle.dp spacing: 15 * DefaultStyle.dp
ColumnLayout {
visible: mainItem.nameGroupCall
spacing: 5 * DefaultStyle.dp
Layout.rightMargin: 38 * DefaultStyle.dp
RowLayout {
spacing: 0
Text {
font.pixelSize: 13 * DefaultStyle.dp
font.weight: 700 * DefaultStyle.dp
text: qsTr("Nom du groupe")
}
Item{Layout.fillWidth: true}
Text {
font.pixelSize: 12 * DefaultStyle.dp
font.weight: 300 * DefaultStyle.dp
text: qsTr("Requis")
}
}
TextField {
id: groupCallName
Layout.fillWidth: true
Layout.preferredHeight: 49 * DefaultStyle.dp
focus: mainItem.nameGroupCall
KeyNavigation.down: participantList.count > 0 ? participantList : searchbar
Keys.onPressed: (event) => {
if(currentIndex <=0 && event.key == Qt.Key_Up){
nextItemInFocusChain(false).forceActiveFocus()
}
}
}
}
ListView { ListView {
id: participantList id: participantList
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: contentHeight Layout.preferredHeight: contentHeight
Layout.maximumHeight: mainItem.height / 3 Layout.maximumHeight: mainItem.height / 3
width: mainItem.width width: mainItem.width
model: contactList.selectedContacts model: suggestionList.selectedContacts
clip: true clip: true
focus: !groupCallName.visible && participantList.count > 0 focus: participantList.count > 0
Keys.onPressed: (event) => { Keys.onPressed: (event) => {
if(currentIndex <=0 && event.key == Qt.Key_Up){ if(currentIndex <=0 && event.key == Qt.Key_Up){
nextItemInFocusChain(false).forceActiveFocus() nextItemInFocusChain(false).forceActiveFocus()
@ -100,7 +67,7 @@ FocusScope{
icon.height: 24 * DefaultStyle.dp icon.height: 24 * DefaultStyle.dp
focus: true focus: true
contentImageColor: DefaultStyle.main1_500_main contentImageColor: DefaultStyle.main1_500_main
onClicked: contactList.selectedContacts.splice(index, 1) onClicked: suggestionList.removeSelectedContactByAddress(modelData)
} }
} }
} }
@ -120,17 +87,37 @@ FocusScope{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 6 * DefaultStyle.dp Layout.topMargin: 6 * DefaultStyle.dp
Layout.rightMargin: 28 * DefaultStyle.dp Layout.rightMargin: 28 * DefaultStyle.dp
Layout.preferredHeight: 45 * DefaultStyle.dp
placeholderText: mainItem.placeHolderText placeholderText: mainItem.placeHolderText
focus: !groupCallName.visible && participantList.count == 0 focus: participantList.count == 0
color: mainItem.searchBarColor color: mainItem.searchBarColor
borderColor: mainItem.searchBarColor borderColor: mainItem.searchBarColor
KeyNavigation.up: participantList.count > 0 KeyNavigation.up: participantList.count > 0
? participantList ? participantList
: groupCallName.visible
? groupCallName
: nextItemInFocusChain(false) : nextItemInFocusChain(false)
KeyNavigation.down: contactList KeyNavigation.down: contactList
} }
Flickable {
Layout.fillWidth: true
Layout.fillHeight: true
contentWidth: width
contentHeight: content.height
clip: true
Control.ScrollBar.vertical: ScrollBar {
id: contactsScrollBar
active: true
interactive: true
policy: Control.ScrollBar.AsNeeded
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.rightMargin: 8 * DefaultStyle.dp
}
ColumnLayout {
id: content
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: contactsScrollBar.implicitWidth + 12 * DefaultStyle.dp
Text { Text {
Layout.topMargin: 6 * DefaultStyle.dp Layout.topMargin: 6 * DefaultStyle.dp
text: qsTr("Contacts") text: qsTr("Contacts")
@ -143,47 +130,48 @@ FocusScope{
id: contactList id: contactList
visible: contentHeight > 0 || searchbar.text.length > 0 visible: contentHeight > 0 || searchbar.text.length > 0
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true // Layout.fillHeight: true
Layout.topMargin: 8 * DefaultStyle.dp Layout.topMargin: 8 * DefaultStyle.dp
Layout.rightMargin: 8 * DefaultStyle.dp
Layout.preferredHeight: contentHeight Layout.preferredHeight: contentHeight
multiSelectionEnabled: true multiSelectionEnabled: true
contactMenuVisible: false contactMenuVisible: false
confInfoGui: mainItem.conferenceInfoGui confInfoGui: mainItem.conferenceInfoGui
searchBarText: searchbar.text searchBarText: searchbar.text
onContactAddedToSelection: participantList.positionViewAtEnd() onContactAddedToSelection: (address) => {
headerPositioning: ListView.InlineHeader suggestionList.addContactToSelection(address)
header: MouseArea { }
onClicked: contactList.addContactToSelection(sipAddr.text) onContactRemovedFromSelection: (address) => suggestionList.removeSelectedContactByAddress(address)
visible: searchbar.text.length > 0 Control.ScrollBar.vertical.visible: false
height: searchbar.text.length > 0 ? 56 * DefaultStyle.dp : 0
width: contactList.width
RowLayout {
Layout.fillWidth: true
spacing: 10 * DefaultStyle.dp
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: 30 * DefaultStyle.dp
anchors.left: parent.left
Avatar {
Layout.preferredWidth: 45 * DefaultStyle.dp
Layout.preferredHeight: 45 * DefaultStyle.dp
_address: sipAddr.text
} }
ColumnLayout {
spacing: 0
Text { Text {
id: sipAddr Layout.topMargin: 6 * DefaultStyle.dp
property string _text: UtilsCpp.interpretUrl(searchbar.text) text: qsTr("Suggestions")
text: SettingsCpp.onlyDisplaySipUriUsername ? UtilsCpp.getUsername(_text) : _text font {
font.pixelSize: 14 * DefaultStyle.dp pixelSize: 16 * DefaultStyle.dp
weight: 800 * DefaultStyle.dp
} }
} }
ContactListView {
id: suggestionList
Layout.fillWidth: true
Layout.fillHeight: true
Layout.preferredHeight: contentHeight
contactMenuVisible: false
searchBarText: searchbar.text
sourceFlags: LinphoneEnums.MagicSearchSource.All
multiSelectionEnabled: true
onContactAddedToSelection: (address) => {
contactList.addContactToSelection(address)
participantList.positionViewAtEnd()
}
onContactRemovedFromSelection: (address) => contactList.removeSelectedContactByAddress(address)
Control.ScrollBar.vertical.visible: false
}
} }
} }
} // Item {
Item { // Layout.fillHeight: true
Layout.fillHeight: true // }
}
} }
} }

View file

@ -602,22 +602,46 @@ AbstractMainPage {
Component { Component {
id: groupCallItem id: groupCallItem
FocusScope{ FocusScope{
width: parent?.width
height: parent?.height
Control.StackView.onActivated: { Control.StackView.onActivated: {
titleLoader.sourceComponent = groupCallTitle titleLoader.sourceComponent = groupCallTitle
addParticipantsLayout.forceActiveFocus() addParticipantsLayout.forceActiveFocus()
} }
ColumnLayout {
spacing: 5 * DefaultStyle.dp
anchors.fill: parent
RowLayout {
spacing: 0
Layout.rightMargin: 38 * DefaultStyle.dp
Text {
font.pixelSize: 13 * DefaultStyle.dp
font.weight: 700 * DefaultStyle.dp
text: qsTr("Nom du groupe")
}
Item{Layout.fillWidth: true}
Text {
font.pixelSize: 12 * DefaultStyle.dp
font.weight: 300 * DefaultStyle.dp
text: qsTr("Requis")
}
}
TextField {
id: groupCallName
Layout.fillWidth: true
Layout.rightMargin: 38 * DefaultStyle.dp
Layout.preferredHeight: 49 * DefaultStyle.dp
focus: true
KeyNavigation.down: addParticipantsLayout//participantList.count > 0 ? participantList : searchbar
}
AddParticipantsForm { AddParticipantsForm {
id: addParticipantsLayout id: addParticipantsLayout
anchors.fill: parent Layout.fillWidth: true
Layout.fillHeight: true
onSelectedParticipantsCountChanged: mainItem.selectedParticipantsCount = selectedParticipantsCount onSelectedParticipantsCountChanged: mainItem.selectedParticipantsCount = selectedParticipantsCount
nameGroupCall: true
focus: true focus: true
Connections { Connections {
target: mainItem target: mainItem
function onStartGroupCallRequested() { function onStartGroupCallRequested() {
if (groupName.length === 0) { if (groupCallName.text.length === 0) {
UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("Un nom doit être donné à l'appel de groupe"), false) UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("Un nom doit être donné à l'appel de groupe"), false)
} else if(!mainItem.isRegistered) { } else if(!mainItem.isRegistered) {
UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("Vous n'etes pas connecté"), false) UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("Vous n'etes pas connecté"), false)
@ -625,7 +649,7 @@ AbstractMainPage {
mainItem.confInfoGui = Qt.createQmlObject('import Linphone mainItem.confInfoGui = Qt.createQmlObject('import Linphone
ConferenceInfoGui{ ConferenceInfoGui{
}', mainItem) }', mainItem)
mainItem.confInfoGui.core.subject = addParticipantsLayout.groupName mainItem.confInfoGui.core.subject = groupCallName.text
mainItem.confInfoGui.core.isScheduled = false mainItem.confInfoGui.core.isScheduled = false
mainItem.confInfoGui.core.addParticipants(addParticipantsLayout.selectedParticipants) mainItem.confInfoGui.core.addParticipants(addParticipantsLayout.selectedParticipants)
mainItem.confInfoGui.core.save() mainItem.confInfoGui.core.save()
@ -635,6 +659,7 @@ AbstractMainPage {
} }
} }
} }
}
Component{ Component{
id: emptySelection id: emptySelection