aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qml/DownloadedDiveDelegate.qml
blob: 99ec100a846dc4f266fbb01efc1aec411e4e9a7c (plain) (blame)
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
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
	property bool selected

	enabled: true
	supportsMouseEvents: true
	width: parent.width
	height: Math.round(Kirigami.Units.gridUnit * 1.8)
	padding: 0

	property real detailsOpacity : 0
	property color textColor: subsurfaceTheme.secondaryTextColor

	Row {
		id: downloadedDive
		width: parent.width
		spacing: Kirigami.Units.largeSpacing
		padding: 0
		anchors.leftMargin: Math.round (Kirigami.Units.largeSpacing / 2)
		anchors.fill: parent
		add: Transition {
			NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 400 }
			NumberAnimation { property: "scale"; from: 0; to: 1.0; duration: 400 }
		}
		SsrfCheckBox {
			id: diveIsSelected
			checked: innerListItem.selected;
			width: childrenRect.width - Kirigami.Units.smallSpacing;
			height: childrenRect.heigh - Kirigami.Units.smallSpacing;
			anchors.verticalCenter: parent.verticalCenter
			onClicked: {
				console.log("Clicked on the checkbox of item " + index)
				importModel.selectRow(index)
			}
		}
		Kirigami.Label {
			id: dateLabel
			text: innerListItem.datetime
			width: Math.round(parent.width * 0.35)
			font.pointSize: subsurfaceTheme.smallPointSize
			color: textColor
		}
		Kirigami.Label {
			text: innerListItem.depth + ' / ' + innerListItem.duration
			width: Math.round(parent.width * 0.35)
			font.pointSize: subsurfaceTheme.smallPointSize
			color: textColor
		}
	}
}