mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 21:53:23 +00:00
Mobile: save pressures
Save start and end pressures for used cylinders. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
This commit is contained in:
parent
c33a952582
commit
ae70a751c7
4 changed files with 42 additions and 15 deletions
|
@ -33,8 +33,8 @@ Kirigami.Page {
|
||||||
property alias suitText: detailsEdit.suitText
|
property alias suitText: detailsEdit.suitText
|
||||||
property alias suitModel: detailsEdit.suitModel
|
property alias suitModel: detailsEdit.suitModel
|
||||||
property alias weight: detailsEdit.weightText
|
property alias weight: detailsEdit.weightText
|
||||||
property alias startpressure0: detailsEdit.startpressureText0
|
property alias startpressure: detailsEdit.startpressure
|
||||||
property alias endpressure0: detailsEdit.endpressureText0
|
property alias endpressure: detailsEdit.endpressure
|
||||||
property alias cylinderIndex0: detailsEdit.cylinderIndex0
|
property alias cylinderIndex0: detailsEdit.cylinderIndex0
|
||||||
property alias cylinderIndex1: detailsEdit.cylinderIndex1
|
property alias cylinderIndex1: detailsEdit.cylinderIndex1
|
||||||
property alias cylinderIndex2: detailsEdit.cylinderIndex2
|
property alias cylinderIndex2: detailsEdit.cylinderIndex2
|
||||||
|
@ -262,8 +262,8 @@ Kirigami.Page {
|
||||||
// careful when translating, this text is "magic" in DiveDetailsEdit.qml
|
// careful when translating, this text is "magic" in DiveDetailsEdit.qml
|
||||||
weight = "cannot edit multiple weight systems"
|
weight = "cannot edit multiple weight systems"
|
||||||
}
|
}
|
||||||
startpressure0 = currentItem.modelData.dive.startPressure
|
startpressure = currentItem.modelData.dive.startPressure
|
||||||
endpressure0 = currentItem.modelData.dive.endPressure
|
endpressure = currentItem.modelData.dive.endPressure
|
||||||
usedGas = currentItem.modelData.dive.firstGas
|
usedGas = currentItem.modelData.dive.firstGas
|
||||||
usedCyl = currentItem.modelData.dive.getCylinder
|
usedCyl = currentItem.modelData.dive.getCylinder
|
||||||
cylinderIndex0 = currentItem.modelData.dive.cylinderList.indexOf(usedCyl[0])
|
cylinderIndex0 = currentItem.modelData.dive.cylinderList.indexOf(usedCyl[0])
|
||||||
|
|
|
@ -31,9 +31,9 @@ Item {
|
||||||
property alias durationText: txtDuration.text
|
property alias durationText: txtDuration.text
|
||||||
property alias depthText: txtDepth.text
|
property alias depthText: txtDepth.text
|
||||||
property alias weightText: txtWeight.text
|
property alias weightText: txtWeight.text
|
||||||
property alias startpressureText0: txtStartPressure0.text
|
|
||||||
property alias endpressureText0: txtEndPressure0.text
|
|
||||||
property var usedGas: []
|
property var usedGas: []
|
||||||
|
property var endpressure: []
|
||||||
|
property var startpressure: []
|
||||||
property alias gpsCheckbox: checkboxGPS.checked
|
property alias gpsCheckbox: checkboxGPS.checked
|
||||||
property alias suitModel: suitBox.model
|
property alias suitModel: suitBox.model
|
||||||
property alias divemasterModel: divemasterBox.model
|
property alias divemasterModel: divemasterBox.model
|
||||||
|
@ -74,22 +74,32 @@ Item {
|
||||||
if (usedCyl[0] != null) {
|
if (usedCyl[0] != null) {
|
||||||
usedCyl[0] = cylinderBox0.currentText
|
usedCyl[0] = cylinderBox0.currentText
|
||||||
usedGas[0] = txtGasMix0.text
|
usedGas[0] = txtGasMix0.text
|
||||||
|
startpressure[0] = txtStartPressure0.text
|
||||||
|
endpressure[0] = txtEndPressure0.text
|
||||||
}
|
}
|
||||||
if (usedCyl[1] != null) {
|
if (usedCyl[1] != null) {
|
||||||
usedCyl[1] = cylinderBox1.currentText
|
usedCyl[1] = cylinderBox1.currentText
|
||||||
usedGas[1] = txtGasMix0.text
|
usedGas[1] = txtGasMix0.text
|
||||||
|
startpressure[1] = txtStartPressure1.text
|
||||||
|
endpressure[1] = txtEndPressure1.text
|
||||||
}
|
}
|
||||||
if (usedCyl[2] != null) {
|
if (usedCyl[2] != null) {
|
||||||
usedCyl[2] = cylinderBox2.currentText
|
usedCyl[2] = cylinderBox2.currentText
|
||||||
usedGas[2] = txtGasMix0.text
|
usedGas[2] = txtGasMix0.text
|
||||||
|
startpressure[2] = txtStartPressure2.text
|
||||||
|
endpressure[2] = txtEndPressure2.text
|
||||||
}
|
}
|
||||||
if (usedCyl[3] != null) {
|
if (usedCyl[3] != null) {
|
||||||
usedCyl[3] = cylinderBox3.currentText
|
usedCyl[3] = cylinderBox3.currentText
|
||||||
usedGas[3] = txtGasMix0.text
|
usedGas[3] = txtGasMix0.text
|
||||||
|
startpressure[3] = txtStartPressure3.text
|
||||||
|
endpressure[3] = txtEndPressure3.text
|
||||||
}
|
}
|
||||||
if (usedCyl[4] != null) {
|
if (usedCyl[4] != null) {
|
||||||
usedCyl[4] = cylinderBox4.currentText
|
usedCyl[4] = cylinderBox4.currentText
|
||||||
usedGas[4] = txtGasMix0.text
|
usedGas[4] = txtGasMix0.text
|
||||||
|
startpressure[4] = txtStartPressure4.text
|
||||||
|
endpressure[4] = txtEndPressure4.text
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply the changes to the dive_table
|
// apply the changes to the dive_table
|
||||||
|
@ -97,8 +107,8 @@ Item {
|
||||||
detailsEdit.depthText, detailsEdit.airtempText, detailsEdit.watertempText,
|
detailsEdit.depthText, detailsEdit.airtempText, detailsEdit.watertempText,
|
||||||
suitBox.currentText != "" ? suitBox.currentText : suitBox.editText, buddyBox.editText,
|
suitBox.currentText != "" ? suitBox.currentText : suitBox.editText, buddyBox.editText,
|
||||||
divemasterBox.currentText != "" ? divemasterBox.currentText : divemasterBox.editText,
|
divemasterBox.currentText != "" ? divemasterBox.currentText : divemasterBox.editText,
|
||||||
detailsEdit.weightText, detailsEdit.notesText, detailsEdit.startpressureText,
|
detailsEdit.weightText, detailsEdit.notesText, startpressure,
|
||||||
detailsEdit.endpressureText, usedGas, usedCyl ,
|
endpressure, usedGas, usedCyl ,
|
||||||
detailsEdit.rating,
|
detailsEdit.rating,
|
||||||
detailsEdit.visibility)
|
detailsEdit.visibility)
|
||||||
// trigger the profile to be redrawn
|
// trigger the profile to be redrawn
|
||||||
|
@ -377,6 +387,7 @@ Item {
|
||||||
}
|
}
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
id: txtStartPressure0
|
id: txtStartPressure0
|
||||||
|
text: startpressure[0] != null ? startpressure[0] : null
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
focus = false
|
focus = false
|
||||||
|
@ -390,6 +401,7 @@ Item {
|
||||||
}
|
}
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
id: txtEndPressure0
|
id: txtEndPressure0
|
||||||
|
text: endpressure[0] != null ? endpressure[0] : null
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
focus = false
|
focus = false
|
||||||
|
@ -438,6 +450,7 @@ Item {
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
visible: usedCyl[1] != null ? true : false
|
visible: usedCyl[1] != null ? true : false
|
||||||
id: txtStartPressure1
|
id: txtStartPressure1
|
||||||
|
text: startpressure[1] != null ? startpressure[1] : null
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
focus = false
|
focus = false
|
||||||
|
@ -453,6 +466,7 @@ Item {
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
visible: usedCyl[1] != null ? true : false
|
visible: usedCyl[1] != null ? true : false
|
||||||
id: txtEndPressure1
|
id: txtEndPressure1
|
||||||
|
text: endpressure[1] != null ? endpressure[1] : null
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
focus = false
|
focus = false
|
||||||
|
@ -502,6 +516,7 @@ Item {
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
visible: usedCyl[2] != null ? true : false
|
visible: usedCyl[2] != null ? true : false
|
||||||
id: txtStartPressure2
|
id: txtStartPressure2
|
||||||
|
text: startpressure[2] != null ? startpressure[2] : null
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
focus = false
|
focus = false
|
||||||
|
@ -517,6 +532,7 @@ Item {
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
visible: usedCyl[2] != null ? true : false
|
visible: usedCyl[2] != null ? true : false
|
||||||
id: txtEndPressure2
|
id: txtEndPressure2
|
||||||
|
text: endpressure[2] != null ? endpressure[2] : null
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
focus = false
|
focus = false
|
||||||
|
@ -566,6 +582,7 @@ Item {
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
visible: usedCyl[3] != null ? true : false
|
visible: usedCyl[3] != null ? true : false
|
||||||
id: txtStartPressure3
|
id: txtStartPressure3
|
||||||
|
text: startpressure[3] != null ? startpressure[3] : null
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
focus = false
|
focus = false
|
||||||
|
@ -581,6 +598,7 @@ Item {
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
visible: usedCyl[3] != null ? true : false
|
visible: usedCyl[3] != null ? true : false
|
||||||
id: txtEndPressure3
|
id: txtEndPressure3
|
||||||
|
text: endpressure[3] != null ? endpressure[3] : null
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
focus = false
|
focus = false
|
||||||
|
@ -630,6 +648,7 @@ Item {
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
visible: usedCyl[4] != null ? true : false
|
visible: usedCyl[4] != null ? true : false
|
||||||
id: txtStartPressure4
|
id: txtStartPressure4
|
||||||
|
text: startpressure[4] != null ? startpressure[4] : null
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
focus = false
|
focus = false
|
||||||
|
@ -645,6 +664,7 @@ Item {
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
visible: usedCyl[4] != null ? true : false
|
visible: usedCyl[4] != null ? true : false
|
||||||
id: txtEndPressure4
|
id: txtEndPressure4
|
||||||
|
text: endpressure[4] != null ? endpressure[4] : null
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
focus = false
|
focus = false
|
||||||
|
|
|
@ -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
|
// 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,
|
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 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());
|
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
|
// start and end pressures for first cylinder only
|
||||||
if (myDive->startPressure() != startpressure || myDive->endPressure() != endpressure) {
|
if (myDive->startPressure() != startpressure || myDive->endPressure() != endpressure) {
|
||||||
diveChanged = true;
|
diveChanged = true;
|
||||||
d->cylinder[0].start.mbar = parsePressureToMbar(startpressure);
|
for ( int i = 0, j = 0 ; j < startpressure.length() && j < endpressure.length() ; i++ ) {
|
||||||
d->cylinder[0].end.mbar = parsePressureToMbar(endpressure);
|
if (!is_cylinder_used(d, i))
|
||||||
if (d->cylinder[0].end.mbar > d->cylinder[0].start.mbar)
|
continue;
|
||||||
d->cylinder[0].end.mbar = d->cylinder[0].start.mbar;
|
|
||||||
|
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
|
// gasmix for first cylinder
|
||||||
if (myDive->firstGas() != gasmix) {
|
if (myDive->firstGas() != gasmix) {
|
||||||
|
|
|
@ -157,8 +157,8 @@ public slots:
|
||||||
void commitChanges(QString diveId, QString date, QString location, QString gps,
|
void commitChanges(QString diveId, QString date, QString location, QString gps,
|
||||||
QString duration, QString depth, QString airtemp,
|
QString duration, QString depth, QString airtemp,
|
||||||
QString watertemp, QString suit, QString buddy,
|
QString watertemp, QString suit, QString buddy,
|
||||||
QString diveMaster, QString weight, QString notes, QString startpressure,
|
QString diveMaster, QString weight, QString notes, QStringList startpressure,
|
||||||
QString endpressure, QStringList gasmix, QStringList usedCylinder, int rating, int visibility);
|
QStringList endpressure, QStringList gasmix, QStringList usedCylinder, int rating, int visibility);
|
||||||
void changesNeedSaving();
|
void changesNeedSaving();
|
||||||
void openNoCloudRepo();
|
void openNoCloudRepo();
|
||||||
void saveChangesLocal();
|
void saveChangesLocal();
|
||||||
|
|
Loading…
Add table
Reference in a new issue