| 1 | import QtQuick |
| 2 | import QtQuick.Layouts |
| 3 | |
| 4 | // Control panel > notifications: the count in Doto, do-not-disturb, clear, the history. |
| 5 | ColumnLayout { |
| 6 | id: page |
| 7 | spacing: 12 |
| 8 | |
| 9 | RowLayout { |
| 10 | Layout.fillWidth: true |
| 11 | Layout.leftMargin: 6 |
| 12 | spacing: 12 |
| 13 | Num { |
| 14 | text: Notifs.count |
| 15 | font.pixelSize: 44 |
| 16 | } |
| 17 | Lb { |
| 18 | Layout.fillWidth: true |
| 19 | Layout.alignment: Qt.AlignVCenter |
| 20 | text: Notifs.count === 1 ? "notification" : "notifications" |
| 21 | } |
| 22 | IconBtn { |
| 23 | icon: Notifs.dnd ? Theme.iBellOff : Theme.iBell |
| 24 | label: "dnd" |
| 25 | active: Notifs.dnd |
| 26 | onClicked: Notifs.dnd = !Notifs.dnd |
| 27 | } |
| 28 | IconBtn { |
| 29 | visible: Notifs.count > 0 |
| 30 | icon: Theme.iTrash |
| 31 | label: "clear" |
| 32 | onClicked: Notifs.clearAll() |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | Lb { |
| 37 | visible: Notifs.count === 0 |
| 38 | Layout.alignment: Qt.AlignHCenter |
| 39 | Layout.topMargin: 30 |
| 40 | Layout.bottomMargin: 30 |
| 41 | text: "all quiet" |
| 42 | color: Theme.mute |
| 43 | } |
| 44 | |
| 45 | Flickable { |
| 46 | id: flick |
| 47 | Layout.fillWidth: true |
| 48 | Layout.fillHeight: true |
| 49 | Layout.preferredHeight: list.implicitHeight |
| 50 | clip: true |
| 51 | contentWidth: width |
| 52 | contentHeight: list.implicitHeight |
| 53 | boundsBehavior: Flickable.StopAtBounds |
| 54 | |
| 55 | ColumnLayout { |
| 56 | id: list |
| 57 | width: flick.width |
| 58 | spacing: 10 |
| 59 | Repeater { |
| 60 | model: { Notifs.count; return Notifs.history() } |
| 61 | delegate: NotifCard { |
| 62 | required property var modelData |
| 63 | n: modelData |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | } |