Merge with develop

--HG--
branch : compatibility-develop
hg/compatibility-develop
Nimetu 6 years ago
commit eb8e4fc39b

@ -69,7 +69,7 @@ namespace NLGUI
/// Maximum concurrent MultiCurl connections per CGroupHTML instance /// Maximum concurrent MultiCurl connections per CGroupHTML instance
sint32 curlMaxConnections; sint32 curlMaxConnections;
SWebOptions(): curlMaxConnections(2) SWebOptions(): curlMaxConnections(5)
{ {
} }
}; };
@ -753,7 +753,7 @@ namespace NLGUI
{ {
public: public:
CDataDownload(const std::string &u, const std::string &d, TDataType t, CViewBase *i, const std::string &s, const std::string &m, const CStyleParams &style = CStyleParams(), const TImageType imagetype = NormalImage) CDataDownload(const std::string &u, const std::string &d, TDataType t, CViewBase *i, const std::string &s, const std::string &m, const CStyleParams &style = CStyleParams(), const TImageType imagetype = NormalImage)
: data(NULL), fp(NULL), url(u), dest(d), type(t), luaScript(s), md5sum(m), redirects(0) : data(NULL), fp(NULL), url(u), dest(d), type(t), luaScript(s), md5sum(m), redirects(0), ConnectionTimeout(60)
{ {
if (t == ImgType) imgs.push_back(CDataImageDownload(i, style, imagetype)); if (t == ImgType) imgs.push_back(CDataImageDownload(i, style, imagetype));
} }
@ -769,6 +769,7 @@ namespace NLGUI
uint32 redirects; uint32 redirects;
FILE *fp; FILE *fp;
std::vector<CDataImageDownload> imgs; std::vector<CDataImageDownload> imgs;
uint32 ConnectionTimeout;
}; };
std::list<CDataDownload> Curls; std::list<CDataDownload> Curls;

