Fix torrent download on win32 (all seems functional now).

This commit is contained in:
Christophe Dumez
2010-05-30 17:23:41 +00:00
parent cfc4e7c8f6
commit 47e337dc5d
4 changed files with 2074 additions and 2052 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -73,24 +73,27 @@ void downloadThread::processDlFinished(QNetworkReply* reply) {
} }
// Success // Success
QString filePath; QString filePath;
QTemporaryFile tmpfile; QTemporaryFile *tmpfile = new QTemporaryFile;
tmpfile.setAutoRemove(false); tmpfile->setAutoRemove(false);
if (tmpfile.open()) { if (tmpfile->open()) {
filePath = tmpfile.fileName(); filePath = tmpfile->fileName();
qDebug("Temporary filename is: %s", qPrintable(filePath)); qDebug("Temporary filename is: %s", qPrintable(filePath));
if(reply->open(QIODevice::ReadOnly)) { if(reply->open(QIODevice::ReadOnly)) {
// TODO: Support GZIP compression // TODO: Support GZIP compression
tmpfile.write(reply->readAll()); tmpfile->write(reply->readAll());
reply->close(); reply->close();
tmpfile.close(); tmpfile->close();
delete tmpfile;
// Send finished signal // Send finished signal
emit downloadFinished(url, filePath); emit downloadFinished(url, filePath);
} else { } else {
// Error when reading the request // Error when reading the request
tmpfile.close(); tmpfile->close();
delete tmpfile;
emit downloadFailure(url, tr("I/O Error")); emit downloadFailure(url, tr("I/O Error"));
} }
} else { } else {
delete tmpfile;
emit downloadFailure(url, tr("I/O Error")); emit downloadFailure(url, tr("I/O Error"));
} }
} }

View File

@@ -155,11 +155,8 @@ void SearchEngine::checkForPythonExe() {
QString path_envar = QString::fromLocal8Bit(getenv("PATH")); QString path_envar = QString::fromLocal8Bit(getenv("PATH"));
if(path_envar.isNull()) { if(path_envar.isNull()) {
path_envar = ""; path_envar = "";
} else {
if(!path_envar.endsWith(";"))
path_envar += ";";
} }
path_envar += python_path+";"; path_envar = python_path+";"+path_envar;
qDebug("New PATH envvar is: %s", qPrintable(path_envar)); qDebug("New PATH envvar is: %s", qPrintable(path_envar));
QString envar = "PATH="+path_envar; QString envar = "PATH="+path_envar;
putenv(envar.toLocal8Bit().data()); putenv(envar.toLocal8Bit().data());

View File

@@ -3,7 +3,7 @@ LANG_PATH = lang
ICONS_PATH = Icons ICONS_PATH = Icons
# Set the following variable to 1 to enable debug # Set the following variable to 1 to enable debug
DEBUG_MODE = 1 DEBUG_MODE = 0
# Global # Global
TEMPLATE = app TEMPLATE = app