aboutsummaryrefslogtreecommitdiffstats
path: root/qt-mobile/qml/DiveDetails.qml
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-03-31 21:57:12 -0500
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-03-31 22:36:15 -0500
commit2efa047999c5e82bb05215648bbe8248fd0b03e6 (patch)
treef231e16e7d770805af58359f5476064a72ec034a /qt-mobile/qml/DiveDetails.qml
parent2069526e74505e873140f7be35871db7acbc084d (diff)
parent2480f21e5b2463bd5ac82980f44386277f24c51f (diff)
downloadsubsurface-2efa047999c5e82bb05215648bbe8248fd0b03e6.tar.gz
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>
Diffstat (limited to 'qt-mobile/qml/DiveDetails.qml')
-rw-r--r--qt-mobile/qml/DiveDetails.qml95
1 files changed, 51 insertions, 44 deletions
diff --git a/qt-mobile/qml/DiveDetails.qml b/qt-mobile/qml/DiveDetails.qml
index 4bdd052e4..22cffdd6d 100644
--- a/qt-mobile/qml/DiveDetails.qml
+++ b/qt-mobile/qml/DiveDetails.qml
@@ -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
+ }
}
}
}