From 4d32adaa41847f5bd0b9f708d6f5c2a9142adf39 Mon Sep 17 00:00:00 2001 From: miruka Date: Thu, 18 Jul 2019 07:22:41 -0400 Subject: [PATCH] Animate event side change --- src/qml/Chat/Timeline/EventContent.qml | 15 +++++++++------ src/qml/Chat/Timeline/EventDelegate.qml | 6 ++++-- src/qml/UI.qml | 19 ++++++++++--------- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/qml/Chat/Timeline/EventContent.qml b/src/qml/Chat/Timeline/EventContent.qml index 0a5037a3..5eb1fa14 100644 --- a/src/qml/Chat/Timeline/EventContent.qml +++ b/src/qml/Chat/Timeline/EventContent.qml @@ -7,17 +7,19 @@ import "../../Base" import "../../utils.js" as Utils Row { - id: messageContent + id: eventContent spacing: theme.spacing / 2 - layoutDirection: onRight ? Qt.RightToLeft : Qt.LeftToRight + // layoutDirection: onRight ? Qt.RightToLeft : Qt.LeftToRight HUserAvatar { id: avatar userId: model.senderId - width: model.showNameLine ? 48 : 28 - height: combine ? 1 : model.showNameLine ? 48 : 28 + width: onRight ? 0 : model.showNameLine ? 48 : 28 + height: onRight ? 0 : combine ? 1 : model.showNameLine ? 48 : 28 opacity: combine ? 0 : 1 - visible: ! onRight + visible: width > 0 + Behavior on width { HNumberAnimation {} } + Behavior on height { HNumberAnimation {} } } Rectangle { @@ -27,7 +29,7 @@ Row { //width: nameLabel.implicitWidth width: Math.min( - eventList.width - avatar.width - messageContent.spacing, + eventList.width - avatar.width - eventContent.spacing, theme.fontSize.normal * 0.5 * 75, // 600 with 16px font Math.max( nameLabel.visible ? nameLabel.implicitWidth : 0, @@ -44,6 +46,7 @@ Row { width: parent.width height: model.showNameLine && ! onRight && ! combine ? implicitHeight : 0 + Behavior on height { HNumberAnimation {} } visible: height > 0 id: nameLabel diff --git a/src/qml/Chat/Timeline/EventDelegate.qml b/src/qml/Chat/Timeline/EventDelegate.qml index cc3649a9..2e5b02c8 100644 --- a/src/qml/Chat/Timeline/EventDelegate.qml +++ b/src/qml/Chat/Timeline/EventDelegate.qml @@ -78,7 +78,9 @@ Column { } EventContent { - anchors.left: parent.left - anchors.right: onRight ? parent.right : undefined + // anchors.left: parent.left + // anchors.right: onRight ? parent.right : undefined + x: onRight ? parent.width - width : 0 + Behavior on x { HNumberAnimation {} } } } diff --git a/src/qml/UI.qml b/src/qml/UI.qml index 1961da88..582ca6eb 100644 --- a/src/qml/UI.qml +++ b/src/qml/UI.qml @@ -71,19 +71,20 @@ Item { Timer { // TODO: remove this, debug id: initialRoomTimer - interval: 5000 + interval: 4000 repeat: false - // onTriggered: pageStack.showRoom( - // "@test_mary:matrix.org", - // "Rooms", - // "!TSXGsbBbdwsdylIOJZ:matrix.org" + onTriggered: pageStack.showRoom( + "@test_mary:matrix.org", + "Rooms", + // "!TSXGsbBbdwsdylIOJZ:matrix.org" // st + "!VDSsFIzQnXARSCVNxS:matrix.org" // hs // "Invites", // "!xjqvLOGhMVutPXpAqi:matrix.org" - // ) - onTriggered: pageStack.showPage( - "EditAccount/EditAccount", - {"userId": "@test_mary:matrix.org"} ) + // onTriggered: pageStack.showPage( + // "EditAccount/EditAccount", + // {"userId": "@test_mary:matrix.org"} + // ) } onCurrentItemChanged: if (currentItem) {