diff --git a/resources/qml/ReplyPopup.qml b/resources/qml/ReplyPopup.qml index 17ce7ee403384e5f9aeef989f8a95a829f8be914..7f2917cc3224808c44fd0b2137ed2798c40a57ad 100644 --- a/resources/qml/ReplyPopup.qml +++ b/resources/qml/ReplyPopup.qml @@ -33,6 +33,7 @@ Rectangle { userColor: TimelineManager.userColor(modelData.userId, palette.window) visible: room && room.reply maxWidth: parent.width - anchors.leftMargin - anchors.rightMargin + limitHeight: true } ImageButton { id: closeReplyButton diff --git a/resources/qml/delegates/Reply.qml b/resources/qml/delegates/Reply.qml index ff46347f16504dedf41e34b0b5d9a5f146888a68..f0884a0644b603570d221b49808d42451eb649f4 100644 --- a/resources/qml/delegates/Reply.qml +++ b/resources/qml/delegates/Reply.qml @@ -20,9 +20,10 @@ AbstractButton { property string userId: eventId ? room.dataById(eventId, Room.UserId, "") : "" property string userName: eventId ? room.dataById(eventId, Room.UserName, "") : "" - implicitHeight: replyContainer.implicitHeight + implicitHeight: replyContainer.height implicitWidth: replyContainer.implicitWidth required property int maxWidth + property bool limitHeight: false NhekoCursorShape { anchors.fill: parent @@ -48,6 +49,7 @@ AbstractButton { replyTo: "" mainInset: 4 + Nheko.paddingMedium maxWidth: r.maxWidth + limitAsReply: r.limitHeight //height: replyContainer.implicitHeight data: Row { @@ -55,6 +57,10 @@ AbstractButton { spacing: Nheko.paddingSmall + clip: r.limitHeight + + height: Math.min( timelineEvent.main?.height, timelineView.height / 10) + Nheko.paddingSmall + usernameBtn.height + Rectangle { id: colorline @@ -71,6 +77,7 @@ AbstractButton { AbstractButton { id: usernameBtn + contentItem: Label { id: userName_ text: r.userName diff --git a/src/timeline/EventDelegateChooser.cpp b/src/timeline/EventDelegateChooser.cpp index f299b991439fb155e7d50802963f79ecbbd2c301..5ce8d63e9e4607388da98795a197dd6811c24070 100644 --- a/src/timeline/EventDelegateChooser.cpp +++ b/src/timeline/EventDelegateChooser.cpp @@ -142,7 +142,7 @@ EventDelegateChooser::DelegateIncubator::setInitialState(QObject *obj) auto attached = qobject_cast<EventDelegateChooserAttachedType *>( qmlAttachedPropertiesObject<EventDelegateChooser>(obj)); Q_ASSERT(attached != nullptr); - attached->setIsReply(this->forReply); + attached->setIsReply(this->forReply || chooser.limitAsReply_); for (const auto &role : roles) { const auto &roleName = roleNames[role.role()]; diff --git a/src/timeline/EventDelegateChooser.h b/src/timeline/EventDelegateChooser.h index df1953abfcc7fb22724bbd897a1d222b27927901..139b143ad802ec9cca23aec24faea01daf2427be 100644 --- a/src/timeline/EventDelegateChooser.h +++ b/src/timeline/EventDelegateChooser.h @@ -137,6 +137,7 @@ class EventDelegateChooser : public QQuickItem Q_PROPERTY(int maxWidth READ maxWidth WRITE setMaxWidth NOTIFY maxWidthChanged) Q_PROPERTY(int replyInset READ replyInset WRITE setReplyInset NOTIFY replyInsetChanged) Q_PROPERTY(int mainInset READ mainInset WRITE setMainInset NOTIFY mainInsetChanged) + Q_PROPERTY(bool limitAsReply READ limitAsReply WRITE setLimitAsReply NOTIFY limitAsReplyChanged) public: QQmlListProperty<EventDelegateChoice> choices(); @@ -156,6 +157,12 @@ public: sameWidth_ = width; emit sameWidthChanged(); } + bool limitAsReply() const { return limitAsReply_; } + void setLimitAsReply(bool width) + { + limitAsReply_ = width; + emit limitAsReplyChanged(); + } int maxWidth() const { return maxWidth_; } void setMaxWidth(int width) { @@ -229,6 +236,7 @@ signals: void eventIdChanged(); void replyToChanged(); void sameWidthChanged(); + void limitAsReplyChanged(); void maxWidthChanged(); void replyInsetChanged(); void mainInsetChanged(); @@ -264,10 +272,11 @@ private: TimelineModel *room_{nullptr}; QString eventId_; QString replyId; - bool sameWidth_ = false; - int maxWidth_ = 400; - int replyInset_ = 0; - int mainInset_ = 0; + bool sameWidth_ = false; + bool limitAsReply_ = false; + int maxWidth_ = 400; + int replyInset_ = 0; + int mainInset_ = 0; static void appendChoice(QQmlListProperty<EventDelegateChoice> *, EventDelegateChoice *); static qsizetype choiceCount(QQmlListProperty<EventDelegateChoice> *);