2015-07-10 08:40:30 +00:00
|
|
|
import QtQuick 2.3
|
|
|
|
import QtQuick.Controls 1.2
|
|
|
|
import QtQuick.Window 2.2
|
|
|
|
import QtQuick.Dialogs 1.2
|
|
|
|
import org.subsurfacedivelog.mobile 1.0
|
2015-07-10 08:45:20 +00:00
|
|
|
import QtQuick.Layouts 1.0
|
2015-07-10 08:40:30 +00:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: page
|
2015-08-20 08:44:01 +00:00
|
|
|
objectName: "DiveList"
|
2015-07-10 08:40:30 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: diveDelegate
|
|
|
|
Item {
|
|
|
|
id: dive
|
|
|
|
|
|
|
|
property real detailsOpacity : 0
|
|
|
|
|
2015-11-06 21:52:30 +00:00
|
|
|
width: diveListView.width - units.smallSpacing
|
2015-07-12 17:52:44 +00:00
|
|
|
height: childrenRect.height
|
2015-07-10 08:40:30 +00:00
|
|
|
|
|
|
|
//Mouse region: When clicked, the mode changes to details view
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
2015-07-21 12:00:29 +00:00
|
|
|
onClicked: {
|
|
|
|
detailsWindow.width = parent.width
|
|
|
|
detailsWindow.location = location
|
|
|
|
detailsWindow.dive_id = id
|
|
|
|
detailsWindow.buddy = buddy
|
|
|
|
detailsWindow.suit = suit
|
|
|
|
detailsWindow.airtemp = airtemp
|
|
|
|
detailsWindow.watertemp = watertemp
|
|
|
|
detailsWindow.divemaster = divemaster
|
|
|
|
detailsWindow.notes = notes
|
2015-07-27 19:26:51 +00:00
|
|
|
detailsWindow.number = diveNumber
|
|
|
|
detailsWindow.date = date
|
2015-07-21 12:00:29 +00:00
|
|
|
stackView.push(detailsWindow)
|
|
|
|
}
|
2015-07-10 08:40:30 +00:00
|
|
|
}
|
|
|
|
|
2015-07-27 06:51:53 +00:00
|
|
|
//Layout of the page: (mini profile, dive no, date at the top
|
2015-07-10 08:40:30 +00:00
|
|
|
//And other details at the bottom.
|
2015-10-09 03:05:23 +00:00
|
|
|
Item {
|
2015-11-06 21:52:30 +00:00
|
|
|
x: units.smallSpacing
|
|
|
|
width: parent.width - units.smallSpacing * 2
|
|
|
|
height: childrenRect.height + units.smallSpacing * 2
|
|
|
|
//spacing: units.smallSpacing / 2
|
|
|
|
anchors.margins: units.smallSpacing
|
2015-07-10 08:40:30 +00:00
|
|
|
|
2015-10-09 01:56:36 +00:00
|
|
|
Text {
|
2015-10-09 03:05:23 +00:00
|
|
|
id: locationText
|
|
|
|
text: location
|
|
|
|
color: theme.textColor
|
2015-11-12 01:13:47 +00:00
|
|
|
//font.pointSize: Math.round(units.fontMetrics.pointSize * 1.2) // why this doesn't work is a mystery to me, so ...
|
|
|
|
scale: 1.2 // Let's see how this works, otherwise, we'll need the default point size somewhere
|
2015-10-09 03:05:23 +00:00
|
|
|
transformOrigin: Item.TopLeft
|
2015-11-12 01:13:47 +00:00
|
|
|
elide: Text.ElideRight
|
|
|
|
maximumLineCount: 1 // needed for elide to work at all
|
2015-10-09 03:05:23 +00:00
|
|
|
anchors {
|
|
|
|
left: parent.left
|
|
|
|
top: parent.top
|
2015-11-12 01:13:47 +00:00
|
|
|
right: dateLabel.left
|
2015-10-09 03:05:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
Text {
|
2015-11-12 01:13:47 +00:00
|
|
|
id: dateLabel
|
2015-10-09 03:05:23 +00:00
|
|
|
text: date
|
|
|
|
opacity: 0.6
|
|
|
|
color: theme.textColor
|
2015-11-11 23:18:57 +00:00
|
|
|
font.pointSize: units.smallPointSize
|
2015-10-09 03:05:23 +00:00
|
|
|
anchors {
|
|
|
|
right: parent.right
|
|
|
|
top: parent.top
|
2015-11-06 21:52:30 +00:00
|
|
|
bottomMargin: units.smallSpacing / 2
|
2015-10-09 03:05:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
Row {
|
|
|
|
id: descriptionText
|
|
|
|
anchors {
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
bottom: numberText.bottom
|
|
|
|
}
|
|
|
|
Text {
|
|
|
|
text: 'Depth: '
|
|
|
|
opacity: 0.6
|
|
|
|
color: theme.textColor
|
|
|
|
}
|
|
|
|
Text {
|
|
|
|
text: depth
|
|
|
|
width: Math.max(units.gridUnit * 3, paintedWidth) // helps vertical alignment throughout listview
|
|
|
|
color: theme.textColor
|
|
|
|
}
|
|
|
|
Text {
|
|
|
|
text: 'Duration: '
|
|
|
|
opacity: 0.6
|
|
|
|
color: theme.textColor
|
|
|
|
}
|
|
|
|
Text {
|
|
|
|
text: duration
|
|
|
|
color: theme.textColor
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Text {
|
|
|
|
id: numberText
|
|
|
|
text: "#" + diveNumber
|
|
|
|
color: theme.textColor
|
|
|
|
scale: 1.2
|
|
|
|
transformOrigin: Item.BottomRight
|
|
|
|
opacity: 0.4
|
|
|
|
anchors {
|
|
|
|
right: parent.right
|
2015-11-06 21:52:30 +00:00
|
|
|
topMargin: units.smallSpacing
|
2015-10-09 03:05:23 +00:00
|
|
|
top: locationText.bottom
|
|
|
|
}
|
2015-10-09 01:56:36 +00:00
|
|
|
}
|
2015-10-09 03:05:23 +00:00
|
|
|
//Text { text: location; width: parent.width }
|
2015-10-09 01:56:36 +00:00
|
|
|
Rectangle {
|
|
|
|
color: theme.textColor
|
|
|
|
opacity: .2
|
|
|
|
height: Math.max(1, units.gridUnit / 24) // we really want a thin line
|
2015-10-09 03:05:23 +00:00
|
|
|
anchors {
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
top: numberText.bottom
|
|
|
|
}
|
2015-07-10 08:40:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: tripHeading
|
2015-10-09 01:56:36 +00:00
|
|
|
Item {
|
2015-11-06 21:52:30 +00:00
|
|
|
width: page.width - units.smallSpacing * 2
|
|
|
|
height: childrenRect.height + units.smallSpacing * 2
|
2015-07-10 08:40:30 +00:00
|
|
|
|
|
|
|
Text {
|
2015-10-09 01:56:36 +00:00
|
|
|
id: sectionText
|
2015-07-10 08:40:30 +00:00
|
|
|
text: section
|
2015-10-09 01:56:36 +00:00
|
|
|
anchors {
|
|
|
|
top: parent.top
|
|
|
|
left: parent.left
|
2015-11-06 21:52:30 +00:00
|
|
|
leftMargin: units.smallSpacing
|
2015-10-09 01:56:36 +00:00
|
|
|
right: parent.right
|
|
|
|
}
|
|
|
|
color: theme.textColor
|
2015-07-10 08:40:30 +00:00
|
|
|
font.pointSize: 16
|
|
|
|
}
|
2015-10-09 01:56:36 +00:00
|
|
|
Rectangle {
|
|
|
|
height: Math.max(2, units.gridUnit / 12) // we want a thicker line
|
|
|
|
anchors {
|
|
|
|
top: sectionText.bottom
|
|
|
|
left: parent.left
|
2015-11-06 21:52:30 +00:00
|
|
|
leftMargin: units.smallSpacing
|
2015-10-09 01:56:36 +00:00
|
|
|
right: parent.right
|
|
|
|
}
|
|
|
|
color: theme.accentColor
|
|
|
|
}
|
2015-07-10 08:40:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ListView {
|
|
|
|
id: diveListView
|
|
|
|
anchors.fill: parent
|
|
|
|
model: diveModel
|
|
|
|
delegate: diveDelegate
|
2015-10-09 01:56:36 +00:00
|
|
|
boundsBehavior: Flickable.StopAtBounds
|
2015-11-06 21:52:30 +00:00
|
|
|
//highlight: Rectangle { color: theme.highlightColor; width: units.smallSpacing }
|
2015-07-10 08:40:30 +00:00
|
|
|
focus: true
|
2015-10-09 01:56:36 +00:00
|
|
|
clip: true
|
2015-07-10 08:40:30 +00:00
|
|
|
section.property: "trip"
|
|
|
|
section.criteria: ViewSection.FullString
|
|
|
|
section.delegate: tripHeading
|
|
|
|
}
|
2015-11-07 00:45:40 +00:00
|
|
|
StartPage {
|
|
|
|
anchors.fill: parent
|
2015-11-07 23:46:36 +00:00
|
|
|
opacity: (diveListView.count == 0) ? 1.0 : 0
|
2015-11-07 23:05:31 +00:00
|
|
|
visible: opacity > 0
|
2015-11-07 00:45:40 +00:00
|
|
|
Behavior on opacity { NumberAnimation { duration: units.shortDuration } }
|
|
|
|
Component.onCompleted: {
|
2015-11-07 23:46:36 +00:00
|
|
|
print("diveListView.count " + diveListView.count);
|
2015-11-07 00:45:40 +00:00
|
|
|
}
|
|
|
|
}
|
2015-07-10 08:40:30 +00:00
|
|
|
}
|