Eventdelegate: Merge menu print and debug console
Also fix avatar-message spacing
This commit is contained in:
		
							
								
								
									
										2
									
								
								TODO.md
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								TODO.md
									
									
									
									
									
								
							| @@ -11,7 +11,6 @@ | |||||||
|   - When qml syntax highlighting supports ES6 string interpolation, use them |   - When qml syntax highlighting supports ES6 string interpolation, use them | ||||||
|  |  | ||||||
| - Fixes | - Fixes | ||||||
|   - Scroll to begin/end |  | ||||||
|   - `minutesBetween()` for 13:13:58 and 14:15:07 |   - `minutesBetween()` for 13:13:58 and 14:15:07 | ||||||
|   - `# > quote` doesn't color |   - `# > quote` doesn't color | ||||||
|   - Pressing backspace in composer sometimes doesn't work |   - Pressing backspace in composer sometimes doesn't work | ||||||
| @@ -42,6 +41,7 @@ | |||||||
|     - Copy to X11 selection |     - Copy to X11 selection | ||||||
|   - Link previews |   - Link previews | ||||||
|     - Take the previews into account to calculate delegate min height |     - Take the previews into account to calculate delegate min height | ||||||
|  |     - Support images not just at the end of the message | ||||||
|  |  | ||||||
|   - Just use Shortcut onHeld instead of analyzing the current velocity |   - Just use Shortcut onHeld instead of analyzing the current velocity | ||||||
|     in `smartVerticalFlick()` |     in `smartVerticalFlick()` | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ import "../../utils.js" as Utils | |||||||
|  |  | ||||||
| Row { | Row { | ||||||
|     id: eventContent |     id: eventContent | ||||||
|     spacing: theme.spacing / 2 |     spacing: theme.spacing / 1.25 | ||||||
|  |  | ||||||
|     readonly property string eventText: Utils.processedEventText(model) |     readonly property string eventText: Utils.processedEventText(model) | ||||||
|     readonly property string eventTime: Utils.formatTime(model.date) |     readonly property string eventTime: Utils.formatTime(model.date) | ||||||
|   | |||||||
| @@ -53,6 +53,19 @@ Column { | |||||||
|     property string hoveredImage: "" |     property string hoveredImage: "" | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     function json() { | ||||||
|  |         return JSON.stringify( | ||||||
|  |             Utils.getItem( | ||||||
|  |                 modelSources[[ | ||||||
|  |                     "Event", chatPage.userId, chatPage.roomId | ||||||
|  |                 ]], | ||||||
|  |                 "client_id", | ||||||
|  |                 model.client_id | ||||||
|  |             ), | ||||||
|  |         null, 4) | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|     Daybreak { |     Daybreak { | ||||||
|         visible: dayBreak |         visible: dayBreak | ||||||
|         width: eventDelegate.width |         width: eventDelegate.width | ||||||
| @@ -114,26 +127,14 @@ Column { | |||||||
|                 Utils.copyToClipboard(selectableLabelContainer.joinedSelection) |                 Utils.copyToClipboard(selectableLabelContainer.joinedSelection) | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         HMenuItem { |  | ||||||
|             icon.name: "settings" |  | ||||||
|             text: qsTr("Print event item") |  | ||||||
|             visible: debugMode |  | ||||||
|             onTriggered: print(JSON.stringify(Utils.getItem( |  | ||||||
|                 modelSources[[ |  | ||||||
|                     "Event", chatPage.userId, chatPage.roomId |  | ||||||
|                 ]], |  | ||||||
|                 "client_id", |  | ||||||
|                 model.client_id |  | ||||||
|             ), null, 4)) |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         HMenuItem { |         HMenuItem { | ||||||
|             icon.name: "settings" |             icon.name: "settings" | ||||||
|             text: qsTr("Set as debug console target") |             text: qsTr("Set as debug console target") | ||||||
|             visible: debugMode |             visible: debugMode | ||||||
|             onTriggered: { |             onTriggered: { | ||||||
|                 mainUI.debugConsole.target = [eventDelegate, eventContent] |                 mainUI.debugConsole.target = [eventDelegate, eventContent] | ||||||
|  |                 mainUI.debugConsole.runJS("t[0].json()") | ||||||
|             } |             } | ||||||
|         }   |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -72,7 +72,7 @@ Window { | |||||||
|                     wrapMode: Text.Wrap |                     wrapMode: Text.Wrap | ||||||
|                     color: theme.chat.message.quote |                     color: theme.chat.message.quote | ||||||
|                     font.family: theme.fontFamily.mono |                     font.family: theme.fontFamily.mono | ||||||
|                     visible: model.input |                     visible: Boolean(model.input) | ||||||
|  |  | ||||||
|                     Layout.fillWidth: true |                     Layout.fillWidth: true | ||||||
|                 } |                 } | ||||||
| @@ -83,7 +83,7 @@ Window { | |||||||
|                     color: model.error ? |                     color: model.error ? | ||||||
|                            theme.colors.errorText : theme.colors.text |                            theme.colors.errorText : theme.colors.text | ||||||
|                     font.family: theme.fontFamily.mono |                     font.family: theme.fontFamily.mono | ||||||
|                     visible: model.output |                     visible: Boolean(model.output) | ||||||
|  |  | ||||||
|                     Layout.fillWidth: true |                     Layout.fillWidth: true | ||||||
|                 } |                 } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	