| 
									
										
										
										
											2019-09-14 16:05:57 -04:00
										 |  |  | import QtQuick 2.12 | 
					
						
							|  |  |  | import QtQuick.Layouts 1.12 | 
					
						
							| 
									
										
										
										
											2019-11-07 06:44:53 -04:00
										 |  |  | import "../utils.js" as Utils | 
					
						
							| 
									
										
										
										
											2019-09-14 16:05:57 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | HButton { | 
					
						
							|  |  |  |     id: tile | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-14 18:52:43 -04:00
										 |  |  |     signal leftClicked() | 
					
						
							|  |  |  |     signal rightClicked() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-07 06:44:53 -04:00
										 |  |  |     default property alias additionalData: contentItem.data | 
					
						
							| 
									
										
										
										
											2019-09-14 16:05:57 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     readonly property alias title: title | 
					
						
							|  |  |  |     readonly property alias additionalInfo: additionalInfo | 
					
						
							|  |  |  |     readonly property alias rightInfo: rightInfo | 
					
						
							|  |  |  |     readonly property alias subtitle: subtitle | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     property HMenu contextMenu: HMenu {} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-07 06:44:53 -04:00
										 |  |  |     property Component image | 
					
						
							| 
									
										
										
										
											2019-09-14 16:05:57 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-07 06:44:53 -04:00
										 |  |  |     contentItem: HRowLayout { | 
					
						
							|  |  |  |         id: contentItem | 
					
						
							|  |  |  |         spacing: tile.spacing | 
					
						
							| 
									
										
										
										
											2019-09-14 16:05:57 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-07 06:44:53 -04:00
										 |  |  |         HLoader { | 
					
						
							|  |  |  |             sourceComponent: image | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2019-09-14 16:05:57 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-07 06:44:53 -04:00
										 |  |  |         HColumnLayout { | 
					
						
							|  |  |  |             Layout.fillWidth: true | 
					
						
							| 
									
										
										
										
											2019-09-14 16:05:57 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |             HRowLayout { | 
					
						
							| 
									
										
										
										
											2019-11-07 06:44:53 -04:00
										 |  |  |                 spacing: tile.spacing | 
					
						
							| 
									
										
										
										
											2019-09-14 16:05:57 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-07 06:44:53 -04:00
										 |  |  |                 HLabel { | 
					
						
							|  |  |  |                     id: title | 
					
						
							|  |  |  |                     text: "Missing title" | 
					
						
							|  |  |  |                     elide: Text.ElideRight | 
					
						
							|  |  |  |                     verticalAlignment: Qt.AlignVCenter | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     Layout.fillWidth: true | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 HRowLayout { | 
					
						
							|  |  |  |                     id: additionalInfo | 
					
						
							|  |  |  |                     visible: visibleChildren.length > 0 | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2019-09-14 16:05:57 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-07 06:44:53 -04:00
										 |  |  |                 HLabel { | 
					
						
							|  |  |  |                     id: rightInfo | 
					
						
							|  |  |  |                     font.pixelSize: theme.fontSize.small | 
					
						
							|  |  |  |                     color: theme.colors.halfDimText | 
					
						
							| 
									
										
										
										
											2019-09-14 16:05:57 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-07 06:44:53 -04:00
										 |  |  |                     visible: Layout.maximumWidth > 0 | 
					
						
							|  |  |  |                     Layout.maximumWidth: | 
					
						
							| 
									
										
										
										
											2019-12-04 09:08:38 -04:00
										 |  |  |                         text && tile.width >= 160 * theme.uiScale ? | 
					
						
							|  |  |  |                         implicitWidth : 0 | 
					
						
							| 
									
										
										
										
											2019-11-07 06:44:53 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |                     Behavior on Layout.maximumWidth { HNumberAnimation {} } | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2019-09-14 16:05:57 -04:00
										 |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-07 06:44:53 -04:00
										 |  |  |             HRichLabel { | 
					
						
							|  |  |  |                 id: subtitle | 
					
						
							|  |  |  |                 textFormat: Text.StyledText | 
					
						
							|  |  |  |                 font.pixelSize: theme.fontSize.small | 
					
						
							|  |  |  |                 elide: Text.ElideRight | 
					
						
							|  |  |  |                 color: theme.colors.dimText | 
					
						
							| 
									
										
										
										
											2019-09-14 16:05:57 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-07 06:44:53 -04:00
										 |  |  |                 visible: Layout.maximumHeight > 0 | 
					
						
							|  |  |  |                 Layout.maximumHeight: text ? implicitWidth : 0 | 
					
						
							|  |  |  |                 Layout.fillWidth: true | 
					
						
							| 
									
										
										
										
											2019-09-14 16:05:57 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-07 06:44:53 -04:00
										 |  |  |                 Behavior on Layout.maximumHeight { HNumberAnimation {} } | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2019-09-14 16:05:57 -04:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-14 18:52:43 -04:00
										 |  |  |     TapHandler { | 
					
						
							|  |  |  |         acceptedButtons: Qt.LeftButton | 
					
						
							|  |  |  |         onTapped: leftClicked() | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-09-14 16:05:57 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     TapHandler { | 
					
						
							|  |  |  |         acceptedButtons: Qt.RightButton | 
					
						
							| 
									
										
										
										
											2019-09-14 18:52:43 -04:00
										 |  |  |         onTapped: { | 
					
						
							|  |  |  |             rightClicked() | 
					
						
							|  |  |  |             if (contextMenu.count > 0) contextMenu.popup() | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2019-09-14 16:05:57 -04:00
										 |  |  |     } | 
					
						
							|  |  |  | } |