From 67c75e4595569d7fb2d9754c60cfa5800b996d38 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Wed, 1 Sep 2021 13:23:35 +0200 Subject: [PATCH] - On chat group creation : create a conference - Red leave event - Remove hybrid design chat room/group chat - Remove group info menu entry for one to tone - Remove dots menu if empty - Remove chat edition when left --- .../src/components/calls/CallsListModel.cpp | 2 +- .../modules/Common/Form/DroppableTextArea.qml | 12 +++------ .../ui/modules/Linphone/Chat/Chat.qml | 2 +- .../ui/modules/Linphone/Chat/Notice.qml | 9 ++++--- .../ui/modules/Linphone/Contact/Contact.qml | 2 +- .../ui/modules/Linphone/Timeline/Timeline.qml | 2 +- .../ui/views/App/Main/Conversation.qml | 26 ++++++++++++++----- 7 files changed, 32 insertions(+), 23 deletions(-) diff --git a/linphone-app/src/components/calls/CallsListModel.cpp b/linphone-app/src/components/calls/CallsListModel.cpp index 5c920ee5c..e4f969160 100644 --- a/linphone-app/src/components/calls/CallsListModel.cpp +++ b/linphone-app/src/components/calls/CallsListModel.cpp @@ -325,7 +325,7 @@ QVariantMap CallsListModel::createChatRoom(const QString& subject, const int& se params->setEncryptionBackend(linphone::ChatRoomEncryptionBackend::Lime); }else params->setBackend(linphone::ChatRoomBackend::Basic); - params->enableGroup(chatRoomParticipants.size() > 1); + params->enableGroup( subject!="" ); if(chatRoomParticipants.size() > 0) { diff --git a/linphone-app/ui/modules/Common/Form/DroppableTextArea.qml b/linphone-app/ui/modules/Common/Form/DroppableTextArea.qml index 843cac43c..81113de32 100644 --- a/linphone-app/ui/modules/Common/Form/DroppableTextArea.qml +++ b/linphone-app/ui/modules/Common/Form/DroppableTextArea.qml @@ -62,6 +62,7 @@ Item { enabled: droppableTextArea.dropEnabled icon: 'attachment' iconSize: DroppableTextAreaStyle.fileChooserButton.size + visible: droppableTextArea.enabled onClicked: fileDialog.open() @@ -85,7 +86,7 @@ Item { } // Record audio ActionButton { - visible:false // TODO + visible:false && droppableTextArea.enabled// TODO id: recordAudioButton //anchors.verticalCenter: parent.verticalCenter @@ -193,14 +194,7 @@ Item { Layout.rightMargin: DroppableTextAreaStyle.fileChooserButton.margins+15 Layout.leftMargin: 10 Layout.alignment: Qt.AlignVCenter - //anchors.verticalCenter: parent.verticalCenter - /*{ - right: parent.right - rightMargin: scrollBar.width + - DroppableTextAreaStyle.fileChooserButton.margins - verticalCenter: parent.verticalCenter - }*/ - //enabled: droppableTextArea.dropEnabled + visible: droppableTextArea.enabled icon: 'send' iconSize: DroppableTextAreaStyle.fileChooserButton.size useStates:false diff --git a/linphone-app/ui/modules/Linphone/Chat/Chat.qml b/linphone-app/ui/modules/Linphone/Chat/Chat.qml index 0819e75e1..97677b362 100644 --- a/linphone-app/ui/modules/Linphone/Chat/Chat.qml +++ b/linphone-app/ui/modules/Linphone/Chat/Chat.qml @@ -245,7 +245,7 @@ Rectangle { borderColor: ChatStyle.sendArea.border.color topWidth: ChatStyle.sendArea.border.width - visible: SettingsModel.chatEnabled + visible: SettingsModel.chatEnabled && !proxyModel.chatRoomModel.hasBeenLeft DroppableTextArea { id: textArea diff --git a/linphone-app/ui/modules/Linphone/Chat/Notice.qml b/linphone-app/ui/modules/Linphone/Chat/Notice.qml index 21240cc8f..584214ecf 100644 --- a/linphone-app/ui/modules/Linphone/Chat/Notice.qml +++ b/linphone-app/ui/modules/Linphone/Chat/Notice.qml @@ -75,19 +75,20 @@ RowLayout{ return qsTr('conferenceEphemeralMessageDisabledEvent'); } if (status == LinphoneEnums.EventLogTypeConferenceSubjectChanged) { - //: 'New subject : %1' : Little message to show on the event when the subject of the chat romm has been changed. %1 is the new subject. + //: 'New subject : %1' : Little message to show on the event when the subject of the chat room has been changed. %1 is the new subject. return qsTr('conferenceSubjectChangedEvent'); } return 'unknown_notice' } + property bool isImportant : $chatEntry.status == ChatNoticeModel.NoticeError || $chatEntry.eventLogType == LinphoneEnums.EventLogTypeConferenceTerminated Layout.preferredHeight: ChatStyle.entry.lineHeight spacing: ChatStyle.entry.message.extraContent.spacing Rectangle{ height:1 Layout.fillWidth: true - color:( $chatEntry.status == ChatNoticeModel.NoticeError ? '#FF0000' : '#979797' ) + color:( isImportant ? '#FF0000' : '#979797' ) } Text { @@ -102,7 +103,7 @@ RowLayout{ } Layout.preferredWidth: contentWidth id:message - color:( $chatEntry.status == ChatNoticeModel.NoticeError ? '#FF0000' : '#979797' ) + color:( isImportant ? '#FF0000' : '#979797' ) font { //bold: true pointSize: Units.dp * 7 @@ -117,6 +118,6 @@ RowLayout{ Rectangle{ height:1 Layout.fillWidth: true - color:( $chatEntry.status == ChatNoticeModel.NoticeError ? '#FF0000' : '#979797' ) + color:( isImportant ? '#FF0000' : '#979797' ) } } diff --git a/linphone-app/ui/modules/Linphone/Contact/Contact.qml b/linphone-app/ui/modules/Linphone/Contact/Contact.qml index cb67b1ceb..8e5bc2049 100644 --- a/linphone-app/ui/modules/Linphone/Contact/Contact.qml +++ b/linphone-app/ui/modules/Linphone/Contact/Contact.qml @@ -83,7 +83,7 @@ Rectangle { icon:'chat_room' iconSize: ContactStyle.contentHeight - visible: entry!=undefined && entry.isOneToOne!=undefined && !entry.isOneToOne && entry.participants.count > 2 + visible: entry!=undefined && entry.isOneToOne!=undefined && !entry.isOneToOne Icon{ anchors.right: parent.right diff --git a/linphone-app/ui/modules/Linphone/Timeline/Timeline.qml b/linphone-app/ui/modules/Linphone/Timeline/Timeline.qml index 47fd4f54c..7b90ef769 100644 --- a/linphone-app/ui/modules/Linphone/Timeline/Timeline.qml +++ b/linphone-app/ui/modules/Linphone/Timeline/Timeline.qml @@ -142,7 +142,7 @@ Rectangle { CheckBoxText { id:simpleFilter //: 'Simple rooms' : Filter item - //~ Mode Selecting it will show all simple romms + //~ Mode Selecting it will show all simple rooms text:qsTr('timelineFilterSimpleRooms') property var value : (checked?TimelineProxyModel.SimpleChatRoom:0) onValueChanged: timeline.model.filterFlags = filterChoices.getFilterFlags() diff --git a/linphone-app/ui/views/App/Main/Conversation.qml b/linphone-app/ui/views/App/Main/Conversation.qml index 7c75982e9..54ee317cf 100644 --- a/linphone-app/ui/views/App/Main/Conversation.qml +++ b/linphone-app/ui/views/App/Main/Conversation.qml @@ -86,7 +86,7 @@ ColumnLayout { icon:'chat_room' iconSize: ConversationStyle.bar.groupChatSize - visible: conversation.haveMoreThanOneParticipants + visible: !chatRoomModel.isOneToOne } Item{ Layout.fillHeight: true @@ -156,9 +156,11 @@ ColumnLayout { } onUsernameClicked: { + if(!conversation.hasBeenLeft) { usernameEdit.visible = !usernameEdit.visible usernameEdit.forceActiveFocus() } + } } Item{ Layout.fillHeight: true @@ -173,6 +175,7 @@ ColumnLayout { iconSize:30 MouseArea{ anchors.fill:parent + visible: !conversation.hasBeenLeft onClicked : { window.detachVirtualWindow() window.attachVirtualWindow(Qt.resolvedUrl('Dialogs/InfoEncryption.qml') @@ -254,7 +257,7 @@ ColumnLayout { ActionButton { icon: 'group_chat' - visible: SettingsModel.outgoingCallsEnabled && conversation.haveMoreThanOneParticipants && conversation.haveLessThanMinParticipantsForCall + visible: SettingsModel.outgoingCallsEnabled && conversation.haveMoreThanOneParticipants && conversation.haveLessThanMinParticipantsForCall && !conversation.hasBeenLeft //onClicked: CallsListModel.launchAudioCall(conversation.chatRoomModel) onClicked: Logic.openConferenceManager({chatRoomModel:conversation.chatRoomModel, autoCall:true}) @@ -296,6 +299,8 @@ ColumnLayout { id:dotButton icon: 'menu_vdots' iconSize: ConversationStyle.bar.actions.edit.iconSize + visible: conversationMenu.showGroupInfo || conversationMenu.showDevices || conversationMenu.showEphemerals + //autoIcon: true onClicked: { @@ -309,12 +314,19 @@ ColumnLayout { x:mainBar.width-width y:mainBar.height menuStyle : MenuStyle.aux2 + + property bool showGroupInfo: !chatRoomModel.isOneToOne + property bool showDevices : conversation.securityLevel != 1 + property bool showEphemerals: conversation.securityLevel != 1 && chatRoomModel.isMeAdmin + MenuItem{ + id:groupInfoMenu //: 'Group information' : Item menu to get information about the chat room text: qsTr('conversationMenuGroupInformations') iconMenu: (hovered ? 'menu_infos_selected' : 'menu_infos') iconSizeMenu: 25 menuItemStyle : MenuItemStyle.aux2 + visible: conversationMenu.showGroupInfo onTriggered: { window.detachVirtualWindow() window.attachVirtualWindow(Qt.resolvedUrl('Dialogs/InfoChatRoom.qml') @@ -322,17 +334,18 @@ ColumnLayout { } } Rectangle{ + id: separator1 height:1 width:parent.width color:Colors.u.color - visible: devicesMenuItem.visible + visible: groupInfoMenu.visible && devicesMenuItem.visible } MenuItem{ id: devicesMenuItem //: "Conversation's devices" : Item menu to get all participant devices of the chat room text: qsTr('conversationMenuDevices') iconMenu: (hovered ? 'menu_devices_selected' : 'menu_devices' ) - visible: conversation.securityLevel != 1 + visible: conversationMenu.showDevices iconSizeMenu: 25 menuItemStyle : MenuItemStyle.aux2 onTriggered: { @@ -342,10 +355,11 @@ ColumnLayout { } } Rectangle{ + id: separator2 height:1 width:parent.width color:Colors.u.color - visible: ephemeralMenuItem.visible + visible: ephemeralMenuItem.visible && (groupInfoMenu.visible || devicesMenuItem.visible) } MenuItem{ id: ephemeralMenuItem @@ -354,7 +368,7 @@ ColumnLayout { iconMenu: (hovered ? 'menu_ephemeral_selected' : 'menu_ephemeral') iconSizeMenu: 25 menuItemStyle : MenuItemStyle.aux2 - visible: conversation.securityLevel != 1 && chatRoomModel.isMeAdmin + visible: conversationMenu.showEphemerals onTriggered: { window.detachVirtualWindow() window.attachVirtualWindow(Qt.resolvedUrl('Dialogs/EphemeralChatRoom.qml')