aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quickcontrols/wearable/qml/Notifications/NotificationsPage.qml
blob: 6cbf2d92cf55fe688ccd016ddc4e7d2916aa4602 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

import QtQuick
import QtQuick.Controls as QQC2
import "../Style"
import "notifications.js" as NotificationData

ListView {
    id: missedCallsView

    clip: true
    focus: true
    boundsBehavior: Flickable.StopAtBounds
    snapMode: ListView.SnapToItem

    model: ListModel {
        id: missedCallsList
    }

    Image {
        id: missedCallIcon
        width: parent.width / 2
        anchors.right: parent.horizontalCenter
        anchors.verticalCenter: parent.verticalCenter
        source: UIStyle.themeImagePath("images/missedcall")
        fillMode: Image.Pad
    }

    delegate: Item {
        height: missedCallsView.height
        width: missedCallsView.width / 2
        anchors.left: missedCallsView.contentItem.horizontalCenter

        Column {
            spacing: 15
            anchors.verticalCenter: parent.verticalCenter

            Image {
                anchors.horizontalCenter: parent.horizontalCenter
                source: qsTr("images/avatar%1-%2.png").arg(model.gender).arg(UIStyle.darkTheme ? "dark" : "light")
            }

            Text {
                text: model.name
                anchors.horizontalCenter: parent.horizontalCenter
                font.bold: true
                font.pixelSize: UIStyle.fontSizeS
                color: UIStyle.themeColorQtGray1
            }

            Text {
                anchors.horizontalCenter: parent.horizontalCenter
                text: date + " " + time
                font.pixelSize: UIStyle.fontSizeXS
                font.italic: true
                color: UIStyle.themeColorQtGray2
            }
        }
    }

    Component.onCompleted: {
        NotificationData.populateData(missedCallsList)
    }
}