2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
2020-11-17 19:02:56 +00:00
|
|
|
import QtGraphicalEffects 1.13
|
2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick.Layouts 1.13
|
2020-11-17 19:02:56 +00:00
|
|
|
import "./"
|
2020-05-27 21:28:25 +00:00
|
|
|
import "../../../../imports"
|
2020-06-19 18:06:58 +00:00
|
|
|
import "../../../../shared"
|
2020-09-18 08:29:31 +00:00
|
|
|
import "../../../../shared/status"
|
2020-05-27 21:28:25 +00:00
|
|
|
|
2020-09-18 12:24:16 +00:00
|
|
|
ScrollView {
|
|
|
|
height: parent.height
|
|
|
|
width: parent.width
|
|
|
|
contentHeight: notificationsContainer.height
|
|
|
|
clip: true
|
|
|
|
|
2020-11-19 14:59:31 +00:00
|
|
|
Item {
|
2020-09-18 12:24:16 +00:00
|
|
|
id: notificationsContainer
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: contentMargin
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: contentMargin
|
|
|
|
height: this.childrenRect.height + 100
|
|
|
|
|
2020-11-19 14:59:31 +00:00
|
|
|
property Component mutedChatsModalComponent: MutedChatsModal {}
|
|
|
|
|
|
|
|
|
2020-09-18 12:24:16 +00:00
|
|
|
ButtonGroup {
|
|
|
|
id: notificationSetting
|
|
|
|
}
|
|
|
|
|
|
|
|
ButtonGroup {
|
|
|
|
id: soundSetting
|
|
|
|
}
|
|
|
|
|
|
|
|
ButtonGroup {
|
|
|
|
id: messageSetting
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusSectionHeadline {
|
|
|
|
id: sectionHeadlineNotifications
|
2020-09-22 07:53:03 +00:00
|
|
|
//% "Notification preferences"
|
|
|
|
text: qsTrId("notifications-preferences")
|
2020-09-18 12:24:16 +00:00
|
|
|
anchors.top: parent.top
|
2020-11-17 19:02:56 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2020-09-18 12:24:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: column
|
|
|
|
anchors.top: sectionHeadlineNotifications.bottom
|
|
|
|
anchors.topMargin: Style.current.smallPadding
|
2020-11-17 19:02:56 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2020-09-18 12:24:16 +00:00
|
|
|
|
2021-01-19 19:26:59 +00:00
|
|
|
StatusRadioButtonRow {
|
|
|
|
//% "All messages"
|
|
|
|
text: qsTrId("all-messages")
|
|
|
|
buttonGroup: notificationSetting
|
|
|
|
checked: appSettings.notificationSetting === Constants.notifyAllMessages
|
|
|
|
onRadioCheckedChanged: {
|
|
|
|
if (checked) {
|
|
|
|
appSettings.notificationSetting = Constants.notifyAllMessages
|
2020-10-15 11:53:27 +00:00
|
|
|
}
|
2020-09-18 12:24:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-19 19:26:59 +00:00
|
|
|
StatusRadioButtonRow {
|
|
|
|
//% "Just @mentions"
|
|
|
|
text: qsTrId("just--mentions")
|
|
|
|
buttonGroup: notificationSetting
|
|
|
|
checked: appSettings.notificationSetting === Constants.notifyJustMentions
|
|
|
|
onRadioCheckedChanged: {
|
|
|
|
if (checked) {
|
|
|
|
appSettings.notificationSetting = Constants.notifyJustMentions
|
2020-10-15 11:53:27 +00:00
|
|
|
}
|
2020-09-18 12:24:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-19 19:26:59 +00:00
|
|
|
StatusRadioButtonRow {
|
|
|
|
//% "Nothing"
|
|
|
|
text: qsTrId("nothing")
|
|
|
|
buttonGroup: notificationSetting
|
|
|
|
checked: appSettings.notificationSetting === Constants.notifyNone
|
|
|
|
onRadioCheckedChanged: {
|
|
|
|
if (checked) {
|
|
|
|
appSettings.notificationSetting = Constants.notifyNone
|
2020-10-15 11:53:27 +00:00
|
|
|
}
|
2020-09-18 12:24:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Separator {
|
|
|
|
id: separator
|
|
|
|
anchors.top: column.bottom
|
|
|
|
anchors.topMargin: Style.current.bigPadding
|
2020-11-17 19:02:56 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: -Style.current.padding
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: -Style.current.padding
|
2020-09-18 12:24:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusSectionHeadline {
|
|
|
|
id: sectionHeadlineSound
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Appearance"
|
|
|
|
text: qsTrId("appearance")
|
2020-09-18 12:24:16 +00:00
|
|
|
anchors.top: separator.bottom
|
2020-11-17 19:02:56 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2020-09-18 12:24:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: column2
|
|
|
|
anchors.top: sectionHeadlineSound.bottom
|
|
|
|
anchors.topMargin: Style.current.smallPadding
|
2020-11-17 19:02:56 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2020-09-18 12:24:16 +00:00
|
|
|
width: parent.width
|
|
|
|
|
2021-01-19 19:26:59 +00:00
|
|
|
StatusSettingsLineButton {
|
|
|
|
//% "Play a sound when receiving a notification"
|
|
|
|
text: qsTrId("play-a-sound-when-receiving-a-notification")
|
|
|
|
isSwitch: true
|
|
|
|
switchChecked: appSettings.notificationSoundsEnabled
|
|
|
|
onClicked: {
|
|
|
|
appSettings.notificationSoundsEnabled = checked
|
2020-09-18 12:24:16 +00:00
|
|
|
}
|
2021-01-19 19:26:59 +00:00
|
|
|
}
|
2020-09-18 12:24:16 +00:00
|
|
|
|
2021-01-19 19:26:59 +00:00
|
|
|
StatusSettingsLineButton {
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Use your operating system's notifications"
|
|
|
|
text: qsTrId("use-your-operating-system-s-notifications")
|
2021-01-19 19:26:59 +00:00
|
|
|
isSwitch: true
|
|
|
|
switchChecked: appSettings.useOSNotifications
|
|
|
|
onClicked: {
|
|
|
|
appSettings.useOSNotifications = checked
|
2020-09-18 12:24:16 +00:00
|
|
|
}
|
|
|
|
|
2020-12-07 17:37:39 +00:00
|
|
|
StyledText {
|
2021-01-19 19:26:59 +00:00
|
|
|
id: detailText
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Setting this to false will instead use Status' notification style as seen below"
|
|
|
|
text: qsTrId("setting-this-to-false-will-instead-use-status--notification-style-as-seen-below")
|
2021-01-19 19:26:59 +00:00
|
|
|
color: Style.current.secondaryText
|
|
|
|
width: parent.width
|
|
|
|
font.pixelSize: 12
|
2020-12-07 17:37:39 +00:00
|
|
|
wrapMode: Text.WordWrap
|
2021-01-19 19:26:59 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Style.current.padding
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.topMargin: 2
|
2020-12-07 17:37:39 +00:00
|
|
|
}
|
|
|
|
}
|
2020-09-18 12:24:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: column3
|
|
|
|
spacing: Style.current.bigPadding
|
|
|
|
anchors.top: column2.bottom
|
|
|
|
anchors.topMargin: Style.current.padding*2
|
2020-11-17 19:02:56 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2020-09-18 12:24:16 +00:00
|
|
|
|
|
|
|
StyledText {
|
2020-09-22 07:53:03 +00:00
|
|
|
//% "Message preview"
|
|
|
|
text: qsTrId("message-preview")
|
2020-09-18 12:24:16 +00:00
|
|
|
font.pixelSize: 15
|
2020-11-17 19:02:56 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2020-09-18 12:24:16 +00:00
|
|
|
}
|
|
|
|
|
2020-11-17 19:02:56 +00:00
|
|
|
Column {
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: -Style.current.padding
|
|
|
|
anchors.right: parent.right
|
|
|
|
spacing: 10
|
|
|
|
|
2021-01-19 19:26:59 +00:00
|
|
|
NotificationAppearancePreview {
|
|
|
|
//% "Anonymous"
|
|
|
|
name: qsTrId("anonymous")
|
|
|
|
notificationTitle: "Status"
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "You have a new message"
|
|
|
|
notificationMessage: qsTrId("you-have-a-new-message")
|
2021-01-19 19:26:59 +00:00
|
|
|
buttonGroup: messageSetting
|
|
|
|
checked: appSettings.notificationMessagePreviewSetting === Constants.notificationPreviewAnonymous
|
|
|
|
onRadioCheckedChanged: {
|
|
|
|
if (checked) {
|
|
|
|
appSettings.notificationMessagePreviewSetting = Constants.notificationPreviewAnonymous
|
2020-11-17 19:02:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-19 19:26:59 +00:00
|
|
|
NotificationAppearancePreview {
|
|
|
|
//% "Name only"
|
|
|
|
name: qsTrId("name-only")
|
|
|
|
notificationTitle: "Vitalik Buterin"
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "You have a new message"
|
|
|
|
notificationMessage: qsTrId("you-have-a-new-message")
|
2021-01-19 19:26:59 +00:00
|
|
|
buttonGroup: messageSetting
|
|
|
|
checked: appSettings.notificationMessagePreviewSetting === Constants.notificationPreviewNameOnly
|
|
|
|
onRadioCheckedChanged: {
|
|
|
|
if (checked) {
|
|
|
|
appSettings.notificationMessagePreviewSetting = Constants.notificationPreviewNameOnly
|
2020-11-17 19:02:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-09-18 12:24:16 +00:00
|
|
|
|
2021-01-19 19:26:59 +00:00
|
|
|
NotificationAppearancePreview {
|
|
|
|
//% "Name & Message"
|
|
|
|
name: qsTrId("name---message")
|
|
|
|
notificationTitle: "Vitalik Buterin"
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Hi there! Yes, no problem, let me know if I can help."
|
|
|
|
notificationMessage: qsTrId("hi-there--yes--no-problem--let-me-know-if-i-can-help-")
|
2021-01-19 19:26:59 +00:00
|
|
|
buttonGroup: messageSetting
|
|
|
|
checked: appSettings.notificationMessagePreviewSetting === Constants.notificationPreviewNameAndMessage
|
|
|
|
onRadioCheckedChanged: {
|
|
|
|
if (checked) {
|
2020-11-17 19:02:56 +00:00
|
|
|
appSettings.notificationMessagePreviewSetting = Constants.notificationPreviewNameAndMessage
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-09-18 12:24:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
2020-09-22 07:53:03 +00:00
|
|
|
//% "No preview or Advanced? Go to Notification Center"
|
|
|
|
text: qsTrId("no-preview-or-advanced--go-to-notification-center")
|
2020-09-18 12:24:16 +00:00
|
|
|
font.pixelSize: 15
|
2020-11-17 19:02:56 +00:00
|
|
|
anchors.left: parent.left
|
2020-09-18 12:24:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Separator {
|
|
|
|
id: separator2
|
|
|
|
anchors.top: column3.bottom
|
|
|
|
anchors.topMargin: Style.current.bigPadding
|
2020-11-17 19:02:56 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: -Style.current.padding
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: -Style.current.padding
|
2020-09-18 12:24:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusSectionHeadline {
|
|
|
|
id: sectionHeadlineContacts
|
2020-09-22 07:53:03 +00:00
|
|
|
//% "Contacts & Users"
|
|
|
|
text: qsTrId("contacts---users")
|
2020-09-18 12:24:16 +00:00
|
|
|
anchors.top: separator2.bottom
|
2020-11-17 19:02:56 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2020-09-18 12:24:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: column4
|
|
|
|
anchors.top: sectionHeadlineContacts.bottom
|
|
|
|
anchors.topMargin: Style.current.smallPadding
|
2020-11-17 19:02:56 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2020-09-18 12:24:16 +00:00
|
|
|
width: parent.width
|
|
|
|
|
2021-01-19 19:26:59 +00:00
|
|
|
StatusSettingsLineButton {
|
|
|
|
//% "Receive notifications from non-contacts"
|
|
|
|
text: qsTrId("receive-notifications-from-non-contacts")
|
|
|
|
isSwitch: true
|
|
|
|
switchChecked: appSettings.allowNotificationsFromNonContacts
|
|
|
|
onClicked: {
|
|
|
|
appSettings.allowNotificationsFromNonContacts = checked
|
2020-09-18 12:24:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-19 19:26:59 +00:00
|
|
|
StatusSettingsLineButton {
|
2020-09-22 07:53:03 +00:00
|
|
|
//% "Muted users"
|
2021-01-19 19:26:59 +00:00
|
|
|
text: qsTrId("muted-users")
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "None"
|
|
|
|
currentValue: profileModel.mutedContacts.rowCount() > 0 ? profileModel.mutedContacts.rowCount() : qsTrId("none")
|
2021-01-19 19:26:59 +00:00
|
|
|
isSwitch: false
|
2020-11-19 14:59:31 +00:00
|
|
|
onClicked: {
|
|
|
|
const mutedChatsModal = notificationsContainer.mutedChatsModalComponent.createObject(notificationsContainer, {
|
|
|
|
showMutedContacts: true
|
|
|
|
})
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Muted contacts"
|
|
|
|
mutedChatsModal.title = qsTrId("muted-contacts")
|
2020-11-19 14:59:31 +00:00
|
|
|
mutedChatsModal.open()
|
|
|
|
}
|
2020-09-18 12:24:16 +00:00
|
|
|
}
|
|
|
|
|
2021-01-19 19:26:59 +00:00
|
|
|
StatusSettingsLineButton {
|
2020-09-22 07:53:03 +00:00
|
|
|
//% "Muted chats"
|
2021-01-19 19:26:59 +00:00
|
|
|
text: qsTrId("muted-chats")
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "None"
|
|
|
|
currentValue: profileModel.mutedChats.rowCount() > 0 ? profileModel.mutedChats.rowCount() : qsTrId("none")
|
2021-01-19 19:26:59 +00:00
|
|
|
isSwitch: false
|
2020-11-19 14:59:31 +00:00
|
|
|
onClicked: {
|
|
|
|
const mutedChatsModal = notificationsContainer.mutedChatsModalComponent.createObject(notificationsContainer, {
|
|
|
|
showMutedContacts: false
|
|
|
|
})
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Muted chats"
|
|
|
|
mutedChatsModal.title = qsTrId("muted-chats")
|
2020-11-19 14:59:31 +00:00
|
|
|
mutedChatsModal.open()
|
|
|
|
}
|
2021-01-19 19:26:59 +00:00
|
|
|
|
|
|
|
StyledText {
|
|
|
|
//% "You can limit what gets shown in notifications"
|
|
|
|
text: qsTrId("you-can-limit-what-gets-shown-in-notifications")
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
width: parent.width
|
|
|
|
font.pixelSize: 12
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Style.current.padding
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.topMargin: 2
|
|
|
|
}
|
2020-09-18 12:24:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Separator {
|
|
|
|
id: separator3
|
|
|
|
anchors.top: column4.bottom
|
|
|
|
anchors.topMargin: Style.current.bigPadding
|
2020-11-17 19:02:56 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: -Style.current.padding
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: -Style.current.padding
|
2020-09-18 12:24:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: column5
|
|
|
|
spacing: Style.current.smallPadding
|
|
|
|
anchors.top: separator3.bottom
|
|
|
|
anchors.topMargin: Style.current.bigPadding
|
2020-11-17 19:02:56 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2020-09-18 12:24:16 +00:00
|
|
|
width: parent.width
|
|
|
|
|
2021-01-29 10:12:45 +00:00
|
|
|
StyledText {
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Reset notification settings"
|
|
|
|
text: qsTrId("reset-notification-settings")
|
2021-01-29 10:12:45 +00:00
|
|
|
font.pixelSize: 15
|
|
|
|
color: Style.current.danger
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
hoverEnabled: true
|
|
|
|
onEntered: {
|
|
|
|
parent.font.underline = true
|
|
|
|
}
|
|
|
|
onExited: {
|
|
|
|
parent.font.underline = false
|
|
|
|
}
|
|
|
|
onClicked: {
|
2021-02-18 19:24:07 +00:00
|
|
|
appSettings.notificationSetting = Constants.notifyAllMessages
|
|
|
|
appSettings.notificationSoundsEnabled = true
|
|
|
|
appSettings.notificationMessagePreviewSetting = Constants.notificationPreviewNameAndMessage
|
|
|
|
appSettings.allowNotificationsFromNonContacts = false
|
2021-01-29 10:12:45 +00:00
|
|
|
}
|
2020-09-18 12:24:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
2020-09-22 07:53:03 +00:00
|
|
|
//% "Restore default notification settings and unmute all chats and users"
|
|
|
|
text: qsTrId("restore-default-notification-settings-and-unmute-all-chats-and-users")
|
2020-09-18 12:24:16 +00:00
|
|
|
font.pixelSize: 15
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
}
|
|
|
|
}
|
2020-05-27 21:28:25 +00:00
|
|
|
}
|
|
|
|
}
|