| 
									
										
										
										
											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-30 11:26:47 +01:00
										 |  |  | import QtQuick.Layouts 1.2 | 
					
						
							| 
									
										
										
										
											2017-10-29 13:44:22 +01:00
										 |  |  | import QtQuick.Controls 2.2 as Controls | 
					
						
							| 
									
										
										
										
											2016-03-08 19:38:03 -08:00
										 |  |  | import QtQuick.Window 2.2 | 
					
						
							| 
									
										
										
										
											2018-09-27 22:09:26 +02:00
										 |  |  | import org.kde.kirigami 2.4 as Kirigami | 
					
						
							| 
									
										
										
										
											2018-09-25 12:33:19 +02:00
										 |  |  | import org.subsurfacedivelog.mobile 1.0 | 
					
						
							| 
									
										
										
										
											2015-11-06 21:53:26 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | Kirigami.Page { | 
					
						
							| 
									
										
										
										
											2016-02-12 12:17:43 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 	title: "Theme Information" | 
					
						
							| 
									
										
										
										
											2018-02-16 11:17:20 +01:00
										 |  |  | 	background: Rectangle { color: subsurfaceTheme.backgroundColor } | 
					
						
							| 
									
										
										
										
											2016-05-04 13:59:01 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-10 15:11:04 -08:00
										 |  |  | 	GridLayout { | 
					
						
							|  |  |  | 		id: themetest | 
					
						
							|  |  |  | 		columns: 2 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 		anchors.margins: Kirigami.Units.gridUnit / 2 | 
					
						
							| 
									
										
										
										
											2015-11-06 21:53:26 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 		Kirigami.Heading { | 
					
						
							| 
									
										
										
										
											2016-02-10 15:11:04 -08:00
										 |  |  | 			Layout.columnSpan: 2 | 
					
						
							| 
									
										
										
										
											2016-05-04 13:59:01 -07:00
										 |  |  | 			text: "Theme Information" | 
					
						
							| 
									
										
										
										
											2016-02-10 15:11:04 -08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2015-11-06 21:53:26 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 		Kirigami.Heading { | 
					
						
							| 
									
										
										
										
											2016-05-04 13:59:01 -07:00
										 |  |  | 			text: "Screen" | 
					
						
							| 
									
										
										
										
											2016-02-10 15:11:04 -08:00
										 |  |  | 			Layout.columnSpan: 2 | 
					
						
							|  |  |  | 			level: 3 | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2015-11-06 21:54:54 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 		Controls.Label { | 
					
						
							| 
									
										
										
										
											2016-05-04 13:59:01 -07:00
										 |  |  | 			text: "Geometry (pixels):" | 
					
						
							| 
									
										
										
										
											2016-02-10 15:11:04 -08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 		Controls.Label { | 
					
						
							| 
									
										
										
										
											2016-02-10 15:11:04 -08:00
										 |  |  | 			text: rootItem.width + "x" + rootItem.height | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2015-12-03 23:27:27 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 		Controls.Label { | 
					
						
							| 
									
										
										
										
											2016-05-04 13:59:01 -07:00
										 |  |  | 			text: "Geometry (gridUnits):" | 
					
						
							| 
									
										
										
										
											2016-02-10 15:11:04 -08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 		Controls.Label { | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 			text: Math.round(rootItem.width / Kirigami.Units.gridUnit) + "x" + Math.round(rootItem.height / Kirigami.Units.gridUnit) | 
					
						
							| 
									
										
										
										
											2016-02-10 15:11:04 -08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2015-12-08 02:07:31 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 		Controls.Label { | 
					
						
							| 
									
										
										
										
											2016-05-04 13:59:01 -07:00
										 |  |  | 			text: "Units.gridUnit:" | 
					
						
							| 
									
										
										
										
											2016-02-10 15:11:04 -08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 		Controls.Label { | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 			text: Kirigami.Units.gridUnit | 
					
						
							| 
									
										
										
										
											2016-02-10 15:11:04 -08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2015-11-06 21:54:54 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 		Controls.Label { | 
					
						
							| 
									
										
										
										
											2016-05-04 13:59:01 -07:00
										 |  |  | 			text: "Units.devicePixelRatio:" | 
					
						
							| 
									
										
										
										
											2016-02-10 15:11:04 -08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 		Controls.Label { | 
					
						
							| 
									
										
										
										
											2016-03-08 19:38:03 -08:00
										 |  |  | 			text: Screen.devicePixelRatio | 
					
						
							| 
									
										
										
										
											2016-02-10 15:11:04 -08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2015-11-06 21:54:54 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 21:26:54 +01:00
										 |  |  | 		Kirigami.Heading { | 
					
						
							| 
									
										
										
										
											2016-05-04 13:59:01 -07:00
										 |  |  | 			text: "Font Metrics" | 
					
						
							| 
									
										
										
										
											2016-02-10 15:11:04 -08:00
										 |  |  | 			level: 3 | 
					
						
							|  |  |  | 			Layout.columnSpan: 2 | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2015-12-08 02:07:31 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												mobile, QML: introduce basePointSize in subsurfaceTheme
By manipulation the used font pointSize property, we can dynamically
scale fonts and derived UI objects. At the same time, we have
some logic to determine the default font, its size, etc, for example
depending on screen properties. The scaling of the UI (and its font)
does not need to interfere with those defaults.
However, when we want to reset the pointSize, we alter the default, so
a backup of the default is needed. Ok, not al full backup, as the only
thing we like to manipulate is the pointSize, to which we want to be
able to return.
All this leads to this commit. A basePointSize property is added, that
is initialized from the default. Due to the binding logic of the QML
engine, it is not a classic initialization, but a binding between the
2 properties. We need to break that binding explicitly, so that
the original PointSize is always preserved.
In addition, a display of the new font property is added to the
developers theme test.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
											
										 
											2018-09-25 12:48:48 +02:00
										 |  |  | 		Controls.Label { | 
					
						
							|  |  |  | 			text: "basePointSize:" | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		Controls.Label { | 
					
						
							|  |  |  | 			text: subsurfaceTheme.basePointSize | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 		Controls.Label { | 
					
						
							| 
									
										
										
										
											2016-05-04 13:59:01 -07:00
										 |  |  | 			text: "FontMetrics pointSize:" | 
					
						
							| 
									
										
										
										
											2016-02-10 15:11:04 -08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 		Controls.Label { | 
					
						
							| 
									
										
										
										
											2018-09-25 12:33:19 +02:00
										 |  |  | 			text: fontMetrics.font.pointSize | 
					
						
							| 
									
										
										
										
											2016-02-10 15:11:04 -08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2015-11-06 21:54:54 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 		Controls.Label { | 
					
						
							| 
									
										
										
										
											2016-05-04 13:59:01 -07:00
										 |  |  | 			text: "FontMetrics pixelSize:" | 
					
						
							| 
									
										
										
										
											2016-02-10 15:11:04 -08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 		Controls.Label { | 
					
						
							| 
									
										
										
										
											2018-09-25 12:33:19 +02:00
										 |  |  | 			text: Number(fontMetrics.height).toFixed(2) | 
					
						
							| 
									
										
										
										
											2016-02-10 15:11:04 -08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2015-11-06 21:54:54 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 		Controls.Label { | 
					
						
							| 
									
										
										
										
											2016-05-04 13:59:01 -07:00
										 |  |  | 			text: "FontMetrics devicePixelRatio:" | 
					
						
							| 
									
										
										
										
											2016-02-10 15:11:04 -08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 		Controls.Label { | 
					
						
							| 
									
										
										
										
											2018-09-25 12:33:19 +02:00
										 |  |  | 			text: Number(fontMetrics.height / fontMetrics.font.pointSize).toFixed(2) | 
					
						
							| 
									
										
										
										
											2016-02-10 15:11:04 -08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2015-11-06 21:53:26 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 		Controls.Label { | 
					
						
							| 
									
										
										
										
											2016-05-04 13:59:01 -07:00
										 |  |  | 			text: "Text item pixelSize:" | 
					
						
							| 
									
										
										
										
											2016-02-10 15:11:04 -08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		Text { | 
					
						
							| 
									
										
										
										
											2018-09-25 12:33:19 +02:00
										 |  |  | 			text: fontMetrics.font.pixelSize | 
					
						
							| 
									
										
										
										
											2016-02-10 15:11:04 -08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2015-11-06 21:57:01 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 		Controls.Label { | 
					
						
							| 
									
										
										
										
											2016-05-04 13:59:01 -07:00
										 |  |  | 			text: "Text item pointSize:" | 
					
						
							| 
									
										
										
										
											2016-02-10 15:11:04 -08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		Text { | 
					
						
							| 
									
										
										
										
											2018-09-25 12:33:19 +02:00
										 |  |  | 			text: fontMetrics.font.pointSize | 
					
						
							| 
									
										
										
										
											2016-02-10 15:11:04 -08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2015-11-06 21:57:01 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 		Controls.Label { | 
					
						
							| 
									
										
										
										
											2016-05-04 13:59:01 -07:00
										 |  |  | 			text: "Pixel density:" | 
					
						
							| 
									
										
										
										
											2016-04-05 16:50:43 -07:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		Text { | 
					
						
							| 
									
										
										
										
											2016-08-15 20:48:23 -07:00
										 |  |  | 			text: Number(Screen.pixelDensity).toFixed(2) | 
					
						
							| 
									
										
										
										
											2016-04-05 16:50:43 -07:00
										 |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 		Controls.Label { | 
					
						
							| 
									
										
										
										
											2016-05-04 13:59:01 -07:00
										 |  |  | 			text: "Height of default font:" | 
					
						
							| 
									
										
										
										
											2016-04-05 16:50:43 -07:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		Text { | 
					
						
							| 
									
										
										
										
											2018-09-25 12:33:19 +02:00
										 |  |  | 			text: Number(fontMetrics.font.pixelSize / Screen.pixelDensity).toFixed(2) + "mm" | 
					
						
							| 
									
										
										
										
											2016-04-05 16:50:43 -07:00
										 |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 		Controls.Label { | 
					
						
							| 
									
										
										
										
											2017-04-13 18:21:50 -07:00
										 |  |  | 			text: "2cm x 2cm square:" | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		Rectangle { | 
					
						
							|  |  |  | 			width: Math.round(Screen.pixelDensity * 20) | 
					
						
							|  |  |  | 			height: Math.round(Screen.pixelDensity * 20) | 
					
						
							|  |  |  | 			color: "black" | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-12 14:25:22 +02:00
										 |  |  | 		Controls.Label { | 
					
						
							| 
									
										
										
										
											2016-02-10 15:11:04 -08:00
										 |  |  | 			Layout.columnSpan: 2 | 
					
						
							|  |  |  | 			Layout.fillHeight: true | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2015-11-06 21:53:26 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | } |