Commit 72c1b0a5 authored by Ronan's avatar Ronan

feat(CallModel): speaker and microphone can be muted

parent a9f6d6d9
Pipeline #421 failed with stage
in 0 seconds
......@@ -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::getMicroVu () const {
return LinphoneUtils::computeVu(mCall->getRecordVolume());
}
float CallModel::getSpeakerVu () const {
return LinphoneUtils::computeVu(mCall->getPlayVolume());
}
float CallModel::getMicroVu () const {
return LinphoneUtils::computeVu(mCall->getRecordVolume());
}
// -----------------------------------------------------------------------------
bool CallModel::getMicroMuted () const {
return !CoreManager::getInstance()->getCore()->micEnabled();
bool CallModel::getSpeakerMuted () const {
return mCall->getSpeakerMuted();
}
void CallModel::setMicroMuted (bool status) {
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
void CallModel::setSpeakerMuted (bool status) {
if (status == getSpeakerMuted())
return;
if (status == core->micEnabled()) {
core->enableMic(!status);
emit microMutedChanged(status);
}
mCall->setSpeakerMuted(status);
emit speakerMutedChanged(getSpeakerMuted());
}
// -----------------------------------------------------------------------------
bool CallModel::getAudioMuted () const {
// TODO
return false;
bool CallModel::getMicroMuted () const {
return mCall->getMicrophoneMuted();
}
void CallModel::setAudioMuted (bool status) {
// TODO
emit audioMutedChanged(status);
void CallModel::setMicroMuted (bool status) {
if (status == getMicroMuted())
return;
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
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment