subsurface/mobile-widgets/qml/DownloadedDiveDelegate.qml
Dirk Hohndel 8c0a1c2e6d QML UI: better list of downloaded dives
Not the lsit is much more compact and shows a lot more dives even on
smaller screens. And it's similar in style to the dive list.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-23 17:30:05 -07:00

82 lines
2.2 KiB
QML

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 }
}
CheckBox {
id: diveIsSelected
checked: innerListItem.selected;
width: childrenRect.width - Kirigami.Units.smallSpacing;
height: childrenRect.heigh - Kirigami.Units.smallSpacing;
anchors.verticalCenter: parent.verticalCenter
indicator: Rectangle {
visible: diveIsSelected
implicitWidth: 20
implicitHeight: 20
//x: isBluetooth.leftPadding
y: parent.height / 2 - height / 2
radius: 4
border.color: diveIsSelected.down ? subsurfaceTheme.primaryColor : subsurfaceTheme.darkerPrimaryColor
color: subsurfaceTheme.backgroundColor
Rectangle {
width: 12
height: 12
x: 4
y: 4
radius: 3
color: diveIsSelected.down ? subsurfaceTheme.primaryColor : subsurfaceTheme.darkerPrimaryColor
visible: diveIsSelected && diveIsSelected.checked
}
}
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
}
}
}