diff options
author | Alex Borisov <borisov.alexandr@rambler.ru> | 2011-12-01 03:11:09 +0200 |
---|---|---|
committer | Alex Borisov <borisov.alexandr@rambler.ru> | 2011-12-01 03:11:09 +0200 |
commit | 918defcaea2b570a927a2884ce0e720b03e32d8a (patch) | |
tree | 5c05b21f2c565a3ccc0124edf3af175657205d04 /client/FileOpThread.cpp | |
parent | 70dc6021943eacded7c26f2ca66375f64f19d819 (diff) |
FIX file transfer; FIX packet parsing bug; + many various fixes and improvements
Diffstat (limited to 'client/FileOpThread.cpp')
-rw-r--r-- | client/FileOpThread.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/client/FileOpThread.cpp b/client/FileOpThread.cpp index 42cb51b..3340db2 100644 --- a/client/FileOpThread.cpp +++ b/client/FileOpThread.cpp @@ -4,6 +4,13 @@ #include "FileOpThread.h" #include "UpdatedConfig.h" + +FileOpThread::~FileOpThread() +{ + if (downloadClient != NULL) + delete downloadClient; +} + void FileOpThread::run() { UpdatedConfig *cfg = UpdatedConfig::CurrentConfig(); @@ -51,13 +58,20 @@ void FileOpThread::run() if (files.size() != 0) { Logger::Debug("Setting server address to %s\n", cfg->GetServerAddr().c_str()); - QString addr = QString::fromLocal8Bit(cfg->GetServerAddr().c_str()); - DownloadClient downloadClient(addr); - downloadClient.Download(files); + downloadClient = new DownloadClient(addr); + + // start downloading files and + // wait for files to be downloaded + QEventLoop loop; + connect(downloadClient, SIGNAL(downloadFinished()), &loop, SLOT(quit())); + downloadClient->Download(files); + loop.exec(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers); } else { Logger::Trace("No files to download from server.\n"); } -}
\ No newline at end of file + + Logger::Trace("Terminating Download Helper thread\n"); +} |