Improve loading of magnet metadata in the background.

Conflicts:
	src/qtlibtorrent/qbtsession.cpp
This commit is contained in:
sledgehammer999
2013-09-18 00:44:18 +03:00
parent 1e802f2090
commit 14310f9b05
6 changed files with 132 additions and 72 deletions

View File

@@ -114,6 +114,38 @@ private:
static QHash<QString, TorrentData> data;
};
class HiddenData {
public:
static void addData(const QString &hash) {
hashes.append(hash);
}
static bool hasData(const QString &hash) {
return hashes.contains(hash, Qt::CaseInsensitive);
}
static void deleteData(const QString &hash) {
if (hashes.removeAll(hash))
metadata_counter--;
}
static int getSize() {
return hashes.size();
}
static int getDownloadingSize() {
return hashes.size() - metadata_counter;
}
static void gotMetadata() {
metadata_counter++;
}
private:
static QStringList hashes;
static unsigned int metadata_counter;
};
class TorrentPersistentData {
public:
enum RatioLimit {