Add Chat Load Embedded Images Option like forum and message.

This commit is contained in:
Phenom 2016-08-09 23:32:25 +02:00
parent 0e1c0c2eb3
commit f71aad4b9c
6 changed files with 45 additions and 3 deletions

View File

@ -120,7 +120,7 @@ ChatWidget::ChatWidget(QWidget *parent) :
ui->actionSearchWithoutLimit->setText(tr("Don't stop to color after")+" "+QString::number(uiMaxSearchLimitColor)+" "+tr("items found (need more CPU)"));
ui->markButton->setVisible(false);
ui->markButton->setVisible(false);
ui->leSearch->setVisible(false);
ui->searchBefore->setVisible(false);
ui->searchBefore->setToolTip(tr("<b>Find Previous </b><br/><i>Ctrl+Shift+G</i>"));
@ -194,8 +194,10 @@ ChatWidget::ChatWidget(QWidget *parent) :
ui->pushtoolsButton->setMenu(menu);
menu->addMenu(fontmenu);
ui->actionSendAsPlainText->setChecked(Settings->getChatSendAsPlainTextByDef());
ui->actionSendAsPlainText->setChecked(Settings->getChatSendAsPlainTextByDef());
ui->textBrowser->resetImagesStatus(Settings->getChatLoadEmbeddedImages());
ui->textBrowser->setImageBlockWidget(ui->imageBlockWidget);
ui->textBrowser->installEventFilter(this);
ui->textBrowser->viewport()->installEventFilter(this);
ui->chatTextEdit->installEventFilter(this);

View File

@ -206,6 +206,16 @@ border-image: url(:/images/closepressed.png)
</layout>
</widget>
</item>
<item>
<widget class="RSImageBlockWidget" name="imageBlockWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QSplitter" name="chatVSplitter">
<property name="orientation">
@ -1007,6 +1017,12 @@ border-image: url(:/images/closepressed.png)
<extends>QTextEdit</extends>
<header location="global">gui/common/MimeTextEdit.h</header>
</customwidget>
<customwidget>
<class>RSImageBlockWidget</class>
<extends>QWidget</extends>
<header>gui/common/RSImageBlockWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../emojione.qrc"/>

View File

@ -130,6 +130,7 @@ ChatPage::save(QString &/*errmsg*/)
Settings->setChatSendMessageWithCtrlReturn(ui.sendMessageWithCtrlReturn->isChecked());
Settings->setChatSendAsPlainTextByDef(ui.sendAsPlainTextByDef->isChecked());
Settings->setChatLoadEmbeddedImages(ui.loadEmbeddedImages->isChecked());
Settings->setChatSearchCharToStartSearch(ui.sbSearch_CharToStart->value());
Settings->setChatSearchCaseSensitively(ui.cbSearch_CaseSensitively->isChecked());
@ -238,6 +239,7 @@ ChatPage::load()
ui.sendMessageWithCtrlReturn->setChecked(Settings->getChatSendMessageWithCtrlReturn());
ui.sendAsPlainTextByDef->setChecked(Settings->getChatSendAsPlainTextByDef());
ui.loadEmbeddedImages->setChecked(Settings->getChatLoadEmbeddedImages());
ui.sbSearch_CharToStart->setValue(Settings->getChatSearchCharToStartSearch());
ui.cbSearch_CaseSensitively->setChecked(Settings->getChatSearchCaseSensitively());

View File

@ -218,6 +218,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="loadEmbeddedImages">
<property name="text">
<string>Load embedded images</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@ -345,6 +345,8 @@ static QString getKeyForLastDir(RshareSettings::enumLastDir type)
return "Messages";
case RshareSettings::LASTDIR_SOUNDS:
return "SOUNDS";
case RshareSettings::LASTDIR_PLUGIN:
return "PLUGIN";
}
return "";
}
@ -601,6 +603,16 @@ QRgb RshareSettings::getChatSearchFoundColor()
return valueFromGroup("Chat", "SearchMaxSearchFoundColor", QString::number(QColor(255,255,150).rgba())).toUInt();
}
bool RshareSettings::getChatLoadEmbeddedImages()
{
return valueFromGroup("Chat", "LoadEmbeddedImages", true).toBool();
}
void RshareSettings::setChatLoadEmbeddedImages(bool value)
{
setValueToGroup("Chat", "LoadEmbeddedImages", value);
}
RshareSettings::enumToasterPosition RshareSettings::getToasterPosition()
{
return (enumToasterPosition) value("ToasterPosition", TOASTERPOS_BOTTOMRIGHT).toInt();

View File

@ -237,6 +237,9 @@ public:
void setChatSearchFoundColor(QRgb rgbValue);
QRgb getChatSearchFoundColor();
bool getChatLoadEmbeddedImages();
void setChatLoadEmbeddedImages(bool value);
enumToasterPosition getToasterPosition();
void setToasterPosition(enumToasterPosition position);