From edce53b23e611846fb5fbfdbb48db12a5d50bf73 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Thu, 20 Jan 2022 15:47:57 +0100 Subject: [PATCH] - Enable CPIM on basic chat rooms. - Fix layout on reply/vocal preview that could be ahead of chat. - Add a volume monitor when recording a vocal message. --- .../assistant/create-app-sip-account.rc | 1 + .../assets/assistant/use-app-sip-account.rc | 1 + .../src/components/core/CoreManager.cpp | 7 ++ .../src/components/recorder/RecorderModel.cpp | 4 + .../src/components/recorder/RecorderModel.hpp | 1 + linphone-app/src/utils/Constants.hpp | 3 +- .../ui/modules/Linphone/Chat/Chat.qml | 96 +++++++++---------- .../Linphone/Chat/ChatAudioPreview.qml | 12 ++- .../Linphone/Chat/ChatMessagePreview.qml | 6 +- .../Linphone/Chat/ChatReplyPreview.qml | 2 +- linphone-sdk | 2 +- 11 files changed, 78 insertions(+), 57 deletions(-) diff --git a/linphone-app/assets/assistant/create-app-sip-account.rc b/linphone-app/assets/assistant/create-app-sip-account.rc index aa5ce41bc..dd016d96d 100644 --- a/linphone-app/assets/assistant/create-app-sip-account.rc +++ b/linphone-app/assets/assistant/create-app-sip-account.rc @@ -15,6 +15,7 @@ sip.linphone.org message-expires=604800 sip:conference-factory@sip.linphone.org + 1
stun.linphone.org diff --git a/linphone-app/assets/assistant/use-app-sip-account.rc b/linphone-app/assets/assistant/use-app-sip-account.rc index b81cd930a..6a3470d28 100644 --- a/linphone-app/assets/assistant/use-app-sip-account.rc +++ b/linphone-app/assets/assistant/use-app-sip-account.rc @@ -15,6 +15,7 @@ sip.linphone.org message-expires=604800 sip:conference-factory@sip.linphone.org + 1
stun.linphone.org diff --git a/linphone-app/src/components/core/CoreManager.cpp b/linphone-app/src/components/core/CoreManager.cpp index 6ed32b569..41c3752ee 100644 --- a/linphone-app/src/components/core/CoreManager.cpp +++ b/linphone-app/src/components/core/CoreManager.cpp @@ -316,13 +316,20 @@ void CoreManager::migrate () { auto params = account->getParams(); if( params->getDomain() == Constants::LinphoneDomain) { auto newParams = params->clone(); + QString accountIdentity = (newParams->getIdentityAddress() ? newParams->getIdentityAddress()->asString().c_str() : "no-identity"); if( rcVersion < 1) { newParams->setContactParameters(Constants::DefaultContactParameters); newParams->setExpires(Constants::DefaultExpires); + qInfo() << "Migrating " << accountIdentity << " for version 1. contact parameters = " << Constants::DefaultContactParameters << ", expires = " << Constants::DefaultExpires; } if( rcVersion < 2) { newParams->setConferenceFactoryUri(Constants::DefaultConferenceURI); setlimeServerUrl = true; + qInfo() << "Migrating " << accountIdentity << " for version 2. conference factory URI = " << Constants::DefaultConferenceURI; + } + if( rcVersion < 3){ + newParams->enableCpimInBasicChatRoom(true); + qInfo() << "Migrating " << accountIdentity << " for version 3. enable Cpim in basic chat rooms"; } account->setParams(newParams); } diff --git a/linphone-app/src/components/recorder/RecorderModel.cpp b/linphone-app/src/components/recorder/RecorderModel.cpp index 30194e6f2..74d04d1da 100644 --- a/linphone-app/src/components/recorder/RecorderModel.cpp +++ b/linphone-app/src/components/recorder/RecorderModel.cpp @@ -52,6 +52,10 @@ int RecorderModel::getDuration()const{ return mRecorder->getDuration(); } +float RecorderModel::getCaptureVolume()const{ + return mRecorder->getCaptureVolume(); +} + LinphoneEnums::RecorderState RecorderModel::getState() const{ return LinphoneEnums::fromLinphone(mRecorder->getState()); } diff --git a/linphone-app/src/components/recorder/RecorderModel.hpp b/linphone-app/src/components/recorder/RecorderModel.hpp index 6ea1269fc..db9359a07 100644 --- a/linphone-app/src/components/recorder/RecorderModel.hpp +++ b/linphone-app/src/components/recorder/RecorderModel.hpp @@ -40,6 +40,7 @@ public: std::shared_ptr getRecorder(); Q_INVOKABLE int getDuration()const; + Q_INVOKABLE float getCaptureVolume()const; LinphoneEnums::RecorderState getState() const; Q_INVOKABLE QString getFile()const; diff --git a/linphone-app/src/utils/Constants.hpp b/linphone-app/src/utils/Constants.hpp index 35f414a7f..35b4f20c0 100644 --- a/linphone-app/src/utils/Constants.hpp +++ b/linphone-app/src/utils/Constants.hpp @@ -124,7 +124,8 @@ public: static constexpr char VcardScheme[] = EXECUTABLE_NAME "-desktop:/"; static constexpr int CbsCallInterval = 20; static constexpr char RcVersionName[] = "rc_version"; - static constexpr int RcVersionCurrent = 2;// 2 = Conference URI + static constexpr int RcVersionCurrent = 3; // 2 = Conference URI + // 3 = CPIM on basic chat rooms //-------------------------------------------------------------------------------- // CISCO diff --git a/linphone-app/ui/modules/Linphone/Chat/Chat.qml b/linphone-app/ui/modules/Linphone/Chat/Chat.qml index 4dc90d61d..87bdcb65b 100644 --- a/linphone-app/ui/modules/Linphone/Chat/Chat.qml +++ b/linphone-app/ui/modules/Linphone/Chat/Chat.qml @@ -298,11 +298,10 @@ Rectangle { footer: Item{ implicitHeight: composersItem.implicitHeight width: parent.width + visible: composersItem.visible Text { id: composersItem property var composers : container.proxyModel.chatRoomModel.composers - onComposersChanged: console.log(composers) - onVisibleChanged: console.log(visible) color: ChatStyle.composingText.color font.pointSize: ChatStyle.composingText.pointSize height: visible ? undefined : 0 @@ -314,20 +313,58 @@ Rectangle { text:(composers.length==0?'': qsTr('chatTyping','',composers.length).arg(container.proxyModel.getDisplayNameComposers())) } } + + ActionButton{ + id: gotToBottomButton + anchors.bottom: parent.bottom + anchors.bottomMargin: 10 + anchors.right: parent.right + anchors.rightMargin: 40 + visible: chat.isIndexAfter(chat.count-1) + onVisibleChanged: updateMarkAsRead() + Component.onCompleted: updateMarkAsRead() + function updateMarkAsRead(){ + if(!visible) + container.proxyModel.markAsReadEnabled = true + } + + Connections{ + target: container.proxyModel + onMarkAsReadEnabledChanged: if( !container.proxyModel.markAsReadEnabled) + gotToBottomButton.updateMarkAsRead() + } + + isCustom: true + backgroundRadius: width/2 + colorSet: ChatStyle.gotToBottom + onClicked: { + chat.bindToEnd = true + } + MessageCounter{ + anchors.left: parent.right + anchors.bottom: parent.top + anchors.bottomMargin: -5 + anchors.leftMargin: -5 + count: container.proxyModel.chatRoomModel.unreadMessagesCount + } + } - ChatMessagePreview{ + + } + ChatMessagePreview{ id: chatMessagePreview + Layout.fillWidth: true + replyChatRoomModel: proxyModel.chatRoomModel + } Rectangle{ id: messageBlock - height: opacity > 0 ? 32 : 0 - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.leftMargin: ChatStyle.entry.leftMargin - anchors.rightMargin: ChatStyle.entry.leftMargin - anchors.bottomMargin: ChatStyle.entry.bottomMargin + onHeightChanged: height = Layout.preferredHeight + Layout.preferredHeight: visible && opacity > 0 ? 32 : 0 + Layout.fillWidth: true + Layout.leftMargin: ChatStyle.entry.leftMargin + Layout.rightMargin: ChatStyle.entry.rightMargin color: ChatStyle.messageBanner.color radius: 10 state: "hidden" @@ -381,45 +418,6 @@ Rectangle { } ] } - - ActionButton{ - id: gotToBottomButton - anchors.bottom: messageBlock.top - anchors.bottomMargin: 10 - anchors.right: parent.right - anchors.rightMargin: 40 - visible: chat.isIndexAfter(chat.count-1) - onVisibleChanged: updateMarkAsRead() - Component.onCompleted: updateMarkAsRead() - function updateMarkAsRead(){ - if(!visible) - container.proxyModel.markAsReadEnabled = true - } - - Connections{ - target: container.proxyModel - onMarkAsReadEnabledChanged: if( !container.proxyModel.markAsReadEnabled) - gotToBottomButton.updateMarkAsRead() - } - - isCustom: true - backgroundRadius: width/2 - colorSet: ChatStyle.gotToBottom - onClicked: { - chat.bindToEnd = true - } - MessageCounter{ - anchors.left: parent.right - anchors.bottom: parent.top - anchors.bottomMargin: -5 - anchors.leftMargin: -5 - count: container.proxyModel.chatRoomModel.unreadMessagesCount - } - } - - - } - // ------------------------------------------------------------------------- // Send area. // ------------------------------------------------------------------------- diff --git a/linphone-app/ui/modules/Linphone/Chat/ChatAudioPreview.qml b/linphone-app/ui/modules/Linphone/Chat/ChatAudioPreview.qml index 504c85790..74ad98f4e 100644 --- a/linphone-app/ui/modules/Linphone/Chat/ChatAudioPreview.qml +++ b/linphone-app/ui/modules/Linphone/Chat/ChatAudioPreview.qml @@ -28,7 +28,7 @@ Rectangle{ mediaProgressBar.stop() onIsPlayingChanged: isPlaying ? mediaProgressBar.resume() : mediaProgressBar.stop() - Layout.preferredHeight: 70 + Layout.preferredHeight: visible ? 70 : 0 color: ChatAudioPreviewStyle.backgroundColor radius: 0 @@ -64,6 +64,16 @@ Rectangle{ colorSet: ChatAudioPreviewStyle.deleteAction onClicked: RecorderManager.clearVocalRecorder() } + VuMeter { + Timer { + interval: 50 + repeat: true + running: audioPreviewBlock.isRecording + + onTriggered: parent.value = audioPreviewBlock.vocalRecorder.getCaptureVolume() + } + visible: audioPreviewBlock.isRecording + } Item{ Layout.fillHeight: true Layout.fillWidth: true diff --git a/linphone-app/ui/modules/Linphone/Chat/ChatMessagePreview.qml b/linphone-app/ui/modules/Linphone/Chat/ChatMessagePreview.qml index a2a75fb71..d4e3ac716 100644 --- a/linphone-app/ui/modules/Linphone/Chat/ChatMessagePreview.qml +++ b/linphone-app/ui/modules/Linphone/Chat/ChatMessagePreview.qml @@ -16,11 +16,9 @@ import 'Chat.js' as Logic ColumnLayout{ property alias replyChatRoomModel : replyPreview.chatRoomModel property int maxHeight: parent.height - ( audioPreview.visible ? audioPreview.height : 0) - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom spacing: 0 - + Layout.preferredHeight: (replyPreview.visible ? replyPreview.height : 0 ) + (audioPreview.visible ? audioPreview.height : 0) + Layout.maximumHeight: Layout.preferredHeight function hide(){ } ChatReplyPreview{ diff --git a/linphone-app/ui/modules/Linphone/Chat/ChatReplyPreview.qml b/linphone-app/ui/modules/Linphone/Chat/ChatReplyPreview.qml index d4b6728c7..6449e509d 100644 --- a/linphone-app/ui/modules/Linphone/Chat/ChatReplyPreview.qml +++ b/linphone-app/ui/modules/Linphone/Chat/ChatReplyPreview.qml @@ -18,7 +18,7 @@ Rectangle{ id: replyPreviewBlock property ChatRoomModel chatRoomModel - Layout.preferredHeight: Math.min(messageContentsList.height + replyPreviewHeaderArea.implicitHeight + 15, parent.maxHeight) + Layout.preferredHeight: visible ? Math.min(messageContentsList.height + replyPreviewHeaderArea.implicitHeight + 15, parent.maxHeight) : 0 property int leftMargin: textArea.textLeftMargin property int rightMargin: textArea.textRightMargin diff --git a/linphone-sdk b/linphone-sdk index a56c5316d..d69419023 160000 --- a/linphone-sdk +++ b/linphone-sdk @@ -1 +1 @@ -Subproject commit a56c5316dd8b8d53dc5769877446ef8635d0ddeb +Subproject commit d69419023710a53f3a1c946243d3448ca3db5e4c