aboutsummaryrefslogtreecommitdiffstats
path: root/apps/windoze/CBuilder5/InstallMgr/StatusFrm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'apps/windoze/CBuilder5/InstallMgr/StatusFrm.cpp')
-rw-r--r--apps/windoze/CBuilder5/InstallMgr/StatusFrm.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/apps/windoze/CBuilder5/InstallMgr/StatusFrm.cpp b/apps/windoze/CBuilder5/InstallMgr/StatusFrm.cpp
index d3e5c34..a162354 100644
--- a/apps/windoze/CBuilder5/InstallMgr/StatusFrm.cpp
+++ b/apps/windoze/CBuilder5/InstallMgr/StatusFrm.cpp
@@ -21,7 +21,12 @@ TStatusForm *StatusForm;
void status_callback(double dltotal, double dlnow) {
- StatusForm->statusBar->Caption = ::IntToStr((long)dlnow) + " bytes out of " + ::IntToStr((long)dltotal) + " transferred (" + IntToStr((int)((float)(dlnow + 1) / (float)(dltotal) * 100)) + "%)";
+ int filePercent = (int)((float)(dlnow + 1) / (float)(dltotal) * 100);
+ int totalPercent = (int)((float)(dlnow + StatusForm->completedBytes + 1) / (float)(StatusForm->totalBytes) * 100);
+ StatusForm->statusBar->Caption = ::IntToStr((long)dlnow) + " bytes out of " + ::IntToStr((long)dltotal) + " transferred (file: " + IntToStr(filePercent) + "% / total: " + IntToStr(totalPercent) + "%)";
+ StatusForm->fileProgress->Position = filePercent;
+ StatusForm->totalProgress->Position = totalPercent;
+
StatusForm->statusBar->Repaint();
}
@@ -101,7 +106,7 @@ void __fastcall TStatusForm::TFTPThread::Execute()
string url = "ftp://" + ist->Source + ist->Directory.c_str() + "/" + src + "/"; //dont forget the final slash
- vector<struct ftpparse> dirList = FTPURLGetDir(session, url.c_str());
+ vector<struct ftpparse> dirList = FTPURLGetDir(session, url.c_str(), passive);
if (!dirList.size()) {
MessageBox(0, "Can't connect. Please check your configuration.", "Connection Error", MB_OK);
@@ -110,6 +115,10 @@ void __fastcall TStatusForm::TFTPThread::Execute()
// StatusForm->ftpCon->List(dirText, "*", true);
// TIdFTPListItems *dirList = StatusForm->ftpCon->DirectoryListing;
+ StatusForm->totalBytes = 0;
+ for (int i = 0; i < dirList.size(); i++)
+ StatusForm->totalBytes += dirList[i].size;
+ StatusForm->completedBytes = 0;
for (int i = 0; i < dirList.size(); i++) {
if (dirList[i].flagtrycwd != 1) {
buffer = dest + "/" + (dirList[i].name);
@@ -125,15 +134,15 @@ void __fastcall TStatusForm::TFTPThread::Execute()
TMainForm::createParent(buffer.c_str()); // make sure parent directory exists
Synchronize((TThreadMethod)&PreDownload1);
try {
- StatusForm->currentFileSize = dirList[i].size;
// StatusForm->ftpCon->Get(dirList->Items[i]->FileName.c_str(), buffer.c_str(), true, false);
string url = "ftp://" + ist->Source + ist->Directory.c_str() + "/" + src + "/" + dirList[i].name; //dont forget the final slash
- if (FTPURLGetFile(session, buffer.c_str(), url.c_str(), status_callback)) {
+ if (FTPURLGetFile(session, buffer.c_str(), url.c_str(), passive, status_callback)) {
MessageBox(0, "Can't download file. If you have not done so recently, you might try pressing the Refresh from Remote Source button.", "Download Error", MB_OK);
StatusForm->Button1Click(0); // abort thread
}
+ StatusForm->completedBytes += dirList[i].size;
}
catch (...) {}
if (Terminated)
@@ -171,8 +180,6 @@ void __fastcall TStatusForm::TFTPThread::FTPLinkPacketRecvd(TObject *Sender)
//void __fastcall TStatusForm::TFTPThread::UpdateBytes(void) {
void __fastcall TStatusForm::UpdateBytes(void) {
- StatusForm->statusBar->Caption = IntToStr(StatusForm->currentByteCount) + " bytes out of " + IntToStr(StatusForm->currentFileSize) + " transferred (" + IntToStr((int)((float)(StatusForm->currentByteCount + 1) / (float)(StatusForm->currentFileSize + 1) * 100)) + "%)";
- StatusForm->statusBar->Repaint();
}