fix #LINQT-1304 microphone auto test slider

This commit is contained in:
Gaelle Braud 2024-10-07 15:06:19 +02:00
parent 2fba926a40
commit 2fce83fb43
10 changed files with 154 additions and 112 deletions

View file

@ -423,6 +423,7 @@ void App::initCore() {
mLinphoneThread->getThreadId(), mLinphoneThread->getThreadId(),
[this]() mutable { [this]() mutable {
CoreModel::getInstance()->start(); CoreModel::getInstance()->start();
SettingsModel::create();
auto settings = SettingsCore::create(); auto settings = SettingsCore::create();
QMetaObject::invokeMethod(App::getInstance()->thread(), [this, settings] { QMetaObject::invokeMethod(App::getInstance()->thread(), [this, settings] {
// QML // QML

View file

@ -22,6 +22,7 @@
#include "core/App.hpp" #include "core/App.hpp"
#include "core/conference/ConferenceCore.hpp" #include "core/conference/ConferenceCore.hpp"
#include "core/conference/ConferenceGui.hpp" #include "core/conference/ConferenceGui.hpp"
#include "core/setting/SettingsCore.hpp"
#include "model/tool/ToolModel.hpp" #include "model/tool/ToolModel.hpp"
#include "tool/Utils.hpp" #include "tool/Utils.hpp"
#include "tool/thread/SafeConnection.hpp" #include "tool/thread/SafeConnection.hpp"
@ -152,19 +153,14 @@ 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();
mSpeakerVolumeGain = mCallModel->getSpeakerVolumeGain(); mSpeakerVolumeGain = mCallModel->getSpeakerVolumeGain();
// TODO : change this with settings value when settings done
if (mSpeakerVolumeGain < 0) { if (mSpeakerVolumeGain < 0) {
auto vol = CoreModel::getInstance()->getCore()->getPlaybackGainDb(); mSpeakerVolumeGain = settingsModel->getPlaybackGain();
call->setSpeakerVolumeGain(vol);
mSpeakerVolumeGain = vol;
} }
mMicrophoneVolumeGain = call->getMicrophoneVolumeGain(); mMicrophoneVolumeGain = call->getMicrophoneVolumeGain();
// TODO : change this with settings value when settings done
if (mMicrophoneVolumeGain < 0) { if (mMicrophoneVolumeGain < 0) {
auto vol = CoreModel::getInstance()->getCore()->getMicGainDb(); mMicrophoneVolumeGain = settingsModel->getCaptureGain();
call->setMicrophoneVolumeGain(vol);
mMicrophoneVolumeGain = vol;
} }
mMicrophoneVolume = call->getRecordVolume(); mMicrophoneVolume = call->getRecordVolume();
mRecordable = mState == LinphoneEnums::CallState::StreamsRunning; mRecordable = mState == LinphoneEnums::CallState::StreamsRunning;
@ -268,21 +264,21 @@ void CallCore::setSelf(QSharedPointer<CallCore> me) {
setState(LinphoneEnums::fromLinphone(state), Utils::coreStringToAppString(message)); setState(LinphoneEnums::fromLinphone(state), Utils::coreStringToAppString(message));
}); });
double speakerVolume = mSpeakerVolumeGain; double speakerVolume = mSpeakerVolumeGain;
double micVolume = mMicrophoneVolumeGain; double micVolumeGain = 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(); micVolumeGain = mCallModel->getMicrophoneVolumeGain();
if (micVolume < 0) { if (micVolumeGain < 0) {
micVolume = CoreModel::getInstance()->getCore()->getMicGainDb(); 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, micVolume, subject]() { mCallModelConnection->invokeToCore([this, state, speakerVolume, micVolumeGain, subject]() {
setSpeakerVolumeGain(speakerVolume); setSpeakerVolumeGain(speakerVolume);
setMicrophoneVolumeGain(micVolume); 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);

View file

@ -40,61 +40,62 @@ QSharedPointer<SettingsCore> SettingsCore::create() {
SettingsCore::SettingsCore(QObject *parent) : QObject(parent) { SettingsCore::SettingsCore(QObject *parent) : QObject(parent) {
mustBeInLinphoneThread(getClassName()); mustBeInLinphoneThread(getClassName());
mSettingsModel = Utils::makeQObject_ptr<SettingsModel>(); auto settingsModel = SettingsModel::getInstance();
assert(settingsModel);
// Security // Security
mVfsEnabled = mSettingsModel->getVfsEnabled(); mVfsEnabled = settingsModel->getVfsEnabled();
// Call // Call
mVideoEnabled = mSettingsModel->getVideoEnabled(); mVideoEnabled = settingsModel->getVideoEnabled();
mEchoCancellationEnabled = mSettingsModel->getEchoCancellationEnabled(); mEchoCancellationEnabled = settingsModel->getEchoCancellationEnabled();
mAutomaticallyRecordCallsEnabled = mSettingsModel->getAutomaticallyRecordCallsEnabled(); mAutomaticallyRecordCallsEnabled = settingsModel->getAutomaticallyRecordCallsEnabled();
// Audio // Audio
mCaptureDevices = mSettingsModel->getCaptureDevices(); mCaptureDevices = settingsModel->getCaptureDevices();
mPlaybackDevices = mSettingsModel->getPlaybackDevices(); mPlaybackDevices = settingsModel->getPlaybackDevices();
mRingerDevices = mSettingsModel->getRingerDevices(); mRingerDevices = settingsModel->getRingerDevices();
mCaptureDevice = mSettingsModel->getCaptureDevice(); mCaptureDevice = settingsModel->getCaptureDevice();
mPlaybackDevice = mSettingsModel->getPlaybackDevice(); mPlaybackDevice = settingsModel->getPlaybackDevice();
mCaptureGain = mSettingsModel->getCaptureGain(); mCaptureGain = settingsModel->getCaptureGain();
mPlaybackGain = mSettingsModel->getPlaybackGain(); mPlaybackGain = settingsModel->getPlaybackGain();
// Video // Video
mVideoDevice = mSettingsModel->getVideoDevice(); mVideoDevice = settingsModel->getVideoDevice();
mVideoDevices = mSettingsModel->getVideoDevices(); mVideoDevices = settingsModel->getVideoDevices();
// Logs // Logs
mLogsEnabled = mSettingsModel->getLogsEnabled(); mLogsEnabled = settingsModel->getLogsEnabled();
mFullLogsEnabled = mSettingsModel->getFullLogsEnabled(); mFullLogsEnabled = settingsModel->getFullLogsEnabled();
mLogsFolder = mSettingsModel->getLogsFolder(); mLogsFolder = settingsModel->getLogsFolder();
mLogsEmail = mSettingsModel->getLogsEmail(); mLogsEmail = settingsModel->getLogsEmail();
// DND // DND
mDndEnabled = mSettingsModel->dndEnabled(); mDndEnabled = settingsModel->dndEnabled();
// Ui // Ui
INIT_CORE_MEMBER(DisableChatFeature, mSettingsModel) INIT_CORE_MEMBER(DisableChatFeature, settingsModel)
INIT_CORE_MEMBER(DisableMeetingsFeature, mSettingsModel) INIT_CORE_MEMBER(DisableMeetingsFeature, settingsModel)
INIT_CORE_MEMBER(DisableBroadcastFeature, mSettingsModel) INIT_CORE_MEMBER(DisableBroadcastFeature, settingsModel)
INIT_CORE_MEMBER(HideSettings, mSettingsModel) INIT_CORE_MEMBER(HideSettings, settingsModel)
INIT_CORE_MEMBER(HideAccountSettings, mSettingsModel) INIT_CORE_MEMBER(HideAccountSettings, settingsModel)
INIT_CORE_MEMBER(DisableCallRecordings, mSettingsModel) INIT_CORE_MEMBER(DisableCallRecordings, settingsModel)
INIT_CORE_MEMBER(AssistantHideCreateAccount, mSettingsModel) INIT_CORE_MEMBER(AssistantHideCreateAccount, settingsModel)
INIT_CORE_MEMBER(AssistantHideCreateAccount, mSettingsModel) INIT_CORE_MEMBER(AssistantHideCreateAccount, settingsModel)
INIT_CORE_MEMBER(AssistantDisableQrCode, mSettingsModel) INIT_CORE_MEMBER(AssistantDisableQrCode, settingsModel)
INIT_CORE_MEMBER(AssistantHideThirdPartyAccount, mSettingsModel) INIT_CORE_MEMBER(AssistantHideThirdPartyAccount, settingsModel)
INIT_CORE_MEMBER(OnlyDisplaySipUriUsername, mSettingsModel) INIT_CORE_MEMBER(OnlyDisplaySipUriUsername, settingsModel)
INIT_CORE_MEMBER(DarkModeAllowed, mSettingsModel) INIT_CORE_MEMBER(DarkModeAllowed, settingsModel)
INIT_CORE_MEMBER(MaxAccount, mSettingsModel) INIT_CORE_MEMBER(MaxAccount, settingsModel)
INIT_CORE_MEMBER(AssistantGoDirectlyToThirdPartySipAccountLogin, mSettingsModel) INIT_CORE_MEMBER(AssistantGoDirectlyToThirdPartySipAccountLogin, settingsModel)
INIT_CORE_MEMBER(AssistantThirdPartySipAccountDomain, mSettingsModel) INIT_CORE_MEMBER(AssistantThirdPartySipAccountDomain, settingsModel)
INIT_CORE_MEMBER(AssistantThirdPartySipAccountTransport, mSettingsModel) INIT_CORE_MEMBER(AssistantThirdPartySipAccountTransport, settingsModel)
INIT_CORE_MEMBER(AutoStart, mSettingsModel) INIT_CORE_MEMBER(AutoStart, settingsModel)
INIT_CORE_MEMBER(ExitOnClose, mSettingsModel) INIT_CORE_MEMBER(ExitOnClose, settingsModel)
INIT_CORE_MEMBER(SyncLdapContacts, mSettingsModel) INIT_CORE_MEMBER(SyncLdapContacts, settingsModel)
INIT_CORE_MEMBER(Ipv6Enabled, mSettingsModel) INIT_CORE_MEMBER(Ipv6Enabled, settingsModel)
} }
SettingsCore::~SettingsCore() { SettingsCore::~SettingsCore() {
@ -103,11 +104,12 @@ SettingsCore::~SettingsCore() {
void SettingsCore::setSelf(QSharedPointer<SettingsCore> me) { void SettingsCore::setSelf(QSharedPointer<SettingsCore> me) {
mustBeInLinphoneThread(getClassName()); mustBeInLinphoneThread(getClassName());
mSettingsModelConnection = QSharedPointer<SafeConnection<SettingsCore, SettingsModel>>( mSettingsModelConnection = QSharedPointer<SafeConnection<SettingsCore, SettingsModel>>(
new SafeConnection<SettingsCore, SettingsModel>(me, mSettingsModel), &QObject::deleteLater); new SafeConnection<SettingsCore, SettingsModel>(me, SettingsModel::getInstance()), &QObject::deleteLater);
// VFS // VFS
mSettingsModelConnection->makeConnectToCore(&SettingsCore::setVfsEnabled, [this](const bool enabled) { mSettingsModelConnection->makeConnectToCore(&SettingsCore::setVfsEnabled, [this](const bool enabled) {
mSettingsModelConnection->invokeToModel([this, enabled]() { mSettingsModel->setVfsEnabled(enabled); }); mSettingsModelConnection->invokeToModel(
[this, enabled]() { SettingsModel::getInstance()->setVfsEnabled(enabled); });
}); });
mSettingsModelConnection->makeConnectToModel(&SettingsModel::vfsEnabledChanged, [this](const bool enabled) { mSettingsModelConnection->makeConnectToModel(&SettingsModel::vfsEnabledChanged, [this](const bool enabled) {
@ -119,7 +121,8 @@ void SettingsCore::setSelf(QSharedPointer<SettingsCore> me) {
// Video Calls // Video Calls
mSettingsModelConnection->makeConnectToCore(&SettingsCore::setVideoEnabled, [this](const bool enabled) { mSettingsModelConnection->makeConnectToCore(&SettingsCore::setVideoEnabled, [this](const bool enabled) {
mSettingsModelConnection->invokeToModel([this, enabled]() { mSettingsModel->setVideoEnabled(enabled); }); mSettingsModelConnection->invokeToModel(
[this, enabled]() { SettingsModel::getInstance()->setVideoEnabled(enabled); });
}); });
mSettingsModelConnection->makeConnectToModel(&SettingsModel::videoEnabledChanged, [this](const bool enabled) { mSettingsModelConnection->makeConnectToModel(&SettingsModel::videoEnabledChanged, [this](const bool enabled) {
@ -132,7 +135,7 @@ void SettingsCore::setSelf(QSharedPointer<SettingsCore> me) {
// Echo cancelling // Echo cancelling
mSettingsModelConnection->makeConnectToCore(&SettingsCore::setEchoCancellationEnabled, [this](const bool enabled) { mSettingsModelConnection->makeConnectToCore(&SettingsCore::setEchoCancellationEnabled, [this](const bool enabled) {
mSettingsModelConnection->invokeToModel( mSettingsModelConnection->invokeToModel(
[this, enabled]() { mSettingsModel->setEchoCancellationEnabled(enabled); }); [this, enabled]() { SettingsModel::getInstance()->setEchoCancellationEnabled(enabled); });
}); });
mSettingsModelConnection->makeConnectToModel(&SettingsModel::echoCancellationEnabledChanged, mSettingsModelConnection->makeConnectToModel(&SettingsModel::echoCancellationEnabledChanged,
@ -144,11 +147,10 @@ void SettingsCore::setSelf(QSharedPointer<SettingsCore> me) {
}); });
// Auto recording // Auto recording
mSettingsModelConnection->makeConnectToCore(&SettingsCore::setAutomaticallyRecordCallsEnabled, mSettingsModelConnection->makeConnectToCore(
[this](const bool enabled) { &SettingsCore::setAutomaticallyRecordCallsEnabled, [this](const bool enabled) {
mSettingsModelConnection->invokeToModel([this, enabled]() { mSettingsModelConnection->invokeToModel(
mSettingsModel->setAutomaticallyRecordCallsEnabled(enabled); [this, enabled]() { SettingsModel::getInstance()->setAutomaticallyRecordCallsEnabled(enabled); });
});
}); });
mSettingsModelConnection->makeConnectToModel(&SettingsModel::automaticallyRecordCallsEnabledChanged, mSettingsModelConnection->makeConnectToModel(&SettingsModel::automaticallyRecordCallsEnabledChanged,
[this](const bool enabled) { [this](const bool enabled) {
@ -160,7 +162,7 @@ void SettingsCore::setSelf(QSharedPointer<SettingsCore> me) {
// Audio device(s) // Audio device(s)
mSettingsModelConnection->makeConnectToCore(&SettingsCore::lSetCaptureDevice, [this](const QString id) { mSettingsModelConnection->makeConnectToCore(&SettingsCore::lSetCaptureDevice, [this](const QString id) {
mSettingsModelConnection->invokeToModel([this, id]() { mSettingsModel->setCaptureDevice(id); }); mSettingsModelConnection->invokeToModel([this, id]() { SettingsModel::getInstance()->setCaptureDevice(id); });
}); });
mSettingsModelConnection->makeConnectToModel(&SettingsModel::captureDeviceChanged, [this](const QString device) { mSettingsModelConnection->makeConnectToModel(&SettingsModel::captureDeviceChanged, [this](const QString device) {
mSettingsModelConnection->invokeToCore([this, device]() { mSettingsModelConnection->invokeToCore([this, device]() {
@ -170,7 +172,7 @@ void SettingsCore::setSelf(QSharedPointer<SettingsCore> me) {
}); });
mSettingsModelConnection->makeConnectToCore(&SettingsCore::lSetPlaybackDevice, [this](const QString id) { mSettingsModelConnection->makeConnectToCore(&SettingsCore::lSetPlaybackDevice, [this](const QString id) {
mSettingsModelConnection->invokeToModel([this, id]() { mSettingsModel->setPlaybackDevice(id); }); mSettingsModelConnection->invokeToModel([this, id]() { SettingsModel::getInstance()->setPlaybackDevice(id); });
}); });
mSettingsModelConnection->makeConnectToModel(&SettingsModel::playbackDeviceChanged, [this](const QString device) { mSettingsModelConnection->makeConnectToModel(&SettingsModel::playbackDeviceChanged, [this](const QString device) {
@ -180,7 +182,7 @@ void SettingsCore::setSelf(QSharedPointer<SettingsCore> me) {
}); });
}); });
mSettingsModelConnection->makeConnectToCore(&SettingsCore::lSetRingerDevice, [this](const QString id) { mSettingsModelConnection->makeConnectToCore(&SettingsCore::lSetRingerDevice, [this](const QString id) {
mSettingsModelConnection->invokeToModel([this, id]() { mSettingsModel->setRingerDevice(id); }); mSettingsModelConnection->invokeToModel([this, id]() { SettingsModel::getInstance()->setRingerDevice(id); });
}); });
mSettingsModelConnection->makeConnectToModel(&SettingsModel::ringerDeviceChanged, [this](const QString device) { mSettingsModelConnection->makeConnectToModel(&SettingsModel::ringerDeviceChanged, [this](const QString device) {
@ -191,7 +193,8 @@ void SettingsCore::setSelf(QSharedPointer<SettingsCore> me) {
}); });
mSettingsModelConnection->makeConnectToCore(&SettingsCore::lSetPlaybackGain, [this](const float value) { mSettingsModelConnection->makeConnectToCore(&SettingsCore::lSetPlaybackGain, [this](const float value) {
mSettingsModelConnection->invokeToModel([this, value]() { mSettingsModel->setPlaybackGain(value); }); mSettingsModelConnection->invokeToModel(
[this, value]() { SettingsModel::getInstance()->setPlaybackGain(value); });
}); });
mSettingsModelConnection->makeConnectToModel(&SettingsModel::playbackGainChanged, [this](const float value) { mSettingsModelConnection->makeConnectToModel(&SettingsModel::playbackGainChanged, [this](const float value) {
@ -202,7 +205,8 @@ void SettingsCore::setSelf(QSharedPointer<SettingsCore> me) {
}); });
mSettingsModelConnection->makeConnectToCore(&SettingsCore::lSetCaptureGain, [this](const float value) { mSettingsModelConnection->makeConnectToCore(&SettingsCore::lSetCaptureGain, [this](const float value) {
mSettingsModelConnection->invokeToModel([this, value]() { mSettingsModel->setCaptureGain(value); }); mSettingsModelConnection->invokeToModel(
[this, value]() { SettingsModel::getInstance()->setCaptureGain(value); });
}); });
mSettingsModelConnection->makeConnectToModel(&SettingsModel::captureGainChanged, [this](const float value) { mSettingsModelConnection->makeConnectToModel(&SettingsModel::captureGainChanged, [this](const float value) {
@ -241,7 +245,7 @@ void SettingsCore::setSelf(QSharedPointer<SettingsCore> me) {
// Video device(s) // Video device(s)
mSettingsModelConnection->makeConnectToCore(&SettingsCore::lSetVideoDevice, [this](const QString id) { mSettingsModelConnection->makeConnectToCore(&SettingsCore::lSetVideoDevice, [this](const QString id) {
mSettingsModelConnection->invokeToModel([this, id]() { mSettingsModel->setVideoDevice(id); }); mSettingsModelConnection->invokeToModel([this, id]() { SettingsModel::getInstance()->setVideoDevice(id); });
}); });
mSettingsModelConnection->makeConnectToModel(&SettingsModel::videoDeviceChanged, [this](const QString device) { mSettingsModelConnection->makeConnectToModel(&SettingsModel::videoDeviceChanged, [this](const QString device) {
@ -261,7 +265,8 @@ void SettingsCore::setSelf(QSharedPointer<SettingsCore> me) {
// Logs // Logs
mSettingsModelConnection->makeConnectToCore(&SettingsCore::setLogsEnabled, [this](const bool status) { mSettingsModelConnection->makeConnectToCore(&SettingsCore::setLogsEnabled, [this](const bool status) {
mSettingsModelConnection->invokeToModel([this, status]() { mSettingsModel->setLogsEnabled(status); }); mSettingsModelConnection->invokeToModel(
[this, status]() { SettingsModel::getInstance()->setLogsEnabled(status); });
}); });
mSettingsModelConnection->makeConnectToModel(&SettingsModel::logsEnabledChanged, [this](const bool status) { mSettingsModelConnection->makeConnectToModel(&SettingsModel::logsEnabledChanged, [this](const bool status) {
@ -272,7 +277,8 @@ void SettingsCore::setSelf(QSharedPointer<SettingsCore> me) {
}); });
mSettingsModelConnection->makeConnectToCore(&SettingsCore::setFullLogsEnabled, [this](const bool status) { mSettingsModelConnection->makeConnectToCore(&SettingsCore::setFullLogsEnabled, [this](const bool status) {
mSettingsModelConnection->invokeToModel([this, status]() { mSettingsModel->setFullLogsEnabled(status); }); mSettingsModelConnection->invokeToModel(
[this, status]() { SettingsModel::getInstance()->setFullLogsEnabled(status); });
}); });
mSettingsModelConnection->makeConnectToModel(&SettingsModel::fullLogsEnabledChanged, [this](const bool status) { mSettingsModelConnection->makeConnectToModel(&SettingsModel::fullLogsEnabledChanged, [this](const bool status) {
@ -284,7 +290,7 @@ void SettingsCore::setSelf(QSharedPointer<SettingsCore> me) {
// DND // DND
mSettingsModelConnection->makeConnectToCore(&SettingsCore::lEnableDnd, [this](const bool value) { mSettingsModelConnection->makeConnectToCore(&SettingsCore::lEnableDnd, [this](const bool value) {
mSettingsModelConnection->invokeToModel([this, value]() { mSettingsModel->enableDnd(value); }); mSettingsModelConnection->invokeToModel([this, value]() { SettingsModel::getInstance()->enableDnd(value); });
}); });
mSettingsModelConnection->makeConnectToModel(&SettingsModel::dndChanged, [this](const bool value) { mSettingsModelConnection->makeConnectToModel(&SettingsModel::dndChanged, [this](const bool value) {
mSettingsModelConnection->invokeToCore([this, value]() { mSettingsModelConnection->invokeToCore([this, value]() {
@ -293,46 +299,48 @@ void SettingsCore::setSelf(QSharedPointer<SettingsCore> me) {
}); });
}); });
DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, mSettingsModel, bool, auto settingsModel = SettingsModel::getInstance();
DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, bool,
disableChatFeature, DisableChatFeature) disableChatFeature, DisableChatFeature)
DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, mSettingsModel, bool, DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, bool,
disableMeetingsFeature, DisableMeetingsFeature) disableMeetingsFeature, DisableMeetingsFeature)
DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, mSettingsModel, bool, DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, bool,
disableBroadcastFeature, DisableBroadcastFeature) disableBroadcastFeature, DisableBroadcastFeature)
DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, mSettingsModel, bool, DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, bool, hideSettings,
hideSettings, HideSettings) HideSettings)
DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, mSettingsModel, bool, DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, bool,
hideAccountSettings, HideAccountSettings) hideAccountSettings, HideAccountSettings)
DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, mSettingsModel, bool, DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, bool,
disableCallRecordings, DisableCallRecordings) disableCallRecordings, DisableCallRecordings)
DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, mSettingsModel, bool, DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, bool,
assistantHideCreateAccount, AssistantHideCreateAccount) assistantHideCreateAccount, AssistantHideCreateAccount)
DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, mSettingsModel, bool, DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, bool,
assistantHideCreateAccount, AssistantHideCreateAccount) assistantHideCreateAccount, AssistantHideCreateAccount)
DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, mSettingsModel, bool, DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, bool,
assistantDisableQrCode, AssistantDisableQrCode) assistantDisableQrCode, AssistantDisableQrCode)
DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, mSettingsModel, bool, DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, bool,
assistantHideThirdPartyAccount, AssistantHideThirdPartyAccount) assistantHideThirdPartyAccount, AssistantHideThirdPartyAccount)
DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, mSettingsModel, bool, DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, bool,
onlyDisplaySipUriUsername, OnlyDisplaySipUriUsername) onlyDisplaySipUriUsername, OnlyDisplaySipUriUsername)
DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, mSettingsModel, bool, DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, bool,
darkModeAllowed, DarkModeAllowed) darkModeAllowed, DarkModeAllowed)
DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, mSettingsModel, int, maxAccount, DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, int, maxAccount,
MaxAccount) MaxAccount)
DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, mSettingsModel, bool, DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, bool,
assistantGoDirectlyToThirdPartySipAccountLogin, assistantGoDirectlyToThirdPartySipAccountLogin,
AssistantGoDirectlyToThirdPartySipAccountLogin) AssistantGoDirectlyToThirdPartySipAccountLogin)
DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, mSettingsModel, QString, DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, QString,
assistantThirdPartySipAccountDomain, AssistantThirdPartySipAccountDomain) assistantThirdPartySipAccountDomain, AssistantThirdPartySipAccountDomain)
DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, mSettingsModel, QString, DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, QString,
assistantThirdPartySipAccountTransport, AssistantThirdPartySipAccountTransport) assistantThirdPartySipAccountTransport, AssistantThirdPartySipAccountTransport)
DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, mSettingsModel, bool, autoStart, DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, bool, autoStart,
AutoStart) AutoStart)
DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, mSettingsModel, bool, exitOnClose, DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, bool, exitOnClose,
ExitOnClose) ExitOnClose)
DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, mSettingsModel, bool, DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, bool,
syncLdapContacts, SyncLdapContacts) syncLdapContacts, SyncLdapContacts)
DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, mSettingsModel, bool, ipv6Enabled, DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, bool, ipv6Enabled,
Ipv6Enabled) Ipv6Enabled)
auto coreModelConnection = QSharedPointer<SafeConnection<SettingsCore, CoreModel>>( auto coreModelConnection = QSharedPointer<SafeConnection<SettingsCore, CoreModel>>(
@ -451,18 +459,19 @@ bool SettingsCore::getDisplayDeviceCheckConfirmation() const {
} }
void SettingsCore::startEchoCancellerCalibration() { void SettingsCore::startEchoCancellerCalibration() {
mSettingsModelConnection->invokeToModel([this]() { mSettingsModel->startEchoCancellerCalibration(); }); mSettingsModelConnection->invokeToModel(
[this]() { SettingsModel::getInstance()->startEchoCancellerCalibration(); });
} }
void SettingsCore::accessCallSettings() { void SettingsCore::accessCallSettings() {
mSettingsModelConnection->invokeToModel([this]() { mSettingsModel->accessCallSettings(); }); mSettingsModelConnection->invokeToModel([this]() { SettingsModel::getInstance()->accessCallSettings(); });
} }
void SettingsCore::closeCallSettings() { void SettingsCore::closeCallSettings() {
mSettingsModelConnection->invokeToModel([this]() { mSettingsModel->closeCallSettings(); }); mSettingsModelConnection->invokeToModel([this]() { SettingsModel::getInstance()->closeCallSettings(); });
} }
void SettingsCore::updateMicVolume() const { void SettingsCore::updateMicVolume() const {
mSettingsModelConnection->invokeToModel([this]() { mSettingsModel->getMicVolume(); }); mSettingsModelConnection->invokeToModel([this]() { SettingsModel::getInstance()->getMicVolume(); });
} }
bool SettingsCore::getLogsEnabled() const { bool SettingsCore::getLogsEnabled() const {
@ -474,11 +483,11 @@ bool SettingsCore::getFullLogsEnabled() const {
} }
void SettingsCore::cleanLogs() const { void SettingsCore::cleanLogs() const {
mSettingsModelConnection->invokeToModel([this]() { mSettingsModel->cleanLogs(); }); mSettingsModelConnection->invokeToModel([this]() { SettingsModel::getInstance()->cleanLogs(); });
} }
void SettingsCore::sendLogs() const { void SettingsCore::sendLogs() const {
mSettingsModelConnection->invokeToModel([this]() { mSettingsModel->sendLogs(); }); mSettingsModelConnection->invokeToModel([this]() { SettingsModel::getInstance()->sendLogs(); });
} }
QString SettingsCore::getLogsEmail() const { QString SettingsCore::getLogsEmail() const {

View file

@ -232,8 +232,6 @@ signals:
void ldapConfigChanged(); void ldapConfigChanged();
private: private:
std::shared_ptr<SettingsModel> mSettingsModel;
// Dummy properties (for properties that use values from core received through signals) // Dummy properties (for properties that use values from core received through signals)
int _dummy_int = 0; int _dummy_int = 0;

View file

@ -31,9 +31,14 @@ DEFINE_ABSTRACT_OBJECT(SettingsModel)
using namespace std; using namespace std;
const std::string SettingsModel::UiSection("ui"); const std::string SettingsModel::UiSection("ui");
std::shared_ptr<SettingsModel> SettingsModel::gCoreModel;
SettingsModel::SettingsModel(QObject *parent) : QObject(parent) { SettingsModel::SettingsModel() {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
connect(CoreModel::getInstance()->thread(), &QThread::finished, this, [this]() {
// Model thread
gCoreModel = nullptr;
});
auto core = CoreModel::getInstance()->getCore(); auto core = CoreModel::getInstance()->getCore();
mConfig = core->getConfig(); mConfig = core->getConfig();
CoreModel::getInstance()->getLogger()->applyConfig(mConfig); CoreModel::getInstance()->getLogger()->applyConfig(mConfig);
@ -63,6 +68,16 @@ SettingsModel::~SettingsModel() {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
} }
shared_ptr<SettingsModel> SettingsModel::create() {
auto model = make_shared<SettingsModel>();
gCoreModel = model;
return model;
}
shared_ptr<SettingsModel> SettingsModel::getInstance() {
return gCoreModel;
}
bool SettingsModel::isReadOnly(const std::string &section, const std::string &name) const { bool SettingsModel::isReadOnly(const std::string &section, const std::string &name) const {
return mConfig->hasEntry(section, name + "/readonly"); return mConfig->hasEntry(section, name + "/readonly");
} }

View file

@ -33,9 +33,12 @@ class SettingsModel : public QObject, public AbstractObject {
Q_OBJECT Q_OBJECT
public: public:
SettingsModel(QObject *parent = Q_NULLPTR); SettingsModel();
virtual ~SettingsModel(); virtual ~SettingsModel();
static std::shared_ptr<SettingsModel> create();
static std::shared_ptr<SettingsModel> getInstance();
bool isReadOnly(const std::string &section, const std::string &name) const; bool isReadOnly(const std::string &section, const std::string &name) const;
std::string std::string
getEntryFullName(const std::string &section, getEntryFullName(const std::string &section,
@ -190,6 +193,9 @@ private:
void notifyConfigReady(); void notifyConfigReady();
MediastreamerUtils::SimpleCaptureGraph *mSimpleCaptureGraph = nullptr; MediastreamerUtils::SimpleCaptureGraph *mSimpleCaptureGraph = nullptr;
int mCaptureGraphListenerCount = 0; int mCaptureGraphListenerCount = 0;
static std::shared_ptr<SettingsModel> gCoreModel;
DECLARE_ABSTRACT_OBJECT DECLARE_ABSTRACT_OBJECT
}; };
#endif // SETTINGS_MODEL_H_ #endif // SETTINGS_MODEL_H_

View file

@ -92,8 +92,9 @@ public:
#define INIT_CORE_MEMBER(X, model) m##X = model->get##X(); #define INIT_CORE_MEMBER(X, model) m##X = model->get##X();
#define DEFINE_CORE_GETSET_CONNECT(safe, CoreClass, ModelClass, model, type, x, X) \ #define DEFINE_CORE_GETSET_CONNECT(safe, CoreClass, ModelClass, model, type, x, X) \
safe->makeConnectToCore(&CoreClass::set##X, \ safe->makeConnectToCore(&CoreClass::set##X, [this, objectToCall = model.get()](type data) { \
[this](type data) { safe->invokeToModel([this, data]() { model->set##X(data); }); }); \ safe->invokeToModel([this, data, objectToCall]() { objectToCall->set##X(data); }); \
}); \
safe->makeConnectToModel(&ModelClass::x##Changed, [this](type data) { \ safe->makeConnectToModel(&ModelClass::x##Changed, [this](type data) { \
safe->invokeToCore([this, data]() { \ safe->invokeToCore([this, data]() { \
if (m##X != data) { \ if (m##X != data) { \

View file

@ -14,9 +14,6 @@ ColumnLayout {
RoundedPane { RoundedPane {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Control.StackView.onActivated: {
rightPanelTitle.text = qsTr("Paramètres")
}
height: contentItem.implicitHeight + topPadding + bottomPadding height: contentItem.implicitHeight + topPadding + bottomPadding
Layout.fillWidth: true Layout.fillWidth: true
topPadding: 25 * DefaultStyle.dp topPadding: 25 * DefaultStyle.dp
@ -103,10 +100,14 @@ ColumnLayout {
} }
} }
Timer { Timer {
id: audioTestSliderTimer
interval: 50 interval: 50
repeat: true repeat: true
running: mainItem.call || false running: false
onTriggered: audioTestSlider.value = (mainItem.call && mainItem.call.core.microVolume) onTriggered: {
if (mainItem.call) audioTestSlider.value = mainItem.call.core.microVolume
else SettingsCpp.updateMicVolume()
}
} }
Slider { Slider {
id: audioTestSlider id: audioTestSlider
@ -166,6 +167,21 @@ ColumnLayout {
propertyOwner: SettingsCpp propertyOwner: SettingsCpp
} }
} }
Connections {
enabled: !mainItem.call
target: SettingsCpp
onMicVolumeChanged: (value) => {
audioTestSlider.value = value
}
}
Component.onCompleted: {
SettingsCpp.accessCallSettings()
audioTestSliderTimer.running = true
}
Component.onDestruction: {
audioTestSliderTimer.running = false
SettingsCpp.closeCallSettings()
}
} }
} }
Item { Item {

View file

@ -19,7 +19,7 @@ AbstractMainPage {
signal returnRequested() signal returnRequested()
signal addParticipantsValidated(list<string> selectedParticipants) signal addParticipantsValidated(list<string> selectedParticipants)
Component.onCompleted: rightPanelStackView.push(overridenRightPanel, Control.StackView.Immediate) Component.onCompleted: rightPanelStackView.push(overridenRightPanel, Control.StackView.Immediate)
showDefaultItem: leftPanelStackView.currentItem.objectName === "listLayout" && meetingListCount === 0 showDefaultItem: leftPanelStackView.currentItem?.objectName === "listLayout" && meetingListCount === 0
onVisibleChanged: if (!visible) { onVisibleChanged: if (!visible) {
leftPanelStackView.clear() leftPanelStackView.clear()

View file

@ -1554,7 +1554,7 @@ AbstractWindow {
id: participantListButton id: participantListButton
visible: mainWindow.conference visible: mainWindow.conference
iconUrl: AppIcons.usersTwo iconUrl: AppIcons.usersTwo
checked: rightPanel.visible && rightPanel.currentItem.objectName == "participantListPanel" checked: rightPanel.visible && rightPanel.currentItem?.objectName == "participantListPanel"
checkedColor: DefaultStyle.main2_400 checkedColor: DefaultStyle.main2_400
Layout.preferredWidth: 55 * DefaultStyle.dp Layout.preferredWidth: 55 * DefaultStyle.dp
Layout.preferredHeight: 55 * DefaultStyle.dp Layout.preferredHeight: 55 * DefaultStyle.dp