fix #LINQT-1565 button icon color

fix #LINQT-1582 auto save audio/video settings when changed in call
This commit is contained in:
Gaelle Braud 2025-01-22 09:48:55 +01:00
parent 860fc22aa5
commit 45b2a4f484
10 changed files with 114 additions and 129 deletions

View file

@ -169,14 +169,6 @@ CallCore::CallCore(const std::shared_ptr<linphone::Call> &call) : QObject(nullpt
mRecording = call->getParams() && call->getParams()->isRecording(); mRecording = call->getParams() && call->getParams()->isRecording();
mRemoteRecording = call->getRemoteParams() && call->getRemoteParams()->isRecording(); mRemoteRecording = call->getRemoteParams() && call->getRemoteParams()->isRecording();
auto settingsModel = SettingsModel::getInstance(); auto settingsModel = SettingsModel::getInstance();
mSpeakerVolumeGain = mCallModel->getSpeakerVolumeGain();
if (mSpeakerVolumeGain < 0) {
mSpeakerVolumeGain = settingsModel->getPlaybackGain();
}
mMicrophoneVolumeGain = call->getMicrophoneVolumeGain();
if (mMicrophoneVolumeGain < 0) {
mMicrophoneVolumeGain = settingsModel->getCaptureGain();
}
mMicrophoneVolume = call->getRecordVolume(); mMicrophoneVolume = call->getRecordVolume();
mRecordable = mState == LinphoneEnums::CallState::StreamsRunning; mRecordable = mState == LinphoneEnums::CallState::StreamsRunning;
mConferenceVideoLayout = LinphoneEnums::fromLinphone(SettingsModel::getInstance()->getDefaultConferenceLayout()); mConferenceVideoLayout = LinphoneEnums::fromLinphone(SettingsModel::getInstance()->getDefaultConferenceLayout());
@ -263,12 +255,6 @@ void CallCore::setSelf(QSharedPointer<CallCore> me) {
mCallModelConnection->makeConnectToModel(&CallModel::qualityUpdated, [this](float quality) { mCallModelConnection->makeConnectToModel(&CallModel::qualityUpdated, [this](float quality) {
mCallModelConnection->invokeToCore([this, quality]() { setCurrentQuality(quality); }); mCallModelConnection->invokeToCore([this, quality]() { setCurrentQuality(quality); });
}); });
mCallModelConnection->makeConnectToModel(&CallModel::speakerVolumeGainChanged, [this](float volume) {
mCallModelConnection->invokeToCore([this, volume]() { setSpeakerVolumeGain(volume); });
});
mCallModelConnection->makeConnectToModel(&CallModel::microphoneVolumeGainChanged, [this](float volume) {
mCallModelConnection->invokeToCore([this, volume]() { setMicrophoneVolumeGain(volume); });
});
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); });
}); });
@ -277,23 +263,9 @@ void CallCore::setSelf(QSharedPointer<CallCore> me) {
mCallModelConnection->makeConnectToModel(&CallModel::stateChanged, [this](std::shared_ptr<linphone::Call> call, mCallModelConnection->makeConnectToModel(&CallModel::stateChanged, [this](std::shared_ptr<linphone::Call> call,
linphone::Call::State state, linphone::Call::State state,
const std::string &message) { const std::string &message) {
double speakerVolume = mSpeakerVolumeGain;
double micVolumeGain = mMicrophoneVolumeGain;
bool isConf = call && call->getConference() != nullptr; bool isConf = call && call->getConference() != nullptr;
if (state == linphone::Call::State::StreamsRunning) {
speakerVolume = mCallModel->getSpeakerVolumeGain();
if (speakerVolume < 0) {
speakerVolume = CoreModel::getInstance()->getCore()->getPlaybackGainDb();
}
micVolumeGain = mCallModel->getMicrophoneVolumeGain();
if (micVolumeGain < 0) {
micVolumeGain = CoreModel::getInstance()->getCore()->getMicGainDb();
}
}
auto subject = call->getConference() ? Utils::coreStringToAppString(call->getConference()->getSubject()) : ""; auto subject = call->getConference() ? Utils::coreStringToAppString(call->getConference()->getSubject()) : "";
mCallModelConnection->invokeToCore([this, state, speakerVolume, micVolumeGain, subject, isConf]() { mCallModelConnection->invokeToCore([this, state, subject, isConf]() {
setSpeakerVolumeGain(speakerVolume);
setMicrophoneVolumeGain(micVolumeGain);
setRecordable(state == linphone::Call::State::StreamsRunning); setRecordable(state == linphone::Call::State::StreamsRunning);
setPaused(state == linphone::Call::State::Paused || state == linphone::Call::State::PausedByRemote); setPaused(state == linphone::Call::State::Paused || state == linphone::Call::State::PausedByRemote);
if (mConference) mConference->setSubject(subject); if (mConference) mConference->setSubject(subject);
@ -357,18 +329,7 @@ void CallCore::setSelf(QSharedPointer<CallCore> me) {
mCallModelConnection->invokeToCore([this, zrtpStats]() { setZrtpStats(zrtpStats); }); mCallModelConnection->invokeToCore([this, zrtpStats]() { setZrtpStats(zrtpStats); });
} }
}); });
mCallModelConnection->makeConnectToCore(&CallCore::lSetSpeakerVolumeGain, [this](float gain) {
mCallModelConnection->invokeToModel([this, gain]() { mCallModel->setSpeakerVolumeGain(gain); });
});
mCallModelConnection->makeConnectToModel(&CallModel::speakerVolumeGainChanged, [this](float gain) {
mCallModelConnection->invokeToCore([this, gain]() { setSpeakerVolumeGain(gain); });
});
mCallModelConnection->makeConnectToCore(&CallCore::lSetMicrophoneVolumeGain, [this](float gain) {
mCallModelConnection->invokeToModel([this, gain]() { mCallModel->setMicrophoneVolumeGain(gain); });
});
mCallModelConnection->makeConnectToModel(&CallModel::microphoneVolumeGainChanged, [this](float gain) {
mCallModelConnection->invokeToCore([this, gain]() { setMicrophoneVolumeGain(gain); });
});
mCallModelConnection->makeConnectToCore(&CallCore::lSetInputAudioDevice, [this](QString id) { mCallModelConnection->makeConnectToCore(&CallCore::lSetInputAudioDevice, [this](QString id) {
mCallModelConnection->invokeToModel([this, id]() { mCallModelConnection->invokeToModel([this, id]() {
auto device = ToolModel::findAudioDevice(id, linphone::AudioDevice::Capabilities::CapabilityRecord); auto device = ToolModel::findAudioDevice(id, linphone::AudioDevice::Capabilities::CapabilityRecord);
@ -735,16 +696,6 @@ void CallCore::setRecordable(bool recordable) {
} }
} }
float CallCore::getSpeakerVolumeGain() const {
return mSpeakerVolumeGain;
}
void CallCore::setSpeakerVolumeGain(float gain) {
if (mSpeakerVolumeGain != gain) {
mSpeakerVolumeGain = gain;
emit speakerVolumeGainChanged();
}
}
float CallCore::getMicrophoneVolume() const { float CallCore::getMicrophoneVolume() const {
return mMicrophoneVolume; return mMicrophoneVolume;
} }
@ -755,16 +706,6 @@ void CallCore::setMicrophoneVolume(float vol) {
} }
} }
float CallCore::getMicrophoneVolumeGain() const {
return mMicrophoneVolumeGain;
}
void CallCore::setMicrophoneVolumeGain(float gain) {
if (mMicrophoneVolumeGain != gain) {
mMicrophoneVolumeGain = gain;
emit microphoneVolumeGainChanged();
}
}
LinphoneEnums::CallState CallCore::getTransferState() const { LinphoneEnums::CallState CallCore::getTransferState() const {
return mTransferState; return mTransferState;
} }

View file

@ -122,10 +122,6 @@ public:
Q_PROPERTY(bool recording READ getRecording WRITE setRecording NOTIFY recordingChanged) Q_PROPERTY(bool recording READ getRecording WRITE setRecording NOTIFY recordingChanged)
Q_PROPERTY(bool remoteRecording READ getRemoteRecording WRITE setRemoteRecording NOTIFY remoteRecordingChanged) Q_PROPERTY(bool remoteRecording READ getRemoteRecording WRITE setRemoteRecording NOTIFY remoteRecordingChanged)
Q_PROPERTY(bool recordable READ getRecordable WRITE setRecordable NOTIFY recordableChanged) Q_PROPERTY(bool recordable READ getRecordable WRITE setRecordable NOTIFY recordableChanged)
Q_PROPERTY(
float speakerVolumeGain READ getSpeakerVolumeGain WRITE setSpeakerVolumeGain NOTIFY speakerVolumeGainChanged)
Q_PROPERTY(float microphoneVolumeGain READ getMicrophoneVolumeGain WRITE setMicrophoneVolumeGain NOTIFY
microphoneVolumeGainChanged)
Q_PROPERTY(float microVolume READ getMicrophoneVolume WRITE setMicrophoneVolume NOTIFY microphoneVolumeChanged) Q_PROPERTY(float microVolume READ getMicrophoneVolume WRITE setMicrophoneVolume NOTIFY microphoneVolumeChanged)
Q_PROPERTY(LinphoneEnums::CallState transferState READ getTransferState NOTIFY transferStateChanged) Q_PROPERTY(LinphoneEnums::CallState transferState READ getTransferState NOTIFY transferStateChanged)
Q_PROPERTY(ConferenceGui *conference READ getConferenceGui NOTIFY conferenceChanged) Q_PROPERTY(ConferenceGui *conference READ getConferenceGui NOTIFY conferenceChanged)
@ -214,12 +210,6 @@ public:
bool getRecordable() const; bool getRecordable() const;
void setRecordable(bool recordable); void setRecordable(bool recordable);
float getSpeakerVolumeGain() const;
void setSpeakerVolumeGain(float gain);
float getMicrophoneVolumeGain() const;
void setMicrophoneVolumeGain(float gain);
float getMicrophoneVolume() const; float getMicrophoneVolume() const;
void setMicrophoneVolume(float vol); void setMicrophoneVolume(float vol);
@ -268,9 +258,7 @@ signals:
void recordingChanged(); void recordingChanged();
void remoteRecordingChanged(); void remoteRecordingChanged();
void recordableChanged(); void recordableChanged();
void speakerVolumeGainChanged();
void microphoneVolumeChanged(); void microphoneVolumeChanged();
void microphoneVolumeGainChanged();
void conferenceChanged(); void conferenceChanged();
void isConferenceChanged(); void isConferenceChanged();
void conferenceVideoLayoutChanged(); void conferenceVideoLayoutChanged();
@ -296,8 +284,6 @@ signals:
void lStopRecording(); void lStopRecording();
void lCheckAuthenticationTokenSelected(const QString &token); void lCheckAuthenticationTokenSelected(const QString &token);
void lSkipZrtpAuthentication(); void lSkipZrtpAuthentication();
void lSetSpeakerVolumeGain(float gain);
void lSetMicrophoneVolumeGain(float gain);
void lSetInputAudioDevice(QString id); void lSetInputAudioDevice(QString id);
void lSetOutputAudioDevice(QString id); void lSetOutputAudioDevice(QString id);
void lSetConferenceVideoLayout(LinphoneEnums::ConferenceLayout layout); void lSetConferenceVideoLayout(LinphoneEnums::ConferenceLayout layout);
@ -354,9 +340,7 @@ private:
bool mIsConference = false; bool mIsConference = false;
QString mLocalToken; QString mLocalToken;
QStringList mRemoteTokens; QStringList mRemoteTokens;
float mSpeakerVolumeGain;
float mMicrophoneVolume; float mMicrophoneVolume;
float mMicrophoneVolumeGain;
QSharedPointer<SafeConnection<CallCore, CallModel>> mCallModelConnection; QSharedPointer<SafeConnection<CallCore, CallModel>> mCallModelConnection;
ZrtpStats mZrtpStats; ZrtpStats mZrtpStats;
AudioStats mAudioStats; AudioStats mAudioStats;

View file

@ -216,10 +216,22 @@ void SettingsCore::setSelf(QSharedPointer<SettingsCore> me) {
}); });
// Audio device(s) // Audio device(s)
mSettingsModelConnection->makeConnectToCore(&SettingsCore::lSetCaptureDevice, [this](QVariantMap device) {
mSettingsModelConnection->invokeToModel([this, device]() {
mAutoSaved = true;
SettingsModel::getInstance()->setCaptureDevice(device);
});
});
mSettingsModelConnection->makeConnectToModel(&SettingsModel::captureDeviceChanged, [this](QVariantMap device) { mSettingsModelConnection->makeConnectToModel(&SettingsModel::captureDeviceChanged, [this](QVariantMap device) {
mSettingsModelConnection->invokeToCore([this, device]() { setCaptureDevice(device); }); mSettingsModelConnection->invokeToCore([this, device]() { setCaptureDevice(device); });
}); });
mSettingsModelConnection->makeConnectToCore(&SettingsCore::lSetPlaybackDevice, [this](QVariantMap device) {
mSettingsModelConnection->invokeToModel([this, device]() {
mAutoSaved = true;
SettingsModel::getInstance()->setPlaybackDevice(device);
});
});
mSettingsModelConnection->makeConnectToModel(&SettingsModel::playbackDeviceChanged, [this](QVariantMap device) { mSettingsModelConnection->makeConnectToModel(&SettingsModel::playbackDeviceChanged, [this](QVariantMap device) {
mSettingsModelConnection->invokeToCore([this, device]() { setPlaybackDevice(device); }); mSettingsModelConnection->invokeToCore([this, device]() { setPlaybackDevice(device); });
}); });
@ -228,10 +240,22 @@ void SettingsCore::setSelf(QSharedPointer<SettingsCore> me) {
mSettingsModelConnection->invokeToCore([this, device]() { setRingerDevice(device); }); mSettingsModelConnection->invokeToCore([this, device]() { setRingerDevice(device); });
}); });
mSettingsModelConnection->makeConnectToCore(&SettingsCore::lSetPlaybackGain, [this](const float value) {
mSettingsModelConnection->invokeToModel([this, value]() {
mAutoSaved = true;
SettingsModel::getInstance()->setPlaybackGain(value);
});
});
mSettingsModelConnection->makeConnectToModel(&SettingsModel::playbackGainChanged, [this](const float value) { mSettingsModelConnection->makeConnectToModel(&SettingsModel::playbackGainChanged, [this](const float value) {
mSettingsModelConnection->invokeToCore([this, value]() { setPlaybackGain(value); }); mSettingsModelConnection->invokeToCore([this, value]() { setPlaybackGain(value); });
}); });
mSettingsModelConnection->makeConnectToCore(&SettingsCore::lSetCaptureGain, [this](const float value) {
mSettingsModelConnection->invokeToModel([this, value]() {
mAutoSaved = true;
SettingsModel::getInstance()->setCaptureGain(value);
});
});
mSettingsModelConnection->makeConnectToModel(&SettingsModel::captureGainChanged, [this](const float value) { mSettingsModelConnection->makeConnectToModel(&SettingsModel::captureGainChanged, [this](const float value) {
mSettingsModelConnection->invokeToCore([this, value]() { setCaptureGain(value); }); mSettingsModelConnection->invokeToCore([this, value]() { setCaptureGain(value); });
}); });
@ -252,10 +276,25 @@ void SettingsCore::setSelf(QSharedPointer<SettingsCore> me) {
}); });
// Video device(s) // Video device(s)
mSettingsModelConnection->makeConnectToCore(&SettingsCore::lSetVideoDevice, [this](QString id) {
mSettingsModelConnection->invokeToModel([this, id]() {
mAutoSaved = true;
SettingsModel::getInstance()->setVideoDevice(id);
});
});
mSettingsModelConnection->makeConnectToModel(&SettingsModel::videoDeviceChanged, [this](const QString device) { mSettingsModelConnection->makeConnectToModel(&SettingsModel::videoDeviceChanged, [this](const QString device) {
mSettingsModelConnection->invokeToCore([this, device]() { setVideoDevice(device); }); mSettingsModelConnection->invokeToCore([this, device]() { setVideoDevice(device); });
}); });
mSettingsModelConnection->makeConnectToCore(&SettingsCore::lSetConferenceLayout, [this](QVariantMap layout) {
auto linLayout = LinphoneEnums::toLinphone(LinphoneEnums::ConferenceLayout(layout["id"].toInt()));
mSettingsModelConnection->invokeToModel([this, linLayout]() {
mAutoSaved = true;
SettingsModel::getInstance()->setDefaultConferenceLayout(linLayout);
});
});
mSettingsModelConnection->makeConnectToModel(&SettingsModel::conferenceLayoutChanged, [this]() { mSettingsModelConnection->makeConnectToModel(&SettingsModel::conferenceLayoutChanged, [this]() {
auto layout = LinphoneEnums::fromLinphone(SettingsModel::getInstance()->getDefaultConferenceLayout()); auto layout = LinphoneEnums::fromLinphone(SettingsModel::getInstance()->getDefaultConferenceLayout());
mSettingsModelConnection->invokeToCore( mSettingsModelConnection->invokeToCore(
@ -546,7 +585,11 @@ void SettingsCore::setVideoDevice(QString device) {
if (mVideoDevice != device) { if (mVideoDevice != device) {
mVideoDevice = device; mVideoDevice = device;
emit videoDeviceChanged(); emit videoDeviceChanged();
setIsSaved(false); if (mAutoSaved) {
mAutoSaved = false;
} else {
setIsSaved(false);
}
} }
} }
@ -554,7 +597,6 @@ void SettingsCore::setVideoDevices(QStringList devices) {
if (mVideoDevices != devices) { if (mVideoDevices != devices) {
mVideoDevices = devices; mVideoDevices = devices;
emit videoDevicesChanged(); emit videoDevicesChanged();
setIsSaved(false);
} }
} }
@ -578,7 +620,11 @@ void SettingsCore::setCaptureGain(float gain) {
if (mCaptureGain != gain) { if (mCaptureGain != gain) {
mCaptureGain = gain; mCaptureGain = gain;
emit captureGainChanged(gain); emit captureGainChanged(gain);
setIsSaved(false); if (mAutoSaved) {
mAutoSaved = false;
} else {
setIsSaved(false);
}
} }
} }
@ -590,7 +636,11 @@ void SettingsCore::setConferenceLayout(QVariantMap layout) {
if (mConferenceLayout["id"] != layout["id"]) { if (mConferenceLayout["id"] != layout["id"]) {
mConferenceLayout = layout; mConferenceLayout = layout;
emit conferenceLayoutChanged(); emit conferenceLayoutChanged();
setIsSaved(false); if (mAutoSaved) {
mAutoSaved = false;
} else {
setIsSaved(false);
}
} }
} }
@ -614,7 +664,11 @@ void SettingsCore::setPlaybackGain(float gain) {
if (mPlaybackGain != gain) { if (mPlaybackGain != gain) {
mPlaybackGain = gain; mPlaybackGain = gain;
emit playbackGainChanged(gain); emit playbackGainChanged(gain);
setIsSaved(false); if (mAutoSaved) {
mAutoSaved = false;
} else {
setIsSaved(false);
}
} }
} }
@ -626,7 +680,11 @@ void SettingsCore::setCaptureDevice(QVariantMap device) {
if (mCaptureDevice["id"] != device["id"]) { if (mCaptureDevice["id"] != device["id"]) {
mCaptureDevice = device; mCaptureDevice = device;
emit captureDeviceChanged(device); emit captureDeviceChanged(device);
setIsSaved(false); if (mAutoSaved) {
mAutoSaved = false;
} else {
setIsSaved(false);
}
} }
} }
@ -638,7 +696,11 @@ void SettingsCore::setPlaybackDevice(QVariantMap device) {
if (mPlaybackDevice["id"] != device["id"]) { if (mPlaybackDevice["id"] != device["id"]) {
mPlaybackDevice = device; mPlaybackDevice = device;
emit playbackDeviceChanged(device); emit playbackDeviceChanged(device);
setIsSaved(false); if (mAutoSaved) {
mAutoSaved = false;
} else {
setIsSaved(false);
}
} }
} }

