mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
Windows execution fixes
This commit is contained in:
parent
58a36f7cfd
commit
338d4fd31e
11 changed files with 164 additions and 53 deletions
|
@ -72,26 +72,27 @@ void downloadThread::processDlFinished(QNetworkReply* reply) {
|
|||
}
|
||||
// Success
|
||||
QString filePath;
|
||||
QTemporaryFile tmpfile;
|
||||
tmpfile.setAutoRemove(false);
|
||||
if (tmpfile.open()) {
|
||||
filePath = tmpfile.fileName();
|
||||
QTemporaryFile *tmpfile = new QTemporaryFile;
|
||||
tmpfile->setAutoRemove(false);
|
||||
if (tmpfile->open()) {
|
||||
filePath = tmpfile->fileName();
|
||||
qDebug("Temporary filename is: %s", qPrintable(filePath));
|
||||
if(reply->open(QIODevice::ReadOnly)) {
|
||||
// TODO: Support GZIP compression
|
||||
QByteArray content = reply->readAll();
|
||||
//qDebug("Read content: %s", content.data());
|
||||
tmpfile.write(content);
|
||||
tmpfile->write(reply->readAll());
|
||||
reply->close();
|
||||
tmpfile.close();
|
||||
tmpfile->close();
|
||||
delete tmpfile;
|
||||
// Send finished signal
|
||||
emit downloadFinished(url, filePath);
|
||||
} else {
|
||||
// Error when reading the request
|
||||
tmpfile.close();
|
||||
tmpfile->close();
|
||||
delete tmpfile;
|
||||
emit downloadFailure(url, tr("I/O Error"));
|
||||
}
|
||||
} else {
|
||||
delete tmpfile;
|
||||
emit downloadFailure(url, tr("I/O Error"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue