|
|
@ -27,82 +27,96 @@ |
|
|
|
#include "misc.h" |
|
|
|
#include "misc.h" |
|
|
|
#include "qtorrenthandle.h" |
|
|
|
#include "qtorrenthandle.h" |
|
|
|
|
|
|
|
|
|
|
|
QTorrentHandle::QTorrentHandle(torrent_handle h) : h(h) { |
|
|
|
QTorrentHandle::QTorrentHandle(torrent_handle h): h(h) {} |
|
|
|
t = h.get_torrent_info(); |
|
|
|
|
|
|
|
s = h.status(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Getters
|
|
|
|
// Getters
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
torrent_handle QTorrentHandle::get_torrent_handle() const { |
|
|
|
torrent_handle QTorrentHandle::get_torrent_handle() const { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
return h; |
|
|
|
return h; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
torrent_info QTorrentHandle::get_torrent_info() const { |
|
|
|
torrent_info QTorrentHandle::get_torrent_info() const { |
|
|
|
return t; |
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
|
|
|
|
return h.get_torrent_info(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QString QTorrentHandle::hash() const { |
|
|
|
QString QTorrentHandle::hash() const { |
|
|
|
return misc::toQString(t.info_hash()); |
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
|
|
|
|
return misc::toQString(h.get_torrent_info().info_hash()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QString QTorrentHandle::name() const { |
|
|
|
QString QTorrentHandle::name() const { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
return misc::toQString(h.name()); |
|
|
|
return misc::toQString(h.name()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
float QTorrentHandle::progress() const { |
|
|
|
float QTorrentHandle::progress() const { |
|
|
|
return s.progress; |
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
|
|
|
|
return h.status().progress; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QString QTorrentHandle::current_tracker() const { |
|
|
|
QString QTorrentHandle::current_tracker() const { |
|
|
|
return misc::toQString(s.current_tracker); |
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
|
|
|
|
return misc::toQString(h.status().current_tracker); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool QTorrentHandle::is_valid() const { |
|
|
|
bool QTorrentHandle::is_valid() const { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
return h.is_valid(); |
|
|
|
return h.is_valid(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool QTorrentHandle::is_paused() const { |
|
|
|
bool QTorrentHandle::is_paused() const { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
return h.is_paused(); |
|
|
|
return h.is_paused(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
size_type QTorrentHandle::total_size() const { |
|
|
|
size_type QTorrentHandle::total_size() const { |
|
|
|
return t.total_size(); |
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
|
|
|
|
return h.get_torrent_info().total_size(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
size_type QTorrentHandle::total_done() const { |
|
|
|
size_type QTorrentHandle::total_done() const { |
|
|
|
return s.total_done; |
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
|
|
|
|
return h.status().total_done; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
float QTorrentHandle::download_payload_rate() const { |
|
|
|
float QTorrentHandle::download_payload_rate() const { |
|
|
|
return s.download_payload_rate; |
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
|
|
|
|
return h.status().download_payload_rate; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
float QTorrentHandle::upload_payload_rate() const { |
|
|
|
float QTorrentHandle::upload_payload_rate() const { |
|
|
|
return s.upload_payload_rate; |
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
|
|
|
|
return h.status().upload_payload_rate; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int QTorrentHandle::num_peers() const { |
|
|
|
int QTorrentHandle::num_peers() const { |
|
|
|
return s.num_peers; |
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
|
|
|
|
return h.status().num_peers; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int QTorrentHandle::num_seeds() const { |
|
|
|
int QTorrentHandle::num_seeds() const { |
|
|
|
return s.num_seeds; |
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
|
|
|
|
return h.status().num_seeds; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QString QTorrentHandle::save_path() const { |
|
|
|
QString QTorrentHandle::save_path() const { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
return misc::toQString(h.save_path().string()); |
|
|
|
return misc::toQString(h.save_path().string()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fs::path QTorrentHandle::save_path_boost() const { |
|
|
|
fs::path QTorrentHandle::save_path_boost() const { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
return h.save_path(); |
|
|
|
return h.save_path(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QStringList QTorrentHandle::url_seeds() const { |
|
|
|
QStringList QTorrentHandle::url_seeds() const { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
QStringList res; |
|
|
|
QStringList res; |
|
|
|
std::vector<std::string> existing_seeds = t.url_seeds(); |
|
|
|
std::vector<std::string> existing_seeds = h.get_torrent_info().url_seeds(); |
|
|
|
unsigned int nbSeeds = existing_seeds.size(); |
|
|
|
unsigned int nbSeeds = existing_seeds.size(); |
|
|
|
QString existing_seed; |
|
|
|
QString existing_seed; |
|
|
|
for(unsigned int i=0; i<nbSeeds; ++i){ |
|
|
|
for(unsigned int i=0; i<nbSeeds; ++i){ |
|
|
@ -113,24 +127,24 @@ QStringList QTorrentHandle::url_seeds() const { |
|
|
|
|
|
|
|
|
|
|
|
// get the size of the torrent without the filtered files
|
|
|
|
// get the size of the torrent without the filtered files
|
|
|
|
size_type QTorrentHandle::actual_size() const{ |
|
|
|
size_type QTorrentHandle::actual_size() const{ |
|
|
|
unsigned int nbFiles = t.num_files(); |
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
|
|
|
|
unsigned int nbFiles = h.get_torrent_info().num_files(); |
|
|
|
if(!h.is_valid()){ |
|
|
|
if(!h.is_valid()){ |
|
|
|
qDebug("/!\\ Error: Invalid handle"); |
|
|
|
qDebug("/!\\ Error: Invalid handle"); |
|
|
|
return t.total_size(); |
|
|
|
return h.get_torrent_info().total_size(); |
|
|
|
} |
|
|
|
} |
|
|
|
QString hash = misc::toQString(t.info_hash()); |
|
|
|
QString hash = misc::toQString(h.get_torrent_info().info_hash()); |
|
|
|
QFile pieces_file(misc::qBittorrentPath()+QString::fromUtf8("BT_backup")+QDir::separator()+hash+QString::fromUtf8(".priorities")); |
|
|
|
QFile pieces_file(misc::qBittorrentPath()+QString::fromUtf8("BT_backup")+QDir::separator()+hash+QString::fromUtf8(".priorities")); |
|
|
|
// Read saved file
|
|
|
|
// Read saved file
|
|
|
|
if(!pieces_file.open(QIODevice::ReadOnly | QIODevice::Text)){ |
|
|
|
if(!pieces_file.open(QIODevice::ReadOnly | QIODevice::Text)){ |
|
|
|
qDebug("* Error: Couldn't open priorities file"); |
|
|
|
return h.get_torrent_info().total_size(); |
|
|
|
return t.total_size(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
QByteArray pieces_priorities = pieces_file.readAll(); |
|
|
|
QByteArray pieces_priorities = pieces_file.readAll(); |
|
|
|
pieces_file.close(); |
|
|
|
pieces_file.close(); |
|
|
|
QList<QByteArray> pieces_priorities_list = pieces_priorities.split('\n'); |
|
|
|
QList<QByteArray> pieces_priorities_list = pieces_priorities.split('\n'); |
|
|
|
if((unsigned int)pieces_priorities_list.size() != nbFiles+1){ |
|
|
|
if((unsigned int)pieces_priorities_list.size() != nbFiles+1){ |
|
|
|
std::cerr << "* Error: Corrupted priorities file\n"; |
|
|
|
std::cerr << "* Error: Corrupted priorities file\n"; |
|
|
|
return t.total_size(); |
|
|
|
return h.get_torrent_info().total_size(); |
|
|
|
} |
|
|
|
} |
|
|
|
size_type effective_size = 0; |
|
|
|
size_type effective_size = 0; |
|
|
|
for(unsigned int i=0; i<nbFiles; ++i){ |
|
|
|
for(unsigned int i=0; i<nbFiles; ++i){ |
|
|
@ -139,78 +153,94 @@ size_type QTorrentHandle::actual_size() const{ |
|
|
|
priority = 1; |
|
|
|
priority = 1; |
|
|
|
} |
|
|
|
} |
|
|
|
if(priority) |
|
|
|
if(priority) |
|
|
|
effective_size += t.file_at(i).size; |
|
|
|
effective_size += h.get_torrent_info().file_at(i).size; |
|
|
|
} |
|
|
|
} |
|
|
|
return effective_size; |
|
|
|
return effective_size; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int QTorrentHandle::download_limit() const { |
|
|
|
int QTorrentHandle::download_limit() const { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
return h.download_limit(); |
|
|
|
return h.download_limit(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int QTorrentHandle::upload_limit() const { |
|
|
|
int QTorrentHandle::upload_limit() const { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
return h.upload_limit(); |
|
|
|
return h.upload_limit(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int QTorrentHandle::num_files() const { |
|
|
|
int QTorrentHandle::num_files() const { |
|
|
|
return t.num_files(); |
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
|
|
|
|
return h.get_torrent_info().num_files(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool QTorrentHandle::has_metadata() const { |
|
|
|
bool QTorrentHandle::has_metadata() const { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
return h.has_metadata(); |
|
|
|
return h.has_metadata(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
entry QTorrentHandle::write_resume_data() const { |
|
|
|
entry QTorrentHandle::write_resume_data() const { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
return h.write_resume_data(); |
|
|
|
return h.write_resume_data(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QString QTorrentHandle::file_at(int index) const { |
|
|
|
QString QTorrentHandle::file_at(int index) const { |
|
|
|
return misc::toQString(t.file_at(index).path.leaf()); |
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
|
|
|
|
return misc::toQString(h.get_torrent_info().file_at(index).path.leaf()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
size_type QTorrentHandle::filesize_at(int index) const { |
|
|
|
size_type QTorrentHandle::filesize_at(int index) const { |
|
|
|
return t.file_at(index).size; |
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
|
|
|
|
return h.get_torrent_info().file_at(index).size; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::vector<announce_entry> const& QTorrentHandle::trackers() const { |
|
|
|
std::vector<announce_entry> const& QTorrentHandle::trackers() const { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
return h.trackers(); |
|
|
|
return h.trackers(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
torrent_status::state_t QTorrentHandle::state() const { |
|
|
|
torrent_status::state_t QTorrentHandle::state() const { |
|
|
|
return s.state; |
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
|
|
|
|
return h.status().state; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QString QTorrentHandle::creator() const { |
|
|
|
QString QTorrentHandle::creator() const { |
|
|
|
return misc::toQString(t.creator()); |
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
|
|
|
|
return misc::toQString(h.get_torrent_info().creator()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QString QTorrentHandle::comment() const { |
|
|
|
QString QTorrentHandle::comment() const { |
|
|
|
return misc::toQString(t.comment()); |
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
|
|
|
|
return misc::toQString(h.get_torrent_info().comment()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
size_type QTorrentHandle::total_failed_bytes() const { |
|
|
|
size_type QTorrentHandle::total_failed_bytes() const { |
|
|
|
return s.total_failed_bytes; |
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
|
|
|
|
return h.status().total_failed_bytes; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void QTorrentHandle::file_progress(std::vector<float>& fp) { |
|
|
|
void QTorrentHandle::file_progress(std::vector<float>& fp) { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
return h.file_progress(fp); |
|
|
|
return h.file_progress(fp); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
size_type QTorrentHandle::total_payload_download() { |
|
|
|
size_type QTorrentHandle::total_payload_download() { |
|
|
|
return s.total_payload_download; |
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
|
|
|
|
return h.status().total_payload_download; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
size_type QTorrentHandle::total_payload_upload() { |
|
|
|
size_type QTorrentHandle::total_payload_upload() { |
|
|
|
return s.total_payload_upload; |
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
|
|
|
|
return h.status().total_payload_upload; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Return a list of absolute paths corresponding
|
|
|
|
// Return a list of absolute paths corresponding
|
|
|
|
// to all files in a torrent
|
|
|
|
// to all files in a torrent
|
|
|
|
QStringList QTorrentHandle::files_path() const { |
|
|
|
QStringList QTorrentHandle::files_path() const { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
QString saveDir = misc::toQString(h.save_path().string()) + QDir::separator(); |
|
|
|
QString saveDir = misc::toQString(h.save_path().string()) + QDir::separator(); |
|
|
|
QStringList res; |
|
|
|
QStringList res; |
|
|
|
torrent_info::file_iterator fi = t.begin_files(); |
|
|
|
torrent_info::file_iterator fi = h.get_torrent_info().begin_files(); |
|
|
|
while(fi != t.end_files()) { |
|
|
|
while(fi != h.get_torrent_info().end_files()) { |
|
|
|
res << QDir::cleanPath(saveDir + misc::toQString(fi->path.string())); |
|
|
|
res << QDir::cleanPath(saveDir + misc::toQString(fi->path.string())); |
|
|
|
fi++; |
|
|
|
fi++; |
|
|
|
} |
|
|
|
} |
|
|
@ -218,7 +248,8 @@ QStringList QTorrentHandle::files_path() const { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int QTorrentHandle::num_uploads() const { |
|
|
|
int QTorrentHandle::num_uploads() const { |
|
|
|
return s.num_uploads; |
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
|
|
|
|
return h.status().num_uploads; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
@ -226,54 +257,67 @@ int QTorrentHandle::num_uploads() const { |
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
void QTorrentHandle::set_download_limit(int limit) { |
|
|
|
void QTorrentHandle::set_download_limit(int limit) { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
h.set_download_limit(limit); |
|
|
|
h.set_download_limit(limit); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void QTorrentHandle::set_upload_limit(int limit) { |
|
|
|
void QTorrentHandle::set_upload_limit(int limit) { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
h.set_upload_limit(limit); |
|
|
|
h.set_upload_limit(limit); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void QTorrentHandle::pause() { |
|
|
|
void QTorrentHandle::pause() { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
h.pause(); |
|
|
|
h.pause(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void QTorrentHandle::resume() { |
|
|
|
void QTorrentHandle::resume() { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
h.resume(); |
|
|
|
h.resume(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void QTorrentHandle::remove_url_seed(QString seed) { |
|
|
|
void QTorrentHandle::remove_url_seed(QString seed) { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
h.remove_url_seed(misc::toString((const char*)seed.toUtf8())); |
|
|
|
h.remove_url_seed(misc::toString((const char*)seed.toUtf8())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void QTorrentHandle::add_url_seed(QString seed) { |
|
|
|
void QTorrentHandle::add_url_seed(QString seed) { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
h.add_url_seed(misc::toString((const char*)seed.toUtf8())); |
|
|
|
h.add_url_seed(misc::toString((const char*)seed.toUtf8())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void QTorrentHandle::set_max_uploads(int val){ |
|
|
|
void QTorrentHandle::set_max_uploads(int val){ |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
h.set_max_uploads(val); |
|
|
|
h.set_max_uploads(val); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void QTorrentHandle::prioritize_files(std::vector<int> v) { |
|
|
|
void QTorrentHandle::prioritize_files(std::vector<int> v) { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
h.prioritize_files(v); |
|
|
|
h.prioritize_files(v); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void QTorrentHandle::set_ratio(float ratio) const { |
|
|
|
void QTorrentHandle::set_ratio(float ratio) const { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
h.set_ratio(ratio); |
|
|
|
h.set_ratio(ratio); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void QTorrentHandle::replace_trackers(std::vector<announce_entry> const& v) const { |
|
|
|
void QTorrentHandle::replace_trackers(std::vector<announce_entry> const& v) const { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
h.replace_trackers(v); |
|
|
|
h.replace_trackers(v); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void QTorrentHandle::force_reannounce() { |
|
|
|
void QTorrentHandle::force_reannounce() { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
h.force_reannounce(); |
|
|
|
h.force_reannounce(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void QTorrentHandle::set_sequenced_download_threshold(int val) { |
|
|
|
void QTorrentHandle::set_sequenced_download_threshold(int val) { |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
h.set_sequenced_download_threshold(val); |
|
|
|
h.set_sequenced_download_threshold(val); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void QTorrentHandle::set_tracker_login(QString username, QString password){ |
|
|
|
void QTorrentHandle::set_tracker_login(QString username, QString password){ |
|
|
|
|
|
|
|
Q_ASSERT(h.is_valid()); |
|
|
|
h.set_tracker_login(std::string(username.toUtf8().data()), std::string(password.toUtf8().data())); |
|
|
|
h.set_tracker_login(std::string(username.toUtf8().data()), std::string(password.toUtf8().data())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -283,12 +327,10 @@ void QTorrentHandle::set_tracker_login(QString username, QString password){ |
|
|
|
|
|
|
|
|
|
|
|
QTorrentHandle& QTorrentHandle::operator =(const torrent_handle& new_h) { |
|
|
|
QTorrentHandle& QTorrentHandle::operator =(const torrent_handle& new_h) { |
|
|
|
h = new_h; |
|
|
|
h = new_h; |
|
|
|
t = h.get_torrent_info(); |
|
|
|
|
|
|
|
s = h.status(); |
|
|
|
|
|
|
|
return *this; |
|
|
|
return *this; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool QTorrentHandle::operator ==(const QTorrentHandle& new_h) const{ |
|
|
|
bool QTorrentHandle::operator ==(const QTorrentHandle& new_h) const{ |
|
|
|
QString hash = misc::toQString(t.info_hash()); |
|
|
|
QString hash = misc::toQString(h.get_torrent_info().info_hash()); |
|
|
|
return (hash == new_h.hash()); |
|
|
|
return (hash == new_h.hash()); |
|
|
|
} |
|
|
|
} |
|
|
|