mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-02-07 15:08:24 +00:00
feat(CallModel): speaker and microphone can be muted
This commit is contained in:
parent
a9f6d6d934
commit
72c1b0a525
3 changed files with 31 additions and 30 deletions
|
|
@ -147,7 +147,7 @@ float CallModel::getSpeakerVolumeGain () const {
|
|||
void CallModel::setSpeakerVolumeGain (float volume) {
|
||||
Q_ASSERT(volume >= 0.0f && volume <= 1.0f);
|
||||
mCall->setSpeakerVolumeGain(volume);
|
||||
emit speakerVolumeGainChanged(mCall->getSpeakerVolumeGain());
|
||||
emit speakerVolumeGainChanged(getSpeakerVolumeGain());
|
||||
}
|
||||
|
||||
float CallModel::getMicroVolumeGain () const {
|
||||
|
|
@ -157,7 +157,7 @@ float CallModel::getMicroVolumeGain () const {
|
|||
void CallModel::setMicroVolumeGain (float volume) {
|
||||
Q_ASSERT(volume >= 0.0f && volume <= 1.0f);
|
||||
mCall->setMicrophoneVolumeGain(volume);
|
||||
emit microVolumeGainChanged(mCall->getMicrophoneVolumeGain());
|
||||
emit microVolumeGainChanged(getMicroVolumeGain());
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
@ -468,39 +468,40 @@ float CallModel::getQuality () const {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
float CallModel::getSpeakerVu () const {
|
||||
return LinphoneUtils::computeVu(mCall->getPlayVolume());
|
||||
}
|
||||
|
||||
float CallModel::getMicroVu () const {
|
||||
return LinphoneUtils::computeVu(mCall->getRecordVolume());
|
||||
}
|
||||
|
||||
float CallModel::getSpeakerVu () const {
|
||||
return LinphoneUtils::computeVu(mCall->getPlayVolume());
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool CallModel::getSpeakerMuted () const {
|
||||
return mCall->getSpeakerMuted();
|
||||
}
|
||||
|
||||
void CallModel::setSpeakerMuted (bool status) {
|
||||
if (status == getSpeakerMuted())
|
||||
return;
|
||||
|
||||
mCall->setSpeakerMuted(status);
|
||||
emit speakerMutedChanged(getSpeakerMuted());
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool CallModel::getMicroMuted () const {
|
||||
return !CoreManager::getInstance()->getCore()->micEnabled();
|
||||
return mCall->getMicrophoneMuted();
|
||||
}
|
||||
|
||||
void CallModel::setMicroMuted (bool status) {
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
if (status == getMicroMuted())
|
||||
return;
|
||||
|
||||
if (status == core->micEnabled()) {
|
||||
core->enableMic(!status);
|
||||
emit microMutedChanged(status);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool CallModel::getAudioMuted () const {
|
||||
// TODO
|
||||
return false;
|
||||
}
|
||||
|
||||
void CallModel::setAudioMuted (bool status) {
|
||||
// TODO
|
||||
emit audioMutedChanged(status);
|
||||
mCall->setMicrophoneMuted(status);
|
||||
emit microMutedChanged(getMicroMuted());
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -43,11 +43,11 @@ class CallModel : public QObject {
|
|||
|
||||
Q_PROPERTY(int duration READ getDuration CONSTANT); // Constants but called with a timer in qml.
|
||||
Q_PROPERTY(float quality READ getQuality CONSTANT);
|
||||
Q_PROPERTY(float microVu READ getMicroVu CONSTANT);
|
||||
Q_PROPERTY(float speakerVu READ getSpeakerVu CONSTANT);
|
||||
Q_PROPERTY(float microVu READ getMicroVu CONSTANT);
|
||||
|
||||
Q_PROPERTY(bool speakerMuted READ getSpeakerMuted WRITE setSpeakerMuted NOTIFY speakerMutedChanged);
|
||||
Q_PROPERTY(bool microMuted READ getMicroMuted WRITE setMicroMuted NOTIFY microMutedChanged);
|
||||
Q_PROPERTY(bool audioMuted READ getAudioMuted WRITE setAudioMuted NOTIFY audioMutedChanged);
|
||||
|
||||
Q_PROPERTY(bool pausedByUser READ getPausedByUser WRITE setPausedByUser NOTIFY statusChanged);
|
||||
Q_PROPERTY(bool videoEnabled READ getVideoEnabled WRITE setVideoEnabled NOTIFY statusChanged);
|
||||
|
|
@ -131,8 +131,8 @@ public:
|
|||
signals:
|
||||
void callErrorChanged (const QString &callError);
|
||||
void isInConferenceChanged (bool status);
|
||||
void speakerMutedChanged (bool status);
|
||||
void microMutedChanged (bool status);
|
||||
void audioMutedChanged (bool status);
|
||||
void recordingChanged (bool status);
|
||||
void statsUpdated ();
|
||||
void statusChanged (CallStatus status);
|
||||
|
|
@ -169,12 +169,12 @@ private:
|
|||
float getMicroVu () const;
|
||||
float getSpeakerVu () const;
|
||||
|
||||
bool getSpeakerMuted () const;
|
||||
void setSpeakerMuted (bool status);
|
||||
|
||||
bool getMicroMuted () const;
|
||||
void setMicroMuted (bool status);
|
||||
|
||||
bool getAudioMuted () const;
|
||||
void setAudioMuted (bool status);
|
||||
|
||||
bool getPausedByUser () const;
|
||||
void setPausedByUser (bool status);
|
||||
|
||||
|
|
|
|||
|
|
@ -336,11 +336,11 @@ Rectangle {
|
|||
ActionSwitch {
|
||||
id: speaker
|
||||
|
||||
enabled: !call.audioMuted
|
||||
enabled: !call.speakerMuted
|
||||
icon: 'speaker'
|
||||
iconSize: CallStyle.actionArea.iconSize
|
||||
|
||||
onClicked: incall.call.audioMuted = enabled
|
||||
onClicked: incall.call.speakerMuted = enabled
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue