forked from qt-creator/qt-creator
Utils: Make remote image loading optional
Change-Id: Ib90c9b8bb54e0c56da322d4034894f2e34d802c9 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -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);
|
||||
|
@@ -20,6 +20,7 @@ public:
|
||||
|
||||
void setMarkdown(const QString &markdown);
|
||||
void setBasePath(const FilePath &filePath);
|
||||
void setAllowRemoteImages(bool allow);
|
||||
};
|
||||
|
||||
} // namespace Utils
|
||||
|
@@ -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();
|
||||
|
Reference in New Issue
Block a user