From 7c42066d757cc57efde6a72aebc35c45e9a850cc Mon Sep 17 00:00:00 2001 From: miruka Date: Thu, 5 Sep 2019 16:24:49 -0400 Subject: [PATCH] Eventdelegate: Merge menu print and debug console Also fix avatar-message spacing --- TODO.md | 2 +- src/qml/Chat/Timeline/EventContent.qml | 2 +- src/qml/Chat/Timeline/EventDelegate.qml | 29 +++++++++++++------------ src/qml/DebugConsole.qml | 4 ++-- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/TODO.md b/TODO.md index ef8e555d..d135550c 100644 --- a/TODO.md +++ b/TODO.md @@ -11,7 +11,6 @@ - When qml syntax highlighting supports ES6 string interpolation, use them - Fixes - - Scroll to begin/end - `minutesBetween()` for 13:13:58 and 14:15:07 - `# > quote` doesn't color - Pressing backspace in composer sometimes doesn't work @@ -42,6 +41,7 @@ - Copy to X11 selection - Link previews - 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 in `smartVerticalFlick()` diff --git a/src/qml/Chat/Timeline/EventContent.qml b/src/qml/Chat/Timeline/EventContent.qml index e6e54563..03eebc54 100644 --- a/src/qml/Chat/Timeline/EventContent.qml +++ b/src/qml/Chat/Timeline/EventContent.qml @@ -5,7 +5,7 @@ import "../../utils.js" as Utils Row { id: eventContent - spacing: theme.spacing / 2 + spacing: theme.spacing / 1.25 readonly property string eventText: Utils.processedEventText(model) readonly property string eventTime: Utils.formatTime(model.date) diff --git a/src/qml/Chat/Timeline/EventDelegate.qml b/src/qml/Chat/Timeline/EventDelegate.qml index 5259de7b..18162ce1 100644 --- a/src/qml/Chat/Timeline/EventDelegate.qml +++ b/src/qml/Chat/Timeline/EventDelegate.qml @@ -53,6 +53,19 @@ Column { property string hoveredImage: "" + function json() { + return JSON.stringify( + Utils.getItem( + modelSources[[ + "Event", chatPage.userId, chatPage.roomId + ]], + "client_id", + model.client_id + ), + null, 4) + } + + Daybreak { visible: dayBreak width: eventDelegate.width @@ -114,26 +127,14 @@ Column { 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 { icon.name: "settings" text: qsTr("Set as debug console target") visible: debugMode onTriggered: { mainUI.debugConsole.target = [eventDelegate, eventContent] + mainUI.debugConsole.runJS("t[0].json()") } - } + } } } diff --git a/src/qml/DebugConsole.qml b/src/qml/DebugConsole.qml index 2d20d2bc..39a71618 100644 --- a/src/qml/DebugConsole.qml +++ b/src/qml/DebugConsole.qml @@ -72,7 +72,7 @@ Window { wrapMode: Text.Wrap color: theme.chat.message.quote font.family: theme.fontFamily.mono - visible: model.input + visible: Boolean(model.input) Layout.fillWidth: true } @@ -83,7 +83,7 @@ Window { color: model.error ? theme.colors.errorText : theme.colors.text font.family: theme.fontFamily.mono - visible: model.output + visible: Boolean(model.output) Layout.fillWidth: true }