gxsforums: make forum's messages respectful to chat options

e.g. to font size. Concerns only the output of messages.
This commit is contained in:
chelovechishko 2018-01-18 21:43:04 +09:00
parent 4c626e04a1
commit fdeb727fc1

View File

@ -1695,22 +1695,31 @@ void GxsForumThreadWidget::insertMessageData(const RsGxsForumMsg &msg)
ui->by_text_label->show(); ui->by_text_label->show();
ui->by_label->show(); ui->by_label->show();
if(redacted) if(redacted) {
{
QString extraTxt = tr( "<p><font color=\"#ff0000\"><b>The author of this message (with ID %1) is banned.</b>").arg(QString::fromStdString(msg.mMeta.mAuthorId.toStdString())) ; QString extraTxt = tr( "<p><font color=\"#ff0000\"><b>The author of this message (with ID %1) is banned.</b>").arg(QString::fromStdString(msg.mMeta.mAuthorId.toStdString())) ;
extraTxt += tr( "<UL><li><b><font color=\"#ff0000\">Messages from this author are not forwarded. </font></b></li>") ; extraTxt += tr( "<UL><li><b><font color=\"#ff0000\">Messages from this author are not forwarded. </font></b></li>") ;
extraTxt += tr( "<li><b><font color=\"#ff0000\">Messages from this author are replaced by this text. </font></b></li></ul>") ; extraTxt += tr( "<li><b><font color=\"#ff0000\">Messages from this author are replaced by this text. </font></b></li></ul>") ;
extraTxt += tr( "<p><b><font color=\"#ff0000\">You can force the visibility and forwarding of messages by setting a different opinion for that Id in People's tab.</font></b></p>") ; extraTxt += tr( "<p><b><font color=\"#ff0000\">You can force the visibility and forwarding of messages by setting a different opinion for that Id in People's tab.</font></b></p>") ;
ui->postText->setHtml(extraTxt) ; ui->postText->setHtml(extraTxt) ;
} } else {
else uint32_t flags = RSHTML_FORMATTEXT_EMBED_LINKS;
{ if(Settings->getForumLoadEmoticons())
uint32_t flags = RSHTML_FORMATTEXT_EMBED_LINKS; flags |= RSHTML_FORMATTEXT_EMBED_SMILEYS ;
if(Settings->getForumLoadEmoticons()) flags |= RSHTML_OPTIMIZEHTML_MASK;
flags |= RSHTML_FORMATTEXT_EMBED_SMILEYS ;
QString extraTxt = RsHtml().formatText(ui->postText->document(), QString::fromUtf8(msg.mMsg.c_str()),flags); QColor backgroundColor = ui->postText->palette().base().color();
qreal desiredContrast = Settings->valueFromGroup("Chat",
"MinimumContrast", 4.5).toDouble();
int desiredMinimumFontSize = Settings->valueFromGroup("Chat",
"MinimumFontSize", 10).toInt();
QString extraTxt = RsHtml().formatText(ui->postText->document(),
QString::fromUtf8(msg.mMsg.c_str()), flags
#ifndef DEBUG_FORUMS \
, backgroundColor, desiredContrast, desiredMinimumFontSize
#endif
);
ui->postText->setHtml(extraTxt); ui->postText->setHtml(extraTxt);
} }
// ui->threadTitle->setText(QString::fromUtf8(msg.mMeta.mMsgName.c_str())); // ui->threadTitle->setText(QString::fromUtf8(msg.mMeta.mMsgName.c_str()));