mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-20 13:19:07 -04:00
tried to sorted out the layout of channel item
This commit is contained in:
parent
6001517718
commit
765664b4f8
2 changed files with 55 additions and 125 deletions
|
@ -76,59 +76,6 @@ void GxsChannelPostItem::init(const RsGxsMessageId& messageId,const std::set<RsG
|
|||
mLoaded = false ;
|
||||
}
|
||||
|
||||
// This code has been suspended because it adds more complexity than usefulness.
|
||||
// It was used to load a channel post where the post item is already known.
|
||||
|
||||
#ifdef SUSPENDED
|
||||
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, const RsGxsChannelPost &post, bool isHome, bool autoUpdate) :
|
||||
GxsFeedItem(feedHolder, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsGxsChannels, autoUpdate)
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "GxsChannelPostItem::GxsChannelPostItem() Direct Load";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
QVector<RsGxsMessageId> v;
|
||||
bool self = false;
|
||||
|
||||
for(std::set<RsGxsMessageId>::const_iterator it(post.mOlderVersions.begin());it!=post.mOlderVersions.end();++it)
|
||||
{
|
||||
if(*it == post.mMeta.mMsgId)
|
||||
self = true ;
|
||||
|
||||
v.push_back(*it) ;
|
||||
}
|
||||
if(!self)
|
||||
v.push_back(post.mMeta.mMsgId);
|
||||
|
||||
setMessageVersions(v) ;
|
||||
|
||||
setup();
|
||||
|
||||
setGroup(group, false);
|
||||
|
||||
setPost(post,false);
|
||||
mLoaded = false ;
|
||||
}
|
||||
|
||||
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost &post, bool isHome, bool autoUpdate) :
|
||||
GxsFeedItem(feedHolder, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsGxsChannels, autoUpdate)
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "GxsChannelPostItem::GxsChannelPostItem() Direct Load";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
setup();
|
||||
|
||||
mLoaded = true ;
|
||||
requestGroup();
|
||||
setPost(post);
|
||||
requestComment();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void GxsChannelPostItem::paintEvent(QPaintEvent *e)
|
||||
{
|
||||
/* This method employs a trick to trigger a deferred loading. The post and group is requested only
|
||||
|
@ -169,7 +116,6 @@ void GxsChannelPostItem::setup()
|
|||
|
||||
/* clear ui */
|
||||
ui->titleLabel->setText(tr("Loading"));
|
||||
ui->subjectLabel->clear();
|
||||
ui->datetimelabel->clear();
|
||||
ui->filelabel->clear();
|
||||
ui->newCommentLabel->hide();
|
||||
|
@ -208,7 +154,7 @@ void GxsChannelPostItem::setup()
|
|||
ui->warning_label->hide();
|
||||
|
||||
ui->titleLabel->setMinimumWidth(100);
|
||||
ui->subjectLabel->setMinimumWidth(100);
|
||||
//ui->subjectLabel->setMinimumWidth(100);
|
||||
ui->warning_label->setMinimumWidth(100);
|
||||
|
||||
ui->mainFrame->setProperty("new", false);
|
||||
|
@ -431,7 +377,7 @@ void GxsChannelPostItem::fill()
|
|||
ui->titleLabel->setText(title);
|
||||
|
||||
RetroShareLink msgLink = RetroShareLink::createGxsMessageLink(RetroShareLink::TYPE_CHANNEL, mPost.mMeta.mGroupId, mPost.mMeta.mMsgId, messageName());
|
||||
ui->subjectLabel->setText(msgLink.toHtml());
|
||||
//ui->subjectLabel->setText(msgLink.toHtml());
|
||||
|
||||
if (IS_GROUP_SUBSCRIBED(mGroup.mMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroup.mMeta.mSubscribeFlags))
|
||||
{
|
||||
|
@ -454,10 +400,10 @@ void GxsChannelPostItem::fill()
|
|||
/* subject */
|
||||
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());
|
||||
//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
|
||||
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(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()), 2)) ;
|
||||
|
||||
|
@ -534,7 +480,7 @@ void GxsChannelPostItem::fill()
|
|||
|
||||
if ( (mPost.mCount != 0) || (mPost.mSize != 0) ) {
|
||||
ui->filelabel->setVisible(true);
|
||||
ui->filelabel->setText(QString("(%1 %2) %3").arg(mPost.mCount).arg(tr("Files")).arg(misc::friendlyUnit(mPost.mSize)));
|
||||
ui->filelabel->setText(QString("(%1 %2) %3").arg(mPost.mCount).arg( (mPost.mCount > 1)?tr("Files"):tr("File")).arg(misc::friendlyUnit(mPost.mSize)));
|
||||
} else {
|
||||
ui->filelabel->setVisible(false);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue