| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | import QtQuick 2.3 | 
					
						
							|  |  |  | import QtQuick.Controls 1.2 | 
					
						
							|  |  |  | import QtQuick.Window 2.2 | 
					
						
							|  |  |  | import QtQuick.Dialogs 1.2 | 
					
						
							|  |  |  | import org.subsurfacedivelog.mobile 1.0 | 
					
						
							| 
									
										
										
										
											2015-07-10 11:45:20 +03:00
										 |  |  | import QtQuick.Layouts 1.0 | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | Rectangle { | 
					
						
							|  |  |  | 	id: page | 
					
						
							| 
									
										
										
										
											2015-08-20 11:44:01 +03:00
										 |  |  | 	objectName: "DiveList" | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	Component { | 
					
						
							|  |  |  | 		id: diveDelegate | 
					
						
							|  |  |  | 		Item { | 
					
						
							|  |  |  | 			id: dive | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			property real detailsOpacity : 0 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-09 03:56:36 +02:00
										 |  |  | 			width: diveListView.width - units.spacing | 
					
						
							| 
									
										
										
										
											2015-07-12 10:52:44 -07:00
										 |  |  | 			height: childrenRect.height | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			//Mouse region: When clicked, the mode changes to details view
 | 
					
						
							|  |  |  | 			MouseArea { | 
					
						
							|  |  |  | 				anchors.fill: parent | 
					
						
							| 
									
										
										
										
											2015-07-21 15:00:29 +03:00
										 |  |  | 				onClicked: { | 
					
						
							|  |  |  | 					detailsWindow.width = parent.width | 
					
						
							|  |  |  | 					detailsWindow.location = location | 
					
						
							|  |  |  | 					detailsWindow.dive_id = id | 
					
						
							|  |  |  | 					detailsWindow.buddy = buddy | 
					
						
							|  |  |  | 					detailsWindow.suit = suit | 
					
						
							|  |  |  | 					detailsWindow.airtemp = airtemp | 
					
						
							|  |  |  | 					detailsWindow.watertemp = watertemp | 
					
						
							|  |  |  | 					detailsWindow.divemaster = divemaster | 
					
						
							|  |  |  | 					detailsWindow.notes = notes | 
					
						
							| 
									
										
										
										
											2015-07-27 12:26:51 -07:00
										 |  |  | 					detailsWindow.number = diveNumber | 
					
						
							|  |  |  | 					detailsWindow.date = date | 
					
						
							| 
									
										
										
										
											2015-07-21 15:00:29 +03:00
										 |  |  | 					stackView.push(detailsWindow) | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-27 08:51:53 +02:00
										 |  |  | 			//Layout of the page: (mini profile, dive no, date at the top
 | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | 			//And other details at the bottom.
 | 
					
						
							| 
									
										
										
										
											2015-10-09 05:05:23 +02:00
										 |  |  | 			Item { | 
					
						
							| 
									
										
										
										
											2015-10-09 03:56:36 +02:00
										 |  |  | 				x: units.spacing | 
					
						
							|  |  |  | 				width: parent.width - units.spacing * 2 | 
					
						
							|  |  |  | 				height: childrenRect.height + units.spacing * 2 | 
					
						
							| 
									
										
										
										
											2015-10-09 05:05:23 +02:00
										 |  |  | 				//spacing: units.spacing / 2
 | 
					
						
							| 
									
										
										
										
											2015-10-09 03:56:36 +02:00
										 |  |  | 				anchors.margins: units.spacing | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-09 03:56:36 +02:00
										 |  |  | 				Text { | 
					
						
							| 
									
										
										
										
											2015-10-09 05:05:23 +02:00
										 |  |  | 					id: locationText | 
					
						
							|  |  |  | 					text: location | 
					
						
							|  |  |  | 					color: theme.textColor | 
					
						
							|  |  |  | 					scale: 1.1 // Let's see how this works, otherwise, we'll need the default point size somewhere
 | 
					
						
							|  |  |  | 					transformOrigin: Item.TopLeft | 
					
						
							|  |  |  | 					anchors { | 
					
						
							|  |  |  | 						left: parent.left | 
					
						
							|  |  |  | 						top: parent.top | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				Text { | 
					
						
							|  |  |  | 					text: date | 
					
						
							|  |  |  | 					opacity: 0.6 | 
					
						
							|  |  |  | 					color: theme.textColor | 
					
						
							|  |  |  | 					anchors { | 
					
						
							|  |  |  | 						right: parent.right | 
					
						
							|  |  |  | 						top: parent.top | 
					
						
							|  |  |  | 						bottomMargin: units.spacing / 2 | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				Row { | 
					
						
							|  |  |  | 					id: descriptionText | 
					
						
							|  |  |  | 					anchors { | 
					
						
							|  |  |  | 						left: parent.left | 
					
						
							|  |  |  | 						right: parent.right | 
					
						
							|  |  |  | 						bottom: numberText.bottom | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					Text { | 
					
						
							|  |  |  | 						text: 'Depth: ' | 
					
						
							|  |  |  | 						opacity: 0.6 | 
					
						
							|  |  |  | 						color: theme.textColor | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					Text { | 
					
						
							|  |  |  | 						text: depth | 
					
						
							|  |  |  | 						width: Math.max(units.gridUnit * 3, paintedWidth) // helps vertical alignment throughout listview
 | 
					
						
							|  |  |  | 						color: theme.textColor | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					Text { | 
					
						
							|  |  |  | 						text: 'Duration: ' | 
					
						
							|  |  |  | 						opacity: 0.6 | 
					
						
							|  |  |  | 						color: theme.textColor | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					Text { | 
					
						
							|  |  |  | 						text: duration | 
					
						
							|  |  |  | 						color: theme.textColor | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				Text { | 
					
						
							|  |  |  | 					id: numberText | 
					
						
							|  |  |  | 					text: "#" + diveNumber | 
					
						
							|  |  |  | 					color: theme.textColor | 
					
						
							|  |  |  | 					scale: 1.2 | 
					
						
							|  |  |  | 					transformOrigin: Item.BottomRight | 
					
						
							|  |  |  | 					opacity: 0.4 | 
					
						
							|  |  |  | 					anchors { | 
					
						
							|  |  |  | 						right: parent.right | 
					
						
							|  |  |  | 						topMargin: units.spacing | 
					
						
							|  |  |  | 						top: locationText.bottom | 
					
						
							|  |  |  | 					} | 
					
						
							| 
									
										
										
										
											2015-10-09 03:56:36 +02:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											2015-10-09 05:05:23 +02:00
										 |  |  | 				//Text { text: location; width: parent.width }
 | 
					
						
							| 
									
										
										
										
											2015-10-09 03:56:36 +02:00
										 |  |  | 				Rectangle { | 
					
						
							|  |  |  | 					color: theme.textColor | 
					
						
							|  |  |  | 					opacity: .2 | 
					
						
							|  |  |  | 					height: Math.max(1, units.gridUnit / 24) // we really want a thin line
 | 
					
						
							| 
									
										
										
										
											2015-10-09 05:05:23 +02:00
										 |  |  | 					anchors { | 
					
						
							|  |  |  | 						left: parent.left | 
					
						
							|  |  |  | 						right: parent.right | 
					
						
							|  |  |  | 						top: numberText.bottom | 
					
						
							|  |  |  | 					} | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | 				} | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	Component { | 
					
						
							|  |  |  | 		id: tripHeading | 
					
						
							| 
									
										
										
										
											2015-10-09 03:56:36 +02:00
										 |  |  | 		Item { | 
					
						
							|  |  |  | 			width: page.width - units.spacing * 2 | 
					
						
							|  |  |  | 			height: childrenRect.height + units.spacing * 2 | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			Text { | 
					
						
							| 
									
										
										
										
											2015-10-09 03:56:36 +02:00
										 |  |  | 				id: sectionText | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | 				text: section | 
					
						
							| 
									
										
										
										
											2015-10-09 03:56:36 +02:00
										 |  |  | 				anchors { | 
					
						
							|  |  |  | 					top: parent.top | 
					
						
							|  |  |  | 					left: parent.left | 
					
						
							|  |  |  | 					leftMargin: units.spacing | 
					
						
							|  |  |  | 					right: parent.right | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				color: theme.textColor | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | 				font.pointSize: 16 | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2015-10-09 03:56:36 +02:00
										 |  |  | 			Rectangle { | 
					
						
							|  |  |  | 				height: Math.max(2, units.gridUnit / 12) // we want a thicker line
 | 
					
						
							|  |  |  | 				anchors { | 
					
						
							|  |  |  | 					top: sectionText.bottom | 
					
						
							|  |  |  | 					left: parent.left | 
					
						
							|  |  |  | 					leftMargin: units.spacing | 
					
						
							|  |  |  | 					right: parent.right | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				color: theme.accentColor | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	ListView { | 
					
						
							|  |  |  | 		id: diveListView | 
					
						
							|  |  |  | 		anchors.fill: parent | 
					
						
							|  |  |  | 		model: diveModel | 
					
						
							|  |  |  | 		delegate: diveDelegate | 
					
						
							| 
									
										
										
										
											2015-10-09 03:56:36 +02:00
										 |  |  | 		boundsBehavior: Flickable.StopAtBounds | 
					
						
							|  |  |  | 		//highlight: Rectangle { color: theme.highlightColor; width: units.spacing }
 | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | 		focus: true | 
					
						
							| 
									
										
										
										
											2015-10-09 03:56:36 +02:00
										 |  |  | 		clip: true | 
					
						
							| 
									
										
										
										
											2015-07-10 11:40:30 +03:00
										 |  |  | 		section.property: "trip" | 
					
						
							|  |  |  | 		section.criteria: ViewSection.FullString | 
					
						
							|  |  |  | 		section.delegate: tripHeading | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } |