This commit is contained in:
felisucoibi 2017-01-18 21:45:56 +01:00
commit 5f7327f87e
6 changed files with 34 additions and 5 deletions

View File

@ -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()));

View File

@ -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);
}

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>423</width>
<width>507</width>
<height>340</height>
</rect>
</property>
@ -38,6 +38,16 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="loadEmoticons">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;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. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Load emoticons (costly)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@ -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()
{

View File

@ -305,6 +305,8 @@ public:
void setForumExpandNewMessages(bool value);
bool getForumLoadEmbeddedImages();
void setForumLoadEmbeddedImages(bool value);
bool getForumLoadEmoticons();
void setForumLoadEmoticons(bool value);
/* Channel */
bool getChannelLoadThread();

View File

@ -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;
}
/**