mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-27 06:54:20 +00:00
- Torrent Addition Dialog: File priorities were not taken into consideration (Thanks Mariusz)
This commit is contained in:
parent
d2dd29c35a
commit
abbbf1e562
@ -893,12 +893,7 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
|
||||
if(!from_url.isNull()) QFile::remove(file);
|
||||
return h;
|
||||
}
|
||||
// FIXME: Remove this debug
|
||||
std::vector<announce_entry> trackers = h.trackers();
|
||||
std::vector<announce_entry>::iterator it;
|
||||
for(it=trackers.begin(); it!=trackers.end(); it++) {
|
||||
qDebug("* Tracker: %s", it->url.c_str());
|
||||
}
|
||||
|
||||
// Connections limit per torrent
|
||||
h.set_max_connections(Preferences::getMaxConnecsPerTorrent());
|
||||
// Uploads limit per torrent
|
||||
@ -910,6 +905,7 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
|
||||
// Sequential download
|
||||
if(TorrentTempData::hasTempData(hash)) {
|
||||
qDebug("addTorrent: Setting download as sequential (from tmp data)");
|
||||
h.prioritize_files(TorrentTempData::getFilesPriority(hash));
|
||||
h.set_sequential_download(TorrentTempData::isSequential(hash));
|
||||
}
|
||||
// Save persistent data for new torrent
|
||||
|
@ -472,7 +472,8 @@ void QTorrentHandle::set_max_connections(int val) {
|
||||
void QTorrentHandle::prioritize_files(std::vector<int> v) {
|
||||
// Does not do anything for seeding torrents
|
||||
Q_ASSERT(h.is_valid());
|
||||
Q_ASSERT(v.size() == (unsigned int)h.get_torrent_info().num_files());
|
||||
if(v.size() != (unsigned int)h.get_torrent_info().num_files())
|
||||
return;
|
||||
h.prioritize_files(v);
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <libtorrent/magnet_uri.hpp>
|
||||
#include "qtorrenthandle.h"
|
||||
#include "misc.h"
|
||||
#include <vector>
|
||||
|
||||
#ifdef QT_4_5
|
||||
#include <QHash>
|
||||
@ -135,13 +136,18 @@ public:
|
||||
return QString::null;
|
||||
}
|
||||
|
||||
static QVariantList getFilesPriority(QString hash) {
|
||||
static std::vector<int> getFilesPriority(QString hash) {
|
||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume"));
|
||||
QHash<QString, QVariant> all_data = settings.value("torrents-tmp", QHash<QString, QVariant>()).toHash();
|
||||
QHash<QString, QVariant> data = all_data[hash].toHash();
|
||||
if(data.contains("files_priority"))
|
||||
return data["files_priority"].toList();
|
||||
return QVariantList();
|
||||
std::vector<int> fp;
|
||||
if(data.contains("files_priority")) {
|
||||
QVariantList list_var = data["files_priority"].toList();
|
||||
foreach(const QVariant& var, list_var) {
|
||||
fp.push_back(var.toInt());
|
||||
}
|
||||
}
|
||||
return fp;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user