Debian Codegraph @

qml/Components/EmptyState.qml

raw
1 /*
2 * Copyright (C) 2014-2016 Canonical Ltd
3 *
4 * This file is part of Lomiri Clock App
5 *
6 * Lomiri Clock App is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 3 as
8 * published by the Free Software Foundation.
9 *
10 * Lomiri Clock App is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 import QtQuick 2.9
20 import Lomiri.Components 1.3
21
22 /*
23 Component which displays an empty state (approved by design). It offers an
24 icon, title and subtitle to describe the empty state.
25 */
26
27 Item {
28 id: emptyState
29
30 // Public APIs
31 property alias iconName: emptyIcon.source
32 property alias title: emptyLabel.text
33 property alias subTitle: emptySublabel.text
34
35 height: childrenRect.height
36
37 Label {
38 id: emptyLabel
39 textSize: Label.Large
40 font.weight: Font.Normal
41 width: parent.width - units.gu(4)
42 wrapMode: Text.WordWrap
43 horizontalAlignment: Text.AlignHCenter
44 anchors.horizontalCenter: parent.horizontalCenter
45 color: mainColor
46 }
47
48 Icon {
49 id: emptyIcon
50
51 anchors {
52 horizontalCenter: parent.horizontalCenter
53 top: emptyLabel.bottom
54 topMargin: units.gu(4)
55 }
56
57 height: units.gu(12)
58 width: height
59 color: mainColor
60 asynchronous: true
61 }
62
63 Label {
64 id: emptySublabel
65 width: parent.width - units.gu(12)
66 wrapMode: Text.WordWrap
67
68 anchors {
69 horizontalCenter: parent.horizontalCenter
70 top: emptyIcon.bottom
71 topMargin: units.gu(4)
72 }
73
74 horizontalAlignment: Text.AlignHCenter
75 color: theme.palette.normal.backgroundSecondaryText
76 onLinkActivated: Qt.openUrlExternally(link)
77 linkColor: theme.palette.normal.activity
78 }
79 }