From 00483a676f084db5d63c3bcb5a73f5a9dfac3d52 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Sat, 21 Nov 2020 00:26:32 +0200 Subject: [PATCH 1/5] Fixed release build --- src/notificationmanager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/notificationmanager.cpp b/src/notificationmanager.cpp index c8fe0c7..a9ce0a3 100644 --- a/src/notificationmanager.cpp +++ b/src/notificationmanager.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #define LOG(x) qDebug() << "[NotificationManager]" << x From e68340d406243f32208cd1ef7677731ad09c22c6 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Sat, 21 Nov 2020 01:15:13 +0200 Subject: [PATCH 2/5] Added notificationTurnsDisplayOn option It defaults to false --- src/appsettings.cpp | 15 +++++++++++++++ src/appsettings.h | 5 +++++ src/notificationmanager.cpp | 5 ++--- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/appsettings.cpp b/src/appsettings.cpp index 02904e6..6dd3bcc 100644 --- a/src/appsettings.cpp +++ b/src/appsettings.cpp @@ -25,6 +25,7 @@ namespace { const QString KEY_USE_OPEN_WITH("useOpenWith"); const QString KEY_SHOW_STICKERS_AS_IMAGES("showStickersAsImages"); const QString KEY_ANIMATE_STICKERS("animateStickers"); + const QString KEY_NOTIFICATION_TURNS_DISPLAY_ON("notificationTurnsDisplayOn"); const QString KEY_NOTIFICATION_FEEDBACK("notificationFeedback"); } @@ -88,6 +89,20 @@ void AppSettings::setAnimateStickers(bool animate) } } +bool AppSettings::notificationTurnsDisplayOn() const +{ + return settings.value(KEY_NOTIFICATION_TURNS_DISPLAY_ON, false).toBool(); +} + +void AppSettings::setNotificationTurnsDisplayOn(bool turnOn) +{ + if (notificationTurnsDisplayOn() != turnOn) { + LOG(KEY_NOTIFICATION_TURNS_DISPLAY_ON << turnOn); + settings.setValue(KEY_NOTIFICATION_TURNS_DISPLAY_ON, turnOn); + emit notificationTurnsDisplayOnChanged(); + } +} + AppSettings::NotificationFeedback AppSettings::notificationFeedback() const { return (NotificationFeedback) settings.value(KEY_NOTIFICATION_FEEDBACK, (int) NotificationFeedbackAll).toInt(); diff --git a/src/appsettings.h b/src/appsettings.h index 5df3d6c..a813300 100644 --- a/src/appsettings.h +++ b/src/appsettings.h @@ -27,6 +27,7 @@ class AppSettings : public QObject { Q_PROPERTY(bool useOpenWith READ getUseOpenWith WRITE setUseOpenWith NOTIFY useOpenWithChanged) Q_PROPERTY(bool showStickersAsImages READ showStickersAsImages WRITE setShowStickersAsImages NOTIFY showStickersAsImagesChanged) Q_PROPERTY(bool animateStickers READ animateStickers WRITE setAnimateStickers NOTIFY animateStickersChanged) + Q_PROPERTY(bool notificationTurnsDisplayOn READ notificationTurnsDisplayOn WRITE setNotificationTurnsDisplayOn NOTIFY notificationTurnsDisplayOnChanged) Q_PROPERTY(NotificationFeedback notificationFeedback READ notificationFeedback WRITE setNotificationFeedback NOTIFY notificationFeedbackChanged) public: @@ -52,6 +53,9 @@ public: bool animateStickers() const; void setAnimateStickers(bool animate); + bool notificationTurnsDisplayOn() const; + void setNotificationTurnsDisplayOn(bool turnOn); + NotificationFeedback notificationFeedback() const; void setNotificationFeedback(NotificationFeedback feedback); @@ -60,6 +64,7 @@ signals: void useOpenWithChanged(); void showStickersAsImagesChanged(); void animateStickersChanged(); + void notificationTurnsDisplayOnChanged(); void notificationFeedbackChanged(); private: diff --git a/src/notificationmanager.cpp b/src/notificationmanager.cpp index a9ce0a3..f1c6914 100644 --- a/src/notificationmanager.cpp +++ b/src/notificationmanager.cpp @@ -362,11 +362,10 @@ void NotificationManager::publishNotification(const NotificationGroup *notificat if (!needFeedback || (chatModel->getChatId() == notificationGroup->chatId && qGuiApp->applicationState() == Qt::ApplicationActive)) { nemoNotification->setHintValue(HINT_DISPLAY_ON, false); - nemoNotification->setHintValue(HINT_VISIBILITY, QVariant()); + nemoNotification->setHintValue(HINT_VISIBILITY, QString()); nemoNotification->setUrgency(Notification::Low); } else { - // The "display on" option will be configurable - nemoNotification->setHintValue(HINT_DISPLAY_ON, true); + nemoNotification->setHintValue(HINT_DISPLAY_ON, appSettings->notificationTurnsDisplayOn()); nemoNotification->setHintValue(HINT_VISIBILITY, VISIBILITY_PUBLIC); nemoNotification->setUrgency(Notification::Normal); } From 2f2cbb4679d1c7eda51fd31179b28d043e880c49 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Sat, 21 Nov 2020 01:42:16 +0200 Subject: [PATCH 3/5] Added UI for notificationTurnsDisplayOn option --- qml/pages/SettingsPage.qml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/qml/pages/SettingsPage.qml b/qml/pages/SettingsPage.qml index 8a8962a..1218704 100644 --- a/qml/pages/SettingsPage.qml +++ b/qml/pages/SettingsPage.qml @@ -113,6 +113,19 @@ Page { } } + TextSwitch { + checked: appSettings.notificationTurnsDisplayOn && enabled + text: qsTr("Notification turns on the display") + height: appSettings.notificationFeedback === AppSettings.NotificationFeedbackNone ? 0 : implicitHeight + clip: height < implicitHeight + visible: height > 0 + automaticCheck: false + onClicked: { + appSettings.notificationTurnsDisplayOn = !checked + } + Behavior on height { SmoothedAnimation { duration: 200 } } + } + SectionHeader { text: qsTr("Appearance") } From ddd7432a3f9a36f1ccf655a2d6eac34e9a3b8ec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85ke=20Engelbrektson?= Date: Sat, 21 Nov 2020 08:32:24 +0100 Subject: [PATCH 4/5] Update harbour-fernschreiber-sv.ts Some improvements to Swedish translation, before I forget. --- translations/harbour-fernschreiber-sv.ts | 26 ++++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index e558854..cf1afb3 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -331,7 +331,7 @@ Select Messages - Välj meddelanden + Markera meddelanden %Ln Messages deleted @@ -359,8 +359,8 @@ %Ln messages selected number of messages selected - %Ln meddelande valt - %Ln meddelanden valda + %Ln meddelande markerat + %Ln meddelanden markerade @@ -540,7 +540,7 @@ sent a voice note - skickade en röstanteckning + skickade ett röstmeddelande sent a document @@ -603,16 +603,16 @@ sent a voice note myself - skickade en röstanteckning + skickade ett röstmeddelande sent a venue myself - skickade en mötesplats + skickade en plats sent a venue - skickade en mötesplats + skickade en plats changed the chat title @@ -865,7 +865,7 @@ Select Message - Välj meddelande + Markera meddelanden Pin Message @@ -1256,7 +1256,7 @@ Voice Note: %1 - Ljudmeddelande: %1 + Röstmeddelande: %1 Animation: %1 @@ -1284,7 +1284,7 @@ sent a voice note - skickade ett röstanteckning + skickade ett röstmeddelande sent a document @@ -1316,7 +1316,7 @@ sent a venue - skickade en mötesplats + skickade en plats sent a picture @@ -1341,7 +1341,7 @@ sent a voice note myself - skickade en röstanteckning + skickade ett röstmeddelande sent a document @@ -1356,7 +1356,7 @@ sent a venue myself - skickade en mötesplats + skickade en plats have registered with Telegram From 4bbeb4fa34592fcfe749288a3023b677bbb233c8 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sat, 21 Nov 2020 10:12:59 +0100 Subject: [PATCH 5/5] Only clear chat model if navigated back | update translation files --- qml/pages/ChatPage.qml | 5 ++++- translations/harbour-fernschreiber-de.ts | 4 ++++ translations/harbour-fernschreiber-en.ts | 4 ++++ translations/harbour-fernschreiber-es.ts | 4 ++++ translations/harbour-fernschreiber-fi.ts | 4 ++++ translations/harbour-fernschreiber-hu.ts | 4 ++++ translations/harbour-fernschreiber-it.ts | 4 ++++ translations/harbour-fernschreiber-pl.ts | 4 ++++ translations/harbour-fernschreiber-ru.ts | 4 ++++ translations/harbour-fernschreiber-sv.ts | 4 ++++ translations/harbour-fernschreiber-zh_CN.ts | 4 ++++ translations/harbour-fernschreiber.ts | 4 ++++ 12 files changed, 48 insertions(+), 1 deletion(-) diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index a8f335a..649c1be 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -355,7 +355,10 @@ Page { } break; case PageStatus.Inactive: - chatModel.clear(); + if (pageStack.depth === 1) { + // Only clear chat model if navigated back to overview page. In other cases we keep the information... + chatModel.clear(); + } break; } } diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index 6aae9f2..08b2f79 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -1198,6 +1198,10 @@ Animate stickers Sticker animieren + + Notification turns on the display + Hinweis schaltet den Bildschirm an + StickerPicker diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index c5d0035..1422ce1 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -1198,6 +1198,10 @@ Animate stickers Animate stickers + + Notification turns on the display + + StickerPicker diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 3ecd8ae..a43108d 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -1179,6 +1179,10 @@ Animate stickers Mostrar pegatinas animadas + + Notification turns on the display + + StickerPicker diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index 7fb55f6..27e503b 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -1199,6 +1199,10 @@ Animate stickers Animoi tarrat + + Notification turns on the display + + StickerPicker diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index fce5b95..4bfef8b 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -1179,6 +1179,10 @@ Animate stickers + + Notification turns on the display + + StickerPicker diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index c04d265..5512dc4 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -1198,6 +1198,10 @@ Animate stickers Riproduci sticker animati + + Notification turns on the display + + StickerPicker diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index 0cf5934..f1724c7 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -1217,6 +1217,10 @@ Animate stickers Animowane naklejki + + Notification turns on the display + + StickerPicker diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index 289d794..a546b6c 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -1217,6 +1217,10 @@ Animate stickers Анимировать стикеры + + Notification turns on the display + + StickerPicker diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index cf1afb3..4be4198 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -1198,6 +1198,10 @@ Animate stickers Animera dekaler + + Notification turns on the display + + StickerPicker diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index 5ffa019..68faf03 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -1179,6 +1179,10 @@ Animate stickers 动态表情贴图 + + Notification turns on the display + + StickerPicker diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index c5d0035..1422ce1 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -1198,6 +1198,10 @@ Animate stickers Animate stickers + + Notification turns on the display + + StickerPicker