fix display subject when join conf via uri

This commit is contained in:
Gaelle Braud 2024-07-09 11:42:34 +02:00
parent 035b9af8a9
commit 4927a02c93
4 changed files with 43 additions and 27 deletions

View file

@ -246,31 +246,33 @@ void CallCore::setSelf(QSharedPointer<CallCore> me) {
mCallModelConnection->makeConnectToModel(&CallModel::microphoneVolumeChanged, [this](float volume) { mCallModelConnection->makeConnectToModel(&CallModel::microphoneVolumeChanged, [this](float volume) {
mCallModelConnection->invokeToCore([this, volume]() { setMicrophoneVolume(volume); }); mCallModelConnection->invokeToCore([this, volume]() { setMicrophoneVolume(volume); });
}); });
mCallModelConnection->makeConnectToModel( mCallModelConnection->makeConnectToModel(&CallModel::stateChanged, [this](std::shared_ptr<linphone::Call> call,
&CallModel::stateChanged, linphone::Call::State state,
[this](std::shared_ptr<linphone::Call> call, linphone::Call::State state, const std::string &message) { const std::string &message) {
mCallModelConnection->invokeToCore([this, state, message]() { mCallModelConnection->invokeToCore([this, state, message]() {
setState(LinphoneEnums::fromLinphone(state), Utils::coreStringToAppString(message)); setState(LinphoneEnums::fromLinphone(state), Utils::coreStringToAppString(message));
}); });
double speakerVolume = mSpeakerVolumeGain; double speakerVolume = mSpeakerVolumeGain;
double micVolume = mMicrophoneVolumeGain; double micVolume = mMicrophoneVolumeGain;
if (state == linphone::Call::State::StreamsRunning) { if (state == linphone::Call::State::StreamsRunning) {
speakerVolume = mCallModel->getSpeakerVolumeGain(); speakerVolume = mCallModel->getSpeakerVolumeGain();
if (speakerVolume < 0) { if (speakerVolume < 0) {
speakerVolume = CoreModel::getInstance()->getCore()->getPlaybackGainDb(); speakerVolume = CoreModel::getInstance()->getCore()->getPlaybackGainDb();
} }
micVolume = mCallModel->getMicrophoneVolumeGain(); micVolume = mCallModel->getMicrophoneVolumeGain();
if (micVolume < 0) { if (micVolume < 0) {
micVolume = CoreModel::getInstance()->getCore()->getMicGainDb(); micVolume = CoreModel::getInstance()->getCore()->getMicGainDb();
} }
} }
mCallModelConnection->invokeToCore([this, state, speakerVolume, micVolume]() { auto subject = call->getConference() ? Utils::coreStringToAppString(call->getConference()->getSubject()) : "";
setSpeakerVolumeGain(speakerVolume); mCallModelConnection->invokeToCore([this, state, speakerVolume, micVolume, subject]() {
setMicrophoneVolumeGain(micVolume); setSpeakerVolumeGain(speakerVolume);
setRecordable(state == linphone::Call::State::StreamsRunning); setMicrophoneVolumeGain(micVolume);
setPaused(state == linphone::Call::State::Paused || state == linphone::Call::State::PausedByRemote); setRecordable(state == linphone::Call::State::StreamsRunning);
}); setPaused(state == linphone::Call::State::Paused || state == linphone::Call::State::PausedByRemote);
}); if (mConference) mConference->setSubject(subject);
});
});
mCallModelConnection->makeConnectToModel(&CallModel::statusChanged, [this](linphone::Call::Status status) { mCallModelConnection->makeConnectToModel(&CallModel::statusChanged, [this](linphone::Call::Status status) {
mCallModelConnection->invokeToCore([this, status]() { setStatus(LinphoneEnums::fromLinphone(status)); }); mCallModelConnection->invokeToCore([this, status]() { setStatus(LinphoneEnums::fromLinphone(status)); });
}); });

View file

@ -59,7 +59,7 @@ void ConferenceCore::setSelf(QSharedPointer<ConferenceCore> me) {
[this](const std::shared_ptr<linphone::ParticipantDevice> &participantDevice) { [this](const std::shared_ptr<linphone::ParticipantDevice> &participantDevice) {
auto device = ParticipantDeviceCore::create(participantDevice); auto device = ParticipantDeviceCore::create(participantDevice);
mConferenceModelConnection->invokeToCore([this, device]() { setActiveSpeaker(device); }); mConferenceModelConnection->invokeToCore([this, device]() { setActiveSpeaker(device); });
}); });
mConferenceModelConnection->makeConnectToModel(&ConferenceModel::participantDeviceStateChanged, [this]() { mConferenceModelConnection->makeConnectToModel(&ConferenceModel::participantDeviceStateChanged, [this]() {
int count = mConferenceModel->getParticipantDeviceCount(); int count = mConferenceModel->getParticipantDeviceCount();
@ -89,6 +89,14 @@ bool ConferenceCore::updateLocalParticipant() { // true if changed
QString ConferenceCore::getSubject() const { QString ConferenceCore::getSubject() const {
return mSubject; return mSubject;
} }
void ConferenceCore::setSubject(const QString &subject) {
if (mSubject != subject) {
mSubject = subject;
emit subjectChanged();
}
}
QDateTime ConferenceCore::getStartDate() const { QDateTime ConferenceCore::getStartDate() const {
return mStartDate; return mStartDate;
} }

View file

@ -41,7 +41,7 @@ public:
// Q_PROPERTY(ParticipantModel* localParticipant READ getLocalParticipant NOTIFY localParticipantChanged) // Q_PROPERTY(ParticipantModel* localParticipant READ getLocalParticipant NOTIFY localParticipantChanged)
Q_PROPERTY(bool isReady MEMBER mIsReady WRITE setIsReady NOTIFY isReadyChanged) Q_PROPERTY(bool isReady MEMBER mIsReady WRITE setIsReady NOTIFY isReadyChanged)
Q_PROPERTY(QString subject MEMBER mSubject CONSTANT) Q_PROPERTY(QString subject READ getSubject WRITE setSubject NOTIFY subjectChanged)
Q_PROPERTY(bool isLocalScreenSharing MEMBER mIsLocalScreenSharing WRITE setIsLocalScreenSharing NOTIFY Q_PROPERTY(bool isLocalScreenSharing MEMBER mIsLocalScreenSharing WRITE setIsLocalScreenSharing NOTIFY
isLocalScreenSharingChanged) isLocalScreenSharingChanged)
Q_PROPERTY(bool isScreenSharingEnabled MEMBER mIsScreenSharingEnabled WRITE setIsScreenSharingEnabled NOTIFY Q_PROPERTY(bool isScreenSharingEnabled MEMBER mIsScreenSharingEnabled WRITE setIsScreenSharingEnabled NOTIFY
@ -59,6 +59,7 @@ public:
bool updateLocalParticipant(); // true if changed bool updateLocalParticipant(); // true if changed
QString getSubject() const; QString getSubject() const;
void setSubject(const QString &subject);
QDateTime getStartDate() const; QDateTime getStartDate() const;
Q_INVOKABLE qint64 getElapsedSeconds() const; Q_INVOKABLE qint64 getElapsedSeconds() const;
int getParticipantDeviceCount() const; int getParticipantDeviceCount() const;
@ -84,6 +85,7 @@ signals:
void isScreenSharingEnabledChanged(); void isScreenSharingEnabledChanged();
void participantDeviceCountChanged(); void participantDeviceCountChanged();
void activeSpeakerChanged(); void activeSpeakerChanged();
void subjectChanged();
void lToggleScreenSharing(); void lToggleScreenSharing();

View file

@ -143,6 +143,10 @@ void ConferenceModel::toggleScreenSharing() {
if (enable) { if (enable) {
params->setConferenceVideoLayout(linphone::Conference::Layout::ActiveSpeaker); params->setConferenceVideoLayout(linphone::Conference::Layout::ActiveSpeaker);
params->enableVideo(true); params->enableVideo(true);
auto videoDirection = params->getVideoDirection();
if (videoDirection != linphone::MediaDirection::SendOnly &&
videoDirection != linphone::MediaDirection::SendRecv)
params->setVideoDirection(linphone::MediaDirection::SendOnly);
} }
if (params->isValid()) mMonitor->getCall()->update(params); if (params->isValid()) mMonitor->getCall()->update(params);
else lCritical() << log().arg("Cannot toggle screen sharing because parameters are invalid"); else lCritical() << log().arg("Cannot toggle screen sharing because parameters are invalid");