| 1 |
/* |
| 2 |
* Copyright (C) 2014, 2015, 2016 Canonical Ltd |
| 3 |
* |
| 4 |
* This file is part of Ubuntu Clock App |
| 5 |
* |
| 6 |
* Ubuntu 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 |
* Ubuntu 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.4 |
| 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 |
Column { |
| 28 |
id: emptyState |
| 29 |
spacing: units.gu(2) |
| 30 |
width: units.gu(36) |
| 31 |
|
| 32 |
// Public APIs |
| 33 |
default property alias iconPlaceholder: iconContainer.data |
| 34 |
property alias iconName: emptyIcon.name |
| 35 |
property alias title: emptyLabel.text |
| 36 |
property alias subTitle: emptySublabel.text |
| 37 |
|
| 38 |
property alias controlComponent: controlLoader.sourceComponent |
| 39 |
|
| 40 |
Item { |
| 41 |
width: childrenRect.width |
| 42 |
height: childrenRect.height |
| 43 |
Icon { |
| 44 |
id: emptyIcon |
| 45 |
height: visible ? units.gu(10) : 0 |
| 46 |
width: visible ? height : 0 |
| 47 |
color: theme.palette.normal.base |
| 48 |
visible: name || source |
| 49 |
} |
| 50 |
Row { |
| 51 |
id: iconContainer |
| 52 |
anchors.horizontalCenter: parent.horizontalCenter |
| 53 |
} |
| 54 |
} |
| 55 |
|
| 56 |
Label { |
| 57 |
id: emptyLabel |
| 58 |
width: parent.width |
| 59 |
horizontalAlignment: Text.AlignLeft |
| 60 |
textSize: Label.XLarge |
| 61 |
|
| 62 |
elide: Text.ElideRight |
| 63 |
wrapMode: Text.WordWrap |
| 64 |
maximumLineCount: 2 |
| 65 |
} |
| 66 |
|
| 67 |
Label { |
| 68 |
id: emptySublabel |
| 69 |
width: parent.width |
| 70 |
horizontalAlignment: Text.AlignLeft |
| 71 |
textSize: Label.Medium |
| 72 |
|
| 73 |
elide: Text.ElideRight |
| 74 |
wrapMode: Text.WordWrap |
| 75 |
} |
| 76 |
|
| 77 |
Loader { |
| 78 |
id: controlLoader |
| 79 |
} |
| 80 |
} |