summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/downloadmanager.cpp4
-rw-r--r--src/installationmanager.cpp8
-rw-r--r--src/nxmaccessmanager.cpp2
3 files changed, 11 insertions, 3 deletions
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp
index 97a0a266..c8f118f6 100644
--- a/src/downloadmanager.cpp
+++ b/src/downloadmanager.cpp
@@ -1150,7 +1150,9 @@ void DownloadManager::downloadFinished()
QVariantMap serverMap = server.toMap();
if (serverMap["URI"].toString() == url) {
int deltaTime = info->m_StartTime.secsTo(QTime::currentTime());
- emit downloadSpeed(serverMap["Name"].toString(), (info->m_TotalSize - info->m_PreResumeSize) / deltaTime);
+ if (deltaTime > 5) {
+ emit downloadSpeed(serverMap["Name"].toString(), (info->m_TotalSize - info->m_PreResumeSize) / deltaTime);
+ } // no division by zero please! Also, if the download is shorter than a few seconds, the result is way to inprecise
break;
}
}
diff --git a/src/installationmanager.cpp b/src/installationmanager.cpp
index 5d00142d..af2e6852 100644
--- a/src/installationmanager.cpp
+++ b/src/installationmanager.cpp
@@ -152,7 +152,6 @@ bool InstallationManager::unpackSingleFile(const QString &fileName)
if (_wcsicmp(data[i]->getFileName(), ToWString(fileName).c_str()) == 0) {
available = true;
data[i]->setSkip(false);
-qDebug("usf %ls -> %s", data[i]->getFileName(), qPrintable(baseName));
data[i]->setOutputFileName(ToWString(baseName).c_str());
m_TempFilesToDelete.insert(baseName);
} else {
@@ -727,6 +726,13 @@ bool InstallationManager::install(const QString &fileName, GuessedValue<QString>
qPrintable(installer->name()), e.what());
}
+ // clean up temp files
+ // TODO: this doesn't yet remove directories. Also, the files may be left there if this point isn't reached
+ foreach (const QString &tempFile, m_TempFilesToDelete) {
+ QFile::remove(QDir::tempPath() + "/" + tempFile);
+ }
+
+
// act upon the installation result. at this point the files have already been
// extracted to the correct location
switch (installResult) {
diff --git a/src/nxmaccessmanager.cpp b/src/nxmaccessmanager.cpp
index 008d20a6..d83ffa61 100644
--- a/src/nxmaccessmanager.cpp
+++ b/src/nxmaccessmanager.cpp
@@ -40,7 +40,7 @@ using namespace MOShared;
NXMAccessManager::NXMAccessManager(QObject *parent)
- : QNetworkAccessManager(parent), m_LoginReply(NULL)
+ : QNetworkAccessManager(parent), m_LoginReply(NULL), m_ProgressDialog()
{
}