- 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.
This commit is contained in:
Julien Wadel 2022-01-20 15:47:57 +01:00
parent df28674ced
commit edce53b23e
11 changed files with 78 additions and 57 deletions

View file

@ -15,6 +15,7 @@
<entry name="realm" overwrite="true">sip.linphone.org</entry>
<entry name="contact_parameters" overwrite="true">message-expires=604800</entry>
<entry name="conference_factory_uri" overwrite="true">sip:conference-factory@sip.linphone.org</entry>
<entry name="cpim_in_basic_chat_rooms_enabled" overwrite="true">1</entry>
</section>
<section name="nat_policy_default_values">
<entry name="stun_server" overwrite="true">stun.linphone.org</entry>

View file

@ -15,6 +15,7 @@
<entry name="realm" overwrite="true">sip.linphone.org</entry>
<entry name="contact_parameters" overwrite="true">message-expires=604800</entry>
<entry name="conference_factory_uri" overwrite="true">sip:conference-factory@sip.linphone.org</entry>
<entry name="cpim_in_basic_chat_rooms_enabled" overwrite="true">1</entry>
</section>
<section name="nat_policy_default_values">
<entry name="stun_server" overwrite="true">stun.linphone.org</entry>

View file

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

View file

@ -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());
}

View file

@ -40,6 +40,7 @@ public:
std::shared_ptr<linphone::Recorder> getRecorder();
Q_INVOKABLE int getDuration()const;
Q_INVOKABLE float getCaptureVolume()const;
LinphoneEnums::RecorderState getState() const;
Q_INVOKABLE QString getFile()const;

View file

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

View file

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

View file

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

View file

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

View file

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

@ -1 +1 @@
Subproject commit a56c5316dd8b8d53dc5769877446ef8635d0ddeb
Subproject commit d69419023710a53f3a1c946243d3448ca3db5e4c