From 388967c7374d9adae3f3168477b25806bdd1b0e0 Mon Sep 17 00:00:00 2001 From: miruka Date: Sat, 6 Jul 2019 17:29:32 -0400 Subject: [PATCH] Improve TypingMembersBar --- TODO.md | 3 +++ src/icons/typing.svg | 1 + src/qml/Base/HScrollableTextArea.qml | 2 -- src/qml/Chat/Chat.qml | 5 ++++- src/qml/Chat/SendBox.qml | 1 + src/qml/Chat/Timeline/EventDelegate.qml | 6 ----- src/qml/Chat/Timeline/EventList.qml | 2 ++ src/qml/Chat/TypingMembersBar.qml | 29 ++++++++++++++++++------- src/qml/EventHandlers/rooms.js | 6 +++++ src/qml/SidePane/PaneToolBar.qml | 1 + 10 files changed, 39 insertions(+), 17 deletions(-) create mode 100644 src/icons/typing.svg diff --git a/TODO.md b/TODO.md index c3ae6950..f78c93e9 100644 --- a/TODO.md +++ b/TODO.md @@ -1,3 +1,6 @@ +- daybreak color +- rename component id that are named "root" +- html links color - invite/leave/forget backend funcs - license headers - replace "property var" by "property " where applicable and diff --git a/src/icons/typing.svg b/src/icons/typing.svg new file mode 100644 index 00000000..a3977ab5 --- /dev/null +++ b/src/icons/typing.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/qml/Base/HScrollableTextArea.qml b/src/qml/Base/HScrollableTextArea.qml index 3d5c4e88..94d317de 100644 --- a/src/qml/Base/HScrollableTextArea.qml +++ b/src/qml/Base/HScrollableTextArea.qml @@ -26,7 +26,5 @@ ScrollView { id: textAreaBackground color: HStyle.controls.textArea.background } - - //Keys.forwardTo: [scrollView] } } diff --git a/src/qml/Chat/Chat.qml b/src/qml/Chat/Chat.qml index b91ce81e..bdb66309 100644 --- a/src/qml/Chat/Chat.qml +++ b/src/qml/Chat/Chat.qml @@ -55,7 +55,10 @@ HColumnLayout { Layout.fillHeight: true } - TypingMembersBar {} + TypingMembersBar { + Layout.fillWidth: true + //Layout.preferredHeight: text ? implicitHeight : 0 + } InviteBanner { visible: category === "Invites" diff --git a/src/qml/Chat/SendBox.qml b/src/qml/Chat/SendBox.qml index bb7b9ed6..958ec90d 100644 --- a/src/qml/Chat/SendBox.qml +++ b/src/qml/Chat/SendBox.qml @@ -27,6 +27,7 @@ HRectangle { HScrollableTextArea { Layout.fillHeight: true Layout.fillWidth: true + Layout.topMargin: Math.max(0, root.Layout.minimumHeight - 34) id: textArea placeholderText: qsTr("Type a message...") diff --git a/src/qml/Chat/Timeline/EventDelegate.qml b/src/qml/Chat/Timeline/EventDelegate.qml index 1cc70b0f..b2ce9f2e 100644 --- a/src/qml/Chat/Timeline/EventDelegate.qml +++ b/src/qml/Chat/Timeline/EventDelegate.qml @@ -75,12 +75,6 @@ Column { width: roomEventDelegate.width } - Item { // TODO: put this in Daybreak.qml? - visible: dayBreak - width: parent.width - height: topPadding - } - EventContent { anchors.right: isOwn ? parent.right : undefined } diff --git a/src/qml/Chat/Timeline/EventList.qml b/src/qml/Chat/Timeline/EventList.qml index 497004a2..66816d88 100644 --- a/src/qml/Chat/Timeline/EventList.qml +++ b/src/qml/Chat/Timeline/EventList.qml @@ -3,6 +3,8 @@ import SortFilterProxyModel 0.2 import "../../Base" HRectangle { + property alias listView: roomEventListView + property int space: 8 color: HStyle.chat.roomEventList.background diff --git a/src/qml/Chat/TypingMembersBar.qml b/src/qml/Chat/TypingMembersBar.qml index 5046dd30..5f671f6f 100644 --- a/src/qml/Chat/TypingMembersBar.qml +++ b/src/qml/Chat/TypingMembersBar.qml @@ -3,17 +3,30 @@ import QtQuick.Layouts 1.3 import "../Base" HRectangle { + property alias label: typingLabel + + implicitWidth: childrenRect.width + implicitHeight: typingLabel.text ? childrenRect.height : 0 color: HStyle.chat.typingMembers.background - Layout.fillWidth: true - Layout.preferredHeight: usersLabel.text ? usersLabel.implicitHeight : 0 + Row { + spacing: 8 + leftPadding: spacing + rightPadding: spacing + topPadding: 2 + bottomPadding: 2 - HLabel { - id: usersLabel - anchors.fill: parent + HIcon { + svgName: "typing" // TODO: animate + height: typingLabel.height + } - text: chatPage.roomInfo.typingText - elide: Text.ElideMiddle - maximumLineCount: 1 + HLabel { + id: typingLabel + text: chatPage.roomInfo.typingText + textFormat: Text.StyledText + elide: Text.ElideMiddle + maximumLineCount: 1 + } } } diff --git a/src/qml/EventHandlers/rooms.js b/src/qml/EventHandlers/rooms.js index 258744c8..0351a355 100644 --- a/src/qml/EventHandlers/rooms.js +++ b/src/qml/EventHandlers/rooms.js @@ -1,9 +1,15 @@ +//Qt.include("../utils.js") + + function typingTextFor(members, our_user_id) { var names = [] for (var i = 0; i < members.length; i++) { if (members[i] != our_user_id) { names.push(users.getUser(members[i]).displayName) + //names.push(coloredNameHtml( + //users.getUser(members[i]).displayName, members[i] + //)) } } diff --git a/src/qml/SidePane/PaneToolBar.qml b/src/qml/SidePane/PaneToolBar.qml index bdbb4ab2..d807b09c 100644 --- a/src/qml/SidePane/PaneToolBar.qml +++ b/src/qml/SidePane/PaneToolBar.qml @@ -12,6 +12,7 @@ HRowLayout { HButton { iconName: "settings" backgroundColor: HStyle.sidePane.settingsButton.background + Layout.preferredHeight: parent.height } HTextField {