summaryrefslogtreecommitdiffstats
path: root/src/downloadmanager.cpp
diff options
context:
space:
mode:
authorJonathan Bauer2011-03-24 12:56:17 +0100
committerJonathan Bauer2011-03-24 12:56:17 +0100
commit27d0351664673689caeec7e56c6851b0a12ad1ef (patch)
tree99ad7a9482b2ddd7837ba99798ea14e1b73744c3 /src/downloadmanager.cpp
parentmd5 hash of eth0 mac + ip for hardwarehash tests, completed POST data building (diff)
downloadfbgui-27d0351664673689caeec7e56c6851b0a12ad1ef.tar.gz
fbgui-27d0351664673689caeec7e56c6851b0a12ad1ef.tar.xz
fbgui-27d0351664673689caeec7e56c6851b0a12ad1ef.zip
debug tags
Diffstat (limited to 'src/downloadmanager.cpp')
-rw-r--r--src/downloadmanager.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp
index bcfaafb..fdec663 100644
--- a/src/downloadmanager.cpp
+++ b/src/downloadmanager.cpp
@@ -16,32 +16,32 @@ void DownloadManager::checkDownloadDirectory()
// check if downloadPath exists, if not create it.
downloadDir = QDir(downloadPath);
if (!downloadDir.exists()){
- qxtLog->debug() << "Download directory: " << downloadDir.path() << " doesn't exist.";
+ qxtLog->debug() << "[dm] Download directory: " << downloadDir.path() << " doesn't exist.";
// try to create the directory
if (QDir::current().mkdir(downloadPath))
- qxtLog->debug() << "Created download directory: " << downloadDir.path();
+ qxtLog->debug() << "[dm] Created download directory: " << downloadDir.path();
else {
- qxtLog->debug() << "Failed to create directory: " << downloadDir.path();
+ qxtLog->debug() << "[dm] Failed to create directory: " << downloadDir.path();
// try to save to /tmp/fbgui
downloadDir.setPath(QDir::tempPath () + "/fbgui");
if (!downloadDir.exists()){
if (QDir::current().mkdir(QDir::tempPath () + "/fbgui"))
- qxtLog->debug() << "Successfully created: " << downloadDir.absolutePath();
+ qxtLog->debug() << "[dm] Successfully created: " << downloadDir.absolutePath();
else {
// just in case
- qxtLog->debug() << "Failed to create: " << downloadDir.absolutePath();
- qxtLog->debug() << "Exiting...";
+ qxtLog->debug() << "[dm] Failed to create: " << downloadDir.absolutePath();
+ qxtLog->debug() << "[dm] Exiting...";
exit(EXIT_FAILURE);
}
}
else
- qxtLog->debug() << downloadDir.absolutePath() << " already exists.";
+ qxtLog->debug() << "[dm] " << downloadDir.absolutePath() << " already exists.";
}
}
else
- qxtLog->debug() << "Download directory: " << downloadDir.absolutePath() << " already exists.";
+ qxtLog->debug() << "[dm] Download directory: " << downloadDir.absolutePath() << " already exists.";
- qxtLog->debug() << "Saving downloads to: " << downloadDir.absolutePath();
+ qxtLog->debug() << "[dm] Saving downloads to: " << downloadDir.absolutePath();
//downloadPath = downloadDir.absolutePath();
}
// ----------------------------------------------------------------------------------------
@@ -59,19 +59,19 @@ void DownloadManager::downloadFile(const QUrl& fileUrl)
void DownloadManager::processDownloadRequest(const QUrl& url)
{
if (url.isEmpty()){
- qxtLog->debug() << "No URL specified for download.";
+ qxtLog->debug() << "[dm] No URL specified for download.";
return;
}
// if download in progress, enqueue file and return.
if (dip){
dlQ.enqueue(url);
- qxtLog->debug() << "Download in progress! Queued:" << url.toString()
+ qxtLog->debug() << "[dm] Download in progress! Queued:" << url.toString()
<< "(" << dlQ.size() << " in queue)";
return;
}
// no running downloads: enqueue and start next download.
dlQ.enqueue(url);
- qxtLog->debug() << "Enqueueing:" << url.toString();
+ qxtLog->debug() << "[dm] Enqueueing:" << url.toString();
startNextDownload();
}
// ----------------------------------------------------------------------------------------
@@ -79,10 +79,10 @@ void DownloadManager::startNextDownload()
{
if (dlQ.isEmpty()){
emit downloadQueueEmpty();
- qxtLog->debug() << "Download manager ready. (1)";
+ qxtLog->debug() << "[dm] Download manager ready. (1)";
return;
}
- qxtLog->debug() << "Starting next download: " << dlQ.head().toString()
+ qxtLog->debug() << "[dm] Starting next download: " << dlQ.head().toString()
<< " (" << dlQ.size() - 1 << " in queue.)";
// dequeue next URL to download.
@@ -94,16 +94,16 @@ void DownloadManager::startNextDownload()
// check if filename exists on target file system
if (downloadDir.exists(tmp)){
- qxtLog->debug() << "File already exists: " << downloadDir.absoluteFilePath(tmp);
+ qxtLog->debug() << "[dm] File already exists: " << downloadDir.absoluteFilePath(tmp);
outfile.setFileName(QString(downloadDir.absolutePath() + "/" + tmp + ".\%1").arg(downloaded));
}
else
outfile.setFileName(downloadDir.absoluteFilePath(tmp));
- qxtLog->debug() << "Saving to: " << outfile.fileName();
+ qxtLog->debug() << "[dm] Saving to: " << outfile.fileName();
// try to open for writing
if (!outfile.open(QIODevice::WriteOnly)){
- qxtLog->debug() << "No write access to " << outfile.fileName() << " . Skipping download...";
+ qxtLog->debug() << "[dm] No write access to " << outfile.fileName() << " . Skipping download...";
return;
}
@@ -160,7 +160,7 @@ void DownloadManager::downloadProgress(qint64 bytesIn, qint64 bytesTotal)
if (currentProgress - lastProgress >= updateInterval){
lastProgress = currentProgress;
emit updateProgress(currentProgress, speed, unit);
- qxtLog->debug() << "Download progress of " << currentDownload->url().toString()
+ qxtLog->debug() << "[dm] Download progress of " << currentDownload->url().toString()
<< ": " << bytesIn << "/" << bytesTotal << "(" << currentProgress << "\%)";
}
return;
@@ -174,21 +174,21 @@ void DownloadManager::downloadFinished()
outfile.close();
outfile.remove();
int statusCode = currentDownload->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
- qxtLog->debug() << "Download of " << currentDownload->url().toString()
+ qxtLog->debug() << "[dm] Download of " << currentDownload->url().toString()
<< " failed with HTTP error code: " << statusCode;
emit notify(QString("Download failed! HTTP Status Code: %1").arg(statusCode));
}
else{
// if kcl, append the session ID to it
if (outfile.fileName() == downloadDir.absoluteFilePath("kcl")){
- qxtLog->debug() << "Completing kernel command line...";
+ qxtLog->debug() << "[dm] Completing kernel command line...";
outfile.write(" session=" + sessionID.toUtf8());
}
// end download
currentDownload->deleteLater();
outfile.close();
downloaded++;
- qxtLog->debug() << "Download of " << currentDownload->url().toString()
+ qxtLog->debug() << "[dm] Download of " << currentDownload->url().toString()
<< " finished. (downloaded = "<< downloaded << ")";
emit notify(QString("Successfully downloaded %1").arg(currentDownload->url().toString()));
}
@@ -196,7 +196,7 @@ void DownloadManager::downloadFinished()
// process next in queue
if (dlQ.isEmpty()){
emit downloadQueueEmpty();
- qxtLog->debug() << "Download manager ready. (2)";
+ qxtLog->debug() << "[dm] Download manager ready. (2)";
return;
}
startNextDownload();