summaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
Diffstat (limited to 'mobile-widgets')
-rw-r--r--mobile-widgets/qml/DiveDetails.qml61
-rw-r--r--mobile-widgets/qml/DiveDetailsView.qml58
2 files changed, 60 insertions, 59 deletions
diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml
index d766970ff..4d9f7fc63 100644
--- a/mobile-widgets/qml/DiveDetails.qml
+++ b/mobile-widgets/qml/DiveDetails.qml
@@ -52,7 +52,7 @@ Kirigami.Page {
property alias cylinderModel3: detailsEdit.cylinderModel3
property alias cylinderModel4: detailsEdit.cylinderModel4
- title: currentItem && currentItem.modelData ? currentItem.modelData.dive.location : qsTr("Dive details")
+ title: currentItem && currentItem.modelData ? currentItem.modelData.location : qsTr("Dive details")
state: "view"
leftPadding: 0
topPadding: Kirigami.Units.gridUnit / 2
@@ -68,7 +68,7 @@ Kirigami.Page {
target: diveDetailsPage;
actions {
right: deleteAction
- left: currentItem ? (currentItem.modelData && currentItem.modelData.dive.gps !== "" ? mapAction : null) : null
+ left: currentItem ? (currentItem.modelData && currentItem.modelData.gps !== "" ? mapAction : null) : null
}
}
},
@@ -153,7 +153,7 @@ Kirigami.Page {
name: ":/icons/trash-empty.svg"
}
onTriggered: {
- var deletedId = currentItem.modelData.dive.id
+ var deletedId = currentItem.modelData.id
var deletedIndex = diveDetailsListView.currentIndex
manager.deleteDive(deletedId)
pageStack.pop()
@@ -181,7 +181,7 @@ Kirigami.Page {
}
onTriggered: {
showMap()
- mapPage.centerOnDiveSite(currentItem.modelData.dive.dive_site)
+ mapPage.centerOnDiveSite(currentItem.modelData.diveSite)
}
}
@@ -218,11 +218,11 @@ Kirigami.Page {
// why do we do this? What consumes this?
manager.selectedDiveTimestamp = currentItem.modelData.dive.timestamp
// make sure the core data structures reflect that this dive is selected
- manager.selectDive(currentItem.modelData.dive.id)
+ manager.selectDive(currentItem.modelData.id)
// update the map to show the highlighted flag and center on it
if (rootItem.pageIndex(mapPage) !== -1) {
mapPage.reloadMap()
- mapPage.centerOnDiveSite(currentItem.modelData.dive.dive_site)
+ mapPage.centerOnDiveSite(currentItem.modelData.diveSite)
}
}
@@ -251,34 +251,35 @@ Kirigami.Page {
// set things up for editing - so make sure that the detailsEdit has
// all the right data (using the property aliases set up above)
var dive = currentItem.modelData.dive
- dive_id = dive.id
- number = dive.number
- date = dive.date + " " + dive.time
- location = dive.location
- locationIndex = manager.locationList.indexOf(dive.location)
- gps = dive.gps
+ var modelData = currentItem.modelData
+ dive_id = modelData.id
+ number = modelData.number
+ date = modelData.dateTime
+ location = modelData.location
+ locationIndex = manager.locationList.indexOf(modelData.location)
+ gps = modelData.gps
gpsCheckbox = false
- duration = dive.duration
- depth = dive.depth
- airtemp = dive.airTemp
- watertemp = dive.waterTemp
- suitIndex = manager.suitList.indexOf(dive.suit)
- if (dive.buddy.indexOf(",") > 0) {
- buddyIndex = manager.buddyList.indexOf(dive.buddy.split(",", 1).toString())
+ duration = modelData.duration
+ depth = modelData.depth
+ airtemp = modelData.airTemp
+ watertemp = modelData.waterTemp
+ suitIndex = manager.suitList.indexOf(modelData.suit)
+ if (modelData.buddy.indexOf(",") > 0) {
+ buddyIndex = manager.buddyList.indexOf(modelData.buddy.split(",", 1).toString())
} else {
- buddyIndex = manager.buddyList.indexOf(dive.buddy)
+ buddyIndex = manager.buddyList.indexOf(modelData.buddy)
}
- buddyText = dive.buddy;
- if (dive.divemaster.indexOf(",") > 0) {
- divemasterIndex = manager.divemasterList.indexOf(dive.divemaster.split(",", 1).toString())
+ buddyText = modelData.buddy;
+ if (modelData.diveMaster.indexOf(",") > 0) {
+ divemasterIndex = manager.divemasterList.indexOf(modelData.diveMaster.split(",", 1).toString())
} else {
- divemasterIndex = manager.divemasterList.indexOf(dive.divemaster)
+ divemasterIndex = manager.divemasterList.indexOf(modelData.diveMaster)
}
- divemasterText = dive.divemaster
- notes = dive.notes
- if (dive.singleWeight) {
+ divemasterText = modelData.diveMaster
+ notes = modelData.notes
+ if (modelData.singleWeight) {
// we have only one weight, go ahead, have fun and edit it
- weight = dive.sumWeight
+ weight = modelData.sumWeight
} else {
// careful when translating, this text is "magic" in DiveDetailsEdit.qml
weight = "cannot edit multiple weight systems"
@@ -292,8 +293,8 @@ Kirigami.Page {
cylinderIndex2 = dive.cylinderList.indexOf(usedCyl[2])
cylinderIndex3 = dive.cylinderList.indexOf(usedCyl[3])
cylinderIndex4 = dive.cylinderList.indexOf(usedCyl[4])
- rating = dive.rating
- visibility = dive.visibility
+ rating = modelData.rating
+ visibility = modelData.viz
diveDetailsPage.state = "edit"
}
diff --git a/mobile-widgets/qml/DiveDetailsView.qml b/mobile-widgets/qml/DiveDetailsView.qml
index 846a817a4..e46d6c45e 100644
--- a/mobile-widgets/qml/DiveDetailsView.qml
+++ b/mobile-widgets/qml/DiveDetailsView.qml
@@ -36,7 +36,7 @@ Item {
anchors.left: parent.left
Controls.Label {
id: locationText
- text: dive.location
+ text: location
font.weight: Font.Bold
font.pointSize: subsurfaceTheme.titlePointSize
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
@@ -49,21 +49,21 @@ Item {
}
MouseArea {
anchors.fill: parent
- enabled: dive.gps_decimal !== ""
+ enabled: gpsDecimal !== ""
onClicked: {
showMap()
- mapPage.centerOnDiveSite(dive.dive_site)
+ mapPage.centerOnDiveSite(dive_site)
}
}
}
SsrfButton {
id: gpsButton
anchors.right: parent.right
- enabled: dive.gps !== ""
+ enabled: gps !== ""
text: qsTr("Map it")
onClicked: {
showMap()
- mapPage.centerOnDiveSite(dive.dive_site)
+ mapPage.centerOnDiveSite(dive_site)
}
}
Row {
@@ -77,14 +77,14 @@ Item {
}
Controls.Label {
- text: dive.date + " " + dive.time
+ text: dateTime
width: Math.max(locationText.width * 0.45, paintedWidth)
font.pointSize: subsurfaceTheme.smallPointSize
color: subsurfaceTheme.textColor
}
// let's try to show the depth / duration very compact
Controls.Label {
- text: dive.depth + ' / ' + dive.duration
+ text: depthDuration
width: Math.max(Kirigami.Units.gridUnit * 3, paintedWidth)
font.pointSize: subsurfaceTheme.smallPointSize
color: subsurfaceTheme.textColor
@@ -92,7 +92,7 @@ Item {
}
Controls.Label {
id: numberText
- text: "#" + dive.number
+ text: "#" + number
font.pointSize: subsurfaceTheme.smallPointSize
color: subsurfaceTheme.textColor
anchors {
@@ -117,35 +117,35 @@ Item {
width: height
height: subsurfaceTheme.regularPointSize
anchors.verticalCenter: ratingText.verticalCenter
- source: (dive.rating >= 1) ? ":/icons/ic_star.svg" : ":/icons/ic_star_border.svg"
+ source: (rating >= 1) ? ":/icons/ic_star.svg" : ":/icons/ic_star_border.svg"
color: subsurfaceTheme.textColor
}
Kirigami.Icon {
width: height
height: subsurfaceTheme.regularPointSize
anchors.verticalCenter: ratingText.verticalCenter
- source: (dive.rating >= 2) ? ":/icons/ic_star.svg" : ":/icons/ic_star_border.svg"
+ source: (rating >= 2) ? ":/icons/ic_star.svg" : ":/icons/ic_star_border.svg"
color: subsurfaceTheme.textColor
}
Kirigami.Icon {
width: height
height: subsurfaceTheme.regularPointSize
anchors.verticalCenter: ratingText.verticalCenter
- source: (dive.rating >= 3) ? ":/icons/ic_star.svg" : ":/icons/ic_star_border.svg"
+ source: (rating >= 3) ? ":/icons/ic_star.svg" : ":/icons/ic_star_border.svg"
color: subsurfaceTheme.textColor
}
Kirigami.Icon {
width: height
height: subsurfaceTheme.regularPointSize
anchors.verticalCenter: ratingText.verticalCenter
- source: (dive.rating >= 4) ? ":/icons/ic_star.svg" : ":/icons/ic_star_border.svg"
+ source: (rating >= 4) ? ":/icons/ic_star.svg" : ":/icons/ic_star_border.svg"
color: subsurfaceTheme.textColor
}
Kirigami.Icon {
width: height
height: subsurfaceTheme.regularPointSize
anchors.verticalCenter: ratingText.verticalCenter
- source: (dive.rating === 5) ? ":/icons/ic_star.svg" : ":/icons/ic_star_border.svg"
+ source: (rating === 5) ? ":/icons/ic_star.svg" : ":/icons/ic_star_border.svg"
color: subsurfaceTheme.textColor
}
}
@@ -165,35 +165,35 @@ Item {
width: height
height: subsurfaceTheme.regularPointSize
anchors.verticalCenter: visibilityText.verticalCenter
- source: (dive.visibility >= 1) ? ":/icons/ic_star.svg" : ":/icons/ic_star_border.svg"
+ source: (viz >= 1) ? ":/icons/ic_star.svg" : ":/icons/ic_star_border.svg"
color: subsurfaceTheme.textColor
}
Kirigami.Icon {
width: height
height: subsurfaceTheme.regularPointSize
anchors.verticalCenter: visibilityText.verticalCenter
- source: (dive.visibility >= 2) ? ":/icons/ic_star.svg" : ":/icons/ic_star_border.svg"
+ source: (viz >= 2) ? ":/icons/ic_star.svg" : ":/icons/ic_star_border.svg"
color: subsurfaceTheme.textColor
}
Kirigami.Icon {
width: height
height: subsurfaceTheme.regularPointSize
anchors.verticalCenter: visibilityText.verticalCenter
- source: (dive.visibility >= 3) ? ":/icons/ic_star.svg" : ":/icons/ic_star_border.svg"
+ source: (viz >= 3) ? ":/icons/ic_star.svg" : ":/icons/ic_star_border.svg"
color: subsurfaceTheme.textColor
}
Kirigami.Icon {
width: height
height: subsurfaceTheme.regularPointSize
anchors.verticalCenter: visibilityText.verticalCenter
- source: (dive.visibility >= 4) ? ":/icons/ic_star.svg" : ":/icons/ic_star_border.svg"
+ source: (viz >= 4) ? ":/icons/ic_star.svg" : ":/icons/ic_star_border.svg"
color: subsurfaceTheme.textColor
}
Kirigami.Icon {
width: height
height: subsurfaceTheme.regularPointSize
anchors.verticalCenter: visibilityText.verticalCenter
- source: (dive.visibility === 5) ? ":/icons/ic_star.svg" : ":/icons/ic_star_border.svg"
+ source: (viz === 5) ? ":/icons/ic_star.svg" : ":/icons/ic_star_border.svg"
color: subsurfaceTheme.textColor
}
}
@@ -214,7 +214,7 @@ Item {
QMLProfile {
id: qmlProfile
- visible: !dive.noDive
+ visible: !noDive
Layout.fillWidth: true
Layout.preferredHeight: Layout.minimumHeight
Layout.minimumHeight: width * 0.75
@@ -230,7 +230,7 @@ Item {
}
Controls.Label {
id: noProfile
- visible: dive.noDive
+ visible: noDive
Layout.fillWidth: true
Layout.columnSpan: 3
Layout.margins: Kirigami.Units.gridUnit
@@ -266,21 +266,21 @@ Item {
//------------
Controls.Label {
id: txtSuit
- text: dive.suit
+ text: suit
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
Layout.maximumWidth: detailsView.col1Width
color: subsurfaceTheme.textColor
}
Controls.Label {
id: txtAirTemp
- text: dive.airTemp
+ text: airTemp
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
Layout.maximumWidth: detailsView.col2Width
color: subsurfaceTheme.textColor
}
Controls.Label {
id: txtWaterTemp
- text: dive.waterTemp
+ text: waterTemp
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
Layout.maximumWidth: detailsView.col3Width
color: subsurfaceTheme.textColor
@@ -325,21 +325,21 @@ Item {
//------------
Controls.Label {
id: txtCylinder
- text: dive.getCylinder.join(', ')
+ text: cylinder
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
Layout.maximumWidth: detailsView.col1Width
color: subsurfaceTheme.textColor
}
Controls.Label {
id: txtWeight
- text: dive.sumWeight
+ text: sumWeight
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
Layout.maximumWidth: detailsView.col2Width
color: subsurfaceTheme.textColor
}
Controls.Label {
id: txtSAC
- text: dive.sac
+ text: sac
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
Layout.maximumWidth: detailsView.col3Width
color: subsurfaceTheme.textColor
@@ -377,14 +377,14 @@ Item {
//-----------
Controls.Label {
id: txtDiveMaster
- text: dive.divemaster
+ text: diveMaster
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
Layout.maximumWidth: detailsView.col1Width
color: subsurfaceTheme.textColor
}
Controls.Label {
id: txtBuddy
- text: dive.buddy
+ text: buddy
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
Layout.columnSpan: 2
Layout.maximumWidth: detailsView.col2Width + detailsView.col3Width
@@ -411,7 +411,7 @@ Item {
Controls.Label {
id: txtNotes
- text: dive.notes
+ text: notes
focus: true
Layout.columnSpan: 3
Layout.fillWidth: true