diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index 5ebc6e86f..3b7fb9a76 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -156,7 +156,6 @@ void bittorrent::setDownloadLimit(QString hash, long val) { QTorrentHandle h = getTorrentHandle(hash); if(h.is_valid()) { h.set_download_limit(val); - TorrentPersistentData::saveSpeedLimits(h); } } @@ -169,7 +168,6 @@ void bittorrent::setUploadLimit(QString hash, long val) { QTorrentHandle h = getTorrentHandle(hash); if(h.is_valid()) { h.set_upload_limit(val); - TorrentPersistentData::saveSpeedLimits(h); } } @@ -701,19 +699,12 @@ QTorrentHandle bittorrent::addMagnetUri(QString magnet_uri, bool resumed) { h.set_max_connections(Preferences::getMaxConnecsPerTorrent()); // Uploads limit per torrent h.set_max_uploads(Preferences::getMaxUploadsPerTorrent()); - // Speed limits - if(TorrentPersistentData::isKnownTorrent(h.hash())) { - h.set_download_limit(TorrentPersistentData::getDownloadLimit(h.hash())); - h.set_upload_limit(TorrentPersistentData::getUploadLimit(h.hash())); - } // Resolve countries h.resolve_countries(resolve_countries); // Load filtered files if(resumed) { // Load custom url seeds loadWebSeeds(hash); - // Load speed limit from hard drive - loadTorrentSpeedLimits(hash); // Load trackers loadTrackerFile(hash); // XXX: only when resuming because torrentAddition dialog is not supported yet @@ -880,11 +871,6 @@ QTorrentHandle bittorrent::addTorrent(QString path, bool fromScanDir, QString fr h.set_max_connections(Preferences::getMaxConnecsPerTorrent()); // Uploads limit per torrent h.set_max_uploads(Preferences::getMaxUploadsPerTorrent()); - // Speed limits - if(TorrentPersistentData::isKnownTorrent(h.hash())) { - h.set_download_limit(TorrentPersistentData::getDownloadLimit(h.hash())); - h.set_upload_limit(TorrentPersistentData::getUploadLimit(h.hash())); - } // Resolve countries qDebug("AddTorrent: Resolve_countries: %d", (int)resolve_countries); h.resolve_countries(resolve_countries); @@ -893,8 +879,6 @@ QTorrentHandle bittorrent::addTorrent(QString path, bool fromScanDir, QString fr if(resumed) { // Load custom url seeds loadWebSeeds(hash); - // Load speed limit from hard drive - loadTorrentSpeedLimits(hash); // Load trackers loadTrackerFile(hash); } else { @@ -977,7 +961,6 @@ void bittorrent::setMaxConnectionsPerTorrent(int max) { continue; } h.set_max_connections(max); - TorrentPersistentData::saveSpeedLimits(h); } } @@ -992,7 +975,6 @@ void bittorrent::setMaxUploadsPerTorrent(int max) { continue; } h.set_max_uploads(max); - TorrentPersistentData::saveSpeedLimits(h); } } @@ -1102,13 +1084,6 @@ bool bittorrent::enableDHT(bool b) { return true; } -void bittorrent::loadTorrentSpeedLimits(QString hash) { - QTorrentHandle h = getTorrentHandle(hash); - qDebug("Loading speedLimits file for %s", hash.toLocal8Bit().data()); - h.set_download_limit(TorrentPersistentData::getDownloadLimit(hash)); - h.set_upload_limit(TorrentPersistentData::getUploadLimit(hash)); -} - // Read pieces priorities from hard disk // and ask QTorrentHandle to consider them void bittorrent::loadFilesPriorities(QTorrentHandle &h) { diff --git a/src/bittorrent.h b/src/bittorrent.h index ea4954881..cf0a6cb4c 100644 --- a/src/bittorrent.h +++ b/src/bittorrent.h @@ -135,7 +135,6 @@ class bittorrent : public QObject { void enableIPFilter(QString filter); void disableIPFilter(); void setQueueingEnabled(bool enable); - void loadTorrentSpeedLimits(QString hash); void handleDownloadFailure(QString url, QString reason); void loadWebSeeds(QString fileHash); void downloadUrlAndSkipDialog(QString url, QString save_path=QString::null); diff --git a/src/torrentPersistentData.h b/src/torrentPersistentData.h index ab1657804..7fff28f68 100644 --- a/src/torrentPersistentData.h +++ b/src/torrentPersistentData.h @@ -204,9 +204,6 @@ public: } // Sequential download data["sequential"] = h.is_sequential_download(); - // Speed limits - data["up_speed"] = h.upload_limit(); - data["dl_speed"] = h.download_limit(); // Save data all_data[h.hash()] = data; settings.setValue("torrents", all_data); @@ -259,17 +256,6 @@ public: qDebug("TorrentPersistentData: Saving save_path: %s, hash: %s", save_path.toLocal8Bit().data(), hash.toLocal8Bit().data()); } - static void saveSpeedLimits(QTorrentHandle h) { - Q_ASSERT(!h.hash().isEmpty()); - QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); - QHash all_data = settings.value("torrents", QHash()).toHash(); - QHash data = all_data[h.hash()].toHash(); - data["up_speed"] = h.upload_limit(); - data["dl_speed"] = h.download_limit(); - all_data[h.hash()] = data; - settings.setValue("torrents", all_data); - } - static void saveUrlSeeds(QTorrentHandle h) { QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); QHash all_data = settings.value("torrents", QHash()).toHash(); @@ -325,20 +311,6 @@ public: return data["files_priority"].toList(); } - static int getUploadLimit(QString hash) { - QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); - QHash all_data = settings.value("torrents", QHash()).toHash(); - QHash data = all_data[hash].toHash(); - return data.value("up_speed", -1).toInt(); - } - - static int getDownloadLimit(QString hash) { - QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); - QHash all_data = settings.value("torrents", QHash()).toHash(); - QHash data = all_data[hash].toHash(); - return data.value("dl_speed", -1).toInt(); - } - static QString getSavePath(QString hash) { QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); QHash all_data = settings.value("torrents", QHash()).toHash();