45 lines
2.2 KiB
QML
45 lines
2.2 KiB
QML
pragma ComponentBehavior: Bound
|
|
import QtQuick
|
|
import QtQuick.Controls.Material
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
import "services"
|
|
import "components"
|
|
|
|
ScrollView {
|
|
id: center
|
|
Material.theme: Theme.dark ? Material.Dark : Material.Light
|
|
Material.accent: Theme.primary
|
|
contentWidth: availableWidth
|
|
clip: true
|
|
ColumnLayout {
|
|
width: center.availableWidth
|
|
spacing: 14
|
|
Label { text: "Центр уведомлений"; font.pixelSize: 24; font.weight: Font.DemiBold; color: Theme.foreground; Layout.fillWidth: true }
|
|
Switch { text: "Не беспокоить"; checked: Notifications.dnd; enabled: Preferences.writable; onClicked: Notifications.setDnd(checked) }
|
|
Switch { text: "Сохранять историю уведомлений"; checked: Notifications.saveHistory; enabled: Preferences.writable; onClicked: Notifications.setSaveHistory(checked) }
|
|
ActionButton { text: "Очистить всё"; enabled: Notifications.items.length + Notifications.history.length > 0; onClicked: Notifications.clear() }
|
|
Label { visible: Notifications.error !== ""; text: Notifications.error; color: Theme.outline; Layout.fillWidth: true; wrapMode: Text.Wrap }
|
|
Repeater {
|
|
model: Notifications.groups
|
|
ColumnLayout {
|
|
id: group
|
|
required property var modelData
|
|
Layout.fillWidth: true
|
|
spacing: 8
|
|
Label { Layout.fillWidth: true; text: group.modelData.name + " · " + group.modelData.entries.length; font.pixelSize: 20; color: Theme.primary; textFormat: Text.PlainText }
|
|
Repeater {
|
|
model: group.modelData.entries
|
|
NotificationCard {
|
|
required property var modelData
|
|
Layout.fillWidth: true
|
|
notification: modelData.notification || null
|
|
record: modelData.record || null
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Label { visible: Notifications.groups.length === 0; text: "Всё чисто — новых уведомлений нет"; color: Theme.foreground }
|
|
}
|
|
}
|