| 
									
										
										
										
											2017-04-27 20:30:36 +02:00
										 |  |  | // SPDX-License-Identifier: GPL-2.0
 | 
					
						
							| 
									
										
										
										
											2017-07-15 18:20:52 +02:00
										 |  |  | import QtQuick 2.6 | 
					
						
							| 
									
										
										
										
											2017-10-29 13:44:22 +01:00
										 |  |  | import QtQuick.Controls 2.2 as Controls | 
					
						
							| 
									
										
										
										
											2016-01-07 21:40:15 -08:00
										 |  |  | import QtQuick.Window 2.2 | 
					
						
							|  |  |  | import QtQuick.Dialogs 1.2 | 
					
						
							| 
									
										
										
										
											2017-10-30 11:26:47 +01:00
										 |  |  | import QtQuick.Layouts 1.2 | 
					
						
							| 
									
										
										
										
											2016-01-07 21:40:15 -08:00
										 |  |  | import QtQuick.Window 2.2 | 
					
						
							|  |  |  | import org.subsurfacedivelog.mobile 1.0 | 
					
						
							| 
									
										
										
											
												QML UI: Kirigami to 2.2
When first tested this commit, especially the dive list was looking
terrible. However, after including newer SHA's from libkirigami, and
correcting lots of spacing/margin issue, a retest of this commit shows
no strange artifact any more, and the amount of warnings in the log
output is reduced significantly. So now, it appears save to
upgrade.
Notice that main.qml still uses Kirigami 2.0. and is not updated in
this commit. With version 2.2, there is a new way of theming, that
is not (yet) compatible with our current code. Blindly upgrading to
2.2 leads to a almost black dive list, wrong button colors, and
runtime errors in the log, due to the fact the direct setting from
QML Kirigami's Theme colors is not allowed any more.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
											
										 
											2017-10-14 21:13:01 +02:00
										 |  |  | import org.kde.kirigami 2.2 as Kirigami | 
					
						
							| 
									
										
										
										
											2016-01-07 21:40:15 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | Kirigami.ScrollablePage { | 
					
						
							| 
									
										
										
										
											2016-01-07 21:40:15 -08:00
										 |  |  | 	id: gpsListWindow | 
					
						
							|  |  |  | 	objectName: "gpsList" | 
					
						
							| 
									
										
										
										
											2016-05-03 21:24:00 +02:00
										 |  |  | 	title: qsTr("GPS Fixes") | 
					
						
							| 
									
										
										
										
											2018-02-16 11:17:20 +01:00
										 |  |  | 	background: Rectangle { color: subsurfaceTheme.backgroundColor } | 
					
						
							| 
									
										
										
										
											2016-01-07 21:40:15 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	Component { | 
					
						
							|  |  |  | 		id: gpsDelegate | 
					
						
							| 
									
										
										
										
											2016-03-31 21:57:12 -05:00
										 |  |  | 		Kirigami.SwipeListItem { | 
					
						
							| 
									
										
										
										
											2016-01-07 21:40:15 -08:00
										 |  |  | 			id: gpsFix | 
					
						
							|  |  |  | 			enabled: true | 
					
						
							|  |  |  | 			width: parent.width | 
					
						
							| 
									
										
										
										
											2017-04-15 13:32:16 -07:00
										 |  |  | 			GridLayout { | 
					
						
							|  |  |  | 				columns: 4 | 
					
						
							|  |  |  | 				id: timeAndName | 
					
						
							|  |  |  | 				width: parent.width | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 				Controls.Label { | 
					
						
							| 
									
										
										
										
											2017-04-15 13:32:16 -07:00
										 |  |  | 					text: qsTr('Date: ') | 
					
						
							| 
									
										
										
										
											2017-07-15 18:20:52 +02:00
										 |  |  | 					color: subsurfaceTheme.textColor | 
					
						
							| 
									
										
										
										
											2017-04-15 13:32:16 -07:00
										 |  |  | 					opacity: 0.6 | 
					
						
							|  |  |  | 					font.pointSize: subsurfaceTheme.smallPointSize | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 				Controls.Label { | 
					
						
							| 
									
										
										
										
											2017-04-15 13:32:16 -07:00
										 |  |  | 					text: date | 
					
						
							| 
									
										
										
										
											2017-07-15 18:20:52 +02:00
										 |  |  | 					color: subsurfaceTheme.textColor | 
					
						
							| 
									
										
										
										
											2017-04-15 13:32:16 -07:00
										 |  |  | 					Layout.preferredWidth: Math.max(parent.width / 5, paintedWidth) | 
					
						
							|  |  |  | 					font.pointSize: subsurfaceTheme.smallPointSize | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 				Controls.Label { | 
					
						
							| 
									
										
										
										
											2017-04-15 13:32:16 -07:00
										 |  |  | 					text: qsTr('Name: ') | 
					
						
							| 
									
										
										
										
											2017-07-15 18:20:52 +02:00
										 |  |  | 					color: subsurfaceTheme.textColor | 
					
						
							| 
									
										
										
										
											2017-04-15 13:32:16 -07:00
										 |  |  | 					opacity: 0.6 | 
					
						
							|  |  |  | 					font.pointSize: subsurfaceTheme.smallPointSize | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 				Controls.Label { | 
					
						
							| 
									
										
										
										
											2017-04-15 13:32:16 -07:00
										 |  |  | 					text: name | 
					
						
							| 
									
										
										
										
											2017-07-15 18:20:52 +02:00
										 |  |  | 					color: subsurfaceTheme.textColor | 
					
						
							| 
									
										
										
										
											2017-04-15 13:32:16 -07:00
										 |  |  | 					Layout.preferredWidth: Math.max(parent.width / 5, paintedWidth) | 
					
						
							|  |  |  | 					font.pointSize: subsurfaceTheme.smallPointSize | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 				Controls.Label { | 
					
						
							| 
									
										
										
										
											2017-04-15 13:32:16 -07:00
										 |  |  | 					text: qsTr('Latitude: ') | 
					
						
							| 
									
										
										
										
											2017-07-15 18:20:52 +02:00
										 |  |  | 					color: subsurfaceTheme.textColor | 
					
						
							| 
									
										
										
										
											2017-04-15 13:32:16 -07:00
										 |  |  | 					opacity: 0.6 | 
					
						
							|  |  |  | 					font.pointSize: subsurfaceTheme.smallPointSize | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 				Controls.Label { | 
					
						
							| 
									
										
										
										
											2017-04-15 13:32:16 -07:00
										 |  |  | 					text: latitude | 
					
						
							| 
									
										
										
										
											2017-07-15 18:20:52 +02:00
										 |  |  | 					color: subsurfaceTheme.textColor | 
					
						
							| 
									
										
										
										
											2017-04-15 13:32:16 -07:00
										 |  |  | 					font.pointSize: subsurfaceTheme.smallPointSize | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 				Controls.Label { | 
					
						
							| 
									
										
										
										
											2017-04-15 13:32:16 -07:00
										 |  |  | 					text: qsTr('Longitude: ') | 
					
						
							| 
									
										
										
										
											2017-07-15 18:20:52 +02:00
										 |  |  | 					color: subsurfaceTheme.textColor | 
					
						
							| 
									
										
										
										
											2017-04-15 13:32:16 -07:00
										 |  |  | 					opacity: 0.6 | 
					
						
							|  |  |  | 					font.pointSize: subsurfaceTheme.smallPointSize | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 				Controls.Label { | 
					
						
							| 
									
										
										
										
											2017-04-15 13:32:16 -07:00
										 |  |  | 					text: longitude | 
					
						
							| 
									
										
										
										
											2017-07-15 18:20:52 +02:00
										 |  |  | 					color: subsurfaceTheme.textColor | 
					
						
							| 
									
										
										
										
											2017-04-15 13:32:16 -07:00
										 |  |  | 					font.pointSize: subsurfaceTheme.smallPointSize | 
					
						
							| 
									
										
										
										
											2016-01-07 21:40:15 -08:00
										 |  |  | 				} | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2016-01-08 21:48:53 -08:00
										 |  |  | 			actions: [ | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 				Kirigami.Action { | 
					
						
							| 
									
										
										
										
											2018-01-02 17:02:19 +01:00
										 |  |  | 					icon { | 
					
						
							|  |  |  | 						name: "trash-empty" | 
					
						
							|  |  |  | 					} | 
					
						
							| 
									
										
										
										
											2016-01-08 21:48:53 -08:00
										 |  |  | 					onTriggered: { | 
					
						
							|  |  |  | 						print("delete this!") | 
					
						
							| 
									
										
										
										
											2016-01-08 23:18:41 -08:00
										 |  |  | 						manager.deleteGpsFix(when) | 
					
						
							| 
									
										
										
										
											2016-01-08 21:48:53 -08:00
										 |  |  | 					} | 
					
						
							| 
									
										
										
										
											2016-01-08 23:17:48 -08:00
										 |  |  | 				}, | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 				Kirigami.Action { | 
					
						
							| 
									
										
										
										
											2018-01-02 17:02:19 +01:00
										 |  |  | 					icon { | 
					
						
							|  |  |  | 						name: "gps" | 
					
						
							|  |  |  | 					} | 
					
						
							| 
									
										
										
										
											2016-01-08 23:17:48 -08:00
										 |  |  | 					onTriggered: { | 
					
						
							| 
									
										
										
										
											2016-04-02 07:09:40 -05:00
										 |  |  | 						showMap(latitude + " " + longitude) | 
					
						
							| 
									
										
										
										
											2016-01-08 23:17:48 -08:00
										 |  |  | 					} | 
					
						
							| 
									
										
										
										
											2016-01-08 21:48:53 -08:00
										 |  |  | 				} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			] | 
					
						
							| 
									
										
										
										
											2016-01-07 21:40:15 -08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 	ListView { | 
					
						
							|  |  |  | 		id: gpsListView | 
					
						
							| 
									
										
										
										
											2016-01-07 21:40:15 -08:00
										 |  |  | 		anchors.fill: parent | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 		model: gpsModel | 
					
						
							|  |  |  | 		currentIndex: -1 | 
					
						
							|  |  |  | 		delegate: gpsDelegate | 
					
						
							|  |  |  | 		boundsBehavior: Flickable.StopAtBounds | 
					
						
							|  |  |  | 		maximumFlickVelocity: parent.height * 5 | 
					
						
							|  |  |  | 		cacheBuffer: Math.max(5000, parent.height * 5) | 
					
						
							|  |  |  | 		focus: true | 
					
						
							|  |  |  | 		clip: true | 
					
						
							| 
									
										
										
										
											2016-01-07 21:40:15 -08:00
										 |  |  | 	} | 
					
						
							|  |  |  | } |