added back links to posts in channel feeditems

This commit is contained in:
csoler 2020-09-27 20:08:36 +02:00
parent e389c01571
commit 1dddff9e5b
3 changed files with 41 additions and 61 deletions

View File

@ -156,7 +156,7 @@ void GxsChannelPostItem::setup()
// memory. // memory.
ui->logoLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/images/thumb-default-video.png")); ui->logoLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/images/thumb-default-video.png"));
ui->warn_image_label->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/images/status_unknown.png")); //ui->warn_image_label->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/images/status_unknown.png"));
ui->readButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/message-state-unread.png")); ui->readButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/message-state-unread.png"));
ui->voteUpButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/vote_up.png")); ui->voteUpButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/vote_up.png"));
ui->voteDownButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/vote_down.png")); ui->voteDownButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/vote_down.png"));
@ -211,12 +211,12 @@ void GxsChannelPostItem::setup()
ui->downloadButton->hide(); ui->downloadButton->hide();
ui->playButton->hide(); ui->playButton->hide();
ui->warn_image_label->hide(); //ui->warn_image_label->hide();
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);
ui->mainFrame->style()->unpolish(ui->mainFrame); ui->mainFrame->style()->unpolish(ui->mainFrame);
@ -466,7 +466,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(mGroupMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroupMeta.mSubscribeFlags)) if (IS_GROUP_SUBSCRIBED(mGroupMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroupMeta.mSubscribeFlags))
{ {
@ -489,12 +489,12 @@ 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)) ;
//QString score = QString::number(post.mTopScore); //QString score = QString::number(post.mTopScore);
// scoreLabel->setText(score); // scoreLabel->setText(score);
@ -654,21 +654,21 @@ void GxsChannelPostItem::setReadStatus(bool isNew, bool isUnread)
ui->mainFrame->style()->polish( ui->mainFrame); ui->mainFrame->style()->polish( ui->mainFrame);
} }
void GxsChannelPostItem::setFileCleanUpWarning(uint32_t time_left) // void GxsChannelPostItem::setFileCleanUpWarning(uint32_t time_left)
{ // {
int hours = (int)time_left/3600; // int hours = (int)time_left/3600;
int minutes = (time_left - hours*3600)%60; // int minutes = (time_left - hours*3600)%60;
//
ui->warning_label->setText(tr("Warning! You have less than %1 hours and %2 minute before this file is deleted Consider saving it.").arg( // ui->warning_label->setText(tr("Warning! You have less than %1 hours and %2 minute before this file is deleted Consider saving it.").arg(
QString::number(hours)).arg(QString::number(minutes))); // QString::number(hours)).arg(QString::number(minutes)));
//
QFont warnFont = ui->warning_label->font(); // QFont warnFont = ui->warning_label->font();
warnFont.setBold(true); // warnFont.setBold(true);
ui->warning_label->setFont(warnFont); // ui->warning_label->setFont(warnFont);
//
ui->warn_image_label->setVisible(true); // ui->warn_image_label->setVisible(true);
ui->warning_label->setVisible(true); // ui->warning_label->setVisible(true);
} // }
void GxsChannelPostItem::updateItem() void GxsChannelPostItem::updateItem()
{ {

View File

@ -56,7 +56,7 @@ public:
bool setGroup(const RsGxsChannelGroup& group, bool doFill = true); bool setGroup(const RsGxsChannelGroup& group, bool doFill = true);
bool setPost(const RsGxsChannelPost& post, bool doFill = true); bool setPost(const RsGxsChannelPost& post, bool doFill = true);
void setFileCleanUpWarning(uint32_t time_left); //void setFileCleanUpWarning(uint32_t time_left);
QString getTitleLabel(); QString getTitleLabel();
QString getMsgLabel(); QString getMsgLabel();

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>922</width> <width>1092</width>
<height>187</height> <height>231</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gxsChannelPostItem_GLayout"> <layout class="QGridLayout" name="gxsChannelPostItem_GLayout">
@ -124,6 +124,16 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="QLabel" name="subjectLabel">
<property name="text">
<string notr="true">TextLabel</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer_2"> <spacer name="verticalSpacer_2">
<property name="orientation"> <property name="orientation">
@ -137,33 +147,6 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<layout class="QHBoxLayout" name="subjectHLayout"/>
</item>
<item>
<layout class="QHBoxLayout" name="warningHLayout">
<item>
<widget class="QLabel" name="warn_image_label">
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="warning_label">
<property name="text">
<string notr="true">TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<layout class="QHBoxLayout" name="newCommHLayout"> <layout class="QHBoxLayout" name="newCommHLayout">
<property name="topMargin"> <property name="topMargin">
@ -486,21 +469,18 @@
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget>
<class>StyledElidedLabel</class>
<extends>QLabel</extends>
<header>gui/common/StyledElidedLabel.h</header>
</customwidget>
<customwidget> <customwidget>
<class>ElidedLabel</class> <class>ElidedLabel</class>
<extends>QLabel</extends> <extends>QLabel</extends>
<header location="global">gui/common/ElidedLabel.h</header> <header location="global">gui/common/ElidedLabel.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>StyledElidedLabel</class>
<extends>QLabel</extends>
<header>gui/common/StyledElidedLabel.h</header>
</customwidget>
</customwidgets> </customwidgets>
<resources> <resources/>
<include location="../icons.qrc"/>
<include location="../images.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>