diff options
author | Alex Borisov <borisov.alexandr@rambler.ru> | 2011-11-28 23:02:47 +0200 |
---|---|---|
committer | Alex Borisov <borisov.alexandr@rambler.ru> | 2011-11-28 23:02:47 +0200 |
commit | 29043c381edb0fa8934a187be3cfd757cf787996 (patch) | |
tree | b513c11fea783fbb079d8f69a3cd1634776637c5 /client/DownloadClient.cpp | |
parent | ee207db191173eb964c50261bc624c1ffcef715b (diff) |
Code to test file transfer
Diffstat (limited to 'client/DownloadClient.cpp')
-rw-r--r-- | client/DownloadClient.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/client/DownloadClient.cpp b/client/DownloadClient.cpp index df4da25..b834622 100644 --- a/client/DownloadClient.cpp +++ b/client/DownloadClient.cpp @@ -19,7 +19,7 @@ void DownloadClient::Download(const string &filename) pair<string, string> file(filename, 0); vector<pair<string, string> > fileList; fileList.push_back(file); - Download(fileList); + Download(fileList); } void DownloadClient::Download(const pair<string, string> &file) @@ -46,6 +46,28 @@ void DownloadClient::Download(const vector<pair<string, string> > &fileList) DoDownload(); } +void DownloadClient::DoDownload() +{ + if (currentId < (int)files.size()) + { + currentId++; + pair<string, string> file = files[currentId]; + QString filename = QString::fromLocal8Bit(file.first.c_str()); + string md5 = file.second; + current = new QFile(filename); + current->open(QIODevice::ReadWrite); + + Logger::Info("Downloading file %s\n", file.first.c_str()); + SendFileRequest(file.first); + } + else + { + Logger::Info("All files have been downloaded."); + isDownloading = false; + emit downloadFinished(); + } +} + void DownloadClient::FileDataRecieved(SslClient::RequestType &type, QByteArray &data) { if (type != RegularFile) @@ -86,25 +108,3 @@ void DownloadClient::FileDataRecieved(SslClient::RequestType &type, QByteArray & DoDownload(); } } - -void DownloadClient::DoDownload() -{ - if (currentId < (int)files.size()) - { - currentId++; - pair<string, string> file = files[currentId]; - QString filename = QString::fromLocal8Bit(file.first.c_str()); - string md5 = file.second; - current = new QFile(filename); - current->open(QIODevice::ReadWrite); - - Logger::Info("Downloading file %s\n", file.first.c_str()); - SendFileRequest(file.first); - } - else - { - Logger::Info("All files have been downloaded."); - isDownloading = false; - emit downloadFinished(); - } -} |