View file

@ -232,7 +232,9 @@ signals:
void captureGraphRunningChanged(bool running); void captureGraphRunningChanged(bool running);
void lSetPlaybackGain(float gain);
void playbackGainChanged(float gain); void playbackGainChanged(float gain);
void lSetCaptureGain(float gain);
void captureGainChanged(float gain); void captureGainChanged(float gain);
void captureDevicesChanged(const QVariantList &devices); void captureDevicesChanged(const QVariantList &devices);
@ -241,8 +243,10 @@ signals:
void conferenceLayoutsChanged(const QVariantList &layouts); void conferenceLayoutsChanged(const QVariantList &layouts);
void mediaEncryptionsChanged(const QVariantList &encryptions); void mediaEncryptionsChanged(const QVariantList &encryptions);
void lSetCaptureDevice(QVariantMap device);
void captureDeviceChanged(const QVariantMap &device); void captureDeviceChanged(const QVariantMap &device);
void lSetConferenceLayout(QVariantMap layout);
void conferenceLayoutChanged(); void conferenceLayoutChanged();
void mediaEncryptionChanged(); void mediaEncryptionChanged();
@ -251,10 +255,12 @@ signals:
void isSavedChanged(); void isSavedChanged();
void lSetPlaybackDevice(QVariantMap device);
void playbackDeviceChanged(const QVariantMap &device); void playbackDeviceChanged(const QVariantMap &device);
void ringerDeviceChanged(const QVariantMap &device); void ringerDeviceChanged(const QVariantMap &device);
void lSetVideoDevice(QString id);
void videoDeviceChanged(); void videoDeviceChanged();
void videoDevicesChanged(); void videoDevicesChanged();
@ -327,6 +333,7 @@ private:
bool mDndEnabled; bool mDndEnabled;
bool mIsSaved = true; bool mIsSaved = true;
bool mAutoSaved = false;
QSettings mAppSettings; QSettings mAppSettings;
QSharedPointer<SafeConnection<SettingsCore, SettingsModel>> mSettingsModelConnection; QSharedPointer<SafeConnection<SettingsCore, SettingsModel>> mSettingsModelConnection;

