From 3433ec547e5c88c7ab24418afc0665fae4cb091e Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Sat, 30 Jan 2021 18:21:42 +0200 Subject: [PATCH 1/2] Made notification sound configurable --- qml/pages/SettingsPage.qml | 117 +++++++++++++++++++++--------------- src/appsettings.cpp | 15 +++++ src/appsettings.h | 5 ++ src/notificationmanager.cpp | 2 +- 4 files changed, 90 insertions(+), 49 deletions(-) diff --git a/qml/pages/SettingsPage.qml b/qml/pages/SettingsPage.qml index 15f943a..8f023c9 100644 --- a/qml/pages/SettingsPage.qml +++ b/qml/pages/SettingsPage.qml @@ -561,11 +561,66 @@ Page { } } + ComboBox { + id: feedbackComboBox + width: parent.columnWidth + label: qsTr("Notification feedback") + description: qsTr("Use non-graphical feedback (sound, vibration) for notifications") + menu: ContextMenu { + id: feedbackMenu + x: 0 + width: feedbackComboBox.width + + MenuItem { + readonly property int value: AppSettings.NotificationFeedbackAll + text: qsTr("All events") + onClicked: { + appSettings.notificationFeedback = value + } + } + MenuItem { + readonly property int value: AppSettings.NotificationFeedbackNew + text: qsTr("Only new events") + onClicked: { + appSettings.notificationFeedback = value + } + } + MenuItem { + readonly property int value: AppSettings.NotificationFeedbackNone + text: qsTr("None") + onClicked: { + appSettings.notificationFeedback = value + } + } + } + + Component.onCompleted: updateFeedbackSelection() + + function updateFeedbackSelection() { + var menuItems = feedbackMenu.children + var n = menuItems.length + for (var i=0; i 0 automaticCheck: false @@ -574,57 +629,23 @@ Page { } Behavior on height { SmoothedAnimation { duration: 200 } } } - } - ComboBox { - id: feedbackComboBox - label: qsTr("Notification feedback") - description: qsTr("Use non-graphical feedback (sound, vibration) for notifications") - menu: ContextMenu { - id: feedbackMenu - - MenuItem { - readonly property int value: AppSettings.NotificationFeedbackAll - text: qsTr("All events") - onClicked: { - appSettings.notificationFeedback = value - } - } - MenuItem { - readonly property int value: AppSettings.NotificationFeedbackNew - text: qsTr("Only new events") - onClicked: { - appSettings.notificationFeedback = value - } - } - MenuItem { - readonly property int value: AppSettings.NotificationFeedbackNone - text: qsTr("None") - onClicked: { - appSettings.notificationFeedback = value - } + TextSwitch { + width: parent.columnWidth + checked: appSettings.notificationSoundsEnabled && enabled + text: qsTr("Enable notification sounds") + description: qsTr("When sounds are enabled, Fernschreiber would use Sailfish OS notification sound for chats, which can be configured in system settings.") + enabled: appSettings.notificationFeedback !== AppSettings.NotificationFeedbackNone + height: enabled ? implicitHeight: 0 + clip: height < implicitHeight + visible: height > 0 + automaticCheck: false + onClicked: { + appSettings.notificationSoundsEnabled = !checked } + Behavior on height { SmoothedAnimation { duration: 200 } } } - Component.onCompleted: updateFeedbackSelection() - - function updateFeedbackSelection() { - var menuItems = feedbackMenu.children - var n = menuItems.length - for (var i=0; isetPreviewBody(notificationBody); nemoNotification->setPreviewSummary(summary); - nemoNotification->setHintValue(HINT_SUPPRESS_SOUND, false); + nemoNotification->setHintValue(HINT_SUPPRESS_SOUND, !appSettings->notificationSoundsEnabled()); nemoNotification->setHintValue(HINT_DISPLAY_ON, appSettings->notificationTurnsDisplayOn()); nemoNotification->setHintValue(HINT_VISIBILITY, VISIBILITY_PUBLIC); nemoNotification->setUrgency(Notification::Normal); From 3bc97f27394d3509fd1c17170a815734378b0759 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sun, 31 Jan 2021 20:23:59 +0100 Subject: [PATCH 2/2] Cover: Smaller font sizes, enable numerus forms, fixes #350 --- qml/pages/CoverPage.qml | 18 ++++--------- translations/harbour-fernschreiber-de.ts | 26 +++++++++---------- translations/harbour-fernschreiber-en.ts | 26 +++++++++---------- translations/harbour-fernschreiber-es.ts | 26 +++++++++---------- translations/harbour-fernschreiber-fi.ts | 26 +++++++++---------- translations/harbour-fernschreiber-hu.ts | 24 ++++++++---------- translations/harbour-fernschreiber-it.ts | 26 +++++++++---------- translations/harbour-fernschreiber-pl.ts | 28 ++++++++++----------- translations/harbour-fernschreiber-ru.ts | 28 ++++++++++----------- translations/harbour-fernschreiber-sk.ts | 28 ++++++++++----------- translations/harbour-fernschreiber-sv.ts | 26 +++++++++---------- translations/harbour-fernschreiber-zh_CN.ts | 26 ++++++++----------- translations/harbour-fernschreiber.ts | 26 +++++++++---------- 13 files changed, 151 insertions(+), 183 deletions(-) diff --git a/qml/pages/CoverPage.qml b/qml/pages/CoverPage.qml index 1a29b8d..e3ed8f4 100644 --- a/qml/pages/CoverPage.qml +++ b/qml/pages/CoverPage.qml @@ -32,17 +32,9 @@ CoverBackground { property int connectionState: TelegramAPI.WaitingForNetwork function setUnreadInfoText() { - if (unreadMessages === 1) { - unreadMessagesText.text = qsTr("unread message"); - } else { - unreadMessagesText.text = qsTr("unread messages"); - } - if (unreadChats === 1) { - unreadChatsText.text = qsTr("chat"); - } else { - unreadChatsText.text = qsTr("chats"); - } + unreadMessagesText.text = qsTr("unread messages", "", coverPage.unreadMessages); + unreadChatsText.text = qsTr("chats", "", coverPage.unreadChats) switch (coverPage.connectionState) { case TelegramAPI.WaitingForNetwork: @@ -131,7 +123,7 @@ CoverBackground { } Label { id: unreadMessagesText - font.pixelSize: Theme.fontSizeSmall + font.pixelSize: Theme.fontSizeExtraSmall width: parent.width - unreadMessagesCountText.width - Theme.paddingMedium wrapMode: Text.Wrap anchors.verticalCenter: unreadMessagesCountText.verticalCenter @@ -146,7 +138,7 @@ CoverBackground { visible: coverPage.authenticated && coverPage.unreadMessages > 1 Text { id: inText - font.pixelSize: Theme.fontSizeSmall + font.pixelSize: Theme.fontSizeExtraSmall color: Theme.primaryColor text: qsTr("in") anchors.verticalCenter: unreadChatsCountText.verticalCenter @@ -159,7 +151,7 @@ CoverBackground { } Text { id: unreadChatsText - font.pixelSize: Theme.fontSizeSmall + font.pixelSize: Theme.fontSizeExtraSmall color: Theme.primaryColor width: parent.width - unreadChatsCountText.width - inText.width - ( 2 * Theme.paddingMedium ) wrapMode: Text.Wrap diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index 898fffa..25f09b9 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -449,14 +449,6 @@ CoverPage - - unread message - ungelesene Nachricht - - - unread messages - ungelesene Nachrichten - in in @@ -481,13 +473,19 @@ Updating content... Aktualisiere Inhalte... - - chat - Chat - - + chats - Chats + + Chat + Chats + + + + unread messages + + ungelesene Nachricht + ungelesene Nachrichten + diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index 293a372..5e45efa 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -449,14 +449,6 @@ CoverPage - - unread message - unread message - - - unread messages - unread messages - in in @@ -481,13 +473,19 @@ Updating content... Updating content... - - chat - chat - - + chats - chats + + chat + chats + + + + unread messages + + unread message + unread messages + diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 8000a26..02f774c 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -449,14 +449,6 @@ CoverPage - - unread message - mensaje no leído - - - unread messages - mensajes no leído - in en @@ -481,13 +473,19 @@ Updating content... Actualizando contenido... - - chat - charla - - + chats - charlas + + charlas + + + + + unread messages + + + + diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index c52859f..a1dbb37 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -449,14 +449,6 @@ CoverPage - - unread message - lukematon viesti - - - unread messages - lukematonta viestiä - in The preposition 'in' is translated to Finnish using the inessive case (suffix ‑ssa/‑ssä), so this string should be left empty in the translation. Unfortunately Qt will ignore empty translations, so let's use the character U+200B (zero width space) instead. @@ -482,13 +474,19 @@ Updating content... Päivitetään sisältöä... - - chat - keskustelussa - - + chats - keskustelussa + + keskustelussa + + + + + unread messages + + + + diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index d717b46..913b301 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -439,14 +439,6 @@ CoverPage - - unread message - olvasatlan üzenet - - - unread messages - olvasatlan üzenetek - in ban @@ -471,13 +463,17 @@ Updating content... Tartalom frissítése... - - chat - csevegés - - + chats - csevegések + + csevegések + + + + unread messages + + + diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index 90aac41..16818d1 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -449,14 +449,6 @@ CoverPage - - unread message - messaggio non letto - - - unread messages - messaggi non letti - in in @@ -465,13 +457,12 @@ Connected Connesso - - chat - chat - - + chats - chat + + chat + + Waiting for network... @@ -489,6 +480,13 @@ Updating content... Aggiorna contenuti... + + unread messages + + + + + EditGroupChatPermissionsColumn diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index 80305a8..f9015b8 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -459,14 +459,6 @@ CoverPage - - unread message - nieprzeczytana wiadomość - - - unread messages - nieprzeczytane wiadomości - in w @@ -491,13 +483,21 @@ Updating content... Aktualizacja treści... - - chat - czat - - + chats - czaty + + czaty + + + + + + unread messages + + + + + diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index 3a1a6ca..49ed98b 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -459,14 +459,6 @@ CoverPage - - unread message - сообщение - - - unread messages - сообщений - in в @@ -491,13 +483,21 @@ Updating content... Обновление контента... - - chat - чате - - + chats - чатах + + чатах + + + + + + unread messages + + + + + diff --git a/translations/harbour-fernschreiber-sk.ts b/translations/harbour-fernschreiber-sk.ts index 796b890..765759d 100644 --- a/translations/harbour-fernschreiber-sk.ts +++ b/translations/harbour-fernschreiber-sk.ts @@ -459,14 +459,6 @@ CoverPage - - unread message - neprečítaná správa - - - unread messages - neprečítané správy - in v @@ -491,13 +483,21 @@ Updating content... Aktualizácia obsahu... - - chat - čet - - + chats - čety + + čety + + + + + + unread messages + + + + + diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index 74d7328..83e975e 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -449,14 +449,6 @@ CoverPage - - unread message - oläst meddelande - - - unread messages - olästa meddelanden - in i @@ -481,13 +473,19 @@ Updating content... Uppdaterar innehåll... - - chat - chatt - - + chats - chattar + + chattar + + + + + unread messages + + + + diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index bccf505..9ff4a03 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -439,16 +439,6 @@ CoverPage - - unread message - 未读 -消息 - - - unread messages - 未读 -消息 - in 位于 @@ -473,13 +463,17 @@ Updating content... 正在更新内容… - - chat - 对话 - - + chats - 对话 + + 对话 + + + + unread messages + + + diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index a9ef6e2..bed4bc1 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -449,14 +449,6 @@ CoverPage - - unread message - unread message - - - unread messages - unread messages - in in @@ -481,13 +473,19 @@ Updating content... Updating content... - - chat - chat - - + chats - chats + + chats + + + + + unread messages + + + +