diff --git a/Linphone/core/setting/SettingsCore.cpp b/Linphone/core/setting/SettingsCore.cpp index 182e52660..480f363a0 100644 --- a/Linphone/core/setting/SettingsCore.cpp +++ b/Linphone/core/setting/SettingsCore.cpp @@ -113,6 +113,7 @@ SettingsCore::SettingsCore(QObject *parent) : QObject(parent) { INIT_CORE_MEMBER(ShortcutCount, settingsModel) INIT_CORE_MEMBER(Shortcuts, settingsModel) + INIT_CORE_MEMBER(CallToneIndicationsEnabled, settingsModel) } SettingsCore::SettingsCore(const SettingsCore &settingsCore) { @@ -183,6 +184,7 @@ SettingsCore::SettingsCore(const SettingsCore &settingsCore) { mDownloadFolder = settingsCore.mDownloadFolder; mShortcutCount = settingsCore.mShortcutCount; mShortcuts = settingsCore.mShortcuts; + mCallToneIndicationsEnabled = settingsCore.mCallToneIndicationsEnabled; } SettingsCore::~SettingsCore() { @@ -386,6 +388,8 @@ void SettingsCore::setSelf(QSharedPointer me) { ShortcutCount) DEFINE_CORE_GET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, QVariantList, shortcuts, Shortcuts) + DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, bool, + callToneIndicationsEnabled, CallToneIndicationsEnabled) auto coreModelConnection = SafeConnection::create(me, CoreModel::getInstance()); diff --git a/Linphone/core/setting/SettingsCore.hpp b/Linphone/core/setting/SettingsCore.hpp index 91f9d91f4..d7080f093 100644 --- a/Linphone/core/setting/SettingsCore.hpp +++ b/Linphone/core/setting/SettingsCore.hpp @@ -217,6 +217,7 @@ public: // Read-only DECLARE_CORE_MEMBER(int, shortcutCount, ShortcutCount) DECLARE_CORE_MEMBER(QVariantList, shortcuts, Shortcuts) + DECLARE_CORE_GETSET_MEMBER(bool, callToneIndicationsEnabled, CallToneIndicationsEnabled) signals: diff --git a/Linphone/model/core/CoreModel.cpp b/Linphone/model/core/CoreModel.cpp index eb6056ffb..4a50469a2 100644 --- a/Linphone/model/core/CoreModel.cpp +++ b/Linphone/model/core/CoreModel.cpp @@ -321,7 +321,7 @@ void CoreModel::onCallStateChanged(const std::shared_ptr &core, } if (state == linphone::Call::State::End && SettingsModel::dndEnabled(core->getConfig()) && core->getCallsNb() == 0) { // Disable tones in DND mode if no more calls are running. - SettingsModel::enableTones(core->getConfig(), false); + SettingsModel::getInstance()->setCallToneIndicationsEnabled(false); } emit callStateChanged(core, call, state, message); } diff --git a/Linphone/model/setting/SettingsModel.cpp b/Linphone/model/setting/SettingsModel.cpp index 04342f475..1209e4bf8 100644 --- a/Linphone/model/setting/SettingsModel.cpp +++ b/Linphone/model/setting/SettingsModel.cpp @@ -42,9 +42,8 @@ SettingsModel::SettingsModel() { auto core = CoreModel::getInstance()->getCore(); mConfig = core->getConfig(); CoreModel::getInstance()->getLogger()->applyConfig(mConfig); - if (mConfig->hasEntry(UiSection, "do_not_disturb") == 1) { - enableDnd(dndEnabled()); - } + // Only activate on enabled. If not, we should keep old configuration. + if (dndEnabled()) enableDnd(true); QObject::connect( CoreModel::getInstance().get(), &CoreModel::globalStateChanged, this, [this](const std::shared_ptr &core, linphone::GlobalState gstate, const std::string &message) { @@ -426,6 +425,19 @@ void SettingsModel::setAutomaticallyRecordCallsEnabled(bool enabled) { emit automaticallyRecordCallsEnabledChanged(enabled); } +bool SettingsModel::getCallToneIndicationsEnabled() const { + mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); + return CoreModel::getInstance()->getCore()->callToneIndicationsEnabled(); +} + +void SettingsModel::setCallToneIndicationsEnabled(bool enabled) { + mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); + if (enabled != getCallToneIndicationsEnabled()) { + CoreModel::getInstance()->getCore()->enableCallToneIndications(enabled); + emit callToneIndicationsEnabledChanged(enabled); + } +} + // ============================================================================= // VFS. // ============================================================================= @@ -539,12 +551,6 @@ bool SettingsModel::dndEnabled() const { return dndEnabled(mConfig); } -void SettingsModel::enableTones(const shared_ptr &config, bool enable) { - mustBeInLinphoneThread(sLog().arg(Q_FUNC_INFO)); - config->setInt("sound", "tone_indications", enable); // General tones - config->setInt("misc", "tone_indications", enable); // Call tones -} - void SettingsModel::enableRinging(bool enable) { mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); mConfig->setInt("sound", "disable_ringing", !enable); // Ringing @@ -552,7 +558,7 @@ void SettingsModel::enableRinging(bool enable) { void SettingsModel::enableDnd(bool enableDnd) { mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); - enableTones(mConfig, !enableDnd); + setCallToneIndicationsEnabled(!enableDnd); enableRinging(!enableDnd); mConfig->setInt(UiSection, "do_not_disturb", enableDnd); emit dndChanged(enableDnd); diff --git a/Linphone/model/setting/SettingsModel.hpp b/Linphone/model/setting/SettingsModel.hpp index e1da41080..c3d320ae9 100644 --- a/Linphone/model/setting/SettingsModel.hpp +++ b/Linphone/model/setting/SettingsModel.hpp @@ -108,9 +108,16 @@ public: QString getVideoDevice() const; void setVideoDevice(QString device); + //------------------------------------------------------------------------------------------------------------ + void startEchoCancellerCalibration(); int getEchoCancellationCalibration() const; + bool getCallToneIndicationsEnabled() const; + void setCallToneIndicationsEnabled(bool enabled); + + //------------------------------------------------------------------------------------------------------------ + bool getLogsEnabled() const; void setLogsEnabled(bool status); @@ -133,7 +140,6 @@ public: bool dndEnabled() const; static bool dndEnabled(const std::shared_ptr &config); void enableDnd(bool value); - static void enableTones(const std::shared_ptr &config, bool enable); void enableRinging(bool enable); QString getLogsEmail() const; @@ -181,8 +187,6 @@ signals: void videoEnabledChanged(bool enabled); // Call. -------------------------------------------------------------------- - void echoCancellationEnabledChanged(bool enabled); - void automaticallyRecordCallsEnabledChanged(bool enabled); void captureGraphRunningChanged(bool running); @@ -198,10 +202,18 @@ signals: void playbackDeviceChanged(QVariantMap device); void ringerDeviceChanged(QVariantMap device); void videoDeviceChanged(QString device); + void conferenceLayoutChanged(); void mediaEncryptionChanged(); void mediaEncryptionMandatoryChanged(); + void echoCancellationEnabledChanged(bool enabled); + void automaticallyRecordCallsEnabledChanged(bool enabled); + + void callToneIndicationsEnabledChanged(bool enabled); + + void showAudioCodecsChanged(bool status); + void micVolumeChanged(float volume); void logsEnabledChanged(bool status); diff --git a/Linphone/model/tool/ToolModel.cpp b/Linphone/model/tool/ToolModel.cpp index f5ae651ac..532366098 100644 --- a/Linphone/model/tool/ToolModel.cpp +++ b/Linphone/model/tool/ToolModel.cpp @@ -164,7 +164,7 @@ bool ToolModel::createCall(const QString &sipAddress, if (SettingsModel::dndEnabled( core->getConfig())) { // Force tones for outgoing calls when in DND mode (ringback, dtmf, etc ... ) disabled // again when no more calls are running. - SettingsModel::enableTones(core->getConfig(), true); + SettingsModel::getInstance()->setCallToneIndicationsEnabled(true); } std::shared_ptr params = core->createCallParams(nullptr); if (localVideoEnabled) CallModel::activateLocalVideo(params, localVideoEnabled); diff --git a/Linphone/view/Page/Layout/Settings/CallSettingsLayout.qml b/Linphone/view/Page/Layout/Settings/CallSettingsLayout.qml index afea464b0..dffca951a 100644 --- a/Linphone/view/Page/Layout/Settings/CallSettingsLayout.qml +++ b/Linphone/view/Page/Layout/Settings/CallSettingsLayout.qml @@ -50,6 +50,12 @@ AbstractSettingsLayout { propertyOwner: SettingsCpp visible: !SettingsCpp.disableCallRecordings } + SwitchSetting { + titleText: qsTr("Tonalités") + subTitleText: qsTr("Activer les tonalités") + propertyName: "callToneIndicationsEnabled" + propertyOwner: SettingsCpp + } } } diff --git a/external/linphone-sdk b/external/linphone-sdk index ba6b6ff92..5711bcc19 160000 --- a/external/linphone-sdk +++ b/external/linphone-sdk @@ -1 +1 @@ -Subproject commit ba6b6ff92790491e8344b9d1b6df4e2df45e3199 +Subproject commit 5711bcc198fdc48665e36bd78fe987b33c281c81