From 19f3823d5a0bbfeea3aba8efe9f0c18d7cc3cb37 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Fri, 24 Nov 2023 17:25:55 +0100 Subject: [PATCH] Add global config in RC to activate chat/video: [app] disable_chat_feature=0 disable_video_feature=0 --- .../src/components/settings/SettingsModel.cpp | 14 ++++++++++---- .../src/components/settings/SettingsModel.hpp | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/linphone-app/src/components/settings/SettingsModel.cpp b/linphone-app/src/components/settings/SettingsModel.cpp index 2b82f638a..7d0d00815 100644 --- a/linphone-app/src/components/settings/SettingsModel.cpp +++ b/linphone-app/src/components/settings/SettingsModel.cpp @@ -657,12 +657,13 @@ void SettingsModel::setVideoDefinition (const QVariantMap &definition) { } bool SettingsModel::getVideoEnabled() const { - return CoreManager::getInstance()->getCore()->videoSupported() && !!mConfig->getInt(UiSection, "video_enabled", 1); + return CoreManager::getInstance()->getCore()->videoSupported() + && !mConfig->getInt("app", "disable_video_feature", !mConfig->getInt(UiSection, "video_enabled", 1)); } void SettingsModel::setVideoEnabled(const bool& enable){ if( CoreManager::getInstance()->getCore()->videoSupported()){ - mConfig->setInt(UiSection, "video_enabled", enable); + mConfig->setInt("app", "disable_video_feature", !enable); emit videoEnabledChanged(); } } @@ -894,8 +895,9 @@ void SettingsModel::setMuteMicrophoneEnabled (bool status) { // ----------------------------------------------------------------------------- + bool SettingsModel::getStandardChatEnabled () const { - return !!mConfig->getInt(UiSection, getEntryFullName(UiSection,"standard_chat_enabled"), 1); + return getChatEnabled() && !!mConfig->getInt(UiSection, getEntryFullName(UiSection,"standard_chat_enabled"), 1); } void SettingsModel::setStandardChatEnabled (bool status) { @@ -905,7 +907,7 @@ void SettingsModel::setStandardChatEnabled (bool status) { } bool SettingsModel::getSecureChatEnabled () const { - return !!mConfig->getInt(UiSection, getEntryFullName(UiSection, "secure_chat_enabled"), 1) + return getChatEnabled() && !!mConfig->getInt(UiSection, getEntryFullName(UiSection, "secure_chat_enabled"), 1) && getLimeIsSupported() && CoreManager::getInstance()->getCore()->getDefaultAccount() && !CoreManager::getInstance()->getCore()->getDefaultAccount()->getParams()->getLimeServerUrl().empty() //&& !CoreManager::getInstance()->getCore()->getLimeX3DhServerUrl().empty() @@ -919,6 +921,10 @@ void SettingsModel::setSecureChatEnabled (bool status) { emit secureChatEnabledChanged(); } +bool SettingsModel::getChatEnabled () const { + return !mConfig->getInt("app", getEntryFullName("app","disable_chat_feature"), 0); +} + bool SettingsModel::getGroupChatEnabled() const{ return CoreManager::getInstance()->getCore()->getDefaultAccount() && !CoreManager::getInstance()->getCore()->getDefaultAccount()->getParams()->getConferenceFactoryUri().empty(); } diff --git a/linphone-app/src/components/settings/SettingsModel.hpp b/linphone-app/src/components/settings/SettingsModel.hpp index 0b7e55689..493fdca0b 100644 --- a/linphone-app/src/components/settings/SettingsModel.hpp +++ b/linphone-app/src/components/settings/SettingsModel.hpp @@ -467,6 +467,7 @@ public: bool getIncallScreenshotEnabled() const; void setIncallScreenshotEnabled(const bool& status); + bool getChatEnabled()const; bool getGroupChatEnabled()const; bool getConferenceEnabled () const;