.reference

git-svn-id: svn://ultimatepp.org/upp/trunk@4832 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2012-04-19 16:47:56 +00:00
commit 2243359e93

View file

@ -6,6 +6,8 @@ struct Loader {
Progress pi;
HttpRequest http;
int64 loaded;
String url;
FileOut out;
typedef Loader CLASSNAME;
@ -16,7 +18,7 @@ struct Loader {
void Loader::Perform()
{
String url = "http://www.samgrob.ch/images/video/m60/m60_mtzion-nw-music1.divx";
url = "http://www.samgrob.ch/images/video/m60/m60_mtzion-nw-music1.divx";
for(;;) {
if(!EditText(url, "Download", "URL"))
break;
@ -35,16 +37,19 @@ void Loader::Perform()
void Loader::ProcessContent(const void *ptr, int size)
{
loaded += size;
if(!out.IsOpen())
}
void Loader::ShowProgress()
{
DDUMP(http.GetPeerAddr());
if(http.GetContentLength() >= 0)
if(http.GetContentLength() >= 0) {
pi.SetText("Downloading " + GetFileName(url));
pi.Set((int)loaded, (int)http.GetContentLength());
else
}
else {
pi.Set(0, 0);
pi.SetText(http.GetPhaseName());
pi.SetText(http.GetPhaseName());
}
if(pi.Canceled())
http.Abort();
}