Changed: Refactor CGroupHTML browse-render flow

--HG--
branch : develop
This commit is contained in:
Nimetu 2019-04-29 15:41:59 +03:00
parent 51e01daa99
commit 30fb50d0db
3 changed files with 421 additions and 501 deletions

View file

@ -113,13 +113,8 @@ namespace NLGUI
// Browse error // Browse error
void browseError (const char *msg); void browseError (const char *msg);
// stop browse
void stopBrowse ();
bool isBrowsing(); bool isBrowsing();
void clean() { stopBrowse(); updateRefreshButton(); removeContent(); }
// Update coords // Update coords
void updateCoords(); void updateCoords();
@ -263,10 +258,10 @@ namespace NLGUI
// \name callback from libwww // \name callback from libwww
// Begin of the parsing of a HTML document // Begin of the rendering of a HTML document
virtual void beginBuild (); virtual void beginBuild ();
// End of the parsing of a HTML document // End of the rendering of a HTML document
virtual void endBuild (); virtual void endBuild ();
// A new text block has been parsed // A new text block has been parsed
@ -284,9 +279,6 @@ namespace NLGUI
// Add POST params to the libwww list // Add POST params to the libwww list
virtual void addHTTPPostParams (SFormFields &formfields, bool trustedDomain); virtual void addHTTPPostParams (SFormFields &formfields, bool trustedDomain);
// the current request is terminated
virtual void requestTerminated();
// Get Home URL // Get Home URL
virtual std::string home(); virtual std::string home();
@ -402,7 +394,6 @@ namespace NLGUI
// Browsing.. // Browsing..
bool _Browsing; bool _Browsing;
bool _Connecting;
double _TimeoutValue; // the timeout in seconds double _TimeoutValue; // the timeout in seconds
double _ConnectingTimeout; double _ConnectingTimeout;
sint _RedirectsRemaining; sint _RedirectsRemaining;
@ -759,6 +750,7 @@ namespace NLGUI
{ {
if (t == ImgType) imgs.push_back(CDataImageDownload(i, style, imagetype)); if (t == ImgType) imgs.push_back(CDataImageDownload(i, style, imagetype));
} }
~CDataDownload();
public: public:
CCurlWWWData *data; CCurlWWWData *data;
@ -772,13 +764,13 @@ namespace NLGUI
std::vector<CDataImageDownload> imgs; std::vector<CDataImageDownload> imgs;
}; };
std::vector<CDataDownload> Curls; std::list<CDataDownload> Curls;
CURLM *MultiCurl; CURLM *MultiCurl;
int RunningCurls; int RunningCurls;
bool startCurlDownload(CDataDownload &download); bool startCurlDownload(CDataDownload &download);
void finishCurlDownload(CDataDownload &download); void finishCurlDownload(const CDataDownload &download);
void pumpCurlDownloads(); void pumpCurlQueue();
void initImageDownload(); void initImageDownload();
void checkImageDownload(); void checkImageDownload();
@ -800,9 +792,15 @@ namespace NLGUI
// add css file from <link href=".." rel="stylesheet"> to download queue // add css file from <link href=".." rel="stylesheet"> to download queue
void addStylesheetDownload(std::vector<std::string> links); void addStylesheetDownload(std::vector<std::string> links);
// stop all curl downalods (html and data)
void releaseDownloads(); void releaseDownloads();
void checkDownloads(); void checkDownloads();
// _CurlWWW download finished
void htmlDownloadFinished(bool success, const std::string &error);
// images, stylesheets, etc finished downloading
void dataDownloadFinished(bool success, const std::string &error, CDataDownload &data);
// HtmlType download finished // HtmlType download finished
void htmlDownloadFinished(const std::string &content, const std::string &type, long code); void htmlDownloadFinished(const std::string &content, const std::string &type, long code);

File diff suppressed because it is too large Load diff

View file

@ -3207,7 +3207,6 @@ void CLuaIHMRyzom::browseNpcWebPage(const std::string &htmlId, const std::string
groupHtml->setTimeout((float)std::max(0.0, timeout)); groupHtml->setTimeout((float)std::max(0.0, timeout));
// Browse the url // Browse the url
groupHtml->clean();
groupHtml->browse(url.c_str()); groupHtml->browse(url.c_str());
// Set top of the page // Set top of the page
CCtrlScroll *pScroll = groupHtml->getScrollBar(); CCtrlScroll *pScroll = groupHtml->getScrollBar();