hide notification content setting

This commit is contained in:
Gaelle Braud 2026-02-02 13:27:51 +01:00
parent d234a6c3d4
commit fd7a5e65f1
9 changed files with 175 additions and 34 deletions

View file

@ -366,7 +366,8 @@ void Notifier::notifyReceivedMessages(const std::shared_ptr<linphone::ChatRoom>
txt = tr("new_conference_invitation");
};
if (messages.size() == 1) { // Display only sender on mono message.
if (messages.size() == 1 &&
SettingsModel::getInstance()->getDisplayNotificationContent()) { // Display only sender on mono message.
if (message->isRead()) return;
getMessage(message);
if (txt.isEmpty()) { // Do not notify message without content
@ -382,6 +383,9 @@ void Notifier::notifyReceivedMessages(const std::shared_ptr<linphone::ChatRoom>
}
}
if (unreadCount == 0) return;
else if (unreadCount == 1)
//: 'New message received!' Notification that warn the user of a new message.
txt = tr("new_chat_room_message");
if (unreadCount > 1)
//: 'New messages received!' Notification that warn the user of new messages.
txt = tr("new_chat_room_messages");

View file

@ -50,17 +50,16 @@ SettingsCore::SettingsCore(QObject *parent) : QObject(parent) {
mVideoEnabled = settingsModel->getVideoEnabled();
mEchoCancellationEnabled = settingsModel->getEchoCancellationEnabled();
mAutoDownloadReceivedFiles = settingsModel->getAutoDownloadReceivedFiles();
mDisplayNotificationContent = settingsModel->getDisplayNotificationContent();
mAutomaticallyRecordCallsEnabled = settingsModel->getAutomaticallyRecordCallsEnabled();
mRingtonePath = settingsModel->getRingtone();
QFileInfo ringtone(mRingtonePath);
if (ringtone.exists()) {
mRingtoneFileName = ringtone.fileName();
mRingtoneFolder = ringtone.absolutePath();
CoreModel::getInstance()->getCore()->enableNativeRinging(false);
} else {
mRingtoneFileName = mRingtonePath.right(mRingtonePath.lastIndexOf(QDir::separator()));
mRingtoneFolder = mRingtonePath.left(mRingtonePath.lastIndexOf(QDir::separator()));
CoreModel::getInstance()->getCore()->enableNativeRinging(true);
}
// Network
@ -166,6 +165,7 @@ SettingsCore::SettingsCore(const SettingsCore &settingsCore) {
mVideoEnabled = settingsCore.mVideoEnabled;
mEchoCancellationEnabled = settingsCore.mEchoCancellationEnabled;
mAutoDownloadReceivedFiles = settingsCore.mAutoDownloadReceivedFiles;
mDisplayNotificationContent = settingsCore.mDisplayNotificationContent;
mAutomaticallyRecordCallsEnabled = settingsCore.mAutomaticallyRecordCallsEnabled;
// Audio
@ -252,6 +252,7 @@ void SettingsCore::reloadSettings() {
setVideoEnabled(settingsModel->getVideoEnabled());
setEchoCancellationEnabled(settingsModel->getEchoCancellationEnabled());
setAutoDownloadReceivedFiles(settingsModel->getAutoDownloadReceivedFiles());
setDisplayNotificationContent(settingsModel->getDisplayNotificationContent());
setAutomaticallyRecordCallsEnabled(settingsModel->getAutomaticallyRecordCallsEnabled());
setRingtone(settingsModel->getRingtone());
@ -402,6 +403,12 @@ void SettingsCore::setSelf(QSharedPointer<SettingsCore> me) {
mSettingsModelConnection->invokeToCore([this, enabled]() { setAutoDownloadReceivedFiles(enabled); });
});
// Auto download incoming files
mSettingsModelConnection->makeConnectToModel(
&SettingsModel::displayNotificationContentChanged, [this](const bool enabled) {
mSettingsModelConnection->invokeToCore([this, enabled]() { setDisplayNotificationContent(enabled); });
});
// Auto recording
mSettingsModelConnection->makeConnectToModel(
&SettingsModel::automaticallyRecordCallsEnabledChanged, [this](const bool enabled) {
@ -642,6 +649,7 @@ void SettingsCore::reset(const SettingsCore &settingsCore) {
setAutomaticallyRecordCallsEnabled(settingsCore.mAutomaticallyRecordCallsEnabled);
setAutoDownloadReceivedFiles(settingsCore.mAutoDownloadReceivedFiles);
setDisplayNotificationContent(settingsCore.mDisplayNotificationContent);
// Audio
setCaptureDevices(settingsCore.mCaptureDevices);
setPlaybackDevices(settingsCore.mPlaybackDevices);
@ -797,6 +805,14 @@ void SettingsCore::setAutoDownloadReceivedFiles(bool enabled) {
}
}
void SettingsCore::setDisplayNotificationContent(bool enabled) {
if (mDisplayNotificationContent != enabled) {
mDisplayNotificationContent = enabled;
emit displayNotificationContentChanged();
setIsSaved(false);
}
}
void SettingsCore::setAutomaticallyRecordCallsEnabled(bool enabled) {
if (mAutomaticallyRecordCallsEnabled != enabled) {
mAutomaticallyRecordCallsEnabled = enabled;
@ -1243,6 +1259,8 @@ void SettingsCore::writeIntoModel(std::shared_ptr<SettingsModel> model) const {
// Chat
model->setAutoDownloadReceivedFiles(mAutoDownloadReceivedFiles);
model->setDisplayNotificationContent(mDisplayNotificationContent);
// Audio
model->setRingerDevice(mRingerDevice);
model->setCaptureDevice(mCaptureDevice);
@ -1318,6 +1336,7 @@ void SettingsCore::writeFromModel(const std::shared_ptr<SettingsModel> &model) {
// Chat
mAutoDownloadReceivedFiles = model->getAutoDownloadReceivedFiles();
mDisplayNotificationContent = model->getDisplayNotificationContent();
// Audio
mCaptureDevices = model->getCaptureDevices();

View file

@ -42,6 +42,8 @@ public:
echoCancellationEnabledChanged)
Q_PROPERTY(bool autoDownloadReceivedFiles READ getAutoDownloadReceivedFiles WRITE setAutoDownloadReceivedFiles
NOTIFY autoDownloadReceivedFilesChanged)
Q_PROPERTY(bool displayNotificationContent READ getDisplayNotificationContent WRITE setDisplayNotificationContent
NOTIFY displayNotificationContentChanged)
Q_PROPERTY(
int echoCancellationCalibration READ getEchoCancellationCalibration NOTIFY echoCancellationCalibrationChanged)
Q_PROPERTY(bool automaticallyRecordCallsEnabled READ getAutomaticallyRecordCallsEnabled WRITE
@ -93,18 +95,17 @@ public:
Q_PROPERTY(bool fullLogsEnabled READ getFullLogsEnabled WRITE setFullLogsEnabled NOTIFY fullLogsEnabledChanged)
Q_PROPERTY(bool crashReporterEnabled READ getCrashReporterEnabled WRITE setCrashReporterEnabled NOTIFY
crashReporterEnabledChanged)
Q_PROPERTY(QString logsEmail READ getLogsEmail)
Q_PROPERTY(QString logsFolder READ getLogsFolder)
Q_PROPERTY(QString ringtoneName READ getRingtoneFileName NOTIFY ringtoneChanged)
Q_PROPERTY(QString ringtonePath READ getRingtonePath WRITE setRingtone NOTIFY ringtoneChanged)
Q_PROPERTY(QString ringtoneFolder MEMBER mRingtoneFolder NOTIFY ringtoneChanged)
Q_PROPERTY(bool dnd READ dndEnabled WRITE lEnableDnd NOTIFY dndChanged)
Q_PROPERTY(bool isSaved READ isSaved WRITE setIsSaved NOTIFY isSavedChanged)
Q_PROPERTY(QString logsEmail READ getLogsEmail) Q_PROPERTY(QString logsFolder READ getLogsFolder)
Q_PROPERTY(QString ringtoneName READ getRingtoneFileName NOTIFY ringtoneChanged)
Q_PROPERTY(QString ringtonePath READ getRingtonePath WRITE setRingtone NOTIFY ringtoneChanged)
Q_PROPERTY(QString ringtoneFolder MEMBER mRingtoneFolder NOTIFY ringtoneChanged)
Q_PROPERTY(bool dnd READ dndEnabled WRITE lEnableDnd NOTIFY dndChanged)
Q_PROPERTY(bool isSaved READ isSaved WRITE setIsSaved NOTIFY isSavedChanged)
Q_PROPERTY(
bool showAccountDevices READ showAccountDevices WRITE setShowAccountDevices NOTIFY showAccountDevicesChanged)
Q_PROPERTY(bool showAccountDevices READ showAccountDevices WRITE setShowAccountDevices
NOTIFY showAccountDevicesChanged)
static QSharedPointer<SettingsCore> create();
static QSharedPointer<SettingsCore> create();
SettingsCore(QObject *parent = Q_NULLPTR);
SettingsCore(const SettingsCore &settingsCore);
virtual ~SettingsCore();
@ -152,6 +153,11 @@ public:
}
void setAutoDownloadReceivedFiles(bool enabled);
bool getDisplayNotificationContent() {
return mDisplayNotificationContent;
}
void setDisplayNotificationContent(bool enabled);
bool getAutomaticallyRecordCallsEnabled() {
return mAutomaticallyRecordCallsEnabled;
}
@ -309,6 +315,7 @@ signals:
void echoCancellationEnabledChanged();
void autoDownloadReceivedFilesChanged();
void displayNotificationContentChanged();
void automaticallyRecordCallsEnabledChanged();
@ -406,6 +413,7 @@ private:
bool mVideoEnabled;
bool mEchoCancellationEnabled;
bool mAutoDownloadReceivedFiles;
bool mDisplayNotificationContent;
bool mAutomaticallyRecordCallsEnabled;
// Audio

View file

@ -2674,17 +2674,35 @@ Stellen Sie sicher, dass Sie keine sensiblen Informationen teilen!</translation>
<translation>Angefügte Dateien</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="25"/>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="21"/>
<source>settings_chat_notifications_title</source>
<extracomment>Notifications</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="32"/>
<source>settings_chat_attached_files_auto_download_title</source>
<extracomment>&quot;Automatic download&quot;</extracomment>
<translation>Automatischer Download</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="27"/>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="34"/>
<source>settings_chat_attached_files_auto_download_subtitle</source>
<extracomment>&quot;Automatically download transferred or received files in conversations&quot;</extracomment>
<translation>Übertragene oder empfangene Dateien in Unterhaltungen automatisch herunterladen</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="50"/>
<source>settings_chat_display_notification_content_title</source>
<extracomment>&quot;Display notification content&quot;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="52"/>
<source>settings_chat_display_notification_content_subtitle</source>
<extracomment>&quot;Display the content of the received message&quot;</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CliModel</name>
@ -5113,13 +5131,19 @@ Ablauf: %1</translation>
<translation>Konferenzeinladung erhalten!</translation>
</message>
<message>
<location filename="../../core/notifier/Notifier.cpp" line="387"/>
<location filename="../../core/notifier/Notifier.cpp" line="388"/>
<source>new_chat_room_message</source>
<extracomment>&apos;New message received!&apos; Notification that warn the user of a new message.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../core/notifier/Notifier.cpp" line="391"/>
<source>new_chat_room_messages</source>
<extracomment>&apos;New messages received!&apos; Notification that warn the user of new messages.</extracomment>
<translation>Neue Nachrichten erhalten!</translation>
</message>
<message>
<location filename="../../core/notifier/Notifier.cpp" line="415"/>
<location filename="../../core/notifier/Notifier.cpp" line="419"/>
<source>new_message_alert_accessible_name</source>
<extracomment>New message on chatroom %1</extracomment>
<translation>Neue Nachricht im Chat %1</translation>

View file

@ -2627,17 +2627,35 @@ Only your correspondent can decrypt them.</translation>
<translation>Attached files</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="25"/>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="21"/>
<source>settings_chat_notifications_title</source>
<extracomment>Notifications</extracomment>
<translation>Notifications</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="32"/>
<source>settings_chat_attached_files_auto_download_title</source>
<extracomment>&quot;Automatic download&quot;</extracomment>
<translation>Automatic download</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="27"/>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="34"/>
<source>settings_chat_attached_files_auto_download_subtitle</source>
<extracomment>&quot;Automatically download transferred or received files in conversations&quot;</extracomment>
<translation>Automatically download transferred or received files in conversations</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="50"/>
<source>settings_chat_display_notification_content_title</source>
<extracomment>&quot;Display notification content&quot;</extracomment>
<translation>Display content</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="52"/>
<source>settings_chat_display_notification_content_subtitle</source>
<extracomment>&quot;Display the content of the received message&quot;</extracomment>
<translation>Display the content of the received message</translation>
</message>
</context>
<context>
<name>CliModel</name>
@ -4458,13 +4476,13 @@ Expiration : %1</translation>
<location filename="../../view/Page/Window/Main/MainWindow.qml" line="207"/>
<source>oidc_connection_waiting_message</source>
<extracomment>&quot;Trying to connect to single sign on on web page ...&quot;</extracomment>
<translation type="unfinished"></translation>
<translation>Trying to connect to single sign on on web page ...</translation>
</message>
<message>
<location filename="../../view/Page/Window/Main/MainWindow.qml" line="220"/>
<source>cancel</source>
<extracomment>Cancel</extracomment>
<translation type="unfinished">Cancel</translation>
<translation>Cancel</translation>
</message>
<message>
<location filename="../../view/Page/Window/Main/MainWindow.qml" line="257"/>
@ -4506,24 +4524,24 @@ Expiration : %1</translation>
<message>
<location filename="../../view/Page/Layout/Chat/ManageParticipants.qml" line="29"/>
<source>info_popup_error_title</source>
<translation type="unfinished">Error</translation>
<translation>Error</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Chat/ManageParticipants.qml" line="31"/>
<source>info_popup_manage_participant_error_message</source>
<extracomment>Error while setting participants !</extracomment>
<translation type="unfinished"></translation>
<translation>Error while setting participants !</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Chat/ManageParticipants.qml" line="34"/>
<source>info_popup_success_title</source>
<translation type="unfinished"></translation>
<translation>Success</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Chat/ManageParticipants.qml" line="36"/>
<source>info_popup_manage_participant_updated_message</source>
<extracomment>Participants updated</extracomment>
<translation type="unfinished"></translation>
<translation>Participants updated</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Chat/ManageParticipants.qml" line="59"/>
@ -4534,7 +4552,7 @@ Expiration : %1</translation>
<location filename="../../view/Page/Layout/Chat/ManageParticipants.qml" line="68"/>
<source>apply_button_text</source>
<extracomment>Apply</extracomment>
<translation type="unfinished"></translation>
<translation>Apply</translation>
</message>
</context>
<context>
@ -5002,13 +5020,19 @@ Expiration : %1</translation>
<translation>Conference invitation received !</translation>
</message>
<message>
<location filename="../../core/notifier/Notifier.cpp" line="387"/>
<location filename="../../core/notifier/Notifier.cpp" line="388"/>
<source>new_chat_room_message</source>
<extracomment>&apos;New message received!&apos; Notification that warn the user of a new message.</extracomment>
<translation>New message received!</translation>
</message>
<message>
<location filename="../../core/notifier/Notifier.cpp" line="391"/>
<source>new_chat_room_messages</source>
<extracomment>&apos;New messages received!&apos; Notification that warn the user of new messages.</extracomment>
<translation>New messages received !</translation>
</message>
<message>
<location filename="../../core/notifier/Notifier.cpp" line="415"/>
<location filename="../../core/notifier/Notifier.cpp" line="419"/>
<source>new_message_alert_accessible_name</source>
<extracomment>New message on chatroom %1</extracomment>
<translation>New message on chatroom %1</translation>

View file

@ -2602,17 +2602,35 @@ en bout. Seul votre correspondant peut les déchiffrer.</translation>
<translation>Fichiers joints</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="25"/>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="21"/>
<source>settings_chat_notifications_title</source>
<extracomment>Notifications</extracomment>
<translation>Notifications</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="32"/>
<source>settings_chat_attached_files_auto_download_title</source>
<extracomment>&quot;Automatic download&quot;</extracomment>
<translation>Téléchargement automatique</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="27"/>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="34"/>
<source>settings_chat_attached_files_auto_download_subtitle</source>
<extracomment>&quot;Automatically download transferred or received files in conversations&quot;</extracomment>
<translation>Télécharger automatiquement les fichiers échangés dans les conversations</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="50"/>
<source>settings_chat_display_notification_content_title</source>
<extracomment>&quot;Display notification content&quot;</extracomment>
<translation>Afficher le contenu</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="52"/>
<source>settings_chat_display_notification_content_subtitle</source>
<extracomment>&quot;Display the content of the received message&quot;</extracomment>
<translation>Afficher le contenu du message reçu</translation>
</message>
</context>
<context>
<name>CliModel</name>
@ -4973,13 +4991,19 @@ Expiration : %1</translation>
<translation>Nouvelle invitation à une conférence !</translation>
</message>
<message>
<location filename="../../core/notifier/Notifier.cpp" line="387"/>
<location filename="../../core/notifier/Notifier.cpp" line="388"/>
<source>new_chat_room_message</source>
<extracomment>&apos;New message received!&apos; Notification that warn the user of a new message.</extracomment>
<translation>Nouveau message reçu</translation>
</message>
<message>
<location filename="../../core/notifier/Notifier.cpp" line="391"/>
<source>new_chat_room_messages</source>
<extracomment>&apos;New messages received!&apos; Notification that warn the user of new messages.</extracomment>
<translation>Nouveaux messages reçus !</translation>
</message>
<message>
<location filename="../../core/notifier/Notifier.cpp" line="415"/>
<location filename="../../core/notifier/Notifier.cpp" line="419"/>
<source>new_message_alert_accessible_name</source>
<extracomment>New message on chatroom %1</extracomment>
<translation>Nouveau message sur la conversation %1</translation>

View file

@ -466,9 +466,7 @@ void SettingsModel::setRingtone(QString ringtonePath) {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
QFileInfo ringtone(ringtonePath);
if (ringtonePath.isEmpty() || !ringtone.exists()) {
CoreModel::getInstance()->getCore()->enableNativeRinging(true);
} else {
CoreModel::getInstance()->getCore()->enableNativeRinging(false);
CoreModel::getInstance()->getCore()->setRing(Utils::appStringToCoreString(ringtonePath));
emit ringtoneChanged(ringtonePath);
}
@ -517,6 +515,17 @@ void SettingsModel::setAutoDownloadReceivedFiles(bool status) {
emit autoDownloadReceivedFilesChanged(status);
}
bool SettingsModel::getDisplayNotificationContent() const {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
return !!mConfig->getInt(UiSection, "display_notification_content", 1);
}
void SettingsModel::setDisplayNotificationContent(bool display) {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
mConfig->setInt(UiSection, "display_notification_content", display);
emit displayNotificationContentChanged(display);
}
bool SettingsModel::getEchoCancellationEnabled() const {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
return CoreModel::getInstance()->getCore()->echoCancellationEnabled();

View file

@ -66,6 +66,9 @@ public:
void setAutoDownloadReceivedFiles(bool enabled);
bool getAutoDownloadReceivedFiles() const;
void setDisplayNotificationContent(bool display);
bool getDisplayNotificationContent() const;
// Audio. --------------------------------------------------------------------
bool getIsInCall() const;
@ -287,6 +290,7 @@ signals:
// Messages. --------------------------------------------------------------------
void autoDownloadReceivedFilesChanged(bool enabled);
void displayNotificationContentChanged(bool display);
private:
void notifyConfigReady();

View file

@ -15,6 +15,13 @@ AbstractSettingsLayout {
subTitle: "",
contentComponent: attachedFilesParamComp,
// hideTopMargin: true
},
{
//: Notifications
title: qsTr("settings_chat_notifications_title"),
subTitle: "",
contentComponent: displayNotifParamComp,
// hideTopMargin: true
}
]
@ -28,6 +35,24 @@ AbstractSettingsLayout {
propertyName: "autoDownloadReceivedFiles"
propertyOwner: SettingsCpp
Connections {
target: mainItem
function onSave() {
SettingsCpp.save()
}
}
}
}
Component {
id: displayNotifParamComp
SwitchSetting {
//: "Display notification content"
titleText: qsTr("settings_chat_display_notification_content_title")
//: "Display the content of the received message"
subTitleText: qsTr("settings_chat_display_notification_content_subtitle")
propertyName: "displayNotificationContent"
propertyOwner: SettingsCpp
Connections {
target: mainItem
function onSave() {