|
|
|
@ -31,7 +31,6 @@
@@ -31,7 +31,6 @@
|
|
|
|
|
#ifndef TORRENTPERSISTENTDATA_H |
|
|
|
|
#define TORRENTPERSISTENTDATA_H |
|
|
|
|
|
|
|
|
|
#include <QSettings> |
|
|
|
|
#include <QVariant> |
|
|
|
|
#include <QDateTime> |
|
|
|
|
#include <libtorrent/version.hpp> |
|
|
|
@ -39,6 +38,7 @@
@@ -39,6 +38,7 @@
|
|
|
|
|
#include "qtorrenthandle.h" |
|
|
|
|
#include "misc.h" |
|
|
|
|
#include <vector> |
|
|
|
|
#include "qinisettings.h" |
|
|
|
|
|
|
|
|
|
#if QT_VERSION < 0x040500 |
|
|
|
|
#include <QMap> |
|
|
|
@ -51,13 +51,13 @@
@@ -51,13 +51,13 @@
|
|
|
|
|
class TorrentTempData { |
|
|
|
|
public: |
|
|
|
|
static bool hasTempData(QString hash) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QHash<QString, QVariant> all_data = settings.value("torrents-tmp", QHash<QString, QVariant>()).toHash(); |
|
|
|
|
return all_data.contains(hash); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void deleteTempData(QString hash) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QHash<QString, QVariant> all_data = settings.value("torrents-tmp", QHash<QString, QVariant>()).toHash(); |
|
|
|
|
if(all_data.contains(hash)) { |
|
|
|
|
all_data.remove(hash); |
|
|
|
@ -66,7 +66,7 @@ public:
@@ -66,7 +66,7 @@ public:
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void setFilesPriority(QString hash, const std::vector<int> &pp) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings 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(); |
|
|
|
|
std::vector<int>::const_iterator pp_it = pp.begin(); |
|
|
|
@ -81,7 +81,7 @@ public:
@@ -81,7 +81,7 @@ public:
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void setFilesPath(QString hash, const QStringList &path_list) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings 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(); |
|
|
|
|
data["files_path"] = path_list; |
|
|
|
@ -90,7 +90,7 @@ public:
@@ -90,7 +90,7 @@ public:
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void setSavePath(QString hash, QString save_path) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings 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(); |
|
|
|
|
data["save_path"] = save_path; |
|
|
|
@ -99,7 +99,7 @@ public:
@@ -99,7 +99,7 @@ public:
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void setLabel(QString hash, QString label) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings 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(); |
|
|
|
|
qDebug("Saving label %s to tmp data", label.toLocal8Bit().data()); |
|
|
|
@ -109,7 +109,7 @@ public:
@@ -109,7 +109,7 @@ public:
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void setSequential(QString hash, bool sequential) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings 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(); |
|
|
|
|
data["sequential"] = sequential; |
|
|
|
@ -118,7 +118,7 @@ public:
@@ -118,7 +118,7 @@ public:
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static bool isSequential(QString hash) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings 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("sequential")) |
|
|
|
@ -129,7 +129,7 @@ public:
@@ -129,7 +129,7 @@ public:
|
|
|
|
|
|
|
|
|
|
#if LIBTORRENT_VERSION_MINOR > 14 |
|
|
|
|
static void setSeedingMode(QString hash,bool seed){ |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings 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(); |
|
|
|
|
data["seeding"] = seed; |
|
|
|
@ -138,7 +138,7 @@ public:
@@ -138,7 +138,7 @@ public:
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static bool isSeedingMode(QString hash){ |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings 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("seeding")) |
|
|
|
@ -148,7 +148,7 @@ public:
@@ -148,7 +148,7 @@ public:
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
static QString getSavePath(QString hash) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings 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("save_path")) |
|
|
|
@ -158,7 +158,7 @@ public:
@@ -158,7 +158,7 @@ public:
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static QStringList getFilesPath(QString hash) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings 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_path")) |
|
|
|
@ -167,7 +167,7 @@ public:
@@ -167,7 +167,7 @@ public:
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static QString getLabel(QString hash) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings 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(); |
|
|
|
|
qDebug("Got label %s from tmp data", data.value("label", "").toString().toLocal8Bit().data()); |
|
|
|
@ -175,7 +175,7 @@ public:
@@ -175,7 +175,7 @@ public:
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static std::vector<int> getFilesPriority(QString hash) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings 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(); |
|
|
|
|
std::vector<int> fp; |
|
|
|
@ -193,19 +193,19 @@ class TorrentPersistentData {
@@ -193,19 +193,19 @@ class TorrentPersistentData {
|
|
|
|
|
public: |
|
|
|
|
|
|
|
|
|
static bool isKnownTorrent(QString hash) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QHash<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash(); |
|
|
|
|
return all_data.contains(hash); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static QStringList knownTorrents() { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QHash<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash(); |
|
|
|
|
return all_data.keys(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void setAddedDate(QString hash) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QHash<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash(); |
|
|
|
|
QHash<QString, QVariant> data = all_data[hash].toHash(); |
|
|
|
|
if(!data.contains("add_date")) { |
|
|
|
@ -216,7 +216,7 @@ public:
@@ -216,7 +216,7 @@ public:
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static QDateTime getAddedDate(QString hash) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QHash<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash(); |
|
|
|
|
QHash<QString, QVariant> data = all_data[hash].toHash(); |
|
|
|
|
QDateTime dt = data.value("add_date", QDateTime()).toDateTime(); |
|
|
|
@ -228,7 +228,7 @@ public:
@@ -228,7 +228,7 @@ public:
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void saveSeedDate(const QTorrentHandle &h) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QHash<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash(); |
|
|
|
|
QHash<QString, QVariant> data = all_data[h.hash()].toHash(); |
|
|
|
|
if(h.is_seed()) |
|
|
|
@ -240,14 +240,14 @@ public:
@@ -240,14 +240,14 @@ public:
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static QDateTime getSeedDate(QString hash) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QHash<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash(); |
|
|
|
|
QHash<QString, QVariant> data = all_data[hash].toHash(); |
|
|
|
|
return data.value("seed_date", QDateTime()).toDateTime(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void deletePersistentData(QString hash) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QHash<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash(); |
|
|
|
|
if(all_data.contains(hash)) { |
|
|
|
|
all_data.remove(hash); |
|
|
|
@ -262,7 +262,7 @@ public:
@@ -262,7 +262,7 @@ public:
|
|
|
|
|
TorrentTempData::deleteTempData(h.hash()); |
|
|
|
|
Q_ASSERT(!TorrentTempData::hasTempData(h.hash())); |
|
|
|
|
// Save persistent data
|
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QHash<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash(); |
|
|
|
|
QHash<QString, QVariant> data; |
|
|
|
|
data["is_magnet"] = is_magnet; |
|
|
|
@ -284,7 +284,7 @@ public:
@@ -284,7 +284,7 @@ public:
|
|
|
|
|
|
|
|
|
|
static void saveSavePath(QString hash, QString save_path) { |
|
|
|
|
Q_ASSERT(!hash.isEmpty()); |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QHash<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash(); |
|
|
|
|
QHash<QString, QVariant> data = all_data[hash].toHash(); |
|
|
|
|
data["save_path"] = save_path; |
|
|
|
@ -295,7 +295,7 @@ public:
@@ -295,7 +295,7 @@ public:
|
|
|
|
|
|
|
|
|
|
static void saveLabel(QString hash, QString label) { |
|
|
|
|
Q_ASSERT(!hash.isEmpty()); |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QHash<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash(); |
|
|
|
|
QHash<QString, QVariant> data = all_data[hash].toHash(); |
|
|
|
|
data["label"] = label; |
|
|
|
@ -305,7 +305,7 @@ public:
@@ -305,7 +305,7 @@ public:
|
|
|
|
|
|
|
|
|
|
static void saveName(QString hash, QString name) { |
|
|
|
|
Q_ASSERT(!hash.isEmpty()); |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QHash<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash(); |
|
|
|
|
QHash<QString, QVariant> data = all_data[hash].toHash(); |
|
|
|
|
data["name"] = name; |
|
|
|
@ -314,7 +314,7 @@ public:
@@ -314,7 +314,7 @@ public:
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void savePriority(const QTorrentHandle &h) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QHash<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash(); |
|
|
|
|
QHash<QString, QVariant> data = all_data[h.hash()].toHash(); |
|
|
|
|
data["priority"] = h.queue_position(); |
|
|
|
@ -323,7 +323,7 @@ public:
@@ -323,7 +323,7 @@ public:
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void saveSeedStatus(const QTorrentHandle &h) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QHash<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash(); |
|
|
|
|
QHash<QString, QVariant> data = all_data[h.hash()].toHash(); |
|
|
|
|
data["seed"] = h.is_seed(); |
|
|
|
@ -335,7 +335,7 @@ public:
@@ -335,7 +335,7 @@ public:
|
|
|
|
|
|
|
|
|
|
// Getters
|
|
|
|
|
static QString getSavePath(QString hash) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QHash<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash(); |
|
|
|
|
QHash<QString, QVariant> data = all_data[hash].toHash(); |
|
|
|
|
//qDebug("TorrentPersistentData: getSavePath %s", data["save_path"].toString().toLocal8Bit().data());
|
|
|
|
@ -343,42 +343,42 @@ public:
@@ -343,42 +343,42 @@ public:
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static QString getLabel(QString hash) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QHash<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash(); |
|
|
|
|
QHash<QString, QVariant> data = all_data[hash].toHash(); |
|
|
|
|
return data.value("label", "").toString(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static QString getName(QString hash) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QHash<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash(); |
|
|
|
|
QHash<QString, QVariant> data = all_data[hash].toHash(); |
|
|
|
|
return data.value("name", "").toString(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int getPriority(QString hash) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QHash<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash(); |
|
|
|
|
QHash<QString, QVariant> data = all_data[hash].toHash(); |
|
|
|
|
return data["priority"].toInt(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static bool isSeed(QString hash) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QHash<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash(); |
|
|
|
|
QHash<QString, QVariant> data = all_data[hash].toHash(); |
|
|
|
|
return data.value("seed", false).toBool(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static bool isMagnet(QString hash) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QHash<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash(); |
|
|
|
|
QHash<QString, QVariant> data = all_data[hash].toHash(); |
|
|
|
|
return data["is_magnet"].toBool(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static QString getMagnetUri(QString hash) { |
|
|
|
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")); |
|
|
|
|
QHash<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash(); |
|
|
|
|
QHash<QString, QVariant> data = all_data[hash].toHash(); |
|
|
|
|
Q_ASSERT(data["is_magnet"].toBool()); |
|
|
|
|