@ -546,6 +546,9 @@ namespace NLGUI
download.data = new CCurlWWWData(curl, download.url); download.data = new CCurlWWWData(curl, download.url);
download.fp = fp; download.fp = fp;
// initial connection timeout, curl default is 300sec
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, download.ConnectionTimeout);
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, true); curl_easy_setopt(curl, CURLOPT_NOPROGRESS, true);
curl_easy_setopt(curl, CURLOPT_URL, download.url.c_str()); curl_easy_setopt(curl, CURLOPT_URL, download.url.c_str());
@ -2519,9 +2522,10 @@ namespace NLGUI
bool CGroupHTML::isBrowsing() bool CGroupHTML::isBrowsing()
{ {
// do not show spinning cursor for image downloads (!Curls.empty())
return _BrowseNextTime || _PostNextTime || _RenderNextTime || return _BrowseNextTime || _PostNextTime || _RenderNextTime ||
_Browsing || _WaitingForStylesheet || _Browsing || _WaitingForStylesheet ||
_CurlWWW || !Curls.empty(); _CurlWWW;
} }
// *************************************************************************** // ***************************************************************************
@ -5564,12 +5568,15 @@ namespace NLGUI
// *************************************************************************** // ***************************************************************************
void CGroupHTML::htmlIMG(const CHtmlElement &elm) void CGroupHTML::htmlIMG(const CHtmlElement &elm)
{ {
// Get the string name std::string src = trim(elm.getAttribute("src"));
if (elm.hasNonEmptyAttribute("src")) if (src.empty())
{ {
// no 'src' attribute, or empty
return;
}
float tmpf; float tmpf;
std::string id = elm.getAttribute("id"); std::string id = elm.getAttribute("id");
std::string src = elm.getAttribute("src");
if (elm.hasNonEmptyAttribute("width")) if (elm.hasNonEmptyAttribute("width"))
getPercentage(_Style.Current.Width, tmpf, elm.getAttribute("width").c_str()); getPercentage(_Style.Current.Width, tmpf, elm.getAttribute("width").c_str());
@ -5624,7 +5631,6 @@ namespace NLGUI
addImage(id, elm.getAttribute("src"), reloadImg, _Style.Current); addImage(id, elm.getAttribute("src"), reloadImg, _Style.Current);
} }
} }
}
// *************************************************************************** // ***************************************************************************
void CGroupHTML::htmlINPUT(const CHtmlElement &elm) void CGroupHTML::htmlINPUT(const CHtmlElement &elm)
@ -5644,9 +5650,14 @@ namespace NLGUI
// Widget minimal width // Widget minimal width
string minWidth = elm.getAttribute("z_input_width"); string minWidth = elm.getAttribute("z_input_width");
// Get the type // <input type="...">
if (elm.hasNonEmptyAttribute("type")) std::string type = trim(elm.getAttribute("type"));
if (type.empty())
{ {
// no 'type' attribute, or empty
return;
}
// Global color flag // Global color flag
if (elm.hasAttribute("global_color")) if (elm.hasAttribute("global_color"))
_Style.Current.GlobalColor = true; _Style.Current.GlobalColor = true;
@ -5658,7 +5669,6 @@ namespace NLGUI
if (!strtooltip.empty()) if (!strtooltip.empty())
tooltip = strtooltip.c_str(); tooltip = strtooltip.c_str();
string type = toLower(elm.getAttribute("type"));
if (type == "image") if (type == "image")
{ {
// The submit button // The submit button
@ -5860,7 +5870,6 @@ namespace NLGUI
} }
} }
} }
}
// *************************************************************************** // ***************************************************************************
void CGroupHTML::htmlLI(const CHtmlElement &elm) void CGroupHTML::htmlLI(const CHtmlElement &elm)
@ -5933,8 +5942,11 @@ namespace NLGUI
std::string httpEquiv = elm.getAttribute("http-equiv"); std::string httpEquiv = elm.getAttribute("http-equiv");
std::string httpContent = elm.getAttribute("content"); std::string httpContent = elm.getAttribute("content");
if (!httpEquiv.empty() && !httpContent.empty()) if (httpEquiv.empty() || httpContent.empty())
{ {
return;
}
// only first http-equiv="refresh" should be handled // only first http-equiv="refresh" should be handled
if (_RefreshUrl.empty() && httpEquiv == "refresh") if (_RefreshUrl.empty() && httpEquiv == "refresh")
{ {
@ -5959,7 +5971,6 @@ namespace NLGUI
_NextRefreshTime += timeSec; _NextRefreshTime += timeSec;
} }
} }
}
// *************************************************************************** // ***************************************************************************
void CGroupHTML::htmlOBJECT(const CHtmlElement &elm) void CGroupHTML::htmlOBJECT(const CHtmlElement &elm)
@ -6323,8 +6334,18 @@ namespace NLGUI
} }
CGroupTable *table = getTable(); CGroupTable *table = getTable();
if (table) if (!table)
{ {
// <td> appears to be outside <table>
return;
}
if (_Cells.empty())
{
// <table> not started
return;
}
if (_Style.hasStyle("padding")) if (_Style.hasStyle("padding"))
{ {
uint32 a; uint32 a;
@ -6333,8 +6354,6 @@ namespace NLGUI
table->CellPadding = a; table->CellPadding = a;
} }
if (!_Cells.empty())
{
_Cells.back() = new CGroupCell(CViewBase::TCtorParam()); _Cells.back() = new CGroupCell(CViewBase::TCtorParam());
if (_Style.checkStyle("background-repeat", "1") || _Style.checkStyle("background-repeat", "repeat")) if (_Style.checkStyle("background-repeat", "1") || _Style.checkStyle("background-repeat", "repeat"))
@ -6401,8 +6420,6 @@ namespace NLGUI
renderPseudoElement(":before", elm); renderPseudoElement(":before", elm);
} }
}
}
void CGroupHTML::htmlTDend(const CHtmlElement &elm) void CGroupHTML::htmlTDend(const CHtmlElement &elm)
{ {
@ -6416,11 +6433,9 @@ namespace NLGUI
// *************************************************************************** // ***************************************************************************
void CGroupHTML::htmlTEXTAREA(const CHtmlElement &elm) void CGroupHTML::htmlTEXTAREA(const CHtmlElement &elm)
{ {
_PRE.push_back(true); if (_Forms.empty())
return;
// Got one form ?
if (!(_Forms.empty()))
{
// read general property // read general property
string templateName; string templateName;
@ -6445,14 +6460,11 @@ namespace NLGUI
_TextAreaTemplate = !templateName.empty() ? templateName : DefaultFormTextAreaGroup; _TextAreaTemplate = !templateName.empty() ? templateName : DefaultFormTextAreaGroup;
_TextArea = true; _TextArea = true;
} _PRE.push_back(true);
} }
void CGroupHTML::htmlTEXTAREAend(const CHtmlElement &elm) void CGroupHTML::htmlTEXTAREAend(const CHtmlElement &elm)
{ {
_TextArea = false;
popIfNotEmpty (_PRE);
if (_Forms.empty()) if (_Forms.empty())
return; return;
@ -6465,6 +6477,9 @@ namespace NLGUI
entry.TextArea = textArea; entry.TextArea = textArea;
_Forms.back().Entries.push_back (entry); _Forms.back().Entries.push_back (entry);
} }
_TextArea = false;
popIfNotEmpty (_PRE);
} }
// *************************************************************************** // ***************************************************************************

@ -843,6 +843,19 @@ namespace NLGUI
ratio -= _Columns[i].TableRatio; ratio -= _Columns[i].TableRatio;
} }
// force table width to fit all columns
// if width is set, then use column min width
if (ForceWidthMin > 0)
tableWidthMax = std::min(_LastParentW - borderWidth, std::max(tableWidthMax, tableWidth));
else
tableWidthMax = std::min(_LastParentW - borderWidth, std::max(tableWidthMax, tableMaxContentWidth));
if (tableWidthMax < 0)
tableWidthMax = 0;
if (tableWidthMax < tableWidthMin)
std::swap(tableWidthMin, tableWidthMax);
// Eval table size with all percent cells resized // Eval table size with all percent cells resized
sint32 tableWidthSizeAfterPercent = tableWidth; sint32 tableWidthSizeAfterPercent = tableWidth;
for (i=0; i<_Columns.size(); i++) for (i=0; i<_Columns.size(); i++)

@ -432,7 +432,7 @@ CClientConfig::CClientConfig()
WebIgTrustedDomains.push_back(WebIgMainDomain); WebIgTrustedDomains.push_back(WebIgMainDomain);
WebIgNotifInterval = 10; // time in minutes WebIgNotifInterval = 10; // time in minutes
CurlMaxConnections = 2; CurlMaxConnections = 5;
CurlCABundle.clear(); CurlCABundle.clear();
RingReleaseNotePath = "http://" + WebIgMainDomain + "/releasenotes_ring/index.php"; RingReleaseNotePath = "http://" + WebIgMainDomain + "/releasenotes_ring/index.php";

Loading…
Cancel
Save