mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-06 21:58:57 -04:00
attempt to fix channel post auto-size by limiting the number of lines from message to display in summary depending on available size
This commit is contained in:
parent
719b414a82
commit
1dea00d2cb
1 changed files with 13 additions and 10 deletions
|
@ -382,6 +382,14 @@ void GxsChannelPostItem::fill()
|
||||||
|
|
||||||
QString title;
|
QString title;
|
||||||
|
|
||||||
|
if(mPost.mThumbnail.mData != NULL)
|
||||||
|
{
|
||||||
|
QPixmap thumbnail;
|
||||||
|
thumbnail.loadFromData(mPost.mThumbnail.mData, mPost.mThumbnail.mSize, "PNG");
|
||||||
|
// Wiping data - as its been passed to thumbnail.
|
||||||
|
ui->logoLabel->setPixmap(thumbnail);
|
||||||
|
}
|
||||||
|
|
||||||
if (!mIsHome)
|
if (!mIsHome)
|
||||||
{
|
{
|
||||||
if (mCloseOnRead && !IS_MSG_NEW(mPost.mMeta.mMsgStatus)) {
|
if (mCloseOnRead && !IS_MSG_NEW(mPost.mMeta.mMsgStatus)) {
|
||||||
|
@ -419,9 +427,12 @@ void GxsChannelPostItem::fill()
|
||||||
/* subject */
|
/* subject */
|
||||||
ui->titleLabel->setText(QString::fromUtf8(mPost.mMeta.mMsgName.c_str()));
|
ui->titleLabel->setText(QString::fromUtf8(mPost.mMeta.mMsgName.c_str()));
|
||||||
|
|
||||||
|
uint32_t autorized_lines = (int)floor((ui->logoLabel->height() - ui->titleLabel->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
|
// 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()), 4), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
ui->subjectLabel->setText(RsHtml().formatText(NULL, RsStringUtil::CopyLines(QString::fromUtf8(mPost.mMsg.c_str()), autorized_lines), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||||
ui->subjectLabel->setText(RsStringUtil::CopyLines(QString::fromUtf8(mPost.mMsg.c_str()), 4)) ;
|
|
||||||
|
//ui->subjectLabel->setText(RsStringUtil::CopyLines(QString::fromUtf8(mPost.mMsg.c_str()), 2)) ;
|
||||||
|
|
||||||
//QString score = QString::number(post.mTopScore);
|
//QString score = QString::number(post.mTopScore);
|
||||||
// scoreLabel->setText(score);
|
// scoreLabel->setText(score);
|
||||||
|
@ -529,14 +540,6 @@ void GxsChannelPostItem::fill()
|
||||||
layout->addWidget(fi);
|
layout->addWidget(fi);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mPost.mThumbnail.mData != NULL)
|
|
||||||
{
|
|
||||||
QPixmap thumbnail;
|
|
||||||
thumbnail.loadFromData(mPost.mThumbnail.mData, mPost.mThumbnail.mSize, "PNG");
|
|
||||||
// Wiping data - as its been passed to thumbnail.
|
|
||||||
ui->logoLabel->setPixmap(thumbnail);
|
|
||||||
}
|
|
||||||
|
|
||||||
mInFill = false;
|
mInFill = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue