Merge branch 'kirigamiPort' of https://github.com/sebasje/subsurface into mergeKirigamiPort

This merge was a bit more challenging given how far things had diverged,
but I hope I got it mostly right.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2016-03-31 21:57:12 -05:00
commit 2efa047999
17 changed files with 436 additions and 423 deletions

View file

@ -4,9 +4,9 @@ import QtQuick.Controls.Styles 1.4
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.2
import org.subsurfacedivelog.mobile 1.0
import org.kde.plasma.mobilecomponents 0.2 as MobileComponents
import org.kde.kirigami 1.0 as Kirigami
MobileComponents.Page {
Kirigami.Page {
id: diveDetailsPage
property alias currentIndex: diveDetailsListView.currentIndex
property alias dive_id: detailsEdit.dive_id
@ -26,25 +26,29 @@ MobileComponents.Page {
property alias endpressure: detailsEdit.endpressureText
property alias gasmix: detailsEdit.gasmixText
topPadding: applicationWindow().header.Layout.preferredHeight
leftPadding: 0
rightPadding: 0
bottomPadding: 0
title: diveDetailsListView.currentItem.modelData.dive.location
state: "view"
flickable: diveDetailsListView.currentItem
states: [
State {
name: "view"
PropertyChanges { target: diveDetailsPage; contextualActions: Qt.platform.os == "ios" ? [ deleteAction, backAction ] : [ deleteAction ] }
PropertyChanges { target: diveDetailList; visible: true }
PropertyChanges { target: detailsEditScroll; visible: false }
},
State {
name: "edit"
PropertyChanges { target: diveDetailsPage; contextualActions: Qt.platform.os == "ios" ? [ cancelAction ] : null }
PropertyChanges { target: diveDetailList; visible: false }
PropertyChanges { target: detailsEditScroll; visible: true }
},
State {
name: "add"
PropertyChanges { target: diveDetailsPage; contextualActions: Qt.platform.os == "ios" ? [ cancelAction ] : null }
PropertyChanges { target: diveDetailList; visible: false }
PropertyChanges { target: detailsEditScroll; visible: true }
}
@ -65,7 +69,7 @@ MobileComponents.Page {
}
}
property QtObject cancelAction: Action {
property QtObject cancelAction: Kirigami.Action {
text: state === "edit" ? "Cancel edit" : "Cancel dive add"
iconName: "dialog-cancel"
onTriggered: {
@ -161,50 +165,53 @@ MobileComponents.Page {
onWidthChanged: diveDetailsListView.positionViewAtIndex(diveDetailsListView.currentIndex, ListView.Beginning);
ScrollView {
id: diveDetailList
Item {
anchors.fill: parent
ListView {
id: diveDetailsListView
ScrollView {
id: diveDetailList
anchors.fill: parent
model: diveModel
currentIndex: -1
boundsBehavior: Flickable.StopAtBounds
maximumFlickVelocity: parent.width * 5
orientation: ListView.Horizontal
focus: true
clip: true
snapMode: ListView.SnapOneItem
onMovementEnded: {
currentIndex = indexAt(contentX+1, 1);
}
delegate: ScrollView {
id: internalScrollView
width: diveDetailsListView.width
height: diveDetailsListView.height
property var modelData: model
Flickable {
//contentWidth: parent.width
contentHeight: diveDetails.height
boundsBehavior: Flickable.StopAtBounds
DiveDetailsView {
id: diveDetails
width: internalScrollView.width
ListView {
id: diveDetailsListView
anchors.fill: parent
model: diveModel
currentIndex: -1
boundsBehavior: Flickable.StopAtBounds
maximumFlickVelocity: parent.width * 5
orientation: ListView.Horizontal
focus: true
clip: true
snapMode: ListView.SnapOneItem
onMovementEnded: {
currentIndex = indexAt(contentX+1, 1);
}
delegate: ScrollView {
id: internalScrollView
width: diveDetailsListView.width
height: diveDetailsListView.height
property var modelData: model
Flickable {
//contentWidth: parent.width
contentHeight: diveDetails.height
boundsBehavior: Flickable.StopAtBounds
DiveDetailsView {
id: diveDetails
width: internalScrollView.width
}
}
}
}
}
}
Flickable {
id: detailsEditScroll
anchors.fill: parent
anchors.margins: MobileComponents.Units.gridUnit
contentWidth: contentItem.childrenRect.width;
contentHeight: contentItem.childrenRect.height
clip: true
bottomMargin: MobileComponents.Units.gridUnit * 3
DiveDetailsEdit {
id: detailsEdit
Kirigami.OverlaySheet {
id: detailsEditScroll
anchors.fill: parent
onOpenedChanged: {
if (!opened) {
diveDetailsPage.state = "view"
}
}
DiveDetailsEdit {
id: detailsEdit
}
}
}
}