leave/enter conference + fix call paused by remote

This commit is contained in:
Gaelle Braud 2024-06-14 12:16:44 +02:00
parent b0169bece9
commit 3d0fe1a732
12 changed files with 80 additions and 64 deletions

View file

@ -441,10 +441,6 @@ void CallCore::setIsSecured(bool secured) {
}
}
bool CallCore::isConference() const {
return mIsConference;
}
ConferenceGui *CallCore::getConferenceGui() const {
return mConference ? new ConferenceGui(mConference) : nullptr;
}
@ -463,6 +459,10 @@ void CallCore::setConference(const QSharedPointer<ConferenceCore> &conference) {
}
}
bool CallCore::isConference() const {
return mIsConference;
}
QString CallCore::getLocalSas() {
return mLocalSas;
}

View file

@ -46,7 +46,6 @@ class CallCore : public QObject, public AbstractObject {
Q_PROPERTY(QString peerAddress READ getPeerAddress CONSTANT)
Q_PROPERTY(QString localAddress READ getLocalAddress CONSTANT)
Q_PROPERTY(bool isSecured READ isSecured NOTIFY securityUpdated)
Q_PROPERTY(bool isConference READ isConference NOTIFY conferenceChanged)
Q_PROPERTY(LinphoneEnums::MediaEncryption encryption READ getEncryption NOTIFY securityUpdated)
Q_PROPERTY(QString localSas READ getLocalSas WRITE setLocalSas MEMBER mLocalSas NOTIFY localSasChanged)
Q_PROPERTY(QString remoteSas WRITE setRemoteSas MEMBER mRemoteSas NOTIFY remoteSasChanged)
@ -64,6 +63,7 @@ class CallCore : public QObject, public AbstractObject {
Q_PROPERTY(float microVolume READ getMicrophoneVolume WRITE setMicrophoneVolume NOTIFY microphoneVolumeChanged)
Q_PROPERTY(LinphoneEnums::CallState transferState READ getTransferState NOTIFY transferStateChanged)
Q_PROPERTY(ConferenceGui *conference READ getConferenceGui NOTIFY conferenceChanged)
Q_PROPERTY(bool isConference READ isConference NOTIFY conferenceChanged)
Q_PROPERTY(LinphoneEnums::ConferenceLayout conferenceVideoLayout READ getConferenceVideoLayout WRITE
lSetConferenceVideoLayout NOTIFY conferenceVideoLayoutChanged)
@ -107,11 +107,12 @@ public:
bool isSecured() const;
void setIsSecured(bool secured);
bool isConference() const;
ConferenceGui *getConferenceGui() const;
QSharedPointer<ConferenceCore> getConferenceCore() const;
void setConference(const QSharedPointer<ConferenceCore> &conference);
bool isConference() const;
QString getLocalSas();
void setLocalSas(const QString &sas);
QString getRemoteSas();
@ -236,7 +237,6 @@ private:
QString mPeerAddress;
QString mLocalAddress;
bool mIsSecured;
bool mIsConference = false;
int mDuration = 0;
bool mSpeakerMuted;
bool mMicrophoneMuted;
@ -247,6 +247,7 @@ private:
bool mRecording = false;
bool mRemoteRecording = false;
bool mRecordable = false;
bool mIsConference = false;
QString mLocalSas;
QString mRemoteSas;
float mSpeakerVolumeGain;

View file

@ -60,6 +60,8 @@ ParticipantDeviceCore::ParticipantDeviceCore(const std::shared_ptr<linphone::Par
lDebug() << "Address = " << Utils::coreStringToAppString(deviceAddress->asStringUriOnly());
mIsLocal = ToolModel::findAccount(deviceAddress) != nullptr; // TODO set local
mIsVideoEnabled = mParticipantDeviceModel->isVideoEnabled();
mIsPaused = device->getState() == linphone::ParticipantDevice::State::Left ||
device->getState() == linphone::ParticipantDevice::State::OnHold;
}
ParticipantDeviceCore::~ParticipantDeviceCore() {
@ -70,10 +72,6 @@ void ParticipantDeviceCore::setSelf(QSharedPointer<ParticipantDeviceCore> me) {
mParticipantDeviceModelConnection = QSharedPointer<SafeConnection<ParticipantDeviceCore, ParticipantDeviceModel>>(
new SafeConnection<ParticipantDeviceCore, ParticipantDeviceModel>(me, mParticipantDeviceModel),
&QObject::deleteLater);
mParticipantDeviceModelConnection->makeConnectToModel(
&ParticipantDeviceModel::isPausedChanged, [this](bool paused) {
mParticipantDeviceModelConnection->invokeToCore([this, paused] { setPaused(paused); });
});
mParticipantDeviceModelConnection->makeConnectToModel(
&ParticipantDeviceModel::isSpeakingChanged, [this](bool speaking) {
mParticipantDeviceModelConnection->invokeToCore([this, speaking] { setIsSpeaking(speaking); });
@ -83,6 +81,7 @@ void ParticipantDeviceCore::setSelf(QSharedPointer<ParticipantDeviceCore> me) {
});
mParticipantDeviceModelConnection->makeConnectToModel(
&ParticipantDeviceModel::stateChanged, [this](LinphoneEnums::ParticipantDeviceState state) {
onStateChanged(state);
mParticipantDeviceModelConnection->invokeToCore(
[this, state, isVideoEnabled = mParticipantDeviceModel->isVideoEnabled()] {
setState(state);
@ -213,33 +212,32 @@ void ParticipantDeviceCore::onIsMuted(const std::shared_ptr<linphone::Participan
bool isMuted) {
emit isMutedChanged();
}
void ParticipantDeviceCore::onStateChanged(const std::shared_ptr<linphone::ParticipantDevice> &participantDevice,
linphone::ParticipantDevice::State state) {
void ParticipantDeviceCore::onStateChanged(LinphoneEnums::ParticipantDeviceState state) {
switch (state) {
case linphone::ParticipantDevice::State::Joining:
case LinphoneEnums::ParticipantDeviceState::Joining:
break;
case linphone::ParticipantDevice::State::Present:
case LinphoneEnums::ParticipantDeviceState::Present:
setPaused(false);
break;
case linphone::ParticipantDevice::State::Leaving:
case LinphoneEnums::ParticipantDeviceState::Leaving:
break;
case linphone::ParticipantDevice::State::Left:
case LinphoneEnums::ParticipantDeviceState::Left:
break;
case linphone::ParticipantDevice::State::ScheduledForJoining:
case LinphoneEnums::ParticipantDeviceState::ScheduledForJoining:
break;
case linphone::ParticipantDevice::State::ScheduledForLeaving:
case LinphoneEnums::ParticipantDeviceState::ScheduledForLeaving:
break;
case linphone::ParticipantDevice::State::OnHold:
case LinphoneEnums::ParticipantDeviceState::OnHold:
setPaused(true);
break;
case linphone::ParticipantDevice::State::Alerting:
case LinphoneEnums::ParticipantDeviceState::Alerting:
break;
case linphone::ParticipantDevice::State::MutedByFocus:
case LinphoneEnums::ParticipantDeviceState::MutedByFocus:
break;
default: {
}
}
setState(LinphoneEnums::fromLinphone(state));
setState(state);
}
void ParticipantDeviceCore::onStreamCapabilityChanged(
const std::shared_ptr<linphone::ParticipantDevice> &participantDevice,

View file

@ -87,8 +87,7 @@ public:
virtual void onIsSpeakingChanged(const std::shared_ptr<linphone::ParticipantDevice> &participantDevice,
bool isSpeaking);
virtual void onIsMuted(const std::shared_ptr<linphone::ParticipantDevice> &participantDevice, bool isMuted);
virtual void onStateChanged(const std::shared_ptr<linphone::ParticipantDevice> &participantDevice,
linphone::ParticipantDevice::State state);
virtual void onStateChanged(LinphoneEnums::ParticipantDeviceState state);
virtual void onStreamCapabilityChanged(const std::shared_ptr<linphone::ParticipantDevice> &participantDevice,
linphone::MediaDirection direction,
linphone::StreamType streamType);

View file

@ -43,10 +43,10 @@ CallModel::CallModel(const std::shared_ptr<linphone::Call> &call, QObject *paren
[this]() { this->microphoneVolumeChanged(Utils::computeVu(mMonitor->getRecordVolume())); });
mMicroVolumeTimer.start();
connect(this, &CallModel::stateChanged, this, [this] {
auto state = mMonitor->getState();
if (state == linphone::Call::State::Paused) setPaused(true);
});
// connect(this, &CallModel::stateChanged, this, [this] {
// auto state = mMonitor->getState();
// if (state == linphone::Call::State::Paused) setPaused(true);
// });
}
CallModel::~CallModel() {
@ -86,14 +86,18 @@ void CallModel::terminate() {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
mMonitor->terminate();
}
void CallModel::setPaused(bool paused) {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
linphone::Status status = -1;
if (paused) {
auto status = mMonitor->pause();
if (status != -1) emit pausedChanged(paused);
if (mMonitor->getConference()) status = mMonitor->getConference()->leave();
else status = mMonitor->pause();
if (status == 0) emit pausedChanged(paused);
} else {
auto status = mMonitor->resume();
if (status != -1) emit pausedChanged(paused);
if (mMonitor->getConference()) status = mMonitor->getConference()->enter();
else status = mMonitor->resume();
if (status == 0) emit pausedChanged(paused);
}
}

View file

@ -51,9 +51,6 @@ void ConferenceModel::terminate() {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
mMonitor->terminate();
}
void ConferenceModel::setPaused(bool paused) {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
}
void ConferenceModel::removeParticipant(const std::shared_ptr<linphone::Participant> &p) {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));

View file

@ -53,8 +53,6 @@ public:
bool isLocalScreenSharing() const;
bool isScreenSharingEnabled() const;
void setPaused(bool paused);
void removeParticipant(const std::shared_ptr<linphone::Participant> &p);
void removeParticipant(const std::shared_ptr<linphone::Address> &address);
void addParticipant(const std::shared_ptr<linphone::Address> &address);
@ -68,7 +66,6 @@ signals:
void speakerMutedChanged(bool isMuted);
void durationChanged(int);
void microphoneVolumeChanged(float);
void pausedChanged(bool paused);
void remoteVideoEnabledChanged(bool remoteVideoEnabled);
void localVideoEnabledChanged(bool enabled);
void recordingChanged(bool recording);

View file

@ -71,7 +71,6 @@ public:
signals:
// void securityLevelChanged();
// void videoEnabledChanged();
void isPausedChanged(bool paused);
void isSpeakingChanged(bool speaking);
void isMutedChanged(bool muted);
void stateChanged(LinphoneEnums::ParticipantDeviceState state);

View file

@ -78,7 +78,7 @@ AppWindow {
middleItemStackView.replace(inCallItem)
}
if (!callsModel.haveCall) {
if (call && call.core.conference) UtilsCpp.closeCallsWindow()
if (call && call.core.isConference) UtilsCpp.closeCallsWindow()
else {
bottomButtonsLayout.setButtonsEnabled(false)
autoCloseWindow.restart()
@ -274,7 +274,7 @@ AppWindow {
: mainWindow.call.core.dir === LinphoneEnums.CallDir.Outgoing
? AppIcons.arrowUpRight
: AppIcons.arrowDownLeft
colorizationColor: !mainWindow.call || mainWindow.callState === LinphoneEnums.CallState.Paused
colorizationColor: !mainWindow.call || mainWindow.call.core.paused || mainWindow.callState === LinphoneEnums.CallState.Paused
|| mainWindow.callState === LinphoneEnums.CallState.PausedByRemote || mainWindow.callState === LinphoneEnums.CallState.End
|| mainWindow.callState === LinphoneEnums.CallState.Released || mainWindow.conference
? DefaultStyle.danger_500main
@ -286,7 +286,8 @@ AppWindow {
id: callStatusText
text: (mainWindow.callState === LinphoneEnums.CallState.End || mainWindow.callState === LinphoneEnums.CallState.Released)
? qsTr("End of the call")
: (mainWindow.callState === LinphoneEnums.CallState.Paused
: mainWindow.call.core.paused
|| (mainWindow.callState === LinphoneEnums.CallState.Paused
|| mainWindow.callState === LinphoneEnums.CallState.PausedByRemote)
? (mainWindow.conference ? qsTr('Réunion mise ') : qsTr('Appel mis')) + qsTr(" en pause")
: mainWindow.conference
@ -676,7 +677,9 @@ AppWindow {
Layout.fillWidth: true
}
}
onClicked: modelData.core.lSetPaused(!modelData.core.paused)
onClicked: {
modelData.core.lSetPaused(!modelData.core.paused)
}
}
Button {
background: Item {}
@ -862,14 +865,14 @@ AppWindow {
target: callStatusText
when: middleItemStackView.currentItem === waitingRoomIn
property: "text"
value: waitingRoomIn.conferenceInfo && waitingRoomIn.conferenceInfo.core.subject
value: waitingRoomIn.conferenceInfo ? waitingRoomIn.conferenceInfo.core.subject : ''
restoreMode: Binding.RestoreBindingOrValue
}
Binding {
target: conferenceDate
when: middleItemStackView.currentItem === waitingRoomIn
property: "text"
value: waitingRoomIn.conferenceInfo && waitingRoomIn.conferenceInfo.core.startEndDateString
value: waitingRoomIn.conferenceInfo ? waitingRoomIn.conferenceInfo.core.startEndDateString : ''
}
Connections {
target: rightPanel
@ -978,10 +981,10 @@ AppWindow {
: DefaultStyle.grey_500
: DefaultStyle.grey_600
}
enabled: mainWindow.callState != LinphoneEnums.CallState.PausedByRemote
enabled: mainWindow.conference || mainWindow.callState != LinphoneEnums.CallState.PausedByRemote
icon.source: enabled && checked ? AppIcons.play : AppIcons.pause
checked: mainWindow.call && mainWindow.call.core.paused
onCheckedChanged: {
checked: mainWindow.call && mainWindow.callState == LinphoneEnums.CallState.Paused || mainWindow.callState == LinphoneEnums.CallState.Pausing || (!mainWindow.conference && mainWindow.callState == LinphoneEnums.CallState.PausedByRemote)
onClicked: {
mainWindow.call.core.lSetPaused(!mainWindow.call.core.paused)
}
}

View file

@ -28,7 +28,6 @@ RowLayout {
qmlName: "WP"
displayAll: false
displayPresence: false
bigBottomAddress: true
mutedStatus: microButton.checked
AccountProxy{
id: accounts

View file

@ -24,6 +24,7 @@ Item {
property alias displayPresence: avatar.displayPresence
property color color: DefaultStyle.grey_600
property int radius: 15 * DefaultStyle.dp
property bool remoteIsPaused: participantDevice ? participantDevice.core.isPaused : false
property var peerAddressObj: previewEnabled && (call || account)
? UtilsCpp.getDisplayName(account ? account.core.identityAddress : call.core.localAddress)
: participantDevice && participantDevice.core
@ -38,7 +39,6 @@ Item {
|| (participantDevice && participantDevice.core.videoEnabled)
property string qmlName
property bool displayAll : !!mainItem.call
property bool bigBottomAddress: displayAll
property bool mutedStatus: participantDevice ? participantDevice.core.isMuted : false
onCallChanged: {
waitingTime.seconds = 0
@ -98,12 +98,13 @@ Item {
}
}
Item{
id: centerItem
visible: !mainItem.remoteIsPaused
anchors.centerIn: parent
height: mainItem.conference
? background.minSize * 142 / 372
: 120 * DefaultStyle.dp
width: height
id: centerItem
Avatar{
id: avatar
anchors.fill: parent
@ -138,9 +139,30 @@ Item {
}
}
}
ColumnLayout {
anchors.centerIn: parent
spacing: 12 * DefaultStyle.dp
visible: mainItem.remoteIsPaused
EffectImage {
imageSource: AppIcons.pause
colorizationColor: DefaultStyle.grey_0
Layout.preferredHeight: background.width / 8
Layout.preferredWidth: height
Layout.alignment: Qt.AlignHCenter
}
Text {
color: DefaultStyle.grey_0
Layout.alignment: Qt.AlignHCenter
text: qsTr("En pause")
font {
pixelSize: 20 * DefaultStyle.dp
weight: 500 * DefaultStyle.dp
}
}
}
ColumnLayout {
spacing: 0
visible: mainItem.displayAll
visible: mainItem.displayAll && !mainItem.remoteIsPaused
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: centerItem.bottom
anchors.topMargin: 21 * DefaultStyle.dp
@ -218,7 +240,6 @@ Item {
}
}
Text {
id: bottomAddress
anchors.left: parent.left
anchors.bottom: parent.bottom
anchors.leftMargin: 10 * DefaultStyle.dp
@ -231,7 +252,7 @@ Item {
: ""
color: DefaultStyle.grey_0
font {
pixelSize: (mainItem.bigBottomAddress ? 14 : 10) * DefaultStyle.dp
pixelSize: 14 * DefaultStyle.dp
weight: 500 * DefaultStyle.dp
}
}
@ -259,8 +280,8 @@ Item {
Layout.preferredWidth: 18 * DefaultStyle.dp
Layout.preferredHeight: 18 * DefaultStyle.dp
visible: mainItem.mutedStatus
icon.width: 13 * DefaultStyle.dp
icon.height: 13 * DefaultStyle.dp
icon.width: 19 * DefaultStyle.dp
icon.height: 19 * DefaultStyle.dp
enabled: false
contentImageColor: DefaultStyle.main2_500main
backgroundColor: DefaultStyle.grey_0

View file

@ -42,9 +42,7 @@ Mosaic {
call: grid.call && !grid.call.core.isConference ? grid.call : null
account: index == 0 ? accountProxy.findAccountByAddress(mainItem.localAddress) : null
displayAll: false
bigBottomAddress: true
displayPresence: false
participantDevice: avatarCell.currentDevice
Component.onCompleted: console.log(qmlName + " is " +(call ? call.core.peerAddress : currentDevice ? currentDevice.core.address : 'addr_NotDefined'))
}