diff --git a/assets/languages/de.ts b/assets/languages/de.ts
index 36827165e..5bfc2d70e 100644
--- a/assets/languages/de.ts
+++ b/assets/languages/de.ts
@@ -1188,7 +1188,11 @@ Server URL ist nicht konfiguriert.
- chatSoundNotificationEnabledLabel
+ chatNotificationSoundEnabledLabel
+
+
+
+ chatNotificationSoundLabel
diff --git a/assets/languages/en.ts b/assets/languages/en.ts
index 59f75e175..0d04e829d 100644
--- a/assets/languages/en.ts
+++ b/assets/languages/en.ts
@@ -1193,8 +1193,12 @@ your friend's SIP address or username.
Call recorder enabled
- chatSoundNotificationEnabledLabel
- Sound notification enabled
+ chatNotificationSoundEnabledLabel
+ Notification sound enabled
+
+
+ chatNotificationSoundLabel
+ Sound notification
diff --git a/assets/languages/fr_FR.ts b/assets/languages/fr_FR.ts
index acd64eb50..393b044f5 100644
--- a/assets/languages/fr_FR.ts
+++ b/assets/languages/fr_FR.ts
@@ -1082,7 +1082,7 @@ Cliquez ici : <a href="%1">%1</a>
logsEnabledLabel
- Logs activés.
+ Logs activés
cleanLogs
@@ -1191,9 +1191,13 @@ Cliquez ici : <a href="%1">%1</a>
Enregistrement d'appel activé
- chatSoundNotificationEnabledLabel
+ chatNotificationSoundEnabledLabel
Son des notifications activé
+
+ chatNotificationSoundLabel
+ Son des notifications
+
SettingsNetwork
diff --git a/assets/languages/ja.ts b/assets/languages/ja.ts
index 41a71ca23..bed886662 100644
--- a/assets/languages/ja.ts
+++ b/assets/languages/ja.ts
@@ -1188,7 +1188,11 @@
- chatSoundNotificationEnabledLabel
+ chatNotificationSoundEnabledLabel
+
+
+
+ chatNotificationSoundLabel
diff --git a/assets/languages/lt.ts b/assets/languages/lt.ts
index 01440d680..d00906647 100644
--- a/assets/languages/lt.ts
+++ b/assets/languages/lt.ts
@@ -1193,7 +1193,11 @@ Tiesiog, įveskite savo draugo SIP adresą ar naudotojo vardą.
- chatSoundNotificationEnabledLabel
+ chatNotificationSoundEnabledLabel
+
+
+
+ chatNotificationSoundLabel
diff --git a/assets/languages/ru.ts b/assets/languages/ru.ts
index 66249d764..b1dda5604 100644
--- a/assets/languages/ru.ts
+++ b/assets/languages/ru.ts
@@ -1191,7 +1191,11 @@
- chatSoundNotificationEnabledLabel
+ chatNotificationSoundEnabledLabel
+
+
+
+ chatNotificationSoundLabel
diff --git a/assets/languages/sv.ts b/assets/languages/sv.ts
index afeea08c3..2be805490 100644
--- a/assets/languages/sv.ts
+++ b/assets/languages/sv.ts
@@ -1187,7 +1187,11 @@
- chatSoundNotificationEnabledLabel
+ chatNotificationSoundEnabledLabel
+
+
+
+ chatNotificationSoundLabel
diff --git a/assets/languages/tr.ts b/assets/languages/tr.ts
index 6b7e67a69..cf01ecb3d 100644
--- a/assets/languages/tr.ts
+++ b/assets/languages/tr.ts
@@ -1193,7 +1193,11 @@ arkadaşınızın SIP adresini veya kullanıcı adını girin.
- chatSoundNotificationEnabledLabel
+ chatNotificationSoundEnabledLabel
+
+
+
+ chatNotificationSoundLabel
diff --git a/src/components/core/CoreHandlers.cpp b/src/components/core/CoreHandlers.cpp
index d57bbb80c..81d3d48a8 100644
--- a/src/components/core/CoreHandlers.cpp
+++ b/src/components/core/CoreHandlers.cpp
@@ -170,7 +170,8 @@ void CoreHandlers::onMessageReceived (
emit messageReceived(message);
// 1. Do not notify if chat is not activated.
- if (!CoreManager::getInstance()->getSettingsModel()->getChatEnabled())
+ SettingsModel *settingsModel = CoreManager::getInstance()->getSettingsModel();
+ if (!settingsModel->getChatEnabled())
return;
// 2. Notify with Notification popup.
@@ -179,7 +180,7 @@ void CoreHandlers::onMessageReceived (
app->getNotifier()->notifyReceivedMessage(message);
// 3. Notify with sound.
- if (!CoreManager::getInstance()->getSettingsModel()->getChatSoundNotificationEnabled())
+ if (!settingsModel->getChatNotificationSoundEnabled())
return;
if (
@@ -188,8 +189,7 @@ void CoreHandlers::onMessageReceived (
Utils::coreStringToAppString(message->getFromAddress()->asStringUriOnly())
)
)
- // TODO: Provide a way to choose sound file.
- core->playLocal(linphone::Factory::get()->getSoundResourcesDir() + "/incoming_chat.wav");
+ core->playLocal(Utils::appStringToCoreString(settingsModel->getChatNotificationSoundPath()));
}
}
diff --git a/src/components/settings/SettingsModel.cpp b/src/components/settings/SettingsModel.cpp
index f9f657d83..e1b3a4920 100644
--- a/src/components/settings/SettingsModel.cpp
+++ b/src/components/settings/SettingsModel.cpp
@@ -303,13 +303,26 @@ void SettingsModel::setChatEnabled (bool status) {
// -----------------------------------------------------------------------------
-bool SettingsModel::getChatSoundNotificationEnabled () const {
+bool SettingsModel::getChatNotificationSoundEnabled () const {
return !!mConfig->getInt(UI_SECTION, "chat_sound_notification_enabled", 1);
}
-void SettingsModel::setChatSoundNotificationEnabled (bool status) {
+void SettingsModel::setChatNotificationSoundEnabled (bool status) {
mConfig->setInt(UI_SECTION, "chat_sound_notification_enabled", status);
- emit chatSoundNotificationEnabledChanged(status);
+ emit chatNotificationSoundEnabledChanged(status);
+}
+
+// -----------------------------------------------------------------------------
+
+QString SettingsModel::getChatNotificationSoundPath () const {
+ static const string defaultFile = linphone::Factory::get()->getSoundResourcesDir() + "/incoming_chat.wav";
+ return Utils::coreStringToAppString(mConfig->getString(UI_SECTION, "chat_sound_notification_file", defaultFile));
+}
+
+void SettingsModel::setChatNotificationSoundPath (const QString &path) {
+ QString cleanedPath = QDir::cleanPath(path);
+ mConfig->setString(UI_SECTION, "chat_sound_notification_file", Utils::appStringToCoreString(cleanedPath));
+ emit chatNotificationSoundPathChanged(cleanedPath);
}
// -----------------------------------------------------------------------------
diff --git a/src/components/settings/SettingsModel.hpp b/src/components/settings/SettingsModel.hpp
index 174abf7ae..ed6112193 100644
--- a/src/components/settings/SettingsModel.hpp
+++ b/src/components/settings/SettingsModel.hpp
@@ -73,7 +73,8 @@ class SettingsModel : public QObject {
Q_PROPERTY(bool chatEnabled READ getChatEnabled WRITE setChatEnabled NOTIFY chatEnabledChanged);
- Q_PROPERTY(bool chatSoundNotificationEnabled READ getChatSoundNotificationEnabled WRITE setChatSoundNotificationEnabled NOTIFY chatSoundNotificationEnabledChanged);
+ Q_PROPERTY(bool chatNotificationSoundEnabled READ getChatNotificationSoundEnabled WRITE setChatNotificationSoundEnabled NOTIFY chatNotificationSoundEnabledChanged);
+ Q_PROPERTY(QString chatNotificationSoundPath READ getChatNotificationSoundPath WRITE setChatNotificationSoundPath NOTIFY chatNotificationSoundPathChanged);
Q_PROPERTY(QString fileTransferUrl READ getFileTransferUrl WRITE setFileTransferUrl NOTIFY fileTransferUrlChanged);
@@ -221,8 +222,11 @@ public:
bool getChatEnabled () const;
void setChatEnabled (bool status);
- bool getChatSoundNotificationEnabled () const;
- void setChatSoundNotificationEnabled (bool status);
+ bool getChatNotificationSoundEnabled () const;
+ void setChatNotificationSoundEnabled (bool status);
+
+ QString getChatNotificationSoundPath () const;
+ void setChatNotificationSoundPath (const QString &path);
QString getFileTransferUrl () const;
void setFileTransferUrl (const QString &url);
@@ -378,7 +382,8 @@ signals:
void chatEnabledChanged (bool status);
- void chatSoundNotificationEnabledChanged (bool status);
+ void chatNotificationSoundEnabledChanged (bool status);
+ void chatNotificationSoundPathChanged (const QString &path);
void fileTransferUrlChanged (const QString &url);
diff --git a/ui/views/App/Settings/SettingsCallsChat.qml b/ui/views/App/Settings/SettingsCallsChat.qml
index bfa94b9aa..570d2efc9 100644
--- a/ui/views/App/Settings/SettingsCallsChat.qml
+++ b/ui/views/App/Settings/SettingsCallsChat.qml
@@ -137,12 +137,25 @@ TabContainer {
FormLine {
FormGroup {
- label: qsTr('chatSoundNotificationEnabledLabel')
+ label: qsTr('chatNotificationSoundEnabledLabel')
Switch {
- checked: SettingsModel.chatSoundNotificationEnabled
+ id: enableChatNotificationSound
- onClicked: SettingsModel.chatSoundNotificationEnabled = !checked
+ checked: SettingsModel.chatNotificationSoundEnabled
+
+ onClicked: SettingsModel.chatNotificationSoundEnabled = !checked
+ }
+ }
+
+ FormGroup {
+ label: qsTr('chatNotificationSoundLabel')
+
+ FileChooserButton {
+ enabled: enableChatNotificationSound.checked
+ selectedFile: SettingsModel.chatNotificationSoundPath
+
+ onAccepted: SettingsModel.chatNotificationSoundPath = selectedFile
}
}
}