Optimized fill of feed items by moving the fill of the hidden area to the first expand of the frame.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8514 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2015-06-17 18:59:12 +00:00
parent 4cb081f4ff
commit 846d5f4f50
27 changed files with 152 additions and 41 deletions

View file

@ -34,6 +34,7 @@
#include "gui/RetroShareLink.h"
#include "util/HandleRichText.h"
#include "util/DateTime.h"
#include "util/stringutil.h"
#include <iostream>
@ -311,7 +312,9 @@ void GxsChannelPostItem::fill()
{
/* subject */
ui->titleLabel->setText(QString::fromUtf8(mPost.mMeta.mMsgName.c_str()));
ui->subjectLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(mPost.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
// fill first 4 lines of message
ui->subjectLabel->setText(RsHtml().formatText(NULL, RsStringUtil::CopyLines(QString::fromUtf8(mPost.mMsg.c_str()), 4), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
//QString score = QString::number(post.mTopScore);
// scoreLabel->setText(score);
@ -376,8 +379,10 @@ void GxsChannelPostItem::fill()
voteDownButton->setEnabled(false);
}*/
ui->msgLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(mPost.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
ui->msgFrame->setVisible(!mPost.mMsg.empty());
if (wasExpanded() || ui->expandFrame->isVisible()) {
fillExpandFrame();
}
ui->datetimelabel->setText(DateTime::formatLongDateTime(mPost.mMeta.mPublishTs));
@ -427,6 +432,11 @@ void GxsChannelPostItem::fill()
mInFill = false;
}
void GxsChannelPostItem::fillExpandFrame()
{
ui->msgLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(mPost.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
}
QString GxsChannelPostItem::messageName()
{
return QString::fromUtf8(mPost.mMeta.mMsgName.c_str());
@ -552,7 +562,7 @@ void GxsChannelPostItem::updateItem()
//downloadButton->setEnabled(true);
}
void GxsChannelPostItem::expand(bool open)
void GxsChannelPostItem::doExpand(bool open)
{
if (mFeedHolder)
{
@ -582,6 +592,15 @@ void GxsChannelPostItem::expand(bool open)
}
}
void GxsChannelPostItem::expandFill(bool first)
{
GxsFeedItem::expandFill(first);
if (first) {
fillExpandFrame();
}
}
void GxsChannelPostItem::toggle()
{
expand(ui->expandFrame->isHidden());