2016-01-12 00:15:02 +00:00
|
|
|
import QtQuick 2.4
|
2015-12-04 02:38:58 +00:00
|
|
|
import QtQuick.Controls 1.4
|
2016-01-12 00:15:02 +00:00
|
|
|
import QtQuick.Controls.Styles 1.4
|
2015-07-21 12:00:29 +00:00
|
|
|
import QtQuick.Dialogs 1.2
|
2016-01-12 00:15:02 +00:00
|
|
|
import QtQuick.Layouts 1.2
|
2015-07-21 12:00:29 +00:00
|
|
|
import org.subsurfacedivelog.mobile 1.0
|
2015-11-29 20:13:57 +00:00
|
|
|
import org.kde.plasma.mobilecomponents 0.2 as MobileComponents
|
2015-07-21 12:00:29 +00:00
|
|
|
|
2015-11-29 20:13:57 +00:00
|
|
|
MobileComponents.Page {
|
2016-01-12 00:15:02 +00:00
|
|
|
id: page
|
|
|
|
objectName: "DiveList"
|
|
|
|
property alias currentIndex: diveListView.currentIndex
|
|
|
|
mainAction: Action {
|
|
|
|
iconName: editDrawer.opened ? "dialog-cancel" : "document-edit"
|
|
|
|
onTriggered: {
|
|
|
|
if (editDrawer.opened) {
|
|
|
|
editDrawer.close();
|
|
|
|
return;
|
2015-12-04 02:32:52 +00:00
|
|
|
}
|
2016-01-12 00:15:02 +00:00
|
|
|
detailsEdit.dive_id = diveListView.currentItem.modelData.dive.id
|
|
|
|
detailsEdit.number = diveListView.currentItem.modelData.dive.number
|
|
|
|
detailsEdit.dateText = diveListView.currentItem.modelData.dive.date
|
|
|
|
detailsEdit.locationText = diveListView.currentItem.modelData.dive.location
|
|
|
|
detailsEdit.durationText = diveListView.currentItem.modelData.dive.duration
|
|
|
|
detailsEdit.depthText = diveListView.currentItem.modelData.dive.depth
|
|
|
|
detailsEdit.airtempText = diveListView.currentItem.modelData.dive.airTemp
|
|
|
|
detailsEdit.watertempText = diveListView.currentItem.modelData.dive.waterTemp
|
|
|
|
detailsEdit.suitText = diveListView.currentItem.modelData.dive.suit
|
|
|
|
detailsEdit.buddyText = diveListView.currentItem.modelData.dive.buddy
|
|
|
|
detailsEdit.divemasterText = diveListView.currentItem.modelData.dive.divemaster
|
|
|
|
detailsEdit.notesText = diveListView.currentItem.modelData.dive.notes
|
|
|
|
editDrawer.open();
|
2015-12-04 02:32:52 +00:00
|
|
|
}
|
2016-01-12 00:15:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function showDiveIndex(index) {
|
|
|
|
diveListView.currentIndex = index;
|
|
|
|
diveListView.positionViewAtIndex(diveListView.currentIndex, ListView.Beginning);
|
|
|
|
}
|
|
|
|
onWidthChanged: diveListView.positionViewAtIndex(diveListView.currentIndex, ListView.Beginning);
|
2015-12-04 02:32:52 +00:00
|
|
|
|
2015-11-30 00:12:47 +00:00
|
|
|
ScrollView {
|
2015-11-11 23:40:13 +00:00
|
|
|
anchors.fill: parent
|
2016-01-12 00:15:02 +00:00
|
|
|
ListView {
|
|
|
|
id: diveListView
|
2015-11-30 00:12:47 +00:00
|
|
|
anchors.fill: parent
|
2016-01-12 00:15:02 +00:00
|
|
|
model: diveModel
|
|
|
|
currentIndex: -1
|
|
|
|
boundsBehavior: Flickable.StopAtBounds
|
|
|
|
maximumFlickVelocity: parent.width/4
|
|
|
|
cacheBuffer: parent.width/2
|
|
|
|
orientation: ListView.Horizontal
|
|
|
|
focus: true
|
2015-11-30 00:12:47 +00:00
|
|
|
clip: true
|
2016-01-12 00:15:02 +00:00
|
|
|
snapMode: ListView.SnapOneItem
|
|
|
|
onMovementEnded: {
|
|
|
|
currentIndex = indexAt(contentX+1, 1);
|
|
|
|
}
|
|
|
|
delegate: ScrollView {
|
|
|
|
id: internalScrollView
|
|
|
|
width: diveListView.width
|
|
|
|
height: diveListView.height
|
|
|
|
property var modelData: model
|
|
|
|
Flickable {
|
|
|
|
//contentWidth: parent.width
|
|
|
|
contentHeight: diveDetails.height
|
|
|
|
DiveDetailsView {
|
|
|
|
id: diveDetails
|
|
|
|
width: internalScrollView.width
|
2015-12-04 00:38:04 +00:00
|
|
|
}
|
|
|
|
}
|
2015-07-21 12:00:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-01-12 00:15:02 +00:00
|
|
|
MobileComponents.OverlayDrawer {
|
|
|
|
id: editDrawer
|
|
|
|
anchors.fill: parent
|
|
|
|
edge: Qt.BottomEdge
|
|
|
|
contentItem: DiveDetailsEdit {
|
|
|
|
id: detailsEdit
|
|
|
|
implicitHeight: page.height - MobileComponents.Units.gridUnit*3
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-21 12:00:29 +00:00
|
|
|
}
|