summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mobile-widgets/qml/DiveDetails.qml8
-rw-r--r--mobile-widgets/qml/DiveDetailsEdit.qml28
-rw-r--r--mobile-widgets/qmlmanager.cpp17
-rw-r--r--mobile-widgets/qmlmanager.h4
4 files changed, 42 insertions, 15 deletions
diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml
index 8ef7d608d..74b1557a1 100644
--- a/mobile-widgets/qml/DiveDetails.qml
+++ b/mobile-widgets/qml/DiveDetails.qml
@@ -33,8 +33,8 @@ Kirigami.Page {
property alias suitText: detailsEdit.suitText
property alias suitModel: detailsEdit.suitModel
property alias weight: detailsEdit.weightText
- property alias startpressure0: detailsEdit.startpressureText0
- property alias endpressure0: detailsEdit.endpressureText0
+ property alias startpressure: detailsEdit.startpressure
+ property alias endpressure: detailsEdit.endpressure
property alias cylinderIndex0: detailsEdit.cylinderIndex0
property alias cylinderIndex1: detailsEdit.cylinderIndex1
property alias cylinderIndex2: detailsEdit.cylinderIndex2
@@ -262,8 +262,8 @@ Kirigami.Page {
// careful when translating, this text is "magic" in DiveDetailsEdit.qml
weight = "cannot edit multiple weight systems"
}
- startpressure0 = currentItem.modelData.dive.startPressure
- endpressure0 = currentItem.modelData.dive.endPressure
+ startpressure = currentItem.modelData.dive.startPressure
+ endpressure = currentItem.modelData.dive.endPressure
usedGas = currentItem.modelData.dive.firstGas
usedCyl = currentItem.modelData.dive.getCylinder
cylinderIndex0 = currentItem.modelData.dive.cylinderList.indexOf(usedCyl[0])
diff --git a/mobile-widgets/qml/DiveDetailsEdit.qml b/mobile-widgets/qml/DiveDetailsEdit.qml
index b7b7f8063..2f2f681e1 100644
--- a/mobile-widgets/qml/DiveDetailsEdit.qml
+++ b/mobile-widgets/qml/DiveDetailsEdit.qml
@@ -31,9 +31,9 @@ Item {
property alias durationText: txtDuration.text
property alias depthText: txtDepth.text
property alias weightText: txtWeight.text
- property alias startpressureText0: txtStartPressure0.text
- property alias endpressureText0: txtEndPressure0.text
property var usedGas: []
+ property var endpressure: []
+ property var startpressure: []
property alias gpsCheckbox: checkboxGPS.checked
property alias suitModel: suitBox.model
property alias divemasterModel: divemasterBox.model
@@ -74,22 +74,32 @@ Item {
if (usedCyl[0] != null) {
usedCyl[0] = cylinderBox0.currentText
usedGas[0] = txtGasMix0.text
+ startpressure[0] = txtStartPressure0.text
+ endpressure[0] = txtEndPressure0.text
}
if (usedCyl[1] != null) {
usedCyl[1] = cylinderBox1.currentText
usedGas[1] = txtGasMix0.text
+ startpressure[1] = txtStartPressure1.text
+ endpressure[1] = txtEndPressure1.text
}
if (usedCyl[2] != null) {
usedCyl[2] = cylinderBox2.currentText
usedGas[2] = txtGasMix0.text
+ startpressure[2] = txtStartPressure2.text
+ endpressure[2] = txtEndPressure2.text
}
if (usedCyl[3] != null) {
usedCyl[3] = cylinderBox3.currentText
usedGas[3] = txtGasMix0.text
+ startpressure[3] = txtStartPressure3.text
+ endpressure[3] = txtEndPressure3.text
}
if (usedCyl[4] != null) {
usedCyl[4] = cylinderBox4.currentText
usedGas[4] = txtGasMix0.text
+ startpressure[4] = txtStartPressure4.text
+ endpressure[4] = txtEndPressure4.text
}
// apply the changes to the dive_table
@@ -97,8 +107,8 @@ Item {
detailsEdit.depthText, detailsEdit.airtempText, detailsEdit.watertempText,
suitBox.currentText != "" ? suitBox.currentText : suitBox.editText, buddyBox.editText,
divemasterBox.currentText != "" ? divemasterBox.currentText : divemasterBox.editText,
- detailsEdit.weightText, detailsEdit.notesText, detailsEdit.startpressureText,
- detailsEdit.endpressureText, usedGas, usedCyl ,
+ detailsEdit.weightText, detailsEdit.notesText, startpressure,
+ endpressure, usedGas, usedCyl ,
detailsEdit.rating,
detailsEdit.visibility)
// trigger the profile to be redrawn
@@ -377,6 +387,7 @@ Item {
}
Controls.TextField {
id: txtStartPressure0
+ text: startpressure[0] != null ? startpressure[0] : null
Layout.fillWidth: true
onEditingFinished: {
focus = false
@@ -390,6 +401,7 @@ Item {
}
Controls.TextField {
id: txtEndPressure0
+ text: endpressure[0] != null ? endpressure[0] : null
Layout.fillWidth: true
onEditingFinished: {
focus = false
@@ -438,6 +450,7 @@ Item {
Controls.TextField {
visible: usedCyl[1] != null ? true : false
id: txtStartPressure1
+ text: startpressure[1] != null ? startpressure[1] : null
Layout.fillWidth: true
onEditingFinished: {
focus = false
@@ -453,6 +466,7 @@ Item {
Controls.TextField {
visible: usedCyl[1] != null ? true : false
id: txtEndPressure1
+ text: endpressure[1] != null ? endpressure[1] : null
Layout.fillWidth: true
onEditingFinished: {
focus = false
@@ -502,6 +516,7 @@ Item {
Controls.TextField {
visible: usedCyl[2] != null ? true : false
id: txtStartPressure2
+ text: startpressure[2] != null ? startpressure[2] : null
Layout.fillWidth: true
onEditingFinished: {
focus = false
@@ -517,6 +532,7 @@ Item {
Controls.TextField {
visible: usedCyl[2] != null ? true : false
id: txtEndPressure2
+ text: endpressure[2] != null ? endpressure[2] : null
Layout.fillWidth: true
onEditingFinished: {
focus = false
@@ -566,6 +582,7 @@ Item {
Controls.TextField {
visible: usedCyl[3] != null ? true : false
id: txtStartPressure3
+ text: startpressure[3] != null ? startpressure[3] : null
Layout.fillWidth: true
onEditingFinished: {
focus = false
@@ -581,6 +598,7 @@ Item {
Controls.TextField {
visible: usedCyl[3] != null ? true : false
id: txtEndPressure3
+ text: endpressure[3] != null ? endpressure[3] : null
Layout.fillWidth: true
onEditingFinished: {
focus = false
@@ -630,6 +648,7 @@ Item {
Controls.TextField {
visible: usedCyl[4] != null ? true : false
id: txtStartPressure4
+ text: startpressure[4] != null ? startpressure[4] : null
Layout.fillWidth: true
onEditingFinished: {
focus = false
@@ -645,6 +664,7 @@ Item {
Controls.TextField {
visible: usedCyl[4] != null ? true : false
id: txtEndPressure4
+ text: endpressure[4] != null ? endpressure[4] : null
Layout.fillWidth: true
onEditingFinished: {
focus = false
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index ad02a3b2b..2e3576596 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -1004,7 +1004,7 @@ bool QMLManager::checkDepth(DiveObjectHelper *myDive, dive *d, QString depth)
// update the dive and return the notes field, stripped of the HTML junk
void QMLManager::commitChanges(QString diveId, QString date, QString location, QString gps, QString duration, QString depth,
QString airtemp, QString watertemp, QString suit, QString buddy, QString diveMaster, QString weight, QString notes,
- QString startpressure, QString endpressure, QStringList gasmix, QStringList usedCylinder, int rating, int visibility)
+ QStringList startpressure, QStringList endpressure, QStringList gasmix, QStringList usedCylinder, int rating, int visibility)
{
struct dive *d = get_dive_by_uniq_id(diveId.toInt());
@@ -1050,10 +1050,17 @@ void QMLManager::commitChanges(QString diveId, QString date, QString location, Q
// start and end pressures for first cylinder only
if (myDive->startPressure() != startpressure || myDive->endPressure() != endpressure) {
diveChanged = true;
- d->cylinder[0].start.mbar = parsePressureToMbar(startpressure);
- d->cylinder[0].end.mbar = parsePressureToMbar(endpressure);
- if (d->cylinder[0].end.mbar > d->cylinder[0].start.mbar)
- d->cylinder[0].end.mbar = d->cylinder[0].start.mbar;
+ for ( int i = 0, j = 0 ; j < startpressure.length() && j < endpressure.length() ; i++ ) {
+ if (!is_cylinder_used(d, i))
+ continue;
+
+ d->cylinder[i].start.mbar = parsePressureToMbar(startpressure[j]);
+ d->cylinder[i].end.mbar = parsePressureToMbar(endpressure[j]);
+ if (d->cylinder[i].end.mbar > d->cylinder[i].start.mbar)
+ d->cylinder[i].end.mbar = d->cylinder[i].start.mbar;
+
+ j++;
+ }
}
// gasmix for first cylinder
if (myDive->firstGas() != gasmix) {
diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h
index 5406c6f68..109f10f74 100644
--- a/mobile-widgets/qmlmanager.h
+++ b/mobile-widgets/qmlmanager.h
@@ -157,8 +157,8 @@ public slots:
void commitChanges(QString diveId, QString date, QString location, QString gps,
QString duration, QString depth, QString airtemp,
QString watertemp, QString suit, QString buddy,
- QString diveMaster, QString weight, QString notes, QString startpressure,
- QString endpressure, QStringList gasmix, QStringList usedCylinder, int rating, int visibility);
+ QString diveMaster, QString weight, QString notes, QStringList startpressure,
+ QStringList endpressure, QStringList gasmix, QStringList usedCylinder, int rating, int visibility);
void changesNeedSaving();
void openNoCloudRepo();
void saveChangesLocal();