From c1f72546e694f30c7ffa5cad35643df5e460a76b Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Thu, 14 Apr 2011 17:20:05 +0200 Subject: Download manager now threaded (Ticket #205) & change the watcher to create the trigger file and wait til it is modified, changing the file (f.e. writing something) triggers URL load --- src/downloadmanager.cpp | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) (limited to 'src/downloadmanager.cpp') diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 9f7a628..eb00354 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -7,6 +7,7 @@ DownloadManager::DownloadManager(){ qxtLog->debug() << "Initializing download manager..."; checkDownloadDirectory(); qnam = new QNetworkAccessManager(); + qnam->moveToThread(&dmThread); dip = false; } // ------------------------------------------------------------------------------------------------------- @@ -197,27 +198,3 @@ void DownloadManager::downloadFinished() } startNextDownload(); } -/******************************************************************************************************** -* - ** dead code: Header filename fetching & renaming ** - -const QByteArray cd = "Content-Disposition"; -QByteArray cdc = currentDownload->rawHeader(cd); -int x = cdc.indexOf("filename=\"") + 10; -cdc.remove(0, x).chop(1); -if (!cdc.isEmpty()) - currentTargetFilename = cdc; -else - currentTargetFilename = QString("download.\%1").arg(downloaded); - -QString tmp = outfile.fileName(); -tmp.remove(0, tmp.lastIndexOf(QChar('/')) + 1); -qDebug() << "Trying to rename " << tmp << " to --> " << currentTargetFilename; - -if (outfile.rename(downloadPath + "/" + currentTargetFilename)) { - qxtLog->debug() << "Renamed file!"; -} -else { - qxtLog->debug() << "Failure to rename file!"; -} -*/ -- cgit v1.2.3-55-g7522