Warn the user when the remote is recording the call.

Add a listener to Call.
This commit is contained in:
Julien Wadel 2022-07-11 16:34:10 +02:00
parent 9cd45c6712
commit f52932eb45
24 changed files with 226 additions and 2 deletions

View file

@ -162,6 +162,7 @@ set(SOURCES
src/app/translator/DefaultTranslator.cpp
src/components/assistant/AssistantModel.cpp
src/components/authentication/AuthenticationNotifier.cpp
src/components/call/CallListener.cpp
src/components/call/CallModel.cpp
src/components/calls/CallsListModel.cpp
src/components/calls/CallsListProxyModel.cpp
@ -294,6 +295,7 @@ set(HEADERS
src/app/translator/DefaultTranslator.hpp
src/components/assistant/AssistantModel.hpp
src/components/authentication/AuthenticationNotifier.hpp
src/components/call/CallListener.hpp
src/components/call/CallModel.hpp
src/components/calls/CallsListModel.hpp
src/components/calls/CallsListProxyModel.hpp

View file

@ -3385,6 +3385,11 @@ Klik her: <a href="%1">%1</a>
<extracomment>&apos;Video conference is not ready. Please Wait...&apos; : Waiting message for starting conference.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>callWarningRecord</source>
<extracomment>&apos;This call is being recorded.&apos; : Warn the user that the remote is currently recording the call.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>VideoConferenceFullscreen</name>

View file

@ -3385,6 +3385,11 @@ Klicken Sie hier: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Video conference is not ready. Please Wait...&apos; : Waiting message for starting conference.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>callWarningRecord</source>
<extracomment>&apos;This call is being recorded.&apos; : Warn the user that the remote is currently recording the call.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>VideoConferenceFullscreen</name>

View file

@ -3408,6 +3408,11 @@ Click here: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Video conference is not ready. Please Wait...&apos; : Waiting message for starting conference.</extracomment>
<translation>Video conference is not ready. Please Wait</translation>
</message>
<message>
<source>callWarningRecord</source>
<extracomment>&apos;This call is being recorded.&apos; : Warn the user that the remote is currently recording the call.</extracomment>
<translation>This call is being recorded.</translation>
</message>
</context>
<context>
<name>VideoConferenceFullscreen</name>

View file

@ -3385,6 +3385,11 @@ Haga clic aquí: &lt;a href=&quot;%1&quot;&gt;%1 &lt;/a&gt;
<extracomment>&apos;Video conference is not ready. Please Wait...&apos; : Waiting message for starting conference.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>callWarningRecord</source>
<extracomment>&apos;This call is being recorded.&apos; : Warn the user that the remote is currently recording the call.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>VideoConferenceFullscreen</name>

View file

@ -3385,6 +3385,11 @@ Cliquez ici : &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Video conference is not ready. Please Wait...&apos; : Waiting message for starting conference.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>callWarningRecord</source>
<extracomment>&apos;This call is being recorded.&apos; : Warn the user that the remote is currently recording the call.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>VideoConferenceFullscreen</name>

View file

@ -3372,6 +3372,11 @@ Kattintson ide: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Video conference is not ready. Please Wait...&apos; : Waiting message for starting conference.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>callWarningRecord</source>
<extracomment>&apos;This call is being recorded.&apos; : Warn the user that the remote is currently recording the call.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>VideoConferenceFullscreen</name>

View file

@ -3385,6 +3385,11 @@ Clicca: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Video conference is not ready. Please Wait...&apos; : Waiting message for starting conference.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>callWarningRecord</source>
<extracomment>&apos;This call is being recorded.&apos; : Warn the user that the remote is currently recording the call.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>VideoConferenceFullscreen</name>

View file

@ -3372,6 +3372,11 @@
<extracomment>&apos;Video conference is not ready. Please Wait...&apos; : Waiting message for starting conference.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>callWarningRecord</source>
<extracomment>&apos;This call is being recorded.&apos; : Warn the user that the remote is currently recording the call.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>VideoConferenceFullscreen</name>

View file

@ -3398,6 +3398,11 @@ Spustelėkite čia: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Video conference is not ready. Please Wait...&apos; : Waiting message for starting conference.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>callWarningRecord</source>
<extracomment>&apos;This call is being recorded.&apos; : Warn the user that the remote is currently recording the call.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>VideoConferenceFullscreen</name>

View file

@ -3385,6 +3385,11 @@ Clique aqui: &lt;a href=&quot;%1&quot;&gt;%1 &lt;/a&gt;
<extracomment>&apos;Video conference is not ready. Please Wait...&apos; : Waiting message for starting conference.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>callWarningRecord</source>
<extracomment>&apos;This call is being recorded.&apos; : Warn the user that the remote is currently recording the call.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>VideoConferenceFullscreen</name>

View file

@ -3398,6 +3398,11 @@
<extracomment>&apos;Video conference is not ready. Please Wait...&apos; : Waiting message for starting conference.</extracomment>
<translation>Видеоконференция не готова. Пожалуйста, подождите</translation>
</message>
<message>
<source>callWarningRecord</source>
<extracomment>&apos;This call is being recorded.&apos; : Warn the user that the remote is currently recording the call.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>VideoConferenceFullscreen</name>

View file

@ -3385,6 +3385,11 @@ Klicka här: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Video conference is not ready. Please Wait...&apos; : Waiting message for starting conference.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>callWarningRecord</source>
<extracomment>&apos;This call is being recorded.&apos; : Warn the user that the remote is currently recording the call.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>VideoConferenceFullscreen</name>

View file

@ -3372,6 +3372,11 @@ Buraya tıklayın: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Video conference is not ready. Please Wait...&apos; : Waiting message for starting conference.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>callWarningRecord</source>
<extracomment>&apos;This call is being recorded.&apos; : Warn the user that the remote is currently recording the call.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>VideoConferenceFullscreen</name>

View file

@ -3398,6 +3398,11 @@
<extracomment>&apos;Video conference is not ready. Please Wait...&apos; : Waiting message for starting conference.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>callWarningRecord</source>
<extracomment>&apos;This call is being recorded.&apos; : Warn the user that the remote is currently recording the call.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>VideoConferenceFullscreen</name>

View file

@ -3372,6 +3372,11 @@
<extracomment>&apos;Video conference is not ready. Please Wait...&apos; : Waiting message for starting conference.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>callWarningRecord</source>
<extracomment>&apos;This call is being recorded.&apos; : Warn the user that the remote is currently recording the call.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>VideoConferenceFullscreen</name>

View file

@ -3,3 +3,6 @@ log_collection_upload_server_url=https://www.linphone.org:444/lft.php
[sound]
ec_filter=MSWebRTCAEC
[app]
record_aware=1

View file

@ -0,0 +1,39 @@
/*
* Copyright (c) 2022 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CallListener.hpp"
#include <QQmlApplicationEngine>
#include <algorithm>
#include "CallModel.hpp"
// =============================================================================
// =============================================================================
CallListener::CallListener(QObject* parent) : QObject(parent){
}
void CallListener::onRemoteRecording(const std::shared_ptr<linphone::Call> & call, bool recording){
qDebug() << "onRemoteRecording: " << recording;
emit remoteRecording(call, recording);
}

View file

@ -0,0 +1,46 @@
/*
* Copyright (c) 2022 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CALL_LISTENER_H
#define CALL_LISTENER_H
#include "utils/LinphoneEnums.hpp"
#include <QDateTime>
// =============================================================================
class CallModel;
class CallListener : public QObject, public linphone::CallListener {
Q_OBJECT
public:
CallListener(QObject * parent = nullptr);
virtual ~CallListener(){}
virtual void onRemoteRecording(const std::shared_ptr<linphone::Call> & call, bool recording) override;
signals:
virtual void remoteRecording(const std::shared_ptr<linphone::Call> & call, bool recording);
};
Q_DECLARE_METATYPE(CallListener*)
#endif

View file

@ -25,6 +25,7 @@
#include <QTimer>
#include "app/App.hpp"
#include "CallListener.hpp"
#include "components/calls/CallsListModel.hpp"
#include "components/chat-room/ChatRoomModel.hpp"
#include "components/conference/ConferenceModel.hpp"
@ -49,6 +50,9 @@ using namespace std;
namespace {
constexpr char AutoAnswerObjectName[] = "auto-answer-timer";
}
void CallModel::connectTo(CallListener * listener){
connect(listener, &CallListener::remoteRecording, this, &CallModel::onRemoteRecording);
}
CallModel::CallModel (shared_ptr<linphone::Call> call){
CoreManager *coreManager = CoreManager::getInstance();
@ -60,6 +64,9 @@ CallModel::CallModel (shared_ptr<linphone::Call> call){
mCall->setData("call-model", *this);
updateIsInConference();
if(mCall) {
mCallListener = std::make_shared<CallListener>();
connectTo(mCallListener.get());
mCall->addListener(mCallListener);
mConferenceVideoLayout = LinphoneEnums::fromLinphone(mCall->getParams()->getConferenceVideoLayout());
if(mCall->getConference()){
if( mConferenceVideoLayout == LinphoneEnums::ConferenceLayoutGrid)
@ -70,6 +77,7 @@ CallModel::CallModel (shared_ptr<linphone::Call> call){
settings->setCameraMode(settings->getCallCameraMode());
}
// Deal with auto-answer.
if (!isOutgoing()) {
@ -109,8 +117,10 @@ CallModel::CallModel (shared_ptr<linphone::Call> call){
CallModel::~CallModel () {
mMagicSearch->removeListener(mSearch);
if(mCall)
if(mCall){
mCall->removeListener(mCallListener);
mCall->unsetData("call-model");
}
}
// -----------------------------------------------------------------------------
@ -899,6 +909,14 @@ void CallModel::endCall(){
}
}
bool CallModel::getRemoteRecording() const{
return mCall && mCall->getRemoteParams() && mCall->getRemoteParams()->isRecording();
}
void CallModel::onRemoteRecording(const std::shared_ptr<linphone::Call> & call, bool recording){
emit remoteRecordingChanged(recording);
}
void CallModel::setRemoteDisplayName(const std::string& name){
mRemoteAddress->setDisplayName(name);
if(mCall) {

View file

@ -29,6 +29,7 @@
#include "utils/LinphoneEnums.hpp"
// =============================================================================
class CallListener;
class ConferenceInfoModel;
class ConferenceModel;
class ContactModel;
@ -73,6 +74,7 @@ class CallModel : public QObject {
Q_PROPERTY(bool updating READ getUpdating NOTIFY statusChanged)
Q_PROPERTY(bool recording READ getRecording NOTIFY recordingChanged)
Q_PROPERTY(bool remoteRecording READ getRemoteRecording NOTIFY remoteRecordingChanged)
Q_PROPERTY(bool snapshotEnabled READ getSnapshotEnabled NOTIFY snapshotEnabledChanged) // Grid doesn't enable snapshot
@ -182,6 +184,7 @@ public:
static constexpr int DtmfSoundDelay = 200;
std::shared_ptr<linphone::Call> mCall;
std::shared_ptr<CallListener> mCallListener; // This is passed to linpĥone object and must be in shared_ptr
std::shared_ptr<linphone::Address> mRemoteAddress;
std::shared_ptr<linphone::MagicSearch> mMagicSearch;
@ -189,6 +192,7 @@ public slots:
// Set remote display name when a search has been done
void searchReceived(std::list<std::shared_ptr<linphone::SearchResult>> results);
void endCall();
void onRemoteRecording(const std::shared_ptr<linphone::Call> & call, bool recording);
signals:
void callErrorChanged (const QString &callError);
@ -201,6 +205,7 @@ signals:
void microMutedChanged (bool status);
void cameraEnabledChanged();
void recordingChanged (bool status);
void remoteRecordingChanged(bool status);
void snapshotEnabledChanged();
void statsUpdated ();
void statusChanged (CallStatus status);
@ -216,6 +221,7 @@ signals:
void conferenceVideoLayoutChanged();
public:
void handleCallEncryptionChanged (const std::shared_ptr<linphone::Call> &call);
void handleCallStateChanged (const std::shared_ptr<linphone::Call> &call, linphone::Call::State state);
@ -262,6 +268,7 @@ public:
bool getUpdating () const;
bool getRecording () const;
bool getRemoteRecording() const;
bool getSnapshotEnabled() const;
CallEncryption getEncryption () const;
@ -289,6 +296,8 @@ public:
static QString generateSavedFilename (const QString &from, const QString &to);
private:
void connectTo(CallListener * listener);
bool mIsInConference = false;
bool mPausedByRemote = false;

View file

@ -280,6 +280,7 @@ void CoreManager::createLinphoneCore (const QString &configPath) {
setDatabasesPaths();
setOtherPaths();
mCore->enableFriendListSubscription(true);
mCore->enableRecordAware(true);
}
void CoreManager::updateUserAgent(){

View file

@ -331,6 +331,7 @@ Rectangle {
// Security
ActionButton{
id: securityButton
visible: callModel && !callModel.isConference
anchors.left: parent.left
anchors.verticalCenter: actionsButtons.verticalCenter
@ -346,6 +347,30 @@ Rectangle {
tooltipText: Logic.makeReadableSecuredString(callModel.securedString)
}
RowLayout{
visible: callModel.remoteRecording
anchors.verticalCenter: actionsButtons.verticalCenter
anchors.left: securityButton.right
anchors.leftMargin: 20
anchors.right: actionsButtons.left
anchors.rightMargin: 10
Icon{
icon: VideoConferenceStyle.recordWarning.icon
iconSize: VideoConferenceStyle.recordWarning.iconSize
overwriteColor: VideoConferenceStyle.recordWarning.iconColor
}
Text{
Layout.fillWidth: true
//: 'This call is being recorded.' : Warn the user that the remote is currently recording the call.
text: qsTr('callWarningRecord')
color: VideoConferenceStyle.recordWarning.color
font.italic: true
font.pointSize: VideoConferenceStyle.recordWarning.pointSize
wrapMode: Text.WordWrap
}
}
// Action buttons
RowLayout{
id: actionsButtons

View file

@ -18,7 +18,13 @@ QtObject {
property int pointSize: Units.dp * 12
property int addressPointSize: Units.dp * 10
}
property QtObject recordWarning: QtObject{
property string icon: 'record_custom'
property color iconColor: ColorsList.add(sectionName+'_warning', 'i').color
property int iconSize: 30
property color color: ColorsList.add(sectionName+'_warning_fg', 'q').color
property int pointSize: Units.dp * 9
}
property QtObject grid: QtObject {
property int spacing: 5