mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-17 21:34:10 -05:00
tried to sorted out the layout of channel item
This commit is contained in:
parent
6001517718
commit
765664b4f8
@ -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)) ;
|
||||||
|
|
||||||
@ -534,7 +480,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);
|
||||||
}
|
}
|
||||||
|
@ -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">
|
||||||
@ -50,26 +50,30 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="mainTopHLayout">
|
<layout class="QHBoxLayout" name="mainTopHLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="logoLabel">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="sizePolicy">
|
<item>
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<widget class="QLabel" name="logoLabel">
|
||||||
<horstretch>0</horstretch>
|
<property name="sizePolicy">
|
||||||
<verstretch>0</verstretch>
|
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||||
</sizepolicy>
|
<horstretch>0</horstretch>
|
||||||
</property>
|
<verstretch>0</verstretch>
|
||||||
<property name="text">
|
</sizepolicy>
|
||||||
<string/>
|
</property>
|
||||||
</property>
|
<property name="text">
|
||||||
<property name="pixmap">
|
<string/>
|
||||||
<pixmap resource="../images.qrc">:/images/thumb-default-video.png</pixmap>
|
</property>
|
||||||
</property>
|
<property name="pixmap">
|
||||||
<property name="scaledContents">
|
<pixmap resource="../images.qrc">:/images/thumb-default-video.png</pixmap>
|
||||||
<bool>false</bool>
|
</property>
|
||||||
</property>
|
<property name="scaledContents">
|
||||||
<property name="alignment">
|
<bool>false</bool>
|
||||||
<set>Qt::AlignCenter</set>
|
</property>
|
||||||
</property>
|
<property name="alignment">
|
||||||
</widget>
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="mainRTopVLayout">
|
<layout class="QVBoxLayout" name="mainRTopVLayout">
|
||||||
@ -117,37 +121,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="subjectHLayout">
|
<layout class="QHBoxLayout" name="subjectHLayout"/>
|
||||||
<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">
|
|
||||||
<string notr="true">Short Description</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>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="warningHLayout">
|
<layout class="QHBoxLayout" name="warningHLayout">
|
||||||
@ -282,6 +256,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="downloadButton">
|
<widget class="QPushButton" name="downloadButton">
|
||||||
<property name="focusPolicy">
|
<property name="focusPolicy">
|
||||||
@ -335,19 +319,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">
|
||||||
@ -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…
x
Reference in New Issue
Block a user