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
sint32 curlMaxConnections;
SWebOptions(): curlMaxConnections(2)
SWebOptions(): curlMaxConnections(5)
{
}
};
@ -753,7 +753,7 @@ namespace NLGUI
{
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)
: 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));
}
@ -769,6 +769,7 @@ namespace NLGUI
uint32 redirects;
FILE *fp;
std::vector<CDataImageDownload> imgs;
uint32 ConnectionTimeout;
};
std::list<CDataDownload> Curls;

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

@ -843,6 +843,19 @@ namespace NLGUI
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
sint32 tableWidthSizeAfterPercent = tableWidth;
for (i=0; i<_Columns.size(); i++)

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

Loading…
Cancel
Save