mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-25 06:40:58 -04:00
Merge pull request #1763 from csoler/v0.6-BugFixing
tried to sorted out the layout of channel item
This commit is contained in:
commit
3632478b55
2 changed files with 70 additions and 133 deletions
|
@ -76,59 +76,6 @@ void GxsChannelPostItem::init(const RsGxsMessageId& messageId,const std::set<RsG
|
||||||
mLoaded = false ;
|
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)
|
void GxsChannelPostItem::paintEvent(QPaintEvent *e)
|
||||||
{
|
{
|
||||||
/* This method employs a trick to trigger a deferred loading. The post and group is requested only
|
/* 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 */
|
/* clear ui */
|
||||||
ui->titleLabel->setText(tr("Loading"));
|
ui->titleLabel->setText(tr("Loading"));
|
||||||
ui->subjectLabel->clear();
|
|
||||||
ui->datetimelabel->clear();
|
ui->datetimelabel->clear();
|
||||||
ui->filelabel->clear();
|
ui->filelabel->clear();
|
||||||
ui->newCommentLabel->hide();
|
ui->newCommentLabel->hide();
|
||||||
|
@ -208,7 +154,7 @@ void GxsChannelPostItem::setup()
|
||||||
ui->warning_label->hide();
|
ui->warning_label->hide();
|
||||||
|
|
||||||
ui->titleLabel->setMinimumWidth(100);
|
ui->titleLabel->setMinimumWidth(100);
|
||||||
ui->subjectLabel->setMinimumWidth(100);
|
//ui->subjectLabel->setMinimumWidth(100);
|
||||||
ui->warning_label->setMinimumWidth(100);
|
ui->warning_label->setMinimumWidth(100);
|
||||||
|
|
||||||
ui->mainFrame->setProperty("new", false);
|
ui->mainFrame->setProperty("new", false);
|
||||||
|
@ -431,7 +377,7 @@ void GxsChannelPostItem::fill()
|
||||||
ui->titleLabel->setText(title);
|
ui->titleLabel->setText(title);
|
||||||
|
|
||||||
RetroShareLink msgLink = RetroShareLink::createGxsMessageLink(RetroShareLink::TYPE_CHANNEL, mPost.mMeta.mGroupId, mPost.mMeta.mMsgId, messageName());
|
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))
|
if (IS_GROUP_SUBSCRIBED(mGroup.mMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroup.mMeta.mSubscribeFlags))
|
||||||
{
|
{
|
||||||
|
@ -454,10 +400,10 @@ 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());
|
//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()), 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)) ;
|
//ui->subjectLabel->setText(RsStringUtil::CopyLines(QString::fromUtf8(mPost.mMsg.c_str()), 2)) ;
|
||||||
|
|
||||||
|
@ -525,7 +471,13 @@ void GxsChannelPostItem::fill()
|
||||||
voteDownButton->setEnabled(false);
|
voteDownButton->setEnabled(false);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
ui->msgFrame->setVisible(!mPost.mMsg.empty());
|
{
|
||||||
|
QTextDocument doc;
|
||||||
|
doc.setHtml( QString::fromUtf8(mPost.mMsg.c_str()) );
|
||||||
|
|
||||||
|
ui->msgFrame->setVisible(doc.toPlainText().length() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (wasExpanded() || ui->expandFrame->isVisible()) {
|
if (wasExpanded() || ui->expandFrame->isVisible()) {
|
||||||
fillExpandFrame();
|
fillExpandFrame();
|
||||||
}
|
}
|
||||||
|
@ -534,7 +486,7 @@ void GxsChannelPostItem::fill()
|
||||||
|
|
||||||
if ( (mPost.mCount != 0) || (mPost.mSize != 0) ) {
|
if ( (mPost.mCount != 0) || (mPost.mSize != 0) ) {
|
||||||
ui->filelabel->setVisible(true);
|
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 {
|
} else {
|
||||||
ui->filelabel->setVisible(false);
|
ui->filelabel->setVisible(false);
|
||||||
}
|
}
|
||||||
|
@ -578,6 +530,7 @@ void GxsChannelPostItem::fill()
|
||||||
void GxsChannelPostItem::fillExpandFrame()
|
void GxsChannelPostItem::fillExpandFrame()
|
||||||
{
|
{
|
||||||
ui->msgLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(mPost.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
ui->msgLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(mPost.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GxsChannelPostItem::messageName()
|
QString GxsChannelPostItem::messageName()
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1359</width>
|
<width>1433</width>
|
||||||
<height>342</height>
|
<height>541</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gxsChannelPostItem_GLayout">
|
<layout class="QGridLayout" name="gxsChannelPostItem_GLayout">
|
||||||
|
@ -49,10 +49,12 @@
|
||||||
<layout class="QVBoxLayout" name="mainFrameVLayout">
|
<layout class="QVBoxLayout" name="mainFrameVLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="mainTopHLayout">
|
<layout class="QHBoxLayout" name="mainTopHLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="logoLabel">
|
<widget class="QLabel" name="logoLabel">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
|
@ -71,6 +73,8 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="mainRTopVLayout">
|
<layout class="QVBoxLayout" name="mainRTopVLayout">
|
||||||
<item>
|
<item>
|
||||||
|
@ -114,41 +118,18 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="subjectHLayout">
|
<widget class="QLabel" name="newLabel">
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="subjectLabel">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string notr="true">Short Description</string>
|
<string>New</string>
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="openExternalLinks">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="filelabel">
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">fileLabel</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="subjectHLayout"/>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="warningHLayout">
|
<layout class="QHBoxLayout" name="warningHLayout">
|
||||||
<item>
|
<item>
|
||||||
|
@ -234,13 +215,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="newLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>New</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="scoreLabel">
|
<widget class="QLabel" name="scoreLabel">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
|
@ -335,19 +309,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="copyLinkButton">
|
<widget class="QPushButton" name="copyLinkButton">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -368,6 +329,16 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="filelabel">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">fileLabel</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="unsubscribeButton">
|
<widget class="QPushButton" name="unsubscribeButton">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -387,6 +358,19 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="expandButton">
|
<widget class="QPushButton" name="expandButton">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue