diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index 91ef4f67d..c20598294 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -31,6 +31,7 @@ #include "GxsForumsDialog.h" #include "gui/RetroShareLink.h" #include "gui/common/RSTreeWidgetItem.h" +#include "gui/settings/rsharesettings.h" #include "gui/common/RSElidedItemDelegate.h" #include "gui/settings/rsharesettings.h" #include "gui/gxs/GxsIdTreeWidgetItem.h" @@ -1622,7 +1623,11 @@ void GxsForumThreadWidget::insertMessageData(const RsGxsForumMsg &msg) } else { - QString extraTxt = RsHtml().formatText(ui->postText->document(), QString::fromUtf8(msg.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS); + uint32_t flags = RSHTML_FORMATTEXT_EMBED_LINKS; + if(Settings->getForumLoadEmoticons()) + flags |= RSHTML_FORMATTEXT_EMBED_SMILEYS ; + + QString extraTxt = RsHtml().formatText(ui->postText->document(), QString::fromUtf8(msg.mMsg.c_str()),flags); ui->postText->setHtml(extraTxt); } // ui->threadTitle->setText(QString::fromUtf8(msg.mMeta.mMsgName.c_str())); diff --git a/retroshare-gui/src/gui/settings/ForumPage.cpp b/retroshare-gui/src/gui/settings/ForumPage.cpp index 2821e65a2..90ff1f176 100644 --- a/retroshare-gui/src/gui/settings/ForumPage.cpp +++ b/retroshare-gui/src/gui/settings/ForumPage.cpp @@ -42,6 +42,7 @@ bool ForumPage::save(QString &/*errmsg*/) Settings->setForumMsgSetToReadOnActivate(ui.setMsgToReadOnActivate->isChecked()); Settings->setForumExpandNewMessages(ui.expandNewMessages->isChecked()); Settings->setForumLoadEmbeddedImages(ui.loadEmbeddedImages->isChecked()); + Settings->setForumLoadEmoticons(ui.loadEmoticons->isChecked()); ui.groupFrameSettingsWidget->saveSettings(GroupFrameSettings::Forum); @@ -54,6 +55,7 @@ void ForumPage::load() ui.setMsgToReadOnActivate->setChecked(Settings->getForumMsgSetToReadOnActivate()); ui.expandNewMessages->setChecked(Settings->getForumExpandNewMessages()); ui.loadEmbeddedImages->setChecked(Settings->getForumLoadEmbeddedImages()); + ui.loadEmoticons->setChecked(Settings->getForumLoadEmoticons()); ui.groupFrameSettingsWidget->loadSettings(GroupFrameSettings::Forum); } diff --git a/retroshare-gui/src/gui/settings/ForumPage.ui b/retroshare-gui/src/gui/settings/ForumPage.ui index 1ef297ede..4fb74d888 100644 --- a/retroshare-gui/src/gui/settings/ForumPage.ui +++ b/retroshare-gui/src/gui/settings/ForumPage.ui @@ -6,7 +6,7 @@ 0 0 - 423 + 507 340 @@ -38,6 +38,16 @@ + + + + <html><head/><body><p>This option is costly and it's in the dev's plans to improve it. In the mean time it's disabled by default. If you enable it and long forum posts take a while to display, then disable it again. </p></body></html> + + + Load emoticons (costly) + + + diff --git a/retroshare-gui/src/gui/settings/rsharesettings.cpp b/retroshare-gui/src/gui/settings/rsharesettings.cpp index 1d0507337..46ecdd147 100644 --- a/retroshare-gui/src/gui/settings/rsharesettings.cpp +++ b/retroshare-gui/src/gui/settings/rsharesettings.cpp @@ -1041,12 +1041,18 @@ bool RshareSettings::getForumLoadEmbeddedImages() { return valueFromGroup("Forum", "LoadEmbeddedImages", false).toBool(); } - +bool RshareSettings::getForumLoadEmoticons() +{ + return valueFromGroup("Forum", "LoadEmoticons", false).toBool(); +} void RshareSettings::setForumLoadEmbeddedImages(bool value) { setValueToGroup("Forum", "LoadEmbeddedImages", value); } - +void RshareSettings::setForumLoadEmoticons(bool value) +{ + setValueToGroup("Forum", "LoadEmoticons", value); +} /* Channel */ bool RshareSettings::getChannelLoadThread() { diff --git a/retroshare-gui/src/gui/settings/rsharesettings.h b/retroshare-gui/src/gui/settings/rsharesettings.h index a693deaf3..9ad2d31ff 100644 --- a/retroshare-gui/src/gui/settings/rsharesettings.h +++ b/retroshare-gui/src/gui/settings/rsharesettings.h @@ -305,6 +305,8 @@ public: void setForumExpandNewMessages(bool value); bool getForumLoadEmbeddedImages(); void setForumLoadEmbeddedImages(bool value); + bool getForumLoadEmoticons(); + void setForumLoadEmoticons(bool value); /* Channel */ bool getChannelLoadThread(); diff --git a/retroshare-gui/src/util/HandleRichText.cpp b/retroshare-gui/src/util/HandleRichText.cpp index 9608f5f7d..865bce7e0 100644 --- a/retroshare-gui/src/util/HandleRichText.cpp +++ b/retroshare-gui/src/util/HandleRichText.cpp @@ -1004,13 +1004,17 @@ void RsHtml::optimizeHtml(QTextEdit *textEdit, QString &text, unsigned int flag { if (textEdit->toHtml() == QTextDocument(textEdit->toPlainText()).toHtml()) { text = textEdit->toPlainText(); -// std::cerr << "Optimized text to " << text.length() << " bytes , instead of " << textEdit->toHtml().length() << std::endl; + //std::cerr << "Optimized text to " << text.length() << " bytes , instead of " << textEdit->toHtml().length() << std::endl; return; } text = textEdit->toHtml(); + //std::cerr << "Optimized text from " << text.length() << " bytes , into " ; + optimizeHtml(text, flag); + + //std::cerr << text.length() << " bytes" << std::endl; } /**