mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-29 09:18:45 -04:00
Fix Posted Feed Item when received comment.
This commit is contained in:
parent
daf54dff3d
commit
7c7da7e6d1
6 changed files with 112 additions and 42 deletions
|
@ -84,6 +84,8 @@ void PostedItem::setup()
|
|||
ui->dateLabel->clear();
|
||||
ui->fromLabel->clear();
|
||||
ui->siteLabel->clear();
|
||||
ui->newCommentLabel->hide();
|
||||
ui->commLabel->hide();
|
||||
|
||||
/* general ones */
|
||||
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(removeItem()));
|
||||
|
@ -160,21 +162,37 @@ void PostedItem::loadGroup(const uint32_t &token)
|
|||
void PostedItem::loadMessage(const uint32_t &token)
|
||||
{
|
||||
std::vector<RsPostedPost> posts;
|
||||
if (!rsPosted->getPostData(token, posts))
|
||||
std::vector<RsGxsComment> cmts;
|
||||
if (!rsPosted->getPostData(token, posts, cmts))
|
||||
{
|
||||
std::cerr << "GxsChannelPostItem::loadMessage() ERROR getting data";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (posts.size() != 1)
|
||||
if (posts.size() == 1)
|
||||
{
|
||||
std::cerr << "GxsChannelPostItem::loadMessage() Wrong number of Items";
|
||||
setPost(posts[0]);
|
||||
}
|
||||
else if (cmts.size() == 1)
|
||||
{
|
||||
RsGxsComment cmt = cmts[0];
|
||||
|
||||
ui->newCommentLabel->show();
|
||||
ui->commLabel->show();
|
||||
ui->commLabel->setText(QString::fromUtf8(cmt.mComment.c_str()));
|
||||
|
||||
//Change this item to be uploaded with thread element.
|
||||
setMessageId(cmt.mMeta.mThreadId);
|
||||
requestMessage();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "GxsChannelPostItem::loadMessage() Wrong number of Items. Remove It.";
|
||||
std::cerr << std::endl;
|
||||
removeItem();
|
||||
return;
|
||||
}
|
||||
|
||||
setPost(posts[0]);
|
||||
}
|
||||
|
||||
void PostedItem::fill()
|
||||
|
@ -390,15 +408,15 @@ void PostedItem::setReadStatus(bool isNew, bool isUnread)
|
|||
ui->newLabel->setVisible(isNew);
|
||||
|
||||
/* unpolish widget to clear the stylesheet's palette cache */
|
||||
ui->frame->style()->unpolish(ui->frame);
|
||||
ui->mainFrame->style()->unpolish(ui->mainFrame);
|
||||
|
||||
QPalette palette = ui->frame->palette();
|
||||
palette.setColor(ui->frame->backgroundRole(), isNew ? COLOR_NEW : COLOR_NORMAL); // QScrollArea
|
||||
QPalette palette = ui->mainFrame->palette();
|
||||
palette.setColor(ui->mainFrame->backgroundRole(), isNew ? COLOR_NEW : COLOR_NORMAL); // QScrollArea
|
||||
palette.setColor(QPalette::Base, isNew ? COLOR_NEW : COLOR_NORMAL); // QTreeWidget
|
||||
ui->frame->setPalette(palette);
|
||||
ui->mainFrame->setPalette(palette);
|
||||
|
||||
ui->frame->setProperty("new", isNew);
|
||||
Rshare::refreshStyleSheet(ui->frame, false);
|
||||
ui->mainFrame->setProperty("new", isNew);
|
||||
Rshare::refreshStyleSheet(ui->mainFrame, false);
|
||||
}
|
||||
|
||||
void PostedItem::readToggled(bool checked)
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
<property name="windowTitle">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<layout class="QVBoxLayout" name="PostedItemVLayout">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<widget class="QFrame" name="mainFrame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -31,7 +31,7 @@
|
|||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QVBoxLayout" name="mainFrameVLayout">
|
||||
<item>
|
||||
<widget class="StyledLabel" name="titleLabel">
|
||||
<property name="sizePolicy">
|
||||
|
@ -59,9 +59,33 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="newCommHLayout">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="newCommentLabel">
|
||||
<property name="text">
|
||||
<string>New Comment:</string>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ElidedLabel" name="commLabel">
|
||||
<property name="text">
|
||||
<string>Comment Value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<layout class="QHBoxLayout" name="buttonHLayout">
|
||||
<item>
|
||||
<widget class="StyledLabel" name="scoreLabel">
|
||||
<property name="text">
|
||||
|
@ -207,7 +231,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="fromBoldLabel_2">
|
||||
<widget class="QLabel" name="siteBoldLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -297,21 +321,7 @@
|
|||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>readAndClearButton</zorder>
|
||||
<zorder>dateBoldLabel</zorder>
|
||||
<zorder>dateLabel</zorder>
|
||||
<zorder>fromBoldLabel</zorder>
|
||||
<zorder>commentButton</zorder>
|
||||
<zorder>newLabel</zorder>
|
||||
<zorder>siteLabel</zorder>
|
||||
<zorder>fromLabel</zorder>
|
||||
<zorder>readButton</zorder>
|
||||
<zorder>fromBoldLabel_2</zorder>
|
||||
<zorder>clearButton</zorder>
|
||||
<zorder>titleLabel</zorder>
|
||||
<zorder>voteDownButton</zorder>
|
||||
<zorder>voteUpButton</zorder>
|
||||
<zorder>scoreLabel</zorder>
|
||||
<zorder></zorder>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -357,6 +367,12 @@
|
|||
<extends>QLabel</extends>
|
||||
<header>gui/gxs/GxsIdLabel.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ElidedLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header location="global">gui/common/ElidedLabel.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
|
|
|
@ -269,8 +269,9 @@ void GxsChannelPostItem::loadMessage(const uint32_t &token)
|
|||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "GxsChannelPostItem::loadMessage() Wrong number of Items";
|
||||
std::cerr << "GxsChannelPostItem::loadMessage() Wrong number of Items. Remove It.";
|
||||
std::cerr << std::endl;
|
||||
removeItem();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue