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->invokeToCore([this, volume]() { setMicrophoneVolume(volume); });
});
mCallModelConnection->makeConnectToModel(
&CallModel::stateChanged,
[this](std::shared_ptr<linphone::Call> call, linphone::Call::State state, const std::string &message) {
mCallModelConnection->invokeToCore([this, state, message]() {
setState(LinphoneEnums::fromLinphone(state), Utils::coreStringToAppString(message));
});
double speakerVolume = mSpeakerVolumeGain;
double micVolume = mMicrophoneVolumeGain;
if (state == linphone::Call::State::StreamsRunning) {
speakerVolume = mCallModel->getSpeakerVolumeGain();
if (speakerVolume < 0) {
speakerVolume = CoreModel::getInstance()->getCore()->getPlaybackGainDb();
}
micVolume = mCallModel->getMicrophoneVolumeGain();
if (micVolume < 0) {
micVolume = CoreModel::getInstance()->getCore()->getMicGainDb();
}
}
mCallModelConnection->invokeToCore([this, state, speakerVolume, micVolume]() {
setSpeakerVolumeGain(speakerVolume);
setMicrophoneVolumeGain(micVolume);
setRecordable(state == linphone::Call::State::StreamsRunning);
setPaused(state == linphone::Call::State::Paused || state == linphone::Call::State::PausedByRemote);
});
});
mCallModelConnection->makeConnectToModel(&CallModel::stateChanged, [this](std::shared_ptr<linphone::Call> call,
linphone::Call::State state,
const std::string &message) {
mCallModelConnection->invokeToCore([this, state, message]() {
setState(LinphoneEnums::fromLinphone(state), Utils::coreStringToAppString(message));
});
double speakerVolume = mSpeakerVolumeGain;
double micVolume = mMicrophoneVolumeGain;
if (state == linphone::Call::State::StreamsRunning) {
speakerVolume = mCallModel->getSpeakerVolumeGain();
if (speakerVolume < 0) {
speakerVolume = CoreModel::getInstance()->getCore()->getPlaybackGainDb();
}
micVolume = mCallModel->getMicrophoneVolumeGain();
if (micVolume < 0) {
micVolume = CoreModel::getInstance()->getCore()->getMicGainDb();
}
}
auto subject = call->getConference() ? Utils::coreStringToAppString(call->getConference()->getSubject()) : "";
mCallModelConnection->invokeToCore([this, state, speakerVolume, micVolume, subject]() {
setSpeakerVolumeGain(speakerVolume);
setMicrophoneVolumeGain(micVolume);
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->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) {
auto device = ParticipantDeviceCore::create(participantDevice);
mConferenceModelConnection->invokeToCore([this, device]() { setActiveSpeaker(device); });
});
});
mConferenceModelConnection->makeConnectToModel(&ConferenceModel::participantDeviceStateChanged, [this]() {
int count = mConferenceModel->getParticipantDeviceCount();
@ -89,6 +89,14 @@ bool ConferenceCore::updateLocalParticipant() { // true if changed
QString ConferenceCore::getSubject() const {
return mSubject;
}
void ConferenceCore::setSubject(const QString &subject) {
if (mSubject != subject) {
mSubject = subject;
emit subjectChanged();
}
}
QDateTime ConferenceCore::getStartDate() const {
return mStartDate;
}

View file

@ -41,7 +41,7 @@ public:
// Q_PROPERTY(ParticipantModel* localParticipant READ getLocalParticipant NOTIFY localParticipantChanged)
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
isLocalScreenSharingChanged)
Q_PROPERTY(bool isScreenSharingEnabled MEMBER mIsScreenSharingEnabled WRITE setIsScreenSharingEnabled NOTIFY
@ -59,6 +59,7 @@ public:
bool updateLocalParticipant(); // true if changed
QString getSubject() const;
void setSubject(const QString &subject);
QDateTime getStartDate() const;
Q_INVOKABLE qint64 getElapsedSeconds() const;
int getParticipantDeviceCount() const;
@ -84,6 +85,7 @@ signals:
void isScreenSharingEnabledChanged();
void participantDeviceCountChanged();
void activeSpeakerChanged();
void subjectChanged();
void lToggleScreenSharing();

View file

@ -143,6 +143,10 @@ void ConferenceModel::toggleScreenSharing() {
if (enable) {
params->setConferenceVideoLayout(linphone::Conference::Layout::ActiveSpeaker);
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);
else lCritical() << log().arg("Cannot toggle screen sharing because parameters are invalid");