aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarcus Tillmanns <[email protected]>2024-10-16 09:19:28 +0200
committerMarcus Tillmanns <[email protected]>2024-10-18 07:10:36 +0000
commite78a193513e684e138204766df5bf86a6b76a6a7 (patch)
tree4c75aced459c8f4613bd3c0c443d2324a79146bb /src
parent7c23409e2ae45a9e00a409e47d1d95ebf55dde6c (diff)
Utils: Make remote image loading optional
Diffstat (limited to 'src')
-rw-r--r--src/libs/utils/markdownbrowser.cpp10
-rw-r--r--src/libs/utils/markdownbrowser.h1
-rw-r--r--src/plugins/extensionmanager/extensionmanagerwidget.cpp1
3 files changed, 12 insertions, 0 deletions
diff --git a/src/libs/utils/markdownbrowser.cpp b/src/libs/utils/markdownbrowser.cpp
index f26c45830c6..44937dfa2c3 100644
--- a/src/libs/utils/markdownbrowser.cpp
+++ b/src/libs/utils/markdownbrowser.cpp
@@ -291,6 +291,9 @@ public:
if (m_basePath.isEmpty())
localUrls.clear();
+ if (!m_loadRemoteImages)
+ remoteUrls.clear();
+
const LoopList remoteIterator(remoteUrls);
const LoopList localIterator(localUrls);
@@ -360,11 +363,13 @@ public:
}
void setBasePath(const FilePath &filePath) { m_basePath = filePath; }
+ void setAllowRemoteImages(bool allow) { m_loadRemoteImages = allow; }
private:
AnimatedImageHandler m_imageHandler;
QList<QUrl> m_urlsToLoad;
bool m_needsToRestartLoading = false;
+ bool m_loadRemoteImages = false;
Tasking::TaskTreeRunner m_imageLoaderTree;
FilePath m_basePath;
};
@@ -375,6 +380,11 @@ MarkdownBrowser::MarkdownBrowser(QWidget *parent)
setDocument(new AnimatedDocument(this));
}
+void MarkdownBrowser::setAllowRemoteImages(bool allow)
+{
+ static_cast<AnimatedDocument *>(document())->setAllowRemoteImages(allow);
+}
+
void MarkdownBrowser::setBasePath(const FilePath &filePath)
{
static_cast<AnimatedDocument *>(document())->setBasePath(filePath);
diff --git a/src/libs/utils/markdownbrowser.h b/src/libs/utils/markdownbrowser.h
index ccd48712b63..9ac2c3f2cb3 100644
--- a/src/libs/utils/markdownbrowser.h
+++ b/src/libs/utils/markdownbrowser.h
@@ -20,6 +20,7 @@ public:
void setMarkdown(const QString &markdown);
void setBasePath(const FilePath &filePath);
+ void setAllowRemoteImages(bool allow);
};
} // namespace Utils
diff --git a/src/plugins/extensionmanager/extensionmanagerwidget.cpp b/src/plugins/extensionmanager/extensionmanagerwidget.cpp
index d5730005cd7..0239907c5c8 100644
--- a/src/plugins/extensionmanager/extensionmanagerwidget.cpp
+++ b/src/plugins/extensionmanager/extensionmanagerwidget.cpp
@@ -442,6 +442,7 @@ ExtensionManagerWidget::ExtensionManagerWidget()
m_headingWidget = new HeadingWidget;
m_description = new MarkdownBrowser;
+ m_description->setAllowRemoteImages(true);
m_description->setFrameStyle(QFrame::NoFrame);
m_description->setOpenExternalLinks(true);
QPalette browserPal = m_description->palette();