- updates to file transfer progress bar

This commit is contained in:
Mark Vejvoda 2011-01-04 20:00:39 +00:00
parent f3eee457c0
commit b8e272519c
2 changed files with 10 additions and 5 deletions

View File

@ -1712,9 +1712,9 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName, FTP_Client
if(stats != NULL) {
int fileProgress = 0;
if(stats->download_total > 0) {
fileProgress = (stats->download_now * 100.0 / stats->download_total);
fileProgress = ((stats->download_now / stats->download_total) * 100.0);
}
printf("Got FTP Callback for [%s] fileProgress = %d [now = %f, total = %f]\n",itemName.c_str(),fileProgress,stats->download_now,stats->download_total);
printf("Got FTP Callback for [%s] current file [%s] fileProgress = %d [now = %f, total = %f]\n",itemName.c_str(),stats->currentFilename.c_str(), fileProgress,stats->download_now,stats->download_total);
fileFTPProgressList[itemName] = pair<int,string>(fileProgress,stats->currentFilename);
}

View File

@ -91,7 +91,10 @@ static long file_is_comming(struct curl_fileinfo *finfo,void *data,int remains)
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\n===> FTP Client thread file_is_comming: remains: [%3d] filename: [%s] size: [%10luB] ", remains, finfo->filename,(unsigned long)finfo->size);
if(out != NULL) {
out->currentFilename = finfo->filename;
//out->currentFilename = finfo->filename;
out->currentFilename = fullFilePath;
if(SystemFlags::VERBOSE_MODE_ENABLED) printf(" current filename: [%s] ", fullFilePath.c_str());
}
switch(finfo->filetype) {
@ -263,7 +266,8 @@ void FTPClientThread::getMapFromServer(string mapFileName) {
}
if(this->pCBObject != NULL) {
this->pCBObject->FTPClient_CallbackEvent(mapFileName,ftp_cct_Map,result,NULL);
MutexSafeWrapper safeMutex(this->getProgressMutex());
this->pCBObject->FTPClient_CallbackEvent(mapFileName,ftp_cct_Map,result,NULL);
}
}
@ -288,7 +292,8 @@ void FTPClientThread::getTilesetFromServer(string tileSetName) {
}
if(this->pCBObject != NULL) {
this->pCBObject->FTPClient_CallbackEvent(tileSetName,ftp_cct_Tileset,result,NULL);
MutexSafeWrapper safeMutex(this->getProgressMutex());
this->pCBObject->FTPClient_CallbackEvent(tileSetName,ftp_cct_Tileset,result,NULL);
}
}