| 
									
										
										
										
											2017-04-27 20:30:36 +02:00
										 |  |  | // SPDX-License-Identifier: GPL-2.0
 | 
					
						
							| 
									
										
										
										
											2017-10-29 08:44:06 +01:00
										 |  |  | import QtQuick 2.6 | 
					
						
							| 
									
										
										
										
											2017-10-29 13:44:22 +01:00
										 |  |  | import QtQuick.Controls 2.2 as Controls | 
					
						
							| 
									
										
										
										
											2015-12-04 01:38:04 +01:00
										 |  |  | import QtQuick.Dialogs 1.2 | 
					
						
							| 
									
										
										
										
											2017-10-30 11:26:47 +01:00
										 |  |  | import QtQuick.Layouts 1.2 | 
					
						
							| 
									
										
										
										
											2015-12-04 01:38:04 +01:00
										 |  |  | import org.subsurfacedivelog.mobile 1.0 | 
					
						
							| 
									
										
										
										
											2018-09-27 22:09:26 +02:00
										 |  |  | import org.kde.kirigami 2.4 as Kirigami | 
					
						
							| 
									
										
										
										
											2015-12-04 01:38:04 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | Item { | 
					
						
							| 
									
										
										
										
											2016-01-12 01:15:02 +01:00
										 |  |  | 	id: detailsEdit | 
					
						
							|  |  |  | 	property int dive_id | 
					
						
							| 
									
										
										
										
											2019-10-20 20:13:59 -04:00
										 |  |  | 	property alias number: txtNumber.text | 
					
						
							| 
									
										
										
										
											2016-01-05 06:59:04 -08:00
										 |  |  | 	property alias dateText: txtDate.text | 
					
						
							| 
									
										
										
										
											2018-03-09 15:24:54 +01:00
										 |  |  | 	property alias locationText: locationBox.editText | 
					
						
							|  |  |  | 	property alias locationIndex: locationBox.currentIndex | 
					
						
							| 
									
										
										
										
											2016-04-15 05:17:39 -07:00
										 |  |  | 	property alias gpsText: txtGps.text | 
					
						
							| 
									
										
										
										
											2015-12-26 22:57:47 -08:00
										 |  |  | 	property alias airtempText: txtAirTemp.text | 
					
						
							|  |  |  | 	property alias watertempText: txtWaterTemp.text | 
					
						
							| 
									
										
										
										
											2016-05-16 19:59:05 +02:00
										 |  |  | 	property alias suitIndex: suitBox.currentIndex | 
					
						
							| 
									
										
										
										
											2018-02-11 12:06:27 +01:00
										 |  |  | 	property alias suitText: suitBox.editText | 
					
						
							| 
									
										
										
										
											2016-05-16 19:59:05 +02:00
										 |  |  | 	property alias buddyIndex: buddyBox.currentIndex | 
					
						
							| 
									
										
										
										
											2018-02-11 12:06:27 +01:00
										 |  |  | 	property alias buddyText: buddyBox.editText | 
					
						
							| 
									
										
										
										
											2016-05-16 19:59:05 +02:00
										 |  |  | 	property alias divemasterIndex: divemasterBox.currentIndex | 
					
						
							| 
									
										
										
										
											2018-02-11 12:06:27 +01:00
										 |  |  | 	property alias divemasterText: divemasterBox.editText | 
					
						
							| 
									
										
										
										
											2021-08-15 19:55:17 -07:00
										 |  |  | 	property alias tagText: txtTag.text | 
					
						
							| 
									
										
										
										
											2018-07-16 15:21:39 +02:00
										 |  |  | 	property alias cylinderIndex0: cylinderBox0.currentIndex | 
					
						
							|  |  |  | 	property alias cylinderIndex1: cylinderBox1.currentIndex | 
					
						
							|  |  |  | 	property alias cylinderIndex2: cylinderBox2.currentIndex | 
					
						
							|  |  |  | 	property alias cylinderIndex3: cylinderBox3.currentIndex | 
					
						
							|  |  |  | 	property alias cylinderIndex4: cylinderBox4.currentIndex | 
					
						
							| 
									
										
										
										
											2015-12-26 22:57:47 -08:00
										 |  |  | 	property alias notesText: txtNotes.text | 
					
						
							| 
									
										
										
										
											2016-01-01 00:23:15 -08:00
										 |  |  | 	property alias durationText: txtDuration.text | 
					
						
							| 
									
										
										
										
											2016-01-01 00:32:30 -08:00
										 |  |  | 	property alias depthText: txtDepth.text | 
					
						
							| 
									
										
										
										
											2016-01-28 18:26:37 -08:00
										 |  |  | 	property alias weightText: txtWeight.text | 
					
						
							| 
									
										
										
										
											2018-07-28 15:07:43 +02:00
										 |  |  | 	property var usedGas: [] | 
					
						
							| 
									
										
										
										
											2018-08-06 09:34:39 +02:00
										 |  |  | 	property var endpressure: [] | 
					
						
							|  |  |  | 	property var startpressure: [] | 
					
						
							| 
									
										
										
										
											2016-05-20 18:48:36 +02:00
										 |  |  | 	property alias suitModel: suitBox.model | 
					
						
							|  |  |  | 	property alias divemasterModel: divemasterBox.model | 
					
						
							|  |  |  | 	property alias buddyModel: buddyBox.model | 
					
						
							| 
									
										
										
										
											2018-07-28 15:43:05 +02:00
										 |  |  | 	property alias cylinderModel0: cylinderBox0.model | 
					
						
							|  |  |  | 	property alias cylinderModel1: cylinderBox1.model | 
					
						
							|  |  |  | 	property alias cylinderModel2: cylinderBox2.model | 
					
						
							|  |  |  | 	property alias cylinderModel3: cylinderBox3.model | 
					
						
							|  |  |  | 	property alias cylinderModel4: cylinderBox4.model | 
					
						
							| 
									
										
										
										
											2018-03-09 15:24:54 +01:00
										 |  |  | 	property alias locationModel: locationBox.model | 
					
						
							| 
									
										
										
										
											2017-07-28 17:43:26 +02:00
										 |  |  | 	property int rating | 
					
						
							|  |  |  | 	property int visibility | 
					
						
							| 
									
										
										
										
											2018-07-16 15:21:39 +02:00
										 |  |  | 	property var usedCyl: [] | 
					
						
							| 
									
										
										
										
											2016-01-28 18:26:37 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-30 12:32:57 -08:00
										 |  |  | 	function focusReset() { | 
					
						
							|  |  |  | 		// set the focus explicitlt (to steal from any other field), then unset
 | 
					
						
							|  |  |  | 		editArea.focus = true | 
					
						
							|  |  |  | 		editArea.focus = false | 
					
						
							|  |  |  | 		Qt.inputMethod.hide() | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												mobile: clear internal data when edit/add dive is finished
When editing (or adding) a dive, the internal data containing the
attributes on the edit page was not cleared when editing was
finished (in any way, by saving the edit or by cancelling it).
As long as the user only edits existing dives, all this poses
no problem, as at the start of a dive edit, the data is filled
from the dive to be edited. However, when adding a dive, data
coming from previous edits shows up. This not clearing data
also causes the strange effect as written in issue #950: adding
a dive, deleting it, and adding a dive again, added the first
added dive data, without the edit screen being shown.
All this can be solved by clearing the data from the edit when
editing is done.
Fixes: #950
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
											
										 
											2017-12-15 17:13:15 +01:00
										 |  |  | 	function clearDetailsEdit() { | 
					
						
							|  |  |  | 		detailsEdit.dive_id = 0 | 
					
						
							|  |  |  | 		detailsEdit.number = 0 | 
					
						
							|  |  |  | 		detailsEdit.dateText = "" | 
					
						
							|  |  |  | 		detailsEdit.locationText = "" | 
					
						
							|  |  |  | 		detailsEdit.durationText = "" | 
					
						
							|  |  |  | 		detailsEdit.depthText = "" | 
					
						
							|  |  |  | 		detailsEdit.airtempText = "" | 
					
						
							|  |  |  | 		detailsEdit.watertempText = "" | 
					
						
							| 
									
										
										
										
											2018-01-28 11:28:01 +01:00
										 |  |  | 		detailsEdit.divemasterText = "" | 
					
						
							|  |  |  | 		detailsEdit.buddyText = "" | 
					
						
							| 
									
										
										
											
												mobile: clear internal data when edit/add dive is finished
When editing (or adding) a dive, the internal data containing the
attributes on the edit page was not cleared when editing was
finished (in any way, by saving the edit or by cancelling it).
As long as the user only edits existing dives, all this poses
no problem, as at the start of a dive edit, the data is filled
from the dive to be edited. However, when adding a dive, data
coming from previous edits shows up. This not clearing data
also causes the strange effect as written in issue #950: adding
a dive, deleting it, and adding a dive again, added the first
added dive data, without the edit screen being shown.
All this can be solved by clearing the data from the edit when
editing is done.
Fixes: #950
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
											
										 
											2017-12-15 17:13:15 +01:00
										 |  |  | 		suitBox.currentIndex = -1 | 
					
						
							|  |  |  | 		buddyBox.currentIndex = -1 | 
					
						
							|  |  |  | 		divemasterBox.currentIndex = -1 | 
					
						
							| 
									
										
										
										
											2018-07-16 15:21:39 +02:00
										 |  |  | 		cylinderBox0.currentIndex = -1 | 
					
						
							|  |  |  | 		cylinderBox1.currentIndex = -1 | 
					
						
							|  |  |  | 		cylinderBox2.currentIndex = -1 | 
					
						
							|  |  |  | 		cylinderBox3.currentIndex = -1 | 
					
						
							|  |  |  | 		cylinderBox4.currentIndex = -1 | 
					
						
							| 
									
										
										
											
												mobile: clear internal data when edit/add dive is finished
When editing (or adding) a dive, the internal data containing the
attributes on the edit page was not cleared when editing was
finished (in any way, by saving the edit or by cancelling it).
As long as the user only edits existing dives, all this poses
no problem, as at the start of a dive edit, the data is filled
from the dive to be edited. However, when adding a dive, data
coming from previous edits shows up. This not clearing data
also causes the strange effect as written in issue #950: adding
a dive, deleting it, and adding a dive again, added the first
added dive data, without the edit screen being shown.
All this can be solved by clearing the data from the edit when
editing is done.
Fixes: #950
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
											
										 
											2017-12-15 17:13:15 +01:00
										 |  |  | 		detailsEdit.notesText = "" | 
					
						
							|  |  |  | 		detailsEdit.rating = 0 | 
					
						
							|  |  |  | 		detailsEdit.visibility = 0 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-13 21:25:10 -08:00
										 |  |  | 	function saveData() { | 
					
						
							| 
									
										
										
										
											2020-12-30 14:02:10 -08:00
										 |  |  | 		focusReset() | 
					
						
							| 
									
										
										
										
											2018-07-29 15:42:56 +02:00
										 |  |  | 		var state =  diveDetailsPage.state | 
					
						
							| 
									
										
										
										
											2017-10-04 21:53:40 -07:00
										 |  |  | 		diveDetailsPage.state = "view" // run the transition
 | 
					
						
							| 
									
										
										
										
											2018-07-16 18:01:56 +02:00
										 |  |  | 		// join cylinder info from separate string into a list.
 | 
					
						
							| 
									
										
										
										
											2021-01-16 09:13:12 -08:00
										 |  |  | 		if (usedCyl[0] !== undefined) { | 
					
						
							| 
									
										
										
										
											2018-07-16 18:01:56 +02:00
										 |  |  | 			usedCyl[0] = cylinderBox0.currentText | 
					
						
							| 
									
										
										
										
											2018-08-06 09:29:00 +02:00
										 |  |  | 			usedGas[0] = txtGasMix0.text | 
					
						
							| 
									
										
										
										
											2018-08-06 09:34:39 +02:00
										 |  |  | 			startpressure[0] = txtStartPressure0.text | 
					
						
							|  |  |  | 			endpressure[0] = txtEndPressure0.text | 
					
						
							| 
									
										
										
										
											2018-07-16 18:01:56 +02:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2021-01-16 09:13:12 -08:00
										 |  |  | 		if (usedCyl[1] !== undefined) { | 
					
						
							| 
									
										
										
										
											2018-07-16 18:01:56 +02:00
										 |  |  | 			usedCyl[1] = cylinderBox1.currentText | 
					
						
							| 
									
										
										
										
											2020-08-15 11:42:25 -07:00
										 |  |  | 			usedGas[1] = txtGasMix1.text | 
					
						
							| 
									
										
										
										
											2018-08-06 09:34:39 +02:00
										 |  |  | 			startpressure[1] = txtStartPressure1.text | 
					
						
							|  |  |  | 			endpressure[1] = txtEndPressure1.text | 
					
						
							| 
									
										
										
										
											2018-07-16 18:01:56 +02:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2021-01-16 09:13:12 -08:00
										 |  |  | 		if (usedCyl[2] !== undefined) { | 
					
						
							| 
									
										
										
										
											2018-07-16 18:01:56 +02:00
										 |  |  | 			usedCyl[2] = cylinderBox2.currentText | 
					
						
							| 
									
										
										
										
											2020-08-15 11:42:25 -07:00
										 |  |  | 			usedGas[2] = txtGasMix2.text | 
					
						
							| 
									
										
										
										
											2018-08-06 09:34:39 +02:00
										 |  |  | 			startpressure[2] = txtStartPressure2.text | 
					
						
							|  |  |  | 			endpressure[2] = txtEndPressure2.text | 
					
						
							| 
									
										
										
										
											2018-07-16 18:01:56 +02:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2021-01-16 09:13:12 -08:00
										 |  |  | 		if (usedCyl[3] !== undefined) { | 
					
						
							| 
									
										
										
										
											2018-07-16 18:01:56 +02:00
										 |  |  | 			usedCyl[3] = cylinderBox3.currentText | 
					
						
							| 
									
										
										
										
											2020-08-15 11:42:25 -07:00
										 |  |  | 			usedGas[3] = txtGasMix3.text | 
					
						
							| 
									
										
										
										
											2018-08-06 09:34:39 +02:00
										 |  |  | 			startpressure[3] = txtStartPressure3.text | 
					
						
							|  |  |  | 			endpressure[3] = txtEndPressure3.text | 
					
						
							| 
									
										
										
										
											2018-07-16 18:01:56 +02:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2021-01-16 09:13:12 -08:00
										 |  |  | 		if (usedCyl[4] !== undefined) { | 
					
						
							| 
									
										
										
										
											2018-07-16 18:01:56 +02:00
										 |  |  | 			usedCyl[4] = cylinderBox4.currentText | 
					
						
							| 
									
										
										
										
											2020-08-15 11:42:25 -07:00
										 |  |  | 			usedGas[4] = txtGasMix4.text | 
					
						
							| 
									
										
										
										
											2018-08-06 09:34:39 +02:00
										 |  |  | 			startpressure[4] = txtStartPressure4.text | 
					
						
							|  |  |  | 			endpressure[4] = txtEndPressure4.text | 
					
						
							| 
									
										
										
										
											2018-07-16 18:01:56 +02:00
										 |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-13 21:25:10 -08:00
										 |  |  | 		// apply the changes to the dive_table
 | 
					
						
							| 
									
										
										
										
											2019-10-20 20:13:59 -04:00
										 |  |  | 		manager.commitChanges(dive_id, detailsEdit.number, detailsEdit.dateText, locationBox.editText, detailsEdit.gpsText, detailsEdit.durationText, | 
					
						
							| 
									
										
										
										
											2018-02-11 12:06:27 +01:00
										 |  |  | 				      detailsEdit.depthText, detailsEdit.airtempText, detailsEdit.watertempText, | 
					
						
							| 
									
										
										
										
											2021-08-15 19:55:17 -07:00
										 |  |  | 				      suitBox.editText, buddyBox.editText, divemasterBox.editText, detailsEdit.tagText, | 
					
						
							| 
									
										
										
										
											2018-08-06 09:34:39 +02:00
										 |  |  | 				      detailsEdit.weightText, detailsEdit.notesText, startpressure, | 
					
						
							| 
									
										
										
										
											2020-01-10 08:25:37 +08:00
										 |  |  | 				      endpressure, usedGas, usedCyl, | 
					
						
							| 
									
										
										
										
											2018-02-11 12:06:27 +01:00
										 |  |  | 				      detailsEdit.rating, | 
					
						
							| 
									
										
										
										
											2018-07-29 15:42:56 +02:00
										 |  |  | 				      detailsEdit.visibility, state) | 
					
						
							| 
									
										
										
										
											2016-02-13 21:25:10 -08:00
										 |  |  | 		Qt.inputMethod.hide() | 
					
						
							| 
									
										
										
										
											2016-03-02 04:47:51 -08:00
										 |  |  | 		// now make sure we directly show the saved dive (this may be a new dive, or it may have moved)
 | 
					
						
							| 
									
										
										
											
												mobile: clear internal data when edit/add dive is finished
When editing (or adding) a dive, the internal data containing the
attributes on the edit page was not cleared when editing was
finished (in any way, by saving the edit or by cancelling it).
As long as the user only edits existing dives, all this poses
no problem, as at the start of a dive edit, the data is filled
from the dive to be edited. However, when adding a dive, data
coming from previous edits shows up. This not clearing data
also causes the strange effect as written in issue #950: adding
a dive, deleting it, and adding a dive again, added the first
added dive data, without the edit screen being shown.
All this can be solved by clearing the data from the edit when
editing is done.
Fixes: #950
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
											
										 
											2017-12-15 17:13:15 +01:00
										 |  |  | 		clearDetailsEdit() | 
					
						
							| 
									
										
										
										
											2016-02-13 21:25:10 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 	height: editArea.height + Kirigami.Units.gridUnit * 3 | 
					
						
							| 
									
										
										
										
											2017-10-04 12:27:13 -07:00
										 |  |  | 	width: diveDetailsPage.width - diveDetailsPage.leftPadding - diveDetailsPage.rightPadding - Kirigami.Units.smallSpacing * 2 | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 	Item { | 
					
						
							|  |  |  | 		// there is a maximum width above which this becomes less pleasant to use. 42 gridUnits
 | 
					
						
							|  |  |  | 		// allows for two of the large drop downs or four of the text fields or all of a cylinder
 | 
					
						
							|  |  |  | 		// to be in one row. More just doesn't look good
 | 
					
						
							|  |  |  | 		width: Math.min(parent.width - Kirigami.Units.smallSpacing, Kirigami.Units.gridUnit * 42) | 
					
						
							|  |  |  | 		// weird way to create a little space from the left edge - but I can't do a margin here
 | 
					
						
							|  |  |  | 		x: Kirigami.Units.smallSpacing | 
					
						
							|  |  |  | 		Flow { | 
					
						
							|  |  |  | 			id: editArea | 
					
						
							|  |  |  | 			// with larger fonts we need more space, or things look too crowded
 | 
					
						
							|  |  |  | 			spacing: subsurfaceTheme.currentScale > 1.0 ? 1.5 * Kirigami.Units.largeSpacing : Kirigami.Units.largeSpacing | 
					
						
							| 
									
										
										
										
											2015-12-04 01:38:04 +01:00
										 |  |  | 			width: parent.width | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 			flow: GridLayout.LeftToRight | 
					
						
							|  |  |  | 			RowLayout { | 
					
						
							|  |  |  | 				TemplateLabelSmall { | 
					
						
							|  |  |  | 					Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 					horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 					text: qsTr("Date/Time:") | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				SsrfTextField { | 
					
						
							|  |  |  | 					id: txtDate; | 
					
						
							|  |  |  | 					Layout.preferredWidth: Kirigami.Units.gridUnit * 10 | 
					
						
							|  |  |  | 					flickable: detailsEditFlickable | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2016-01-05 06:59:04 -08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 			RowLayout { | 
					
						
							|  |  |  | 				TemplateLabelSmall { | 
					
						
							|  |  |  | 					horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 					Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 					text: qsTr("Dive number:") | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				SsrfTextField { | 
					
						
							|  |  |  | 					id: txtNumber; | 
					
						
							|  |  |  | 					Layout.preferredWidth: Kirigami.Units.gridUnit * 3 | 
					
						
							|  |  |  | 					flickable: detailsEditFlickable | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				Item { | 
					
						
							|  |  |  | 					// if date and dive number are on the same line, don't have the Depth behind them
 | 
					
						
							|  |  |  | 					// to ensure that we add an element that fills enough of the line that the flow
 | 
					
						
							|  |  |  | 					// will not pull the next element up
 | 
					
						
							|  |  |  | 					visible: editArea.width > Kirigami.Units.gridUnit * 27 | 
					
						
							|  |  |  | 					Layout.preferredWidth: editArea.width - Kirigami.Units.gridUnit * 26 | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2015-12-04 01:38:04 +01:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 			RowLayout { | 
					
						
							|  |  |  | 				TemplateLabelSmall { | 
					
						
							|  |  |  | 					Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 					horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 					text: qsTr("Depth:") | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				SsrfTextField { | 
					
						
							|  |  |  | 					Layout.preferredWidth: Kirigami.Units.gridUnit * 3 | 
					
						
							|  |  |  | 					id: txtDepth | 
					
						
							|  |  |  | 					validator: RegExpValidator { regExp: /[^-]*/ } | 
					
						
							|  |  |  | 					flickable: detailsEditFlickable | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2015-12-04 01:38:04 +01:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 			RowLayout { | 
					
						
							|  |  |  | 				TemplateLabelSmall { | 
					
						
							|  |  |  | 					Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 					horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 					text: qsTr("Duration:") | 
					
						
							| 
									
										
										
										
											2017-11-22 19:22:02 +01:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 				SsrfTextField { | 
					
						
							|  |  |  | 					Layout.preferredWidth: Kirigami.Units.gridUnit * 3 | 
					
						
							|  |  |  | 					id: txtDuration | 
					
						
							|  |  |  | 					validator: RegExpValidator { regExp: /[^-]*/ } | 
					
						
							|  |  |  | 					flickable: detailsEditFlickable | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-04 01:38:04 +01:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 			RowLayout { | 
					
						
							|  |  |  | 				TemplateLabelSmall { | 
					
						
							|  |  |  | 					Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 					horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 					text: qsTr("Air Temp:") | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				SsrfTextField { | 
					
						
							|  |  |  | 					id: txtAirTemp | 
					
						
							|  |  |  | 					Layout.preferredWidth: Kirigami.Units.gridUnit * 3 | 
					
						
							|  |  |  | 					flickable: detailsEditFlickable | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2015-12-04 01:38:04 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-15 05:17:39 -07:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 			RowLayout { | 
					
						
							|  |  |  | 				TemplateLabelSmall { | 
					
						
							|  |  |  | 					Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 					horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 					text: qsTr("Water Temp:") | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				SsrfTextField { | 
					
						
							|  |  |  | 					Layout.preferredWidth: Kirigami.Units.gridUnit * 3 | 
					
						
							|  |  |  | 					id: txtWaterTemp | 
					
						
							|  |  |  | 					flickable: detailsEditFlickable | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2016-04-15 05:17:39 -07:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 			RowLayout { | 
					
						
							|  |  |  | 				width: Kirigami.Units.gridUnit * 20 | 
					
						
							|  |  |  | 				TemplateLabelSmall { | 
					
						
							|  |  |  | 					Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 					horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 					text: qsTr("Location:") | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				TemplateEditComboBox { | 
					
						
							|  |  |  | 					// this one needs more space
 | 
					
						
							|  |  |  | 					id: locationBox | 
					
						
							|  |  |  | 					flickable: detailsEditFlickable | 
					
						
							|  |  |  | 					model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ? | 
					
						
							|  |  |  | 						       manager.locationList : null | 
					
						
							|  |  |  | 					onAccepted: { | 
					
						
							|  |  |  | 						focus = false | 
					
						
							|  |  |  | 						gpsText = manager.getGpsFromSiteName(editText) | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					onActivated: { | 
					
						
							|  |  |  | 						focus = false | 
					
						
							|  |  |  | 						gpsText = manager.getGpsFromSiteName(editText) | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2016-01-01 17:23:29 -08:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 			RowLayout { | 
					
						
							|  |  |  | 				spacing: Kirigami.Units.smallSpacing | 
					
						
							|  |  |  | 				Layout.preferredWidth: Kirigami.Units.gridUnit * 20 | 
					
						
							|  |  |  | 				TemplateLabelSmall { | 
					
						
							|  |  |  | 					Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 					horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 					text: qsTr("Coordinates:") | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				SsrfTextField { | 
					
						
							|  |  |  | 					Layout.preferredWidth: Kirigami.Units.gridUnit * 16 | 
					
						
							|  |  |  | 					id: txtGps | 
					
						
							|  |  |  | 					flickable: detailsEditFlickable | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			RowLayout { | 
					
						
							|  |  |  | 				width: Kirigami.Units.gridUnit * 20 | 
					
						
							|  |  |  | 				TemplateLabelSmall { | 
					
						
							|  |  |  | 					Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 					horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 					text: qsTr("Suit:") | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				TemplateEditComboBox  { | 
					
						
							|  |  |  | 					id: suitBox | 
					
						
							|  |  |  | 					flickable: detailsEditFlickable | 
					
						
							|  |  |  | 					model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ? | 
					
						
							|  |  |  | 						       manager.suitList : null | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2018-07-16 15:21:39 +02:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 			RowLayout { | 
					
						
							|  |  |  | 				width: Kirigami.Units.gridUnit * 20 | 
					
						
							|  |  |  | 				TemplateLabelSmall { | 
					
						
							|  |  |  | 					Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 					horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 					text: qsTr("Buddy:") | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				TemplateEditComboBox { | 
					
						
							|  |  |  | 					id: buddyBox | 
					
						
							|  |  |  | 					flickable: detailsEditFlickable | 
					
						
							|  |  |  | 					model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ? | 
					
						
							|  |  |  | 						       manager.buddyList : null | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2018-07-16 15:21:39 +02:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 			RowLayout { | 
					
						
							|  |  |  | 				width: Kirigami.Units.gridUnit * 20 | 
					
						
							|  |  |  | 				TemplateLabelSmall { | 
					
						
							|  |  |  | 					Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 					horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 					text: qsTr("Divemaster:") | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				TemplateEditComboBox { | 
					
						
							|  |  |  | 					id: divemasterBox | 
					
						
							|  |  |  | 					flickable: detailsEditFlickable | 
					
						
							|  |  |  | 					model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ? | 
					
						
							|  |  |  | 						       manager.divemasterList : null | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2018-07-16 15:21:39 +02:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2021-08-15 19:55:17 -07:00
										 |  |  | 			RowLayout { | 
					
						
							|  |  |  | 				width: Kirigami.Units.gridUnit * 20 | 
					
						
							|  |  |  | 				TemplateLabelSmall { | 
					
						
							|  |  |  | 					Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 					horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 					text: qsTr("Tags:") | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				SsrfTextField { | 
					
						
							|  |  |  | 					Layout.preferredWidth: Kirigami.Units.gridUnit * 16 | 
					
						
							|  |  |  | 					id: txtTag | 
					
						
							|  |  |  | 					flickable: detailsEditFlickable | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2016-01-28 18:26:37 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 			RowLayout { | 
					
						
							|  |  |  | 				width: Kirigami.Units.gridUnit * 16 | 
					
						
							|  |  |  | 				TemplateLabelSmall { | 
					
						
							|  |  |  | 					Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 					horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 					text: qsTr("Weight:") | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				SsrfTextField { | 
					
						
							|  |  |  | 					id: txtWeight | 
					
						
							|  |  |  | 					Layout.preferredWidth: Kirigami.Units.gridUnit * 12 | 
					
						
							|  |  |  | 					readOnly: text === "cannot edit multiple weight systems" | 
					
						
							|  |  |  | 					flickable: detailsEditFlickable | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2018-07-16 15:21:39 +02:00
										 |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 			// all cylinder info should be able to become dynamic instead of this blob of code.
 | 
					
						
							|  |  |  | 			// first cylinder
 | 
					
						
							|  |  |  | 			Flow { | 
					
						
							|  |  |  | 				width: parent.width | 
					
						
							|  |  |  | 				RowLayout { | 
					
						
							|  |  |  | 					width: Kirigami.Units.gridUnit * 12 | 
					
						
							|  |  |  | 					id: cb1 | 
					
						
							|  |  |  | 					TemplateLabelSmall { | 
					
						
							|  |  |  | 						Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 						horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 						text: qsTr("Cylinder1:") | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					TemplateComboBox { | 
					
						
							|  |  |  | 						id: cylinderBox0 | 
					
						
							|  |  |  | 						flickable: detailsEditFlickable | 
					
						
							|  |  |  | 						flat: true | 
					
						
							|  |  |  | 						model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ? | 
					
						
							|  |  |  | 							       diveDetailsListView.currentItem.modelData.cylinderList : null | 
					
						
							|  |  |  | 						inputMethodHints: Qt.ImhNoPredictiveText | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				RowLayout { | 
					
						
							|  |  |  | 					height: cb1.height | 
					
						
							|  |  |  | 					width: Kirigami.Units.gridUnit * 8 | 
					
						
							|  |  |  | 					TemplateLabelSmall { | 
					
						
							|  |  |  | 						Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 						horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 						text: qsTr("Gas mix:") | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					SsrfTextField { | 
					
						
							|  |  |  | 						id: txtGasMix0 | 
					
						
							| 
									
										
										
										
											2021-01-16 09:13:12 -08:00
										 |  |  | 						text: usedGas[0] !== undefined ? usedGas[0] : null | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 						Layout.fillWidth: true | 
					
						
							|  |  |  | 						validator: RegExpValidator { regExp: /(EAN100|EAN\d\d|AIR|100|\d{1,2}|\d{1,2}\/\d{1,2})/i } | 
					
						
							|  |  |  | 						flickable: detailsEditFlickable | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				RowLayout { | 
					
						
							|  |  |  | 					height: cb1.height | 
					
						
							|  |  |  | 					width: Kirigami.Units.gridUnit * 10 | 
					
						
							|  |  |  | 					TemplateLabelSmall { | 
					
						
							|  |  |  | 						Layout.preferredWidth: Kirigami.Units.gridUnit * 6 | 
					
						
							|  |  |  | 						horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 						text: qsTr("Start Pressure:") | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					SsrfTextField { | 
					
						
							|  |  |  | 						id: txtStartPressure0 | 
					
						
							| 
									
										
										
										
											2021-01-16 09:13:12 -08:00
										 |  |  | 						text: startpressure[0] !== undefined ? startpressure[0] : null | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 						Layout.fillWidth: true | 
					
						
							|  |  |  | 						flickable: detailsEditFlickable | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				RowLayout { | 
					
						
							|  |  |  | 					height: cb1.height | 
					
						
							|  |  |  | 					width: Kirigami.Units.gridUnit * 10 | 
					
						
							|  |  |  | 					TemplateLabelSmall { | 
					
						
							|  |  |  | 						Layout.preferredWidth: Kirigami.Units.gridUnit * 6 | 
					
						
							|  |  |  | 						horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 						text: qsTr("End Pressure:") | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					SsrfTextField { | 
					
						
							|  |  |  | 						id: txtEndPressure0 | 
					
						
							| 
									
										
										
										
											2021-01-16 09:13:12 -08:00
										 |  |  | 						text: endpressure[0] !== undefined ? endpressure[0] : null | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 						Layout.fillWidth: true | 
					
						
							|  |  |  | 						flickable: detailsEditFlickable | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2018-07-16 15:21:39 +02:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 			//second cylinder
 | 
					
						
							|  |  |  | 			Flow { | 
					
						
							|  |  |  | 				width: parent.width | 
					
						
							| 
									
										
										
										
											2021-01-16 09:13:12 -08:00
										 |  |  | 				visible: usedCyl[1] !== undefined ? true : false | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 				RowLayout { | 
					
						
							|  |  |  | 					id: cb2 | 
					
						
							|  |  |  | 					width: Kirigami.Units.gridUnit * 12 | 
					
						
							|  |  |  | 					TemplateLabelSmall { | 
					
						
							|  |  |  | 						Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 						horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 						text: qsTr("Cylinder2:") | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					TemplateComboBox { | 
					
						
							|  |  |  | 						id: cylinderBox1 | 
					
						
							|  |  |  | 						flickable: detailsEditFlickable | 
					
						
							|  |  |  | 						flat: true | 
					
						
							|  |  |  | 						model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ? | 
					
						
							|  |  |  | 							       diveDetailsListView.currentItem.modelData.cylinderList : null | 
					
						
							|  |  |  | 						inputMethodHints: Qt.ImhNoPredictiveText | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				RowLayout { | 
					
						
							|  |  |  | 					width: Kirigami.Units.gridUnit * 8 | 
					
						
							|  |  |  | 					height: cb2.height | 
					
						
							|  |  |  | 					TemplateLabelSmall { | 
					
						
							|  |  |  | 						Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 						horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 						text: qsTr("Gas mix:") | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					SsrfTextField { | 
					
						
							|  |  |  | 						id: txtGasMix1 | 
					
						
							| 
									
										
										
										
											2021-01-16 09:13:12 -08:00
										 |  |  | 						text: usedGas[1] !== undefined ? usedGas[1] : null | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 						Layout.fillWidth: true | 
					
						
							|  |  |  | 						validator: RegExpValidator { regExp: /(EAN100|EAN\d\d|AIR|100|\d{1,2}|\d{1,2}\/\d{1,2})/i } | 
					
						
							|  |  |  | 						flickable: detailsEditFlickable | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				RowLayout { | 
					
						
							|  |  |  | 					width: Kirigami.Units.gridUnit * 10 | 
					
						
							|  |  |  | 					height: cb2.height | 
					
						
							|  |  |  | 					TemplateLabelSmall { | 
					
						
							|  |  |  | 						Layout.preferredWidth: Kirigami.Units.gridUnit * 6 | 
					
						
							|  |  |  | 						horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 						text: qsTr("Start Pressure:") | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					SsrfTextField { | 
					
						
							|  |  |  | 						id: txtStartPressure1 | 
					
						
							| 
									
										
										
										
											2021-01-16 09:13:12 -08:00
										 |  |  | 						text: startpressure[1] !== undefined ? startpressure[1] : null | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 						Layout.fillWidth: true | 
					
						
							|  |  |  | 						flickable: detailsEditFlickable | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				RowLayout { | 
					
						
							|  |  |  | 					width: Kirigami.Units.gridUnit * 10 | 
					
						
							|  |  |  | 					height: cb2.height | 
					
						
							|  |  |  | 					TemplateLabelSmall { | 
					
						
							|  |  |  | 						Layout.preferredWidth: Kirigami.Units.gridUnit * 6 | 
					
						
							|  |  |  | 						horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 						text: qsTr("End Pressure:") | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					SsrfTextField { | 
					
						
							|  |  |  | 						id: txtEndPressure1 | 
					
						
							| 
									
										
										
										
											2021-01-16 09:13:12 -08:00
										 |  |  | 						text: endpressure[1] !== undefined ? endpressure[1] : null | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 						Layout.fillWidth: true | 
					
						
							|  |  |  | 						flickable: detailsEditFlickable | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2018-07-16 15:21:39 +02:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 			// third cylinder
 | 
					
						
							|  |  |  | 			Flow { | 
					
						
							|  |  |  | 				width: parent.width | 
					
						
							| 
									
										
										
										
											2021-01-16 09:13:12 -08:00
										 |  |  | 				visible: usedCyl[2] !== undefined ? true : false | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 				RowLayout { | 
					
						
							|  |  |  | 					id: cb3 | 
					
						
							|  |  |  | 					width: Kirigami.Units.gridUnit * 12 | 
					
						
							|  |  |  | 					TemplateLabelSmall { | 
					
						
							|  |  |  | 						Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 						horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 						text: qsTr("Cylinder3:") | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					TemplateComboBox { | 
					
						
							|  |  |  | 						id: cylinderBox2 | 
					
						
							|  |  |  | 						flickable: detailsEditFlickable | 
					
						
							|  |  |  | 						currentIndex: find(usedCyl[2]) | 
					
						
							|  |  |  | 						flat: true | 
					
						
							|  |  |  | 						model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ? | 
					
						
							|  |  |  | 							       diveDetailsListView.currentItem.modelData.cylinderList : null | 
					
						
							|  |  |  | 						inputMethodHints: Qt.ImhNoPredictiveText | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				RowLayout { | 
					
						
							|  |  |  | 					width: Kirigami.Units.gridUnit * 8 | 
					
						
							|  |  |  | 					height: cb3.height | 
					
						
							|  |  |  | 					TemplateLabelSmall { | 
					
						
							|  |  |  | 						Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 						horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 						text: qsTr("Gas mix:") | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					SsrfTextField { | 
					
						
							|  |  |  | 						id: txtGasMix2 | 
					
						
							| 
									
										
										
										
											2021-01-16 09:13:12 -08:00
										 |  |  | 						text: usedGas[2] !== undefined ? usedGas[2] : null | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 						Layout.fillWidth: true | 
					
						
							|  |  |  | 						validator: RegExpValidator { regExp: /(EAN100|EAN\d\d|AIR|100|\d{1,2}|\d{1,2}\/\d{1,2})/i } | 
					
						
							|  |  |  | 						flickable: detailsEditFlickable | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				RowLayout { | 
					
						
							|  |  |  | 					width: Kirigami.Units.gridUnit * 10 | 
					
						
							|  |  |  | 					height: cb3.height | 
					
						
							|  |  |  | 					TemplateLabelSmall { | 
					
						
							|  |  |  | 						Layout.preferredWidth: Kirigami.Units.gridUnit * 6 | 
					
						
							|  |  |  | 						horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 						text: qsTr("Start Pressure:") | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					SsrfTextField { | 
					
						
							|  |  |  | 						id: txtStartPressure2 | 
					
						
							| 
									
										
										
										
											2021-01-16 09:13:12 -08:00
										 |  |  | 						text: startpressure[2] !== undefined ? startpressure[2] : null | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 						Layout.fillWidth: true | 
					
						
							|  |  |  | 						flickable: detailsEditFlickable | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				RowLayout { | 
					
						
							|  |  |  | 					width: Kirigami.Units.gridUnit * 10 | 
					
						
							|  |  |  | 					height: cb3.height | 
					
						
							|  |  |  | 					TemplateLabelSmall { | 
					
						
							|  |  |  | 						Layout.preferredWidth: Kirigami.Units.gridUnit * 6 | 
					
						
							|  |  |  | 						horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 						text: qsTr("End Pressure:") | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					SsrfTextField { | 
					
						
							|  |  |  | 						id: txtEndPressure2 | 
					
						
							| 
									
										
										
										
											2021-01-16 09:13:12 -08:00
										 |  |  | 						text: endpressure[2] !== undefined ? endpressure[2] : null | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 						Layout.fillWidth: true | 
					
						
							|  |  |  | 						flickable: detailsEditFlickable | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2018-07-16 15:21:39 +02:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 			// fourth cylinder
 | 
					
						
							|  |  |  | 			Flow { | 
					
						
							|  |  |  | 				width: parent.width | 
					
						
							| 
									
										
										
										
											2021-01-16 09:13:12 -08:00
										 |  |  | 				visible: usedCyl[3] !== undefined ? true : false | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 				RowLayout { | 
					
						
							|  |  |  | 					id: cb4 | 
					
						
							|  |  |  | 					width: Kirigami.Units.gridUnit * 12 | 
					
						
							|  |  |  | 					TemplateLabelSmall { | 
					
						
							|  |  |  | 						Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 						horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 						text: qsTr("Cylinder4:") | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					TemplateComboBox { | 
					
						
							|  |  |  | 						id: cylinderBox3 | 
					
						
							|  |  |  | 						flickable: detailsEditFlickable | 
					
						
							|  |  |  | 						currentIndex: find(usedCyl[3]) | 
					
						
							|  |  |  | 						flat: true | 
					
						
							|  |  |  | 						model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ? | 
					
						
							|  |  |  | 							       diveDetailsListView.currentItem.modelData.cylinderList : null | 
					
						
							|  |  |  | 						inputMethodHints: Qt.ImhNoPredictiveText | 
					
						
							|  |  |  | 					} | 
					
						
							| 
									
										
										
										
											2018-07-16 15:21:39 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 				} | 
					
						
							|  |  |  | 				RowLayout { | 
					
						
							|  |  |  | 					width: Kirigami.Units.gridUnit * 8 | 
					
						
							|  |  |  | 					height: cb4.height | 
					
						
							|  |  |  | 					TemplateLabelSmall { | 
					
						
							|  |  |  | 						Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 						horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 						text: qsTr("Gas mix:") | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					SsrfTextField { | 
					
						
							|  |  |  | 						id: txtGasMix3 | 
					
						
							| 
									
										
										
										
											2021-01-16 09:13:12 -08:00
										 |  |  | 						text: usedGas[3] !== undefined ? usedGas[3] : null | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 						Layout.fillWidth: true | 
					
						
							|  |  |  | 						validator: RegExpValidator { regExp: /(EAN100|EAN\d\d|AIR|100|\d{1,2}|\d{1,2}\/\d{1,2})/i } | 
					
						
							|  |  |  | 						flickable: detailsEditFlickable | 
					
						
							|  |  |  | 					} | 
					
						
							| 
									
										
										
										
											2018-07-16 15:21:39 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 				} | 
					
						
							|  |  |  | 				RowLayout { | 
					
						
							|  |  |  | 					width: Kirigami.Units.gridUnit * 10 | 
					
						
							|  |  |  | 					height: cb4.height | 
					
						
							|  |  |  | 					TemplateLabelSmall { | 
					
						
							|  |  |  | 						Layout.preferredWidth: Kirigami.Units.gridUnit * 6 | 
					
						
							|  |  |  | 						horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 						text: qsTr("Start Pressure:") | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					SsrfTextField { | 
					
						
							|  |  |  | 						id: txtStartPressure3 | 
					
						
							| 
									
										
										
										
											2021-01-16 09:13:12 -08:00
										 |  |  | 						text: startpressure[3] !== undefined ? startpressure[3] : null | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 						Layout.fillWidth: true | 
					
						
							|  |  |  | 						flickable: detailsEditFlickable | 
					
						
							|  |  |  | 					} | 
					
						
							| 
									
										
										
										
											2016-08-30 16:24:19 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 				} | 
					
						
							|  |  |  | 				RowLayout { | 
					
						
							|  |  |  | 					width: Kirigami.Units.gridUnit * 10 | 
					
						
							|  |  |  | 					height: cb4.height | 
					
						
							|  |  |  | 					TemplateLabelSmall { | 
					
						
							|  |  |  | 						Layout.preferredWidth: Kirigami.Units.gridUnit * 6 | 
					
						
							|  |  |  | 						horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 						text: qsTr("End Pressure:") | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					SsrfTextField { | 
					
						
							|  |  |  | 						id: txtEndPressure3 | 
					
						
							| 
									
										
										
										
											2021-01-16 09:13:12 -08:00
										 |  |  | 						text: endpressure[3] !== undefined ? endpressure[3] : null | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 						Layout.fillWidth: true | 
					
						
							|  |  |  | 						flickable: detailsEditFlickable | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2016-02-13 18:34:31 +01:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 			// fifth cylinder
 | 
					
						
							|  |  |  | 			Flow { | 
					
						
							|  |  |  | 				width: parent.width | 
					
						
							| 
									
										
										
										
											2021-01-16 09:13:12 -08:00
										 |  |  | 				visible: usedCyl[4] !== undefined ? true : false | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 				RowLayout { | 
					
						
							|  |  |  | 					id: cb5 | 
					
						
							|  |  |  | 					width: Kirigami.Units.gridUnit * 12 | 
					
						
							|  |  |  | 					TemplateLabelSmall { | 
					
						
							|  |  |  | 						Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 						horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 						text: qsTr("Cylinder5:") | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					TemplateComboBox { | 
					
						
							|  |  |  | 						id: cylinderBox4 | 
					
						
							|  |  |  | 						flickable: detailsEditFlickable | 
					
						
							|  |  |  | 						currentIndex: find(usedCyl[4]) | 
					
						
							|  |  |  | 						flat: true | 
					
						
							|  |  |  | 						model: diveDetailsListView.currentItem && diveDetailsListView.currentItem.modelData !== null ? | 
					
						
							|  |  |  | 							       diveDetailsListView.currentItem.modelData.cylinderList : null | 
					
						
							|  |  |  | 						inputMethodHints: Qt.ImhNoPredictiveText | 
					
						
							|  |  |  | 						Layout.fillWidth: true | 
					
						
							|  |  |  | 					} | 
					
						
							| 
									
										
										
										
											2016-02-13 18:34:31 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 				} | 
					
						
							|  |  |  | 				RowLayout { | 
					
						
							|  |  |  | 					width: Kirigami.Units.gridUnit * 8 | 
					
						
							|  |  |  | 					height: cb5.height | 
					
						
							|  |  |  | 					TemplateLabelSmall { | 
					
						
							|  |  |  | 						Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 						horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 						text: qsTr("Gas mix:") | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					SsrfTextField { | 
					
						
							|  |  |  | 						id: txtGasMix4 | 
					
						
							| 
									
										
										
										
											2021-01-16 09:13:12 -08:00
										 |  |  | 						text: usedGas[4] !== undefined ? usedGas[4] : null | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 						Layout.fillWidth: true | 
					
						
							|  |  |  | 						validator: RegExpValidator { regExp: /(EAN100|EAN\d\d|AIR|100|\d{1,2}|\d{1,2}\/\d{1,2})/i } | 
					
						
							|  |  |  | 						flickable: detailsEditFlickable | 
					
						
							|  |  |  | 					} | 
					
						
							| 
									
										
										
										
											2016-02-09 17:20:17 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 				} | 
					
						
							|  |  |  | 				RowLayout { | 
					
						
							|  |  |  | 					width: Kirigami.Units.gridUnit * 10 | 
					
						
							|  |  |  | 					height: cb5.height | 
					
						
							|  |  |  | 					TemplateLabelSmall { | 
					
						
							|  |  |  | 						Layout.preferredWidth: Kirigami.Units.gridUnit * 6 | 
					
						
							|  |  |  | 						horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 						text: qsTr("Start Pressure:") | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					SsrfTextField { | 
					
						
							|  |  |  | 						id: txtStartPressure4 | 
					
						
							| 
									
										
										
										
											2021-01-16 09:13:12 -08:00
										 |  |  | 						text: startpressure[4] !== undefined ? startpressure[4] : null | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 						Layout.fillWidth: true | 
					
						
							|  |  |  | 						flickable: detailsEditFlickable | 
					
						
							|  |  |  | 					} | 
					
						
							| 
									
										
										
										
											2016-02-09 17:20:17 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 				} | 
					
						
							|  |  |  | 				RowLayout { | 
					
						
							|  |  |  | 					width: Kirigami.Units.gridUnit * 10 | 
					
						
							|  |  |  | 					height: cb5.height | 
					
						
							|  |  |  | 					TemplateLabelSmall { | 
					
						
							|  |  |  | 						Layout.preferredWidth: Kirigami.Units.gridUnit * 6 | 
					
						
							|  |  |  | 						horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 						text: qsTr("End Pressure:") | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					SsrfTextField { | 
					
						
							|  |  |  | 						id: txtEndPressure4 | 
					
						
							| 
									
										
										
										
											2021-01-16 09:13:12 -08:00
										 |  |  | 						text: endpressure[4] !== undefined ? endpressure[4] : null | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 						Layout.fillWidth: true | 
					
						
							|  |  |  | 						flickable: detailsEditFlickable | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2017-07-28 19:28:52 +02:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 			// rating / visibility
 | 
					
						
							|  |  |  | 			RowLayout { | 
					
						
							|  |  |  | 				width: parent.width | 
					
						
							| 
									
										
										
										
											2017-07-28 19:28:52 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 				RowLayout { | 
					
						
							|  |  |  | 					width: Kirigami.Units.gridUnit * 10 | 
					
						
							|  |  |  | 					TemplateLabelSmall { | 
					
						
							|  |  |  | 						Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 						horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 						text: qsTr("Rating:") | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					TemplateSpinBox { | 
					
						
							|  |  |  | 						id: ratingPicker | 
					
						
							|  |  |  | 						Layout.preferredWidth: Kirigami.Units.gridUnit * 6 | 
					
						
							|  |  |  | 						from: 0 | 
					
						
							|  |  |  | 						to: 5 | 
					
						
							|  |  |  | 						value: rating | 
					
						
							|  |  |  | 						onValueChanged: rating = value | 
					
						
							|  |  |  | 					} | 
					
						
							| 
									
										
										
										
											2017-07-28 19:28:52 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 				} | 
					
						
							|  |  |  | 				RowLayout { | 
					
						
							|  |  |  | 					width: Kirigami.Units.gridUnit * 10 | 
					
						
							|  |  |  | 					TemplateLabelSmall { | 
					
						
							|  |  |  | 						Layout.preferredWidth: Kirigami.Units.gridUnit * 4 | 
					
						
							|  |  |  | 						horizontalAlignment: Text.AlignRight | 
					
						
							|  |  |  | 						text: qsTr("Visibility:") | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					TemplateSpinBox { | 
					
						
							|  |  |  | 						id: visibilityPicker | 
					
						
							|  |  |  | 						Layout.preferredWidth: Kirigami.Units.gridUnit * 6 | 
					
						
							|  |  |  | 						from: 0 | 
					
						
							|  |  |  | 						to: 5 | 
					
						
							|  |  |  | 						value: visibility | 
					
						
							|  |  |  | 						onValueChanged: visibility = value | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					Item { Layout.fillWidth: true } | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2015-12-04 01:38:04 +01:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 			ColumnLayout { | 
					
						
							| 
									
										
										
										
											2016-01-21 13:09:10 -08:00
										 |  |  | 				width: parent.width | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 				TemplateLabelSmall { | 
					
						
							|  |  |  | 					Layout.preferredWidth: parent.width | 
					
						
							|  |  |  | 					text: qsTr("Notes:") | 
					
						
							| 
									
										
										
										
											2020-02-07 12:08:20 -08:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 				Controls.TextArea { | 
					
						
							|  |  |  | 					Layout.preferredWidth: parent.width | 
					
						
							|  |  |  | 					width: parent.width | 
					
						
							|  |  |  | 					id: txtNotes | 
					
						
							|  |  |  | 					textFormat: TextEdit.RichText | 
					
						
							|  |  |  | 					focus: true | 
					
						
							|  |  |  | 					color: subsurfaceTheme.textColor | 
					
						
							|  |  |  | 					Layout.fillWidth: true | 
					
						
							|  |  |  | 					Layout.fillHeight: true | 
					
						
							|  |  |  | 					Layout.minimumHeight: Kirigami.Units.gridUnit * 6 | 
					
						
							|  |  |  | 					selectByMouse: true | 
					
						
							|  |  |  | 					wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere | 
					
						
							|  |  |  | 					property bool firstTime: true | 
					
						
							|  |  |  | 					onPressed: waitForKeyboard.start() | 
					
						
							|  |  |  | 					onCursorRectangleChanged: { | 
					
						
							| 
									
										
										
										
											2021-01-16 08:59:22 -08:00
										 |  |  | 						ensureVisible() | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 					} | 
					
						
							|  |  |  | 					// ensure that the y coordinate is inside the visible part of the detailsEditFlickable (our flickable)
 | 
					
						
							| 
									
										
										
										
											2021-01-16 08:59:22 -08:00
										 |  |  | 					function ensureVisible() { | 
					
						
							|  |  |  | 						// make sure there's enough space for the TextArea above the keyboard and action button
 | 
					
						
							|  |  |  | 						// and that it's not too far up, either
 | 
					
						
							|  |  |  | 						var flickable = detailsEditFlickable | 
					
						
							|  |  |  | 						var positionInFlickable = txtNotes.mapToItem(flickable.contentItem, 0, 0) | 
					
						
							|  |  |  | 						var taY = positionInFlickable.y + cursorRectangle.y | 
					
						
							|  |  |  | 						if (manager.verboseEnabled) | 
					
						
							|  |  |  | 							manager.appendTextToLog("position check: lower edge of view is " + | 
					
						
							|  |  |  | 										    (0 + flickable.contentY + flickable.height) + | 
					
						
							|  |  |  | 										    " and text area is at " + taY) | 
					
						
							|  |  |  | 						if (taY > flickable.contentY + flickable.height - 4 * Kirigami.Units.gridUnit) | 
					
						
							|  |  |  | 							flickable.contentY = Math.max(0, 4 * Kirigami.Units.gridUnit + taY - flickable.height) | 
					
						
							|  |  |  | 						while (taY < flickable.contentY) | 
					
						
							|  |  |  | 							flickable.contentY -= 2 * Kirigami.Units.gridUnit | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 					} | 
					
						
							|  |  |  | 					// give the OS enough time to actually resize the flickable
 | 
					
						
							|  |  |  | 					Timer { | 
					
						
							|  |  |  | 						id: waitForKeyboard | 
					
						
							|  |  |  | 						interval: 300 // 300ms seems like FOREVER
 | 
					
						
							|  |  |  | 						onTriggered: { | 
					
						
							|  |  |  | 							if (!Qt.inputMethod.visible) { | 
					
						
							|  |  |  | 								if (txtNotes.firstTime) { | 
					
						
							|  |  |  | 									txtNotes.firstTime = false | 
					
						
							|  |  |  | 									restart() | 
					
						
							|  |  |  | 								} | 
					
						
							|  |  |  | 								return | 
					
						
							| 
									
										
										
										
											2019-10-13 14:43:38 -07:00
										 |  |  | 							} | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 							// make sure at least half the Notes field is visible
 | 
					
						
							| 
									
										
										
										
											2021-01-16 08:59:22 -08:00
										 |  |  | 							txtNotes.ensureVisible() | 
					
						
							| 
									
										
										
										
											2019-10-13 14:43:38 -07:00
										 |  |  | 						} | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2015-12-04 01:38:04 +01:00
										 |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		Item { | 
					
						
							| 
									
										
										
										
											2021-01-12 19:38:30 -08:00
										 |  |  | 			anchors.top: editArea.bottom | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 			height: Kirigami.Units.gridUnit * 3 | 
					
						
							| 
									
										
										
										
											2015-12-04 01:38:04 +01:00
										 |  |  | 			width: height // just to make sure the spacer doesn't produce scrollbars, but also isn't null
 | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2015-12-07 22:24:56 -08:00
										 |  |  | } |