Fix magnet metadata loading. Update the queue and save_path correctly in all use cases.

This commit is contained in:
sledgehammer999
2013-10-09 23:34:00 +03:00
parent c6bc4d2cd2
commit e08ae6b668
2 changed files with 70 additions and 26 deletions

View File

@@ -117,32 +117,36 @@ private:
class HiddenData {
public:
static void addData(const QString &hash) {
hashes.append(hash);
data[hash] = false;
}
static bool hasData(const QString &hash) {
return hashes.contains(hash, Qt::CaseInsensitive);
return data.contains(hash);
}
static void deleteData(const QString &hash) {
if (hashes.removeAll(hash))
if (data.value(hash, false))
metadata_counter--;
data.remove(hash);
}
static int getSize() {
return hashes.size();
return data.size();
}
static int getDownloadingSize() {
return hashes.size() - metadata_counter;
return data.size() - metadata_counter;
}
static void gotMetadata() {
static void gotMetadata(const QString &hash) {
if (!data.contains(hash))
return;
data[hash] = true;
metadata_counter++;
}
private:
static QStringList hashes;
static QHash<QString, bool> data;
static unsigned int metadata_counter;
};