Skip to content
Snippets Groups Projects
Verified Commit 457f42c9 authored by Nicolas Werner's avatar Nicolas Werner
Browse files

Fix pending reply sizing

parent bd1cadb6
No related branches found
No related tags found
No related merge requests found
Pipeline #5258 passed
...@@ -33,6 +33,7 @@ Rectangle { ...@@ -33,6 +33,7 @@ Rectangle {
userColor: TimelineManager.userColor(modelData.userId, palette.window) userColor: TimelineManager.userColor(modelData.userId, palette.window)
visible: room && room.reply visible: room && room.reply
maxWidth: parent.width - anchors.leftMargin - anchors.rightMargin maxWidth: parent.width - anchors.leftMargin - anchors.rightMargin
limitHeight: true
} }
ImageButton { ImageButton {
id: closeReplyButton id: closeReplyButton
......
...@@ -20,9 +20,10 @@ AbstractButton { ...@@ -20,9 +20,10 @@ AbstractButton {
property string userId: eventId ? room.dataById(eventId, Room.UserId, "") : "" property string userId: eventId ? room.dataById(eventId, Room.UserId, "") : ""
property string userName: eventId ? room.dataById(eventId, Room.UserName, "") : "" property string userName: eventId ? room.dataById(eventId, Room.UserName, "") : ""
implicitHeight: replyContainer.implicitHeight implicitHeight: replyContainer.height
implicitWidth: replyContainer.implicitWidth implicitWidth: replyContainer.implicitWidth
required property int maxWidth required property int maxWidth
property bool limitHeight: false
NhekoCursorShape { NhekoCursorShape {
anchors.fill: parent anchors.fill: parent
...@@ -48,6 +49,7 @@ AbstractButton { ...@@ -48,6 +49,7 @@ AbstractButton {
replyTo: "" replyTo: ""
mainInset: 4 + Nheko.paddingMedium mainInset: 4 + Nheko.paddingMedium
maxWidth: r.maxWidth maxWidth: r.maxWidth
limitAsReply: r.limitHeight
//height: replyContainer.implicitHeight //height: replyContainer.implicitHeight
data: Row { data: Row {
...@@ -55,6 +57,10 @@ AbstractButton { ...@@ -55,6 +57,10 @@ AbstractButton {
spacing: Nheko.paddingSmall spacing: Nheko.paddingSmall
clip: r.limitHeight
height: Math.min( timelineEvent.main?.height, timelineView.height / 10) + Nheko.paddingSmall + usernameBtn.height
Rectangle { Rectangle {
id: colorline id: colorline
...@@ -71,6 +77,7 @@ AbstractButton { ...@@ -71,6 +77,7 @@ AbstractButton {
AbstractButton { AbstractButton {
id: usernameBtn id: usernameBtn
contentItem: Label { contentItem: Label {
id: userName_ id: userName_
text: r.userName text: r.userName
......
...@@ -142,7 +142,7 @@ EventDelegateChooser::DelegateIncubator::setInitialState(QObject *obj) ...@@ -142,7 +142,7 @@ EventDelegateChooser::DelegateIncubator::setInitialState(QObject *obj)
auto attached = qobject_cast<EventDelegateChooserAttachedType *>( auto attached = qobject_cast<EventDelegateChooserAttachedType *>(
qmlAttachedPropertiesObject<EventDelegateChooser>(obj)); qmlAttachedPropertiesObject<EventDelegateChooser>(obj));
Q_ASSERT(attached != nullptr); Q_ASSERT(attached != nullptr);
attached->setIsReply(this->forReply); attached->setIsReply(this->forReply || chooser.limitAsReply_);
for (const auto &role : roles) { for (const auto &role : roles) {
const auto &roleName = roleNames[role.role()]; const auto &roleName = roleNames[role.role()];
......
...@@ -137,6 +137,7 @@ class EventDelegateChooser : public QQuickItem ...@@ -137,6 +137,7 @@ class EventDelegateChooser : public QQuickItem
Q_PROPERTY(int maxWidth READ maxWidth WRITE setMaxWidth NOTIFY maxWidthChanged) Q_PROPERTY(int maxWidth READ maxWidth WRITE setMaxWidth NOTIFY maxWidthChanged)
Q_PROPERTY(int replyInset READ replyInset WRITE setReplyInset NOTIFY replyInsetChanged) Q_PROPERTY(int replyInset READ replyInset WRITE setReplyInset NOTIFY replyInsetChanged)
Q_PROPERTY(int mainInset READ mainInset WRITE setMainInset NOTIFY mainInsetChanged) Q_PROPERTY(int mainInset READ mainInset WRITE setMainInset NOTIFY mainInsetChanged)
Q_PROPERTY(bool limitAsReply READ limitAsReply WRITE setLimitAsReply NOTIFY limitAsReplyChanged)
public: public:
QQmlListProperty<EventDelegateChoice> choices(); QQmlListProperty<EventDelegateChoice> choices();
...@@ -156,6 +157,12 @@ public: ...@@ -156,6 +157,12 @@ public:
sameWidth_ = width; sameWidth_ = width;
emit sameWidthChanged(); emit sameWidthChanged();
} }
bool limitAsReply() const { return limitAsReply_; }
void setLimitAsReply(bool width)
{
limitAsReply_ = width;
emit limitAsReplyChanged();
}
int maxWidth() const { return maxWidth_; } int maxWidth() const { return maxWidth_; }
void setMaxWidth(int width) void setMaxWidth(int width)
{ {
...@@ -229,6 +236,7 @@ signals: ...@@ -229,6 +236,7 @@ signals:
void eventIdChanged(); void eventIdChanged();
void replyToChanged(); void replyToChanged();
void sameWidthChanged(); void sameWidthChanged();
void limitAsReplyChanged();
void maxWidthChanged(); void maxWidthChanged();
void replyInsetChanged(); void replyInsetChanged();
void mainInsetChanged(); void mainInsetChanged();
...@@ -264,10 +272,11 @@ private: ...@@ -264,10 +272,11 @@ private:
TimelineModel *room_{nullptr}; TimelineModel *room_{nullptr};
QString eventId_; QString eventId_;
QString replyId; QString replyId;
bool sameWidth_ = false; bool sameWidth_ = false;
int maxWidth_ = 400; bool limitAsReply_ = false;
int replyInset_ = 0; int maxWidth_ = 400;
int mainInset_ = 0; int replyInset_ = 0;
int mainInset_ = 0;
static void appendChoice(QQmlListProperty<EventDelegateChoice> *, EventDelegateChoice *); static void appendChoice(QQmlListProperty<EventDelegateChoice> *, EventDelegateChoice *);
static qsizetype choiceCount(QQmlListProperty<EventDelegateChoice> *); static qsizetype choiceCount(QQmlListProperty<EventDelegateChoice> *);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment