From e2dc2207d825c8442b54d43a2b967377e4fd4056 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Thu, 27 Aug 2009 08:23:35 +0000 Subject: [PATCH] - Fixed v1.4.x torrent import --- src/bittorrent.cpp | 30 ++++++++++++++++++++++++++++-- src/src.pro | 2 +- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index 16c2f5dc4..e827a7715 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -757,7 +757,20 @@ void bittorrent::importOldTorrents() { QPair fileName; foreach(fileName, filePaths) { importOldTempData(fileName.second); - addTorrent(fileName.second, false, QString(), true); + QTorrentHandle h = addTorrent(fileName.second, false, QString(), true); + // Sequential download + if(TorrentTempData::hasTempData(h.hash())) { + qDebug("addTorrent: Setting download as sequential (from tmp data)"); + h.set_sequential_download(TorrentTempData::isSequential(h.hash())); + } + QString savePath = TorrentTempData::getSavePath(h.hash()); + // Save persistent data for new torrent + TorrentPersistentData::saveTorrentPersistentData(h); + // Save save_path + if(!defaultTempPath.isEmpty() && !savePath.isNull()) { + qDebug("addTorrent: Saving save_path in persistent data: %s", savePath.toLocal8Bit().data()); + TorrentPersistentData::saveSavePath(h.hash(), savePath); + } } } else { QStringList filePaths; @@ -767,7 +780,20 @@ void bittorrent::importOldTorrents() { // Resume downloads foreach(const QString &fileName, filePaths) { importOldTempData(fileName); - addTorrent(fileName, false, QString(), true); + QTorrentHandle h = addTorrent(fileName, false, QString(), true); + // Sequential download + if(TorrentTempData::hasTempData(h.hash())) { + qDebug("addTorrent: Setting download as sequential (from tmp data)"); + h.set_sequential_download(TorrentTempData::isSequential(h.hash())); + } + QString savePath = TorrentTempData::getSavePath(h.hash()); + // Save persistent data for new torrent + TorrentPersistentData::saveTorrentPersistentData(h); + // Save save_path + if(!defaultTempPath.isEmpty() && !savePath.isNull()) { + qDebug("addTorrent: Saving save_path in persistent data: %s", savePath.toLocal8Bit().data()); + TorrentPersistentData::saveSavePath(h.hash(), savePath); + } } } settings.setValue("v1_4_x_torrent_imported", true); diff --git a/src/src.pro b/src/src.pro index 5b4ffabdc..f48c536cd 100644 --- a/src/src.pro +++ b/src/src.pro @@ -14,7 +14,7 @@ CONFIG += qt \ network # Update this VERSION for each release -DEFINES += VERSION=\\\"v1.5.0rc1\\\" +DEFINES += VERSION=\\\"v1.5.0rc2\\\" DEFINES += VERSION_MAJOR=1 DEFINES += VERSION_MINOR=5 DEFINES += VERSION_BUGFIX=0