From fdeb727fc144764b25a427052643b177e6ab6dc0 Mon Sep 17 00:00:00 2001 From: chelovechishko Date: Thu, 18 Jan 2018 21:43:04 +0900 Subject: [PATCH] gxsforums: make forum's messages respectful to chat options e.g. to font size. Concerns only the output of messages. --- .../gui/gxsforums/GxsForumThreadWidget.cpp | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index 5209ca184..b37b15980 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -1695,22 +1695,31 @@ void GxsForumThreadWidget::insertMessageData(const RsGxsForumMsg &msg) ui->by_text_label->show(); ui->by_label->show(); - if(redacted) - { + if(redacted) { QString extraTxt = tr( "

The author of this message (with ID %1) is banned.").arg(QString::fromStdString(msg.mMeta.mAuthorId.toStdString())) ; extraTxt += tr( "

") ; extraTxt += tr( "

You can force the visibility and forwarding of messages by setting a different opinion for that Id in People's tab.

") ; ui->postText->setHtml(extraTxt) ; - } - else - { - uint32_t flags = RSHTML_FORMATTEXT_EMBED_LINKS; - if(Settings->getForumLoadEmoticons()) - flags |= RSHTML_FORMATTEXT_EMBED_SMILEYS ; + } else { + uint32_t flags = RSHTML_FORMATTEXT_EMBED_LINKS; + if(Settings->getForumLoadEmoticons()) + flags |= RSHTML_FORMATTEXT_EMBED_SMILEYS ; + flags |= RSHTML_OPTIMIZEHTML_MASK; - 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->threadTitle->setText(QString::fromUtf8(msg.mMeta.mMsgName.c_str()));