diff --git a/code/nel/include/nel/gui/group_html.h b/code/nel/include/nel/gui/group_html.h index c10858933..d448b9d5f 100644 --- a/code/nel/include/nel/gui/group_html.h +++ b/code/nel/include/nel/gui/group_html.h @@ -125,6 +125,8 @@ namespace NLGUI // add image download (used by view_bitmap.cpp to load web images) void addImageDownload(const std::string &url, CViewBase *img, const CStyleParams &style = CStyleParams(), const TImageType type = NormalImage); + // remove image from download list if present + void removeImageDownload(CViewBase *img); std::string localImageName(const std::string &url); // Timeout diff --git a/code/nel/include/nel/gui/view_bitmap.h b/code/nel/include/nel/gui/view_bitmap.h index 4afd37588..ef7735857 100644 --- a/code/nel/include/nel/gui/view_bitmap.h +++ b/code/nel/include/nel/gui/view_bitmap.h @@ -56,8 +56,14 @@ namespace NLGUI _TxtOffsetY = 0; _TxtWidth = -1; _TxtHeight = -1; + + // Support for https://.. textures + _HtmlDownload = false; } + /// Destructor + virtual ~CViewBitmap(); + std::string getProperty( const std::string &name ) const; void setProperty( const std::string &name, const std::string &value ); xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const; @@ -132,6 +138,7 @@ namespace NLGUI bool _Flip : 1; bool _Tile : 1; bool _InheritGCAlpha : 1; + bool _HtmlDownload : 1; // For single texture diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index b2808ad14..9e7275c07 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -740,6 +740,24 @@ namespace NLGUI pumpCurlQueue(); } + void CGroupHTML::removeImageDownload(CViewBase *img) + { + for(std::list::iterator it = Curls.begin(); it != Curls.end(); ++it) + { + // check all active downloads because image does not keep url around + std::vector::iterator imgIter = it->imgs.begin(); + while(imgIter != it->imgs.end()) + { + if (imgIter->Image == img) + { + it->imgs.erase(imgIter); + break; + } + ++imgIter; + } + } + } + void CGroupHTML::initImageDownload() { LOG_DL("Init Image Download"); diff --git a/code/nel/src/gui/view_bitmap.cpp b/code/nel/src/gui/view_bitmap.cpp index 79b8c32a4..659d8e45d 100644 --- a/code/nel/src/gui/view_bitmap.cpp +++ b/code/nel/src/gui/view_bitmap.cpp @@ -37,6 +37,18 @@ REGISTER_UI_CLASS(CViewBitmap) namespace NLGUI { + CViewBitmap::~CViewBitmap() + { + if (_HtmlDownload) + { + CGroupHTML *groupHtml = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:webig:content:html")); + if (groupHtml) { + _HtmlDownload = false; + groupHtml->removeImageDownload(dynamic_cast(this)); + } + } + } + std::string CViewBitmap::getProperty( const std::string &name ) const { if( name == "color" ) @@ -461,6 +473,7 @@ namespace NLGUI if (!CFile::fileExists(localname)) localname = "web_del.tga"; _TextureId.setTexture (localname.c_str(), _TxtOffsetX, _TxtOffsetY, _TxtWidth, _TxtHeight, false); + _HtmlDownload = true; groupHtml->addImageDownload(TxName, dynamic_cast(this)); } }