View file

@ -42,11 +42,6 @@ CallModel::CallModel(const std::shared_ptr<linphone::Call> &call, QObject *paren
connect(&mMicroVolumeTimer, &QTimer::timeout, this, connect(&mMicroVolumeTimer, &QTimer::timeout, this,
[this]() { this->microphoneVolumeChanged(Utils::computeVu(mMonitor->getRecordVolume())); }); [this]() { this->microphoneVolumeChanged(Utils::computeVu(mMonitor->getRecordVolume())); });
mMicroVolumeTimer.start(); mMicroVolumeTimer.start();
// connect(this, &CallModel::stateChanged, this, [this] {
// auto state = mMonitor->getState();
// if (state == linphone::Call::State::Paused) setPaused(true);
// });
} }
CallModel::~CallModel() { CallModel::~CallModel() {
@ -166,30 +161,6 @@ void CallModel::setRecordFile(const std::string &path) {
mMonitor->update(params); mMonitor->update(params);
} }
void CallModel::setSpeakerVolumeGain(float gain) {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
mMonitor->setSpeakerVolumeGain(gain);
emit speakerVolumeGainChanged(gain);
}
float CallModel::getSpeakerVolumeGain() const {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
auto gain = mMonitor->getSpeakerVolumeGain();
return gain;
}
void CallModel::setMicrophoneVolumeGain(float gain) {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
mMonitor->setMicrophoneVolumeGain(gain);
emit microphoneVolumeGainChanged(gain);
}
float CallModel::getMicrophoneVolumeGain() const {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
auto gain = mMonitor->getMicrophoneVolumeGain();
return gain;
}
float CallModel::getMicrophoneVolume() const { float CallModel::getMicrophoneVolume() const {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
auto volume = mMonitor->getRecordVolume(); auto volume = mMonitor->getRecordVolume();

View file

@ -48,8 +48,6 @@ public:
void startRecording(); void startRecording();
void stopRecording(); void stopRecording();
void setRecordFile(const std::string &path); void setRecordFile(const std::string &path);
void setSpeakerVolumeGain(float gain);
void setMicrophoneVolumeGain(float gain);
void setInputAudioDevice(const std::shared_ptr<linphone::AudioDevice> &id); void setInputAudioDevice(const std::shared_ptr<linphone::AudioDevice> &id);
std::shared_ptr<const linphone::AudioDevice> getInputAudioDevice() const; std::shared_ptr<const linphone::AudioDevice> getInputAudioDevice() const;
void setOutputAudioDevice(const std::shared_ptr<linphone::AudioDevice> &id); void setOutputAudioDevice(const std::shared_ptr<linphone::AudioDevice> &id);
@ -64,9 +62,7 @@ public:
void transferToAnother(const std::shared_ptr<linphone::Call> &call); void transferToAnother(const std::shared_ptr<linphone::Call> &call);
void terminateAllCalls(); void terminateAllCalls();
float getMicrophoneVolumeGain() const;
float getMicrophoneVolume() const; float getMicrophoneVolume() const;
float getSpeakerVolumeGain() const;
std::string getRecordFile() const; std::string getRecordFile() const;
std::shared_ptr<const linphone::Address> getRemoteAddress(); std::shared_ptr<const linphone::Address> getRemoteAddress();
bool getAuthenticationTokenVerified() const; bool getAuthenticationTokenVerified() const;

View file

@ -360,7 +360,7 @@ QVariantMap SettingsModel::getRingerDevice() const {
return ToolModel::createVariant(audioDevice); return ToolModel::createVariant(audioDevice);
} }
void SettingsModel::setRingerDevice(const QVariantMap &device) { void SettingsModel::setRingerDevice(QVariantMap device) {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
CoreModel::getInstance()->getCore()->setRingerDevice(Utils::appStringToCoreString(device["id"].toString())); CoreModel::getInstance()->getCore()->setRingerDevice(Utils::appStringToCoreString(device["id"].toString()));
emit ringerDeviceChanged(device); emit ringerDeviceChanged(device);
@ -373,7 +373,7 @@ QString SettingsModel::getVideoDevice() const {
return Utils::coreStringToAppString(CoreModel::getInstance()->getCore()->getVideoDevice()); return Utils::coreStringToAppString(CoreModel::getInstance()->getCore()->getVideoDevice());
} }
void SettingsModel::setVideoDevice(const QString &device) { void SettingsModel::setVideoDevice(QString device) {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
CoreModel::getInstance()->getCore()->setVideoDevice(Utils::appStringToCoreString(device)); CoreModel::getInstance()->getCore()->setVideoDevice(Utils::appStringToCoreString(device));
emit videoDeviceChanged(device); emit videoDeviceChanged(device);

View file

@ -103,10 +103,10 @@ public:
void setMediaEncryptionMandatory(bool mandatory); void setMediaEncryptionMandatory(bool mandatory);
QVariantMap getRingerDevice() const; QVariantMap getRingerDevice() const;
void setRingerDevice(const QVariantMap &device); void setRingerDevice(QVariantMap device);
QString getVideoDevice() const; QString getVideoDevice() const;
void setVideoDevice(const QString &device); void setVideoDevice(QString device);
void startEchoCancellerCalibration(); void startEchoCancellerCalibration();
int getEchoCancellationCalibration() const; int getEchoCancellationCalibration() const;

View file

@ -86,16 +86,23 @@ ColumnLayout {
propertyName: "playbackDevice" propertyName: "playbackDevice"
propertyOwner: SettingsCpp propertyOwner: SettingsCpp
textRole: 'display_name' textRole: 'display_name'
Connections {
enabled: mainItem.call
target: outputAudioDeviceCBox
function onCurrentValueChanged() {
SettingsCpp.lSetPlaybackDevice(outputAudioDeviceCBox.currentValue)
}
}
} }
Slider { Slider {
id: speakerVolume id: speakerVolume
Layout.fillWidth: true Layout.fillWidth: true
from: 0.0 from: 0.0
to: 1.0 to: 1.0
value: mainItem.call ? mainItem.call.core.speakerVolumeGain : SettingsCpp.playbackGain value: SettingsCpp.playbackGain
onMoved: { onMoved: {
if (mainItem.call) mainItem.call.core.lSetSpeakerVolumeGain(value) if (mainItem.call) SettingsCpp.lSetPlaybackGain(value)
SettingsCpp.playbackGain = value else SettingsCpp.playbackGain = value
} }
} }
} }
@ -126,16 +133,23 @@ ColumnLayout {
propertyName: "captureDevice" propertyName: "captureDevice"
propertyOwner: SettingsCpp propertyOwner: SettingsCpp
textRole: 'display_name' textRole: 'display_name'
Connections {
enabled: mainItem.call
target: inputAudioDeviceCBox
function onCurrentValueChanged() {
SettingsCpp.lSetCaptureDevice(inputAudioDeviceCBox.currentValue)
}
}
} }
Slider { Slider {
id: microVolume id: microVolume
Layout.fillWidth: true Layout.fillWidth: true
from: 0.0 from: 0.0
to: 1.0 to: 1.0
value: mainItem.call ? mainItem.call.core.microphoneVolumeGain : SettingsCpp.captureGain value: SettingsCpp.captureGain
onMoved: { onMoved: {
if (mainItem.call) mainItem.call.core.lSetMicrophoneVolumeGain(value) if (mainItem.call) SettingsCpp.lSetCaptureGain(value)
SettingsCpp.captureGain = value else SettingsCpp.captureGain = value
} }
} }
Timer { Timer {
@ -144,8 +158,7 @@ ColumnLayout {
repeat: true repeat: true
running: false running: false
onTriggered: { onTriggered: {
if (mainItem.call) audioTestSlider.value = mainItem.call.core.microVolume SettingsCpp.updateMicVolume()
else SettingsCpp.updateMicVolume()
} }
} }
Slider { Slider {
@ -204,6 +217,13 @@ ColumnLayout {
entries: SettingsCpp.videoDevices entries: SettingsCpp.videoDevices
propertyName: "videoDevice" propertyName: "videoDevice"
propertyOwner: SettingsCpp propertyOwner: SettingsCpp
Connections {
enabled: mainItem.call
target: videoDevicesCbox
function onCurrentValueChanged() {
SettingsCpp.lSetVideoDevice(videoDevicesCbox.currentValue)
}
}
} }
} }
Connections { Connections {

View file

@ -13,6 +13,10 @@
text: { text: {
normal: Linphone.DefaultStyle.grey_0, normal: Linphone.DefaultStyle.grey_0,
pressed: Linphone.DefaultStyle.grey_0 pressed: Linphone.DefaultStyle.grey_0
},
image: {
normal: Linphone.DefaultStyle.grey_0,
pressed: Linphone.DefaultStyle.grey_0
} }
} }