diff --git a/imports/Spectral/Component/Timeline/StateDelegate.qml b/imports/Spectral/Component/Timeline/StateDelegate.qml index 74220bc49..50fa544cf 100644 --- a/imports/Spectral/Component/Timeline/StateDelegate.qml +++ b/imports/Spectral/Component/Timeline/StateDelegate.qml @@ -8,73 +8,47 @@ import Spectral.Dialog 2.0 import Spectral.Effect 2.0 import Spectral.Setting 0.1 -Control { - id: root +RowLayout { + id: row - padding: 8 + Avatar { + Layout.preferredWidth: 24 + Layout.preferredHeight: 24 - contentItem: RowLayout { - id: row + hint: author.displayName + source: author.avatarMediaId + color: author.color - Control { - Layout.alignment: Qt.AlignTop + Component { + id: userDetailDialog - id: authorControl - - padding: 4 - - background: Rectangle { - radius: height / 2 - color: author.color - } - - contentItem: RowLayout { - Avatar { - Layout.preferredWidth: 24 - Layout.preferredHeight: 24 - - hint: author.displayName - source: author.avatarMediaId - color: Qt.darker(author.color, 1.1) - - Component { - id: userDetailDialog - - UserDetailDialog {} - } - - RippleEffect { - anchors.fill: parent - - circular: true - - onClicked: userDetailDialog.createObject(ApplicationWindow.overlay, {"room": currentRoom, "user": author.object, "displayName": author.displayName, "avatarMediaId": author.avatarMediaId, "avatarUrl": author.avatarUrl}).open() - } - } - - Label { - Layout.alignment: Qt.AlignVCenter - - text: author.displayName - font.pixelSize: 13 - font.weight: Font.Medium - color: "white" - rightPadding: 8 - } - } + UserDetailDialog {} } - Label { - Layout.fillWidth: true - Layout.maximumWidth: messageListView.width - authorControl.width - row.spacing - (root.padding * 2) + RippleEffect { + anchors.fill: parent - text: display + " • " + Qt.formatTime(time) - color: MPalette.foreground - font.pixelSize: 13 - font.weight: Font.Medium + circular: true - wrapMode: Label.Wrap - onLinkActivated: Qt.openUrlExternally(link) + onClicked: userDetailDialog.createObject(ApplicationWindow.overlay, {"room": currentRoom, "user": author.object, "displayName": author.displayName, "avatarMediaId": author.avatarMediaId, "avatarUrl": author.avatarUrl}).open() } } + + Label { + Layout.alignment: Qt.AlignVCenter + + text: author.displayName + font.pixelSize: 13 + font.bold: true + } + + Label { + text: model.display + color: MPalette.foreground + font.pixelSize: 13 + font.weight: Font.Medium + + wrapMode: Label.Wrap + onLinkActivated: Qt.openUrlExternally(link) + } } diff --git a/imports/Spectral/Component/Timeline/TextDelegate.qml b/imports/Spectral/Component/Timeline/TextDelegate.qml index 6635f1774..5ab5f2058 100644 --- a/imports/Spectral/Component/Timeline/TextDelegate.qml +++ b/imports/Spectral/Component/Timeline/TextDelegate.qml @@ -2,7 +2,6 @@ import QtQuick 2.12 import org.kde.kirigami 2.4 as Kirigami - TextEdit { text: "" + model.display diff --git a/imports/Spectral/Component/Timeline/TimelineContainer.qml b/imports/Spectral/Component/Timeline/TimelineContainer.qml index 6021ed9c8..28b644871 100644 --- a/imports/Spectral/Component/Timeline/TimelineContainer.qml +++ b/imports/Spectral/Component/Timeline/TimelineContainer.qml @@ -10,12 +10,14 @@ Controls.ItemDelegate { horizontalPadding: Kirigami.Units.largeSpacing verticalPadding: Kirigami.Units.smallSpacing - contentItem: Column { + contentItem: ColumnLayout { id: column SectionDelegate { - anchors.horizontalCenter: parent.horizontalCenter - width: Math.min(implicitWidth, parent.width) + // anchors.horizontalCenter: parent.horizontalCenter + // width: Math.min(implicitWidth, parent.width) + Layout.maximumWidth: parent.width + Layout.alignment: Qt.AlignHCenter visible: showSection } diff --git a/imports/Spectral/Panel/RoomPanel.qml b/imports/Spectral/Panel/RoomPanel.qml index 28e90bafe..b1b940c18 100644 --- a/imports/Spectral/Panel/RoomPanel.qml +++ b/imports/Spectral/Panel/RoomPanel.qml @@ -65,38 +65,38 @@ Kirigami.ScrollablePage { currentRoom.getPreviousContent(20); } -// populate: Transition { -// NumberAnimation { -// property: "opacity"; from: 0; to: 1 -// duration: 200 -// } -// } + // populate: Transition { + // NumberAnimation { + // property: "opacity"; from: 0; to: 1 + // duration: 200 + // } + // } -// add: Transition { -// NumberAnimation { -// property: "opacity"; from: 0; to: 1 -// duration: 200 -// } -// } + // add: Transition { + // NumberAnimation { + // property: "opacity"; from: 0; to: 1 + // duration: 200 + // } + // } -// move: Transition { -// NumberAnimation { -// property: "y"; duration: 200 -// } -// NumberAnimation { -// property: "opacity"; to: 1 -// } -// } + // move: Transition { + // NumberAnimation { + // property: "y"; duration: 200 + // } + // NumberAnimation { + // property: "opacity"; to: 1 + // } + // } -// displaced: Transition { -// NumberAnimation { -// property: "y"; duration: 200 -// easing.type: Easing.OutQuad -// } -// NumberAnimation { -// property: "opacity"; to: 1 -// } -// } + // displaced: Transition { + // NumberAnimation { + // property: "y"; duration: 200 + // easing.type: Easing.OutQuad + // } + // NumberAnimation { + // property: "opacity"; to: 1 + // } + // } delegate: DelegateChooser { role: "eventType" @@ -104,28 +104,34 @@ Kirigami.ScrollablePage { DelegateChoice { roleValue: "state" delegate: TimelineContainer { - width: page.width + width: messageListView.width - StateDelegate {} + innerObject: StateDelegate { + Layout.maximumWidth: parent.width + Layout.alignment: Qt.AlignHCenter + } } } DelegateChoice { roleValue: "emote" delegate: TimelineContainer { - width: page.width + width: messageListView.width - innerObject: StateDelegate {} + innerObject: StateDelegate { + Layout.maximumWidth: parent.width + Layout.alignment: Qt.AlignHCenter + } } } DelegateChoice { roleValue: "message" delegate: TimelineContainer { - width: page.width + width: messageListView.width innerObject: MessageDelegate { - width: parent.width + Layout.fillWidth: true innerObject: TextDelegate { Layout.fillWidth: true @@ -137,10 +143,10 @@ Kirigami.ScrollablePage { DelegateChoice { roleValue: "notice" delegate: TimelineContainer { - width: page.width + width: messageListView.width innerObject: MessageDelegate { - width: parent.width + Layout.fillWidth: true innerObject: TextDelegate { Layout.fillWidth: true @@ -152,10 +158,10 @@ Kirigami.ScrollablePage { DelegateChoice { roleValue: "image" delegate: TimelineContainer { - width: page.width + width: messageListView.width innerObject: MessageDelegate { - width: parent.width + Layout.fillWidth: true innerObject: ImageDelegate { Layout.fillWidth: true @@ -168,10 +174,10 @@ Kirigami.ScrollablePage { DelegateChoice { roleValue: "audio" delegate: TimelineContainer { - width: page.width + width: messageListView.width innerObject: MessageDelegate { - width: parent.width + Layout.fillWidth: true innerObject: AudioDelegate { Layout.fillWidth: true @@ -183,10 +189,10 @@ Kirigami.ScrollablePage { DelegateChoice { roleValue: "video" delegate: TimelineContainer { - width: page.width + width: messageListView.width innerObject: MessageDelegate { - width: parent.width + Layout.fillWidth: true innerObject: AudioDelegate { Layout.fillWidth: true @@ -198,10 +204,10 @@ Kirigami.ScrollablePage { DelegateChoice { roleValue: "file" delegate: TimelineContainer { - width: page.width + width: messageListView.width innerObject: MessageDelegate { - width: parent.width + Layout.fillWidth: true innerObject: FileDelegate { Layout.fillWidth: true diff --git a/src/messageeventmodel.cpp b/src/messageeventmodel.cpp index b8056cf91..91c393bbf 100644 --- a/src/messageeventmodel.cpp +++ b/src/messageeventmodel.cpp @@ -459,7 +459,7 @@ QVariant MessageEventModel::data(const QModelIndex& idx, int role) const { } if (role == ShowAuthorRole) { - for (auto r = row + 1; r < 0; ++r) { + for (auto r = row + 1; r < rowCount(); ++r) { auto i = index(r); if (data(i, SpecialMarksRole) != EventStatus::Hidden) { return data(i, AuthorRole) != data(idx, AuthorRole) ||