toppanel: Wrap the TopArea into an Item
[apps/homescreen.git] / homescreen / qml / toppanel.qml
1 import QtQuick 2.13
2 import QtQuick.Window 2.13
3
4 Window {
5     id: toppanel
6     width: container.width
7     height: Screen.height * (210.0 / 1920.0)
8     flags: Qt.FramelessWindowHint
9     visible: true
10     //color: "#aaaa0000"
11
12     Item {
13         id: container
14         width: Screen.width
15         height: Screen.height * (218.0 / 1920.0)
16
17         TopArea {
18         }
19     }
20
21     Timer {
22         id:notificationTimer
23         interval: 3000
24         running: false
25         repeat: true
26         onTriggered: notificationItem.visible = false
27     }
28
29     Item {
30         id: notificationItem
31         x: 0
32         y: 0
33         z: 1
34         width: 1280
35         height: 100
36         opacity: 0.8
37         visible: false
38
39         Rectangle {
40             width: parent.width
41             height: parent.height
42             anchors.fill: parent
43             color: "gray"
44             Image {
45                 id: notificationIcon
46                 width: 70
47                 height: 70
48                 anchors.left: parent.left
49                 anchors.leftMargin: 20
50                 anchors.verticalCenter: parent.verticalCenter
51                 source: ""
52             }
53
54             Text {
55                 id: notificationtext
56                 font.pixelSize: 25
57                 anchors.left: notificationIcon.right
58                 anchors.leftMargin: 5
59                 anchors.verticalCenter: parent.verticalCenter
60                 color: "white"
61                 text: qsTr("")
62             }
63         }
64     }
65
66     Connections {
67         target: homescreenHandler
68         onShowNotification: {
69             notificationIcon.source = icon_path
70             notificationtext.text = text
71             notificationItem.visible = true
72             notificationTimer.restart()
73         }
74     }
75 }