From 1e1032ec9420a29c85bdaa40c09c7e37d5d4989e Mon Sep 17 00:00:00 2001 From: defnax Date: Sat, 27 Feb 2021 20:43:41 +0100 Subject: [PATCH] attempt to fix some issues on comments feeds --- retroshare-gui/src/gui/feeds/BoardsCommentsItem.cpp | 4 +++- retroshare-gui/src/gui/feeds/BoardsCommentsItem.ui | 8 +++++++- retroshare-gui/src/gui/feeds/ChannelsCommentsItem.cpp | 4 ++-- retroshare-gui/src/gui/feeds/ChannelsCommentsItem.ui | 11 ++++++++++- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/retroshare-gui/src/gui/feeds/BoardsCommentsItem.cpp b/retroshare-gui/src/gui/feeds/BoardsCommentsItem.cpp index 757d10ec5..670567f03 100644 --- a/retroshare-gui/src/gui/feeds/BoardsCommentsItem.cpp +++ b/retroshare-gui/src/gui/feeds/BoardsCommentsItem.cpp @@ -422,7 +422,9 @@ void BoardsCommentsItem::makeUpVote() void BoardsCommentsItem::setComment(const RsGxsComment& cmt) { - ui->commLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(cmt.mComment.c_str()), RSHTML_FORMATTEXT_EMBED_LINKS)); + uint32_t autorized_lines = (int)floor((ui->avatarLabel->height() - ui->buttonHLayout->sizeHint().height())/QFontMetricsF(ui->subjectLabel->font()).height()); + + ui->commLabel->setText(RsHtml().formatText(NULL, RsStringUtil::CopyLines(QString::fromUtf8(cmt.mComment.c_str()), autorized_lines), RSHTML_FORMATTEXT_EMBED_LINKS));; ui->nameLabel->setId(cmt.mMeta.mAuthorId); ui->datetimeLabel->setText(DateTime::formatLongDateTime(cmt.mMeta.mPublishTs)); diff --git a/retroshare-gui/src/gui/feeds/BoardsCommentsItem.ui b/retroshare-gui/src/gui/feeds/BoardsCommentsItem.ui index 5b244fe90..b3e529091 100644 --- a/retroshare-gui/src/gui/feeds/BoardsCommentsItem.ui +++ b/retroshare-gui/src/gui/feeds/BoardsCommentsItem.ui @@ -44,6 +44,9 @@ 9 + + 3 + @@ -279,7 +282,7 @@ 20 - 10 + 6 @@ -377,6 +380,9 @@ 0 + + 3 + diff --git a/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.cpp b/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.cpp index bfa33cde9..88b724598 100644 --- a/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.cpp +++ b/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.cpp @@ -305,7 +305,7 @@ void ChannelsCommentsItem::loadMessage() RsQThreadUtils::postToObject( [cmt,this]() { - uint32_t autorized_lines = (int)floor((ui->logoLabel->height() - ui->buttonHLayout->sizeHint().height())/QFontMetricsF(ui->subjectLabel->font()).height()); + uint32_t autorized_lines = (int)floor((ui->avatarLabel->height() - ui->buttonHLayout->sizeHint().height())/QFontMetricsF(ui->subjectLabel->font()).height()); ui->commLabel->setText(RsHtml().formatText(NULL, RsStringUtil::CopyLines(QString::fromUtf8(cmt.mComment.c_str()), autorized_lines), RSHTML_FORMATTEXT_EMBED_LINKS)); @@ -434,7 +434,7 @@ void ChannelsCommentsItem::fill() /* subject */ //ui->titleLabel->setText(QString::fromUtf8(mPost.mMeta.mMsgName.c_str())); - uint32_t autorized_lines = (int)floor((ui->logoLabel->height() - ui->buttonHLayout->sizeHint().height())/QFontMetricsF(ui->subjectLabel->font()).height()); + uint32_t autorized_lines = (int)floor((ui->avatarLabel->height() - ui->buttonHLayout->sizeHint().height())/QFontMetricsF(ui->subjectLabel->font()).height()); // fill first 4 lines of message. (csoler) Disabled the replacement of smileys and links, because the cost is too crazy //ui->subjectLabel->setText(RsHtml().formatText(NULL, RsStringUtil::CopyLines(QString::fromUtf8(mPost.mMsg.c_str()), autorized_lines), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); diff --git a/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.ui b/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.ui index c686adb3c..45c55b841 100644 --- a/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.ui +++ b/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.ui @@ -44,6 +44,12 @@ 9 + + 6 + + + 3 + @@ -262,6 +268,9 @@ 0 + + 3 + @@ -391,7 +400,7 @@ 58 - 10 + 6