diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2017-05-29 19:55:36 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-05-29 12:00:51 -0700 |
commit | 1de1a85e32176bf4d4bcd63d69b5cb83ff1cdc2d (patch) | |
tree | 7670493508421fde55dad8030a63ec183fc2e52a /mobile-widgets/qml/DownloadedDiveDelegate.qml | |
parent | 81277c259bb20aa28d6f73d828b0fd6fbe84522e (diff) | |
download | subsurface-1de1a85e32176bf4d4bcd63d69b5cb83ff1cdc2d.tar.gz |
QML UI: add DownloadDiveDelegate
A delegate to display the dives in a better way,
based on the code from DiveList.qml
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qml/DownloadedDiveDelegate.qml')
-rw-r--r-- | mobile-widgets/qml/DownloadedDiveDelegate.qml | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/mobile-widgets/qml/DownloadedDiveDelegate.qml b/mobile-widgets/qml/DownloadedDiveDelegate.qml new file mode 100644 index 000000000..eb66ce52d --- /dev/null +++ b/mobile-widgets/qml/DownloadedDiveDelegate.qml @@ -0,0 +1,81 @@ +import QtQuick 2.6 +import QtQuick.Controls 2.0 +import QtQuick.Window 2.2 +import QtQuick.Dialogs 1.2 +import QtQuick.Layouts 1.3 +import org.subsurfacedivelog.mobile 1.0 +import org.kde.kirigami 2.0 as Kirigami + +Kirigami.AbstractListItem { + id: innerListItem + + property string depth + property string datetime + property string duration + + enabled: true + supportsMouseEvents: true + width: parent.width + + property real detailsOpacity : 0 + property int horizontalPadding: Kirigami.Units.gridUnit / 2 - Kirigami.Units.smallSpacing + 1 + property color textColor: subsurfaceTheme.diveListTextColor + + Row { + width: parent.width + height: childrenRect.height + Kirigami.Units.smallSpacing + spacing: horizontalPadding + + add: Transition { + NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 400 } + NumberAnimation { property: "scale"; from: 0; to: 1.0; duration: 400 } + } + Item { + id: diveListEntry + width: parent.width - Kirigami.Units.gridUnit * (innerListItem.deleteButtonVisible ? 3 : 1) + height: childrenRect.height - Kirigami.Units.smallSpacing + + Kirigami.Label { + id: depthLabel + text: "Depth " + innerListItem.depth + font.weight: Font.Light + elide: Text.ElideRight + maximumLineCount: 1 // needed for elide to work at all + anchors { + left: parent.left + leftMargin: horizontalPadding + top: parent.top + right: dateLabel.left + } + } + Kirigami.Label { + id: dateLabel + text: innerListItem.datetime + font.pointSize: subsurfaceTheme.smallPointSize + anchors { + bottom: parent.bottom + right: parent.right + top: parent.top + } + } + Row { + anchors { + top: depthLabel.bottom + left: parent.left + leftMargin: horizontalPadding + right: parent.right + rightMargin: horizontalPadding + topMargin: - Kirigami.Units.smallSpacing * 2 + } + Kirigami.Label { + text: qsTr('Duration: ') + font.pointSize: subsurfaceTheme.smallPointSize + } + Kirigami.Label { + text: innerListItem.duration + font.pointSize: subsurfaceTheme.smallPointSize + } + } + } + } +} |