123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- import QtQuick 2.12
- import QtQuick.Controls 2.5
- import QtQuick.Layouts 1.3
- import Qt.labs.platform 1.1
- Page {
- width: 1280
- height: 470
- id: notificationsForm
- font.capitalization: Font.MixedCase
- Connections {
- target: _qmlHandler
- onNotification: {
- notificationList.append({
- "notificationDate": new Date().toLocaleString(
- Qt.locale(
- "de_DE"),
- "[dd.MM.yyyy hh:mm:ss]"),
- "notificationMessage": message
- })
- }
- onDismissNotification: {
- notificationList.remove(index)
- }
- onShowDesktopNotification: {
- trayIcon.showMessage(title, message)
- }
- }
- ColumnLayout {
- anchors.fill: parent
- ScrollView {
- Layout.preferredWidth: parent.width
- Layout.preferredHeight: 370
- ListView {
- anchors.fill: parent
- model: notificationList
- clip: true
- delegate: NotificationTemplate {
- notificationDateText: notificationDate
- notificationMessageText: notificationMessage
- myIndex: index
- }
- }
- }
- ListModel {
- id: notificationList
- }
- Text {
- Layout.alignment: Qt.AlignCenter
- Layout.preferredWidth: parent.width
- Layout.preferredHeight: 30
- id: loginTitle
- color: "#ffffff"
- text: qsTr("No new notifications!")
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- visible: notificationList.count == 0 ? true : false
- font.pixelSize: 20
- }
- Button {
- id: notificationsDismissAllButton
- Layout.preferredWidth: 180
- Layout.preferredHeight: 70
- Layout.alignment: Qt.AlignCenter
- text: qsTr("Dismiss all")
- enabled: notificationList.count != 0 ? true : false
- visible: enabled
- // @disable-check M223
- onClicked: {
- // @disable-check M222
- notificationList.clear()
- }
- }
- }
- SystemTrayIcon {
- id: trayIcon
- visible: true
- icon.source: "qrc:/images/tray-icon.png"
- }
- }
|