mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
added load image option in forum posts when images are to be displayed
This commit is contained in:
parent
60408b3799
commit
2c019d984f
@ -74,27 +74,20 @@ void RSTextBrowser::paintEvent(QPaintEvent *event)
|
|||||||
|
|
||||||
QVariant RSTextBrowser::loadResource(int type, const QUrl &name)
|
QVariant RSTextBrowser::loadResource(int type, const QUrl &name)
|
||||||
{
|
{
|
||||||
std::cerr << "TEXTBROWSER: load ressource request: type=" << type << " scheme=" << name.scheme().toStdString() << ", url=" << name.toString().toStdString() << std::endl;
|
|
||||||
|
|
||||||
// case 1: always trust the image if it comes from an internal resource
|
// case 1: always trust the image if it comes from an internal resource
|
||||||
|
|
||||||
if(name.scheme().compare("qrc",Qt::CaseInsensitive)==0 && type == QTextDocument::ImageResource)
|
if(name.scheme().compare("qrc",Qt::CaseInsensitive)==0 && type == QTextDocument::ImageResource)
|
||||||
{
|
|
||||||
std::cerr << "loading because it's qrc..." << std::endl;
|
|
||||||
return QTextBrowser::loadResource(type, name);
|
return QTextBrowser::loadResource(type, name);
|
||||||
}
|
|
||||||
|
|
||||||
// case 2: only display if the ser allows it
|
// case 2: only display if the user allows it. Data resources can be bad (svg bombs) but we filter them out globally at the network layer.
|
||||||
|
// It would be good to add here a home-made resource loader that only loads images and not svg crap, just in case.
|
||||||
|
|
||||||
if(name.scheme().compare("data",Qt::CaseInsensitive)==0 && mShowImages)
|
if(name.scheme().compare("data",Qt::CaseInsensitive)==0 && mShowImages)
|
||||||
{
|
|
||||||
std::cerr << "loading because it's data and mShowImages is true..." << std::endl;
|
|
||||||
return QTextBrowser::loadResource(type, name);
|
return QTextBrowser::loadResource(type, name);
|
||||||
}
|
|
||||||
|
|
||||||
// case 3: otherwise, do not display
|
// case 3: otherwise, do not display
|
||||||
|
|
||||||
std::cerr << "not loading " << std::endl;
|
std::cerr << "TEXTBROWSER: refusing load ressource request: type=" << type << " scheme=" << name.scheme().toStdString() << ", url=" << name.toString().toStdString() << std::endl;
|
||||||
|
|
||||||
if (mImageBlockWidget)
|
if (mImageBlockWidget)
|
||||||
mImageBlockWidget->show();
|
mImageBlockWidget->show();
|
||||||
|
@ -213,6 +213,8 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
|
|||||||
ui->line_2->hide() ;
|
ui->line_2->hide() ;
|
||||||
ui->by_text_label->hide() ;
|
ui->by_text_label->hide() ;
|
||||||
ui->by_label->hide() ;
|
ui->by_label->hide() ;
|
||||||
|
ui->postText->setImageBlockWidget(ui->imageBlockWidget);
|
||||||
|
ui->postText->resetImagesStatus(Settings->getForumLoadEmbeddedImages()) ;
|
||||||
|
|
||||||
ui->subscribeToolButton->setToolTip(tr("<p>Subscribing to the forum will gather \
|
ui->subscribeToolButton->setToolTip(tr("<p>Subscribing to the forum will gather \
|
||||||
available posts from your subscribed friends, and make the \
|
available posts from your subscribed friends, and make the \
|
||||||
@ -590,6 +592,7 @@ void GxsForumThreadWidget::changedThread()
|
|||||||
if (mFillThread) {
|
if (mFillThread) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
ui->postText->resetImagesStatus(Settings->getForumLoadEmbeddedImages()) ;
|
||||||
|
|
||||||
insertMessage();
|
insertMessage();
|
||||||
}
|
}
|
||||||
|
@ -6,17 +6,14 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>622</width>
|
<width>851</width>
|
||||||
<height>412</height>
|
<height>721</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSplitter" name="threadSplitter">
|
<widget class="QSplitter" name="threadSplitter">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -117,6 +114,12 @@
|
|||||||
<property name="sizeType">
|
<property name="sizeType">
|
||||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -446,6 +449,19 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<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="RSTextBrowser" name="postText">
|
<widget class="RSTextBrowser" name="postText">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
@ -457,6 +473,9 @@
|
|||||||
<enum>Qt::CustomContextMenu</enum>
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -502,6 +521,12 @@
|
|||||||
<header location="global">gui/common/ElidedLabel.h</header>
|
<header location="global">gui/common/ElidedLabel.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>RSImageBlockWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>gui/common/RSImageBlockWidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../images.qrc"/>
|
<include location="../images.qrc"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user