mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
- Use a capital "B" for Bittorrent class
This commit is contained in:
parent
262b88930e
commit
4ee47ce2b8
@ -101,7 +101,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
|
|||||||
// Fix Tool bar layout
|
// Fix Tool bar layout
|
||||||
toolBar->layout()->setSpacing(7);
|
toolBar->layout()->setSpacing(7);
|
||||||
// Creating Bittorrent session
|
// Creating Bittorrent session
|
||||||
BTSession = new bittorrent();
|
BTSession = new Bittorrent();
|
||||||
connect(BTSession, SIGNAL(fullDiskError(QTorrentHandle&, QString)), this, SLOT(fullDiskError(QTorrentHandle&, QString)));
|
connect(BTSession, SIGNAL(fullDiskError(QTorrentHandle&, QString)), this, SLOT(fullDiskError(QTorrentHandle&, QString)));
|
||||||
connect(BTSession, SIGNAL(finishedTorrent(QTorrentHandle&)), this, SLOT(finishedTorrent(QTorrentHandle&)));
|
connect(BTSession, SIGNAL(finishedTorrent(QTorrentHandle&)), this, SLOT(finishedTorrent(QTorrentHandle&)));
|
||||||
connect(BTSession, SIGNAL(trackerAuthenticationRequired(QTorrentHandle&)), this, SLOT(trackerAuthenticationRequired(QTorrentHandle&)));
|
connect(BTSession, SIGNAL(trackerAuthenticationRequired(QTorrentHandle&)), this, SLOT(trackerAuthenticationRequired(QTorrentHandle&)));
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#include "ui_MainWindow.h"
|
#include "ui_MainWindow.h"
|
||||||
#include "qtorrenthandle.h"
|
#include "qtorrenthandle.h"
|
||||||
|
|
||||||
class bittorrent;
|
class Bittorrent;
|
||||||
class QTimer;
|
class QTimer;
|
||||||
class downloadFromURL;
|
class downloadFromURL;
|
||||||
class SearchEngine;
|
class SearchEngine;
|
||||||
@ -59,7 +59,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// Bittorrent
|
// Bittorrent
|
||||||
bittorrent *BTSession;
|
Bittorrent *BTSession;
|
||||||
QList<QPair<QTorrentHandle,QString> > unauthenticated_trackers; // Still needed?
|
QList<QPair<QTorrentHandle,QString> > unauthenticated_trackers; // Still needed?
|
||||||
// GUI related
|
// GUI related
|
||||||
QTimer *guiUpdater;
|
QTimer *guiUpdater;
|
||||||
|
@ -62,11 +62,11 @@
|
|||||||
enum ProxyType {HTTP=1, SOCKS5=2, HTTP_PW=3, SOCKS5_PW=4};
|
enum ProxyType {HTTP=1, SOCKS5=2, HTTP_PW=3, SOCKS5_PW=4};
|
||||||
|
|
||||||
// Main constructor
|
// Main constructor
|
||||||
bittorrent::bittorrent() : preAllocateAll(false), addInPause(false), ratio_limit(-1), UPnPEnabled(false), NATPMPEnabled(false), LSDEnabled(false), DHTEnabled(false), queueingEnabled(false), geoipDBLoaded(false) {
|
Bittorrent::Bittorrent() : preAllocateAll(false), addInPause(false), ratio_limit(-1), UPnPEnabled(false), NATPMPEnabled(false), LSDEnabled(false), DHTEnabled(false), queueingEnabled(false), geoipDBLoaded(false) {
|
||||||
resolve_countries = false;
|
resolve_countries = false;
|
||||||
// To avoid some exceptions
|
// To avoid some exceptions
|
||||||
fs::path::default_name_check(fs::no_check);
|
fs::path::default_name_check(fs::no_check);
|
||||||
// Creating bittorrent session
|
// Creating Bittorrent session
|
||||||
// Check if we should spoof utorrent
|
// Check if we should spoof utorrent
|
||||||
if(Preferences::isUtorrentSpoofingEnabled()) {
|
if(Preferences::isUtorrentSpoofingEnabled()) {
|
||||||
s = new session(fingerprint("UT", 1, 8, 5, 0), 0);
|
s = new session(fingerprint("UT", 1, 8, 5, 0), 0);
|
||||||
@ -102,7 +102,7 @@ bittorrent::bittorrent() : preAllocateAll(false), addInPause(false), ratio_limit
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Main destructor
|
// Main destructor
|
||||||
bittorrent::~bittorrent() {
|
Bittorrent::~Bittorrent() {
|
||||||
qDebug("BTSession deletion");
|
qDebug("BTSession deletion");
|
||||||
// Do some BT related saving
|
// Do some BT related saving
|
||||||
saveDHTEntry();
|
saveDHTEntry();
|
||||||
@ -131,7 +131,7 @@ bittorrent::~bittorrent() {
|
|||||||
qDebug("Session deleted");
|
qDebug("Session deleted");
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::preAllocateAllFiles(bool b) {
|
void Bittorrent::preAllocateAllFiles(bool b) {
|
||||||
bool change = (preAllocateAll != b);
|
bool change = (preAllocateAll != b);
|
||||||
if(change) {
|
if(change) {
|
||||||
qDebug("PreAllocateAll changed, reloading all torrents!");
|
qDebug("PreAllocateAll changed, reloading all torrents!");
|
||||||
@ -139,7 +139,7 @@ void bittorrent::preAllocateAllFiles(bool b) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::deleteBigRatios() {
|
void Bittorrent::deleteBigRatios() {
|
||||||
if(ratio_limit == -1) return;
|
if(ratio_limit == -1) return;
|
||||||
std::vector<torrent_handle> torrents = getTorrents();
|
std::vector<torrent_handle> torrents = getTorrents();
|
||||||
std::vector<torrent_handle>::iterator torrentIT;
|
std::vector<torrent_handle>::iterator torrentIT;
|
||||||
@ -159,18 +159,18 @@ void bittorrent::deleteBigRatios() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::setDownloadLimit(QString hash, long val) {
|
void Bittorrent::setDownloadLimit(QString hash, long val) {
|
||||||
QTorrentHandle h = getTorrentHandle(hash);
|
QTorrentHandle h = getTorrentHandle(hash);
|
||||||
if(h.is_valid()) {
|
if(h.is_valid()) {
|
||||||
h.set_download_limit(val);
|
h.set_download_limit(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bittorrent::isQueueingEnabled() const {
|
bool Bittorrent::isQueueingEnabled() const {
|
||||||
return queueingEnabled;
|
return queueingEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::setUploadLimit(QString hash, long val) {
|
void Bittorrent::setUploadLimit(QString hash, long val) {
|
||||||
qDebug("Set upload limit rate to %ld", val);
|
qDebug("Set upload limit rate to %ld", val);
|
||||||
QTorrentHandle h = getTorrentHandle(hash);
|
QTorrentHandle h = getTorrentHandle(hash);
|
||||||
if(h.is_valid()) {
|
if(h.is_valid()) {
|
||||||
@ -178,7 +178,7 @@ void bittorrent::setUploadLimit(QString hash, long val) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::handleDownloadFailure(QString url, QString reason) {
|
void Bittorrent::handleDownloadFailure(QString url, QString reason) {
|
||||||
emit downloadFromUrlFailure(url, reason);
|
emit downloadFromUrlFailure(url, reason);
|
||||||
// Clean up
|
// Clean up
|
||||||
int index = url_skippingDlg.indexOf(url);
|
int index = url_skippingDlg.indexOf(url);
|
||||||
@ -188,11 +188,11 @@ void bittorrent::handleDownloadFailure(QString url, QString reason) {
|
|||||||
savepath_fromurl.remove(url);
|
savepath_fromurl.remove(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::startTorrentsInPause(bool b) {
|
void Bittorrent::startTorrentsInPause(bool b) {
|
||||||
addInPause = b;
|
addInPause = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::setQueueingEnabled(bool enable) {
|
void Bittorrent::setQueueingEnabled(bool enable) {
|
||||||
if(queueingEnabled != enable) {
|
if(queueingEnabled != enable) {
|
||||||
qDebug("Queueing system is changing state...");
|
qDebug("Queueing system is changing state...");
|
||||||
queueingEnabled = enable;
|
queueingEnabled = enable;
|
||||||
@ -200,7 +200,7 @@ void bittorrent::setQueueingEnabled(bool enable) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set BT session configuration
|
// Set BT session configuration
|
||||||
void bittorrent::configureSession() {
|
void Bittorrent::configureSession() {
|
||||||
qDebug("Configuring session");
|
qDebug("Configuring session");
|
||||||
// Downloads
|
// Downloads
|
||||||
// * Save path
|
// * Save path
|
||||||
@ -293,7 +293,7 @@ void bittorrent::configureSession() {
|
|||||||
sessionSettings.use_dht_as_fallback = false;
|
sessionSettings.use_dht_as_fallback = false;
|
||||||
//sessionSettings.announce_to_all_trackers = true;
|
//sessionSettings.announce_to_all_trackers = true;
|
||||||
sessionSettings.announce_to_all_tiers = true; //uTorrent behavior
|
sessionSettings.announce_to_all_tiers = true; //uTorrent behavior
|
||||||
// To keep same behavior as in qbittorrent v1.2.0
|
// To keep same behavior as in qBittorrent v1.2.0
|
||||||
sessionSettings.rate_limit_ip_overhead = false;
|
sessionSettings.rate_limit_ip_overhead = false;
|
||||||
// Queueing System
|
// Queueing System
|
||||||
if(Preferences::isQueueingSystemEnabled()) {
|
if(Preferences::isQueueingSystemEnabled()) {
|
||||||
@ -453,7 +453,7 @@ void bittorrent::configureSession() {
|
|||||||
qDebug("Session configured");
|
qDebug("Session configured");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bittorrent::initWebUi(QString username, QString password, int port) {
|
bool Bittorrent::initWebUi(QString username, QString password, int port) {
|
||||||
if(httpServer)
|
if(httpServer)
|
||||||
httpServer->close();
|
httpServer->close();
|
||||||
else
|
else
|
||||||
@ -467,7 +467,7 @@ bool bittorrent::initWebUi(QString username, QString password, int port) {
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::takeETASamples() {
|
void Bittorrent::takeETASamples() {
|
||||||
bool change = false;;
|
bool change = false;;
|
||||||
foreach(const QString &hash, ETA_samples.keys()) {
|
foreach(const QString &hash, ETA_samples.keys()) {
|
||||||
QTorrentHandle h = getTorrentHandle(hash);
|
QTorrentHandle h = getTorrentHandle(hash);
|
||||||
@ -492,7 +492,7 @@ void bittorrent::takeETASamples() {
|
|||||||
// GASA: Global Average Speed Algorithm
|
// GASA: Global Average Speed Algorithm
|
||||||
// CSA: Current Speed Algorithm
|
// CSA: Current Speed Algorithm
|
||||||
// WINX: Window of X Algorithm
|
// WINX: Window of X Algorithm
|
||||||
qlonglong bittorrent::getETA(QString hash) {
|
qlonglong Bittorrent::getETA(QString hash) {
|
||||||
QTorrentHandle h = getTorrentHandle(hash);
|
QTorrentHandle h = getTorrentHandle(hash);
|
||||||
if(!h.is_valid() || h.state() != torrent_status::downloading || !h.active_time())
|
if(!h.is_valid() || h.state() != torrent_status::downloading || !h.active_time())
|
||||||
return -1;
|
return -1;
|
||||||
@ -527,16 +527,16 @@ qlonglong bittorrent::getETA(QString hash) {
|
|||||||
return (qlonglong) floor((double) (bytes_left) / avg_speed);
|
return (qlonglong) floor((double) (bytes_left) / avg_speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<torrent_handle> bittorrent::getTorrents() const {
|
std::vector<torrent_handle> Bittorrent::getTorrents() const {
|
||||||
return s->get_torrents();
|
return s->get_torrents();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the torrent handle, given its hash
|
// Return the torrent handle, given its hash
|
||||||
QTorrentHandle bittorrent::getTorrentHandle(QString hash) const{
|
QTorrentHandle Bittorrent::getTorrentHandle(QString hash) const{
|
||||||
return QTorrentHandle(s->find_torrent(misc::fromString<sha1_hash>((hash.toStdString()))));
|
return QTorrentHandle(s->find_torrent(misc::fromString<sha1_hash>((hash.toStdString()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bittorrent::hasActiveTorrents() const {
|
bool Bittorrent::hasActiveTorrents() const {
|
||||||
std::vector<torrent_handle> torrents = getTorrents();
|
std::vector<torrent_handle> torrents = getTorrents();
|
||||||
std::vector<torrent_handle>::iterator torrentIT;
|
std::vector<torrent_handle>::iterator torrentIT;
|
||||||
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
|
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
|
||||||
@ -547,14 +547,14 @@ bool bittorrent::hasActiveTorrents() const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::banIP(QString ip) {
|
void Bittorrent::banIP(QString ip) {
|
||||||
FilterParserThread::processFilterList(s, QStringList(ip));
|
FilterParserThread::processFilterList(s, QStringList(ip));
|
||||||
Preferences::banIP(ip);
|
Preferences::banIP(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete a torrent from the session, given its hash
|
// Delete a torrent from the session, given its hash
|
||||||
// permanent = true means that the torrent will be removed from the hard-drive too
|
// permanent = true means that the torrent will be removed from the hard-drive too
|
||||||
void bittorrent::deleteTorrent(QString hash, bool delete_local_files) {
|
void Bittorrent::deleteTorrent(QString hash, bool delete_local_files) {
|
||||||
qDebug("Deleting torrent with hash: %s", hash.toLocal8Bit().data());
|
qDebug("Deleting torrent with hash: %s", hash.toLocal8Bit().data());
|
||||||
QTorrentHandle h = getTorrentHandle(hash);
|
QTorrentHandle h = getTorrentHandle(hash);
|
||||||
if(!h.is_valid()) {
|
if(!h.is_valid()) {
|
||||||
@ -586,7 +586,7 @@ void bittorrent::deleteTorrent(QString hash, bool delete_local_files) {
|
|||||||
emit deletedTorrent(hash);
|
emit deletedTorrent(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::pauseAllTorrents() {
|
void Bittorrent::pauseAllTorrents() {
|
||||||
std::vector<torrent_handle> torrents = getTorrents();
|
std::vector<torrent_handle> torrents = getTorrents();
|
||||||
std::vector<torrent_handle>::iterator torrentIT;
|
std::vector<torrent_handle>::iterator torrentIT;
|
||||||
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
|
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
|
||||||
@ -599,7 +599,7 @@ void bittorrent::pauseAllTorrents() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::resumeAllTorrents() {
|
void Bittorrent::resumeAllTorrents() {
|
||||||
std::vector<torrent_handle> torrents = getTorrents();
|
std::vector<torrent_handle> torrents = getTorrents();
|
||||||
std::vector<torrent_handle>::iterator torrentIT;
|
std::vector<torrent_handle>::iterator torrentIT;
|
||||||
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
|
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
|
||||||
@ -612,7 +612,7 @@ void bittorrent::resumeAllTorrents() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::pauseTorrent(QString hash) {
|
void Bittorrent::pauseTorrent(QString hash) {
|
||||||
QTorrentHandle h = getTorrentHandle(hash);
|
QTorrentHandle h = getTorrentHandle(hash);
|
||||||
if(!h.is_paused()) {
|
if(!h.is_paused()) {
|
||||||
h.pause();
|
h.pause();
|
||||||
@ -620,7 +620,7 @@ void bittorrent::pauseTorrent(QString hash) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::resumeTorrent(QString hash) {
|
void Bittorrent::resumeTorrent(QString hash) {
|
||||||
QTorrentHandle h = getTorrentHandle(hash);
|
QTorrentHandle h = getTorrentHandle(hash);
|
||||||
if(h.is_paused()) {
|
if(h.is_paused()) {
|
||||||
h.resume();
|
h.resume();
|
||||||
@ -628,7 +628,7 @@ void bittorrent::resumeTorrent(QString hash) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::loadWebSeeds(QString hash) {
|
void Bittorrent::loadWebSeeds(QString hash) {
|
||||||
QVariantList url_seeds = TorrentPersistentData::getUrlSeeds(hash);
|
QVariantList url_seeds = TorrentPersistentData::getUrlSeeds(hash);
|
||||||
QTorrentHandle h = getTorrentHandle(hash);
|
QTorrentHandle h = getTorrentHandle(hash);
|
||||||
// First remove from the torrent the url seeds that were deleted
|
// First remove from the torrent the url seeds that were deleted
|
||||||
@ -654,7 +654,7 @@ void bittorrent::loadWebSeeds(QString hash) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QTorrentHandle bittorrent::addMagnetUri(QString magnet_uri, bool resumed) {
|
QTorrentHandle Bittorrent::addMagnetUri(QString magnet_uri, bool resumed) {
|
||||||
QTorrentHandle h;
|
QTorrentHandle h;
|
||||||
QString hash = misc::magnetUriToHash(magnet_uri);
|
QString hash = misc::magnetUriToHash(magnet_uri);
|
||||||
if(hash.isEmpty()) {
|
if(hash.isEmpty()) {
|
||||||
@ -714,7 +714,7 @@ QTorrentHandle bittorrent::addMagnetUri(QString magnet_uri, bool resumed) {
|
|||||||
p.paused = false;
|
p.paused = false;
|
||||||
p.duplicate_is_error = false; // Already checked
|
p.duplicate_is_error = false; // Already checked
|
||||||
p.auto_managed = false; // Because it is added in paused state
|
p.auto_managed = false; // Because it is added in paused state
|
||||||
// Adding torrent to bittorrent session
|
// Adding torrent to Bittorrent session
|
||||||
try {
|
try {
|
||||||
h = QTorrentHandle(add_magnet_uri(*s, magnet_uri.toStdString(), p));
|
h = QTorrentHandle(add_magnet_uri(*s, magnet_uri.toStdString(), p));
|
||||||
}catch(std::exception e){
|
}catch(std::exception e){
|
||||||
@ -771,8 +771,8 @@ QTorrentHandle bittorrent::addMagnetUri(QString magnet_uri, bool resumed) {
|
|||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a torrent to the bittorrent session
|
// Add a torrent to the Bittorrent session
|
||||||
QTorrentHandle bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url, bool resumed) {
|
QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url, bool resumed) {
|
||||||
QTorrentHandle h;
|
QTorrentHandle h;
|
||||||
bool fastResume=false;
|
bool fastResume=false;
|
||||||
QDir torrentBackup(misc::qBittorrentPath() + "BT_backup");
|
QDir torrentBackup(misc::qBittorrentPath() + "BT_backup");
|
||||||
@ -886,7 +886,7 @@ QTorrentHandle bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
|
|||||||
p.paused = true;
|
p.paused = true;
|
||||||
p.duplicate_is_error = false; // Already checked
|
p.duplicate_is_error = false; // Already checked
|
||||||
p.auto_managed = false; // Because it is added in paused state
|
p.auto_managed = false; // Because it is added in paused state
|
||||||
// Adding torrent to bittorrent session
|
// Adding torrent to Bittorrent session
|
||||||
try {
|
try {
|
||||||
h = QTorrentHandle(s->add_torrent(p));
|
h = QTorrentHandle(s->add_torrent(p));
|
||||||
}catch(std::exception e){
|
}catch(std::exception e){
|
||||||
@ -965,7 +965,7 @@ QTorrentHandle bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
|
|||||||
|
|
||||||
|
|
||||||
// Check if the user filtered files in this torrent.
|
// Check if the user filtered files in this torrent.
|
||||||
bool bittorrent::has_filtered_files(QString hash) const{
|
bool Bittorrent::has_filtered_files(QString hash) const{
|
||||||
QVariantList files_priority = TorrentPersistentData::getFilesPriority(hash);
|
QVariantList files_priority = TorrentPersistentData::getFilesPriority(hash);
|
||||||
foreach(QVariant var_prio, files_priority) {
|
foreach(QVariant var_prio, files_priority) {
|
||||||
int priority = var_prio.toInt();
|
int priority = var_prio.toInt();
|
||||||
@ -979,11 +979,11 @@ bool bittorrent::has_filtered_files(QString hash) const{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set the maximum number of opened connections
|
// Set the maximum number of opened connections
|
||||||
void bittorrent::setMaxConnections(int maxConnec) {
|
void Bittorrent::setMaxConnections(int maxConnec) {
|
||||||
s->set_max_connections(maxConnec);
|
s->set_max_connections(maxConnec);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::setMaxConnectionsPerTorrent(int max) {
|
void Bittorrent::setMaxConnectionsPerTorrent(int max) {
|
||||||
// Apply this to all session torrents
|
// Apply this to all session torrents
|
||||||
std::vector<torrent_handle> handles = s->get_torrents();
|
std::vector<torrent_handle> handles = s->get_torrents();
|
||||||
unsigned int nbHandles = handles.size();
|
unsigned int nbHandles = handles.size();
|
||||||
@ -997,7 +997,7 @@ void bittorrent::setMaxConnectionsPerTorrent(int max) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::setMaxUploadsPerTorrent(int max) {
|
void Bittorrent::setMaxUploadsPerTorrent(int max) {
|
||||||
// Apply this to all session torrents
|
// Apply this to all session torrents
|
||||||
std::vector<torrent_handle> handles = s->get_torrents();
|
std::vector<torrent_handle> handles = s->get_torrents();
|
||||||
unsigned int nbHandles = handles.size();
|
unsigned int nbHandles = handles.size();
|
||||||
@ -1012,11 +1012,11 @@ void bittorrent::setMaxUploadsPerTorrent(int max) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return DHT state
|
// Return DHT state
|
||||||
bool bittorrent::isDHTEnabled() const{
|
bool Bittorrent::isDHTEnabled() const{
|
||||||
return DHTEnabled;
|
return DHTEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::enableUPnP(bool b) {
|
void Bittorrent::enableUPnP(bool b) {
|
||||||
if(b) {
|
if(b) {
|
||||||
if(!UPnPEnabled) {
|
if(!UPnPEnabled) {
|
||||||
qDebug("Enabling UPnP");
|
qDebug("Enabling UPnP");
|
||||||
@ -1032,7 +1032,7 @@ void bittorrent::enableUPnP(bool b) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::enableNATPMP(bool b) {
|
void Bittorrent::enableNATPMP(bool b) {
|
||||||
if(b) {
|
if(b) {
|
||||||
if(!NATPMPEnabled) {
|
if(!NATPMPEnabled) {
|
||||||
qDebug("Enabling NAT-PMP");
|
qDebug("Enabling NAT-PMP");
|
||||||
@ -1048,7 +1048,7 @@ void bittorrent::enableNATPMP(bool b) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::enableLSD(bool b) {
|
void Bittorrent::enableLSD(bool b) {
|
||||||
if(b) {
|
if(b) {
|
||||||
if(!LSDEnabled) {
|
if(!LSDEnabled) {
|
||||||
qDebug("Enabling LSD");
|
qDebug("Enabling LSD");
|
||||||
@ -1064,7 +1064,7 @@ void bittorrent::enableLSD(bool b) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::loadSessionState() {
|
void Bittorrent::loadSessionState() {
|
||||||
boost::filesystem::ifstream ses_state_file((misc::qBittorrentPath()+QString::fromUtf8("ses_state")).toLocal8Bit().data()
|
boost::filesystem::ifstream ses_state_file((misc::qBittorrentPath()+QString::fromUtf8("ses_state")).toLocal8Bit().data()
|
||||||
, std::ios_base::binary);
|
, std::ios_base::binary);
|
||||||
ses_state_file.unsetf(std::ios_base::skipws);
|
ses_state_file.unsetf(std::ios_base::skipws);
|
||||||
@ -1073,7 +1073,7 @@ void bittorrent::loadSessionState() {
|
|||||||
, std::istream_iterator<char>()));
|
, std::istream_iterator<char>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::saveSessionState() {
|
void Bittorrent::saveSessionState() {
|
||||||
qDebug("Saving session state to disk...");
|
qDebug("Saving session state to disk...");
|
||||||
entry session_state = s->state();
|
entry session_state = s->state();
|
||||||
boost::filesystem::ofstream out((misc::qBittorrentPath()+QString::fromUtf8("ses_state")).toLocal8Bit().data()
|
boost::filesystem::ofstream out((misc::qBittorrentPath()+QString::fromUtf8("ses_state")).toLocal8Bit().data()
|
||||||
@ -1083,7 +1083,7 @@ void bittorrent::saveSessionState() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enable DHT
|
// Enable DHT
|
||||||
bool bittorrent::enableDHT(bool b) {
|
bool Bittorrent::enableDHT(bool b) {
|
||||||
if(b) {
|
if(b) {
|
||||||
if(!DHTEnabled) {
|
if(!DHTEnabled) {
|
||||||
entry dht_state;
|
entry dht_state;
|
||||||
@ -1119,7 +1119,7 @@ bool bittorrent::enableDHT(bool b) {
|
|||||||
|
|
||||||
// Read pieces priorities from hard disk
|
// Read pieces priorities from hard disk
|
||||||
// and ask QTorrentHandle to consider them
|
// and ask QTorrentHandle to consider them
|
||||||
void bittorrent::loadFilesPriorities(QTorrentHandle &h) {
|
void Bittorrent::loadFilesPriorities(QTorrentHandle &h) {
|
||||||
qDebug("Applying files priority");
|
qDebug("Applying files priority");
|
||||||
if(!h.is_valid()) {
|
if(!h.is_valid()) {
|
||||||
qDebug("/!\\ Error: Invalid handle");
|
qDebug("/!\\ Error: Invalid handle");
|
||||||
@ -1144,7 +1144,7 @@ void bittorrent::loadFilesPriorities(QTorrentHandle &h) {
|
|||||||
h.prioritize_files(v);
|
h.prioritize_files(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
float bittorrent::getRealRatio(QString hash) const{
|
float Bittorrent::getRealRatio(QString hash) const{
|
||||||
QTorrentHandle h = getTorrentHandle(hash);
|
QTorrentHandle h = getTorrentHandle(hash);
|
||||||
Q_ASSERT(h.all_time_download() >= 0);
|
Q_ASSERT(h.all_time_download() >= 0);
|
||||||
Q_ASSERT(h.all_time_upload() >= 0);
|
Q_ASSERT(h.all_time_upload() >= 0);
|
||||||
@ -1162,7 +1162,7 @@ float bittorrent::getRealRatio(QString hash) const{
|
|||||||
|
|
||||||
// Only save fast resume data for unfinished and unpaused torrents (Optimization)
|
// Only save fast resume data for unfinished and unpaused torrents (Optimization)
|
||||||
// Called periodically and on exit
|
// Called periodically and on exit
|
||||||
void bittorrent::saveFastResumeData() {
|
void Bittorrent::saveFastResumeData() {
|
||||||
// Stop listening for alerts
|
// Stop listening for alerts
|
||||||
timerAlerts->stop();
|
timerAlerts->stop();
|
||||||
int num_resume_data = 0;
|
int num_resume_data = 0;
|
||||||
@ -1218,22 +1218,22 @@ void bittorrent::saveFastResumeData() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList bittorrent::getConsoleMessages() const {
|
QStringList Bittorrent::getConsoleMessages() const {
|
||||||
return consoleMessages;
|
return consoleMessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList bittorrent::getPeerBanMessages() const {
|
QStringList Bittorrent::getPeerBanMessages() const {
|
||||||
return peerBanMessages;
|
return peerBanMessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::addConsoleMessage(QString msg, QColor color) {
|
void Bittorrent::addConsoleMessage(QString msg, QColor color) {
|
||||||
if(consoleMessages.size() > 100) {
|
if(consoleMessages.size() > 100) {
|
||||||
consoleMessages.removeFirst();
|
consoleMessages.removeFirst();
|
||||||
}
|
}
|
||||||
consoleMessages.append(QString::fromUtf8("<font color='grey'>")+ QDateTime::currentDateTime().toString(QString::fromUtf8("dd/MM/yyyy hh:mm:ss")) + QString::fromUtf8("</font> - <font color='") + color.name() +QString::fromUtf8("'><i>") + msg + QString::fromUtf8("</i></font>"));
|
consoleMessages.append(QString::fromUtf8("<font color='grey'>")+ QDateTime::currentDateTime().toString(QString::fromUtf8("dd/MM/yyyy hh:mm:ss")) + QString::fromUtf8("</font> - <font color='") + color.name() +QString::fromUtf8("'><i>") + msg + QString::fromUtf8("</i></font>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::addPeerBanMessage(QString ip, bool from_ipfilter) {
|
void Bittorrent::addPeerBanMessage(QString ip, bool from_ipfilter) {
|
||||||
if(peerBanMessages.size() > 100) {
|
if(peerBanMessages.size() > 100) {
|
||||||
peerBanMessages.removeFirst();
|
peerBanMessages.removeFirst();
|
||||||
}
|
}
|
||||||
@ -1243,7 +1243,7 @@ void bittorrent::addPeerBanMessage(QString ip, bool from_ipfilter) {
|
|||||||
peerBanMessages.append(QString::fromUtf8("<font color='grey'>")+ QDateTime::currentDateTime().toString(QString::fromUtf8("dd/MM/yyyy hh:mm:ss")) + QString::fromUtf8("</font> - ")+tr("<font color='red'>%1</font> <i>was banned due to corrupt pieces</i>", "x.y.z.w was banned").arg(ip));
|
peerBanMessages.append(QString::fromUtf8("<font color='grey'>")+ QDateTime::currentDateTime().toString(QString::fromUtf8("dd/MM/yyyy hh:mm:ss")) + QString::fromUtf8("</font> - ")+tr("<font color='red'>%1</font> <i>was banned due to corrupt pieces</i>", "x.y.z.w was banned").arg(ip));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bittorrent::isFilePreviewPossible(QString hash) const{
|
bool Bittorrent::isFilePreviewPossible(QString hash) const{
|
||||||
// See if there are supported files in the torrent
|
// See if there are supported files in the torrent
|
||||||
QTorrentHandle h = getTorrentHandle(hash);
|
QTorrentHandle h = getTorrentHandle(hash);
|
||||||
if(!h.is_valid()) {
|
if(!h.is_valid()) {
|
||||||
@ -1260,7 +1260,7 @@ bool bittorrent::isFilePreviewPossible(QString hash) const{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::addTorrentsFromScanFolder(QStringList &pathList) {
|
void Bittorrent::addTorrentsFromScanFolder(QStringList &pathList) {
|
||||||
QString dir_path = FSWatcher->directories().first();
|
QString dir_path = FSWatcher->directories().first();
|
||||||
foreach(const QString &file, pathList) {
|
foreach(const QString &file, pathList) {
|
||||||
QString fullPath = dir_path+QDir::separator()+file;
|
QString fullPath = dir_path+QDir::separator()+file;
|
||||||
@ -1273,15 +1273,15 @@ void bittorrent::addTorrentsFromScanFolder(QStringList &pathList) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString bittorrent::getDefaultSavePath() const {
|
QString Bittorrent::getDefaultSavePath() const {
|
||||||
return defaultSavePath;
|
return defaultSavePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bittorrent::useTemporaryFolder() const {
|
bool Bittorrent::useTemporaryFolder() const {
|
||||||
return !defaultTempPath.isEmpty();
|
return !defaultTempPath.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::setDefaultTempPath(QString temppath) {
|
void Bittorrent::setDefaultTempPath(QString temppath) {
|
||||||
if(defaultTempPath == temppath)
|
if(defaultTempPath == temppath)
|
||||||
return;
|
return;
|
||||||
if(temppath.isEmpty()) {
|
if(temppath.isEmpty()) {
|
||||||
@ -1308,13 +1308,13 @@ void bittorrent::setDefaultTempPath(QString temppath) {
|
|||||||
defaultTempPath = temppath;
|
defaultTempPath = temppath;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::saveTrackerFile(QString hash) {
|
void Bittorrent::saveTrackerFile(QString hash) {
|
||||||
QTorrentHandle h = getTorrentHandle(hash);
|
QTorrentHandle h = getTorrentHandle(hash);
|
||||||
TorrentPersistentData::saveTrackers(h);
|
TorrentPersistentData::saveTrackers(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable directory scanning
|
// Enable directory scanning
|
||||||
void bittorrent::enableDirectoryScanning(QString scan_dir) {
|
void Bittorrent::enableDirectoryScanning(QString scan_dir) {
|
||||||
if(!scan_dir.isEmpty()) {
|
if(!scan_dir.isEmpty()) {
|
||||||
QDir newDir(scan_dir);
|
QDir newDir(scan_dir);
|
||||||
if(!newDir.exists()) {
|
if(!newDir.exists()) {
|
||||||
@ -1339,40 +1339,40 @@ void bittorrent::enableDirectoryScanning(QString scan_dir) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Disable directory scanning
|
// Disable directory scanning
|
||||||
void bittorrent::disableDirectoryScanning() {
|
void Bittorrent::disableDirectoryScanning() {
|
||||||
if(FSWatcher) {
|
if(FSWatcher) {
|
||||||
delete FSWatcher;
|
delete FSWatcher;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the ports range in which is chosen the port the bittorrent
|
// Set the ports range in which is chosen the port the Bittorrent
|
||||||
// session will listen to
|
// session will listen to
|
||||||
void bittorrent::setListeningPort(int port) {
|
void Bittorrent::setListeningPort(int port) {
|
||||||
std::pair<int,int> ports(port, port);
|
std::pair<int,int> ports(port, port);
|
||||||
s->listen_on(ports);
|
s->listen_on(ports);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set download rate limit
|
// Set download rate limit
|
||||||
// -1 to disable
|
// -1 to disable
|
||||||
void bittorrent::setDownloadRateLimit(long rate) {
|
void Bittorrent::setDownloadRateLimit(long rate) {
|
||||||
qDebug("Setting a global download rate limit at %ld", rate);
|
qDebug("Setting a global download rate limit at %ld", rate);
|
||||||
s->set_download_rate_limit(rate);
|
s->set_download_rate_limit(rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
session* bittorrent::getSession() const{
|
session* Bittorrent::getSession() const{
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set upload rate limit
|
// Set upload rate limit
|
||||||
// -1 to disable
|
// -1 to disable
|
||||||
void bittorrent::setUploadRateLimit(long rate) {
|
void Bittorrent::setUploadRateLimit(long rate) {
|
||||||
qDebug("set upload_limit to %fkb/s", rate/1024.);
|
qDebug("set upload_limit to %fkb/s", rate/1024.);
|
||||||
s->set_upload_rate_limit(rate);
|
s->set_upload_rate_limit(rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
// libtorrent allow to adjust ratio for each torrent
|
// libtorrent allow to adjust ratio for each torrent
|
||||||
// This function will apply to same ratio to all torrents
|
// This function will apply to same ratio to all torrents
|
||||||
void bittorrent::setGlobalRatio(float ratio) {
|
void Bittorrent::setGlobalRatio(float ratio) {
|
||||||
if(ratio != -1 && ratio < 1.) ratio = 1.;
|
if(ratio != -1 && ratio < 1.) ratio = 1.;
|
||||||
if(ratio == -1) {
|
if(ratio == -1) {
|
||||||
// 0 means unlimited for libtorrent
|
// 0 means unlimited for libtorrent
|
||||||
@ -1392,7 +1392,7 @@ void bittorrent::setGlobalRatio(float ratio) {
|
|||||||
|
|
||||||
// Torrents will a ratio superior to the given value will
|
// Torrents will a ratio superior to the given value will
|
||||||
// be automatically deleted
|
// be automatically deleted
|
||||||
void bittorrent::setDeleteRatio(float ratio) {
|
void Bittorrent::setDeleteRatio(float ratio) {
|
||||||
if(ratio != -1 && ratio < 1.) ratio = 1.;
|
if(ratio != -1 && ratio < 1.) ratio = 1.;
|
||||||
if(ratio_limit == -1 && ratio != -1) {
|
if(ratio_limit == -1 && ratio != -1) {
|
||||||
Q_ASSERT(!BigRatioTimer);
|
Q_ASSERT(!BigRatioTimer);
|
||||||
@ -1411,7 +1411,7 @@ void bittorrent::setDeleteRatio(float ratio) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::loadTrackerFile(QString hash) {
|
void Bittorrent::loadTrackerFile(QString hash) {
|
||||||
QHash<QString, QVariant> tiers = TorrentPersistentData::getTrackers(hash);
|
QHash<QString, QVariant> tiers = TorrentPersistentData::getTrackers(hash);
|
||||||
std::vector<announce_entry> trackers;
|
std::vector<announce_entry> trackers;
|
||||||
foreach(const QString tracker_url, tiers.keys()) {
|
foreach(const QString tracker_url, tiers.keys()) {
|
||||||
@ -1427,7 +1427,7 @@ void bittorrent::loadTrackerFile(QString hash) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set DHT port (>= 1000 or 0 if same as BT)
|
// Set DHT port (>= 1000 or 0 if same as BT)
|
||||||
void bittorrent::setDHTPort(int dht_port) {
|
void Bittorrent::setDHTPort(int dht_port) {
|
||||||
if(dht_port == 0 or dht_port >= 1000) {
|
if(dht_port == 0 or dht_port >= 1000) {
|
||||||
struct dht_settings DHTSettings;
|
struct dht_settings DHTSettings;
|
||||||
DHTSettings.service_port = dht_port;
|
DHTSettings.service_port = dht_port;
|
||||||
@ -1437,7 +1437,7 @@ void bittorrent::setDHTPort(int dht_port) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enable IP Filtering
|
// Enable IP Filtering
|
||||||
void bittorrent::enableIPFilter(QString filter) {
|
void Bittorrent::enableIPFilter(QString filter) {
|
||||||
qDebug("Enabling IPFiler");
|
qDebug("Enabling IPFiler");
|
||||||
if(!filterParser) {
|
if(!filterParser) {
|
||||||
filterParser = new FilterParserThread(this, s);
|
filterParser = new FilterParserThread(this, s);
|
||||||
@ -1449,7 +1449,7 @@ void bittorrent::enableIPFilter(QString filter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Disable IP Filtering
|
// Disable IP Filtering
|
||||||
void bittorrent::disableIPFilter() {
|
void Bittorrent::disableIPFilter() {
|
||||||
qDebug("Disabling IPFilter");
|
qDebug("Disabling IPFilter");
|
||||||
s->set_ip_filter(ip_filter());
|
s->set_ip_filter(ip_filter());
|
||||||
if(filterParser) {
|
if(filterParser) {
|
||||||
@ -1459,13 +1459,13 @@ void bittorrent::disableIPFilter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set BT session settings (user_agent)
|
// Set BT session settings (user_agent)
|
||||||
void bittorrent::setSessionSettings(session_settings sessionSettings) {
|
void Bittorrent::setSessionSettings(session_settings sessionSettings) {
|
||||||
qDebug("Set session settings");
|
qDebug("Set session settings");
|
||||||
s->set_settings(sessionSettings);
|
s->set_settings(sessionSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set Proxy
|
// Set Proxy
|
||||||
void bittorrent::setProxySettings(proxy_settings proxySettings, bool trackers, bool peers, bool web_seeds, bool dht) {
|
void Bittorrent::setProxySettings(proxy_settings proxySettings, bool trackers, bool peers, bool web_seeds, bool dht) {
|
||||||
qDebug("Set Proxy settings");
|
qDebug("Set Proxy settings");
|
||||||
proxy_settings ps_null;
|
proxy_settings ps_null;
|
||||||
ps_null.type = proxy_settings::none;
|
ps_null.type = proxy_settings::none;
|
||||||
@ -1493,8 +1493,8 @@ void bittorrent::setProxySettings(proxy_settings proxySettings, bool trackers, b
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read alerts sent by the bittorrent session
|
// Read alerts sent by the Bittorrent session
|
||||||
void bittorrent::readAlerts() {
|
void Bittorrent::readAlerts() {
|
||||||
// look at session alerts and display some infos
|
// look at session alerts and display some infos
|
||||||
std::auto_ptr<alert> a = s->pop_alert();
|
std::auto_ptr<alert> a = s->pop_alert();
|
||||||
while (a.get()) {
|
while (a.get()) {
|
||||||
@ -1695,19 +1695,19 @@ void bittorrent::readAlerts() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QHash<QString, TrackerInfos> bittorrent::getTrackersInfo(QString hash) const{
|
QHash<QString, TrackerInfos> Bittorrent::getTrackersInfo(QString hash) const{
|
||||||
return trackersInfos.value(hash, QHash<QString, TrackerInfos>());
|
return trackersInfos.value(hash, QHash<QString, TrackerInfos>());
|
||||||
}
|
}
|
||||||
|
|
||||||
int bittorrent::getListenPort() const{
|
int Bittorrent::getListenPort() const{
|
||||||
return s->listen_port();
|
return s->listen_port();
|
||||||
}
|
}
|
||||||
|
|
||||||
session_status bittorrent::getSessionStatus() const{
|
session_status Bittorrent::getSessionStatus() const{
|
||||||
return s->status();
|
return s->status();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString bittorrent::getSavePath(QString hash) {
|
QString Bittorrent::getSavePath(QString hash) {
|
||||||
QString savePath;
|
QString savePath;
|
||||||
if(TorrentTempData::hasTempData(hash)) {
|
if(TorrentTempData::hasTempData(hash)) {
|
||||||
savePath = TorrentTempData::getSavePath(hash);
|
savePath = TorrentTempData::getSavePath(hash);
|
||||||
@ -1737,24 +1737,24 @@ QString bittorrent::getSavePath(QString hash) {
|
|||||||
// Take an url string to a torrent file,
|
// Take an url string to a torrent file,
|
||||||
// download the torrent file to a tmp location, then
|
// download the torrent file to a tmp location, then
|
||||||
// add it to download list
|
// add it to download list
|
||||||
void bittorrent::downloadFromUrl(QString url) {
|
void Bittorrent::downloadFromUrl(QString url) {
|
||||||
addConsoleMessage(tr("Downloading '%1', please wait...", "e.g: Downloading 'xxx.torrent', please wait...").arg(url), QPalette::WindowText);
|
addConsoleMessage(tr("Downloading '%1', please wait...", "e.g: Downloading 'xxx.torrent', please wait...").arg(url), QPalette::WindowText);
|
||||||
//emit aboutToDownloadFromUrl(url);
|
//emit aboutToDownloadFromUrl(url);
|
||||||
// Launch downloader thread
|
// Launch downloader thread
|
||||||
downloader->downloadUrl(url);
|
downloader->downloadUrl(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::downloadFromURLList(const QStringList& urls) {
|
void Bittorrent::downloadFromURLList(const QStringList& urls) {
|
||||||
foreach(const QString &url, urls) {
|
foreach(const QString &url, urls) {
|
||||||
downloadFromUrl(url);
|
downloadFromUrl(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::addMagnetSkipAddDlg(QString uri) {
|
void Bittorrent::addMagnetSkipAddDlg(QString uri) {
|
||||||
addMagnetUri(uri, false);
|
addMagnetUri(uri, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::downloadUrlAndSkipDialog(QString url, QString save_path) {
|
void Bittorrent::downloadUrlAndSkipDialog(QString url, QString save_path) {
|
||||||
//emit aboutToDownloadFromUrl(url);
|
//emit aboutToDownloadFromUrl(url);
|
||||||
if(!save_path.isEmpty())
|
if(!save_path.isEmpty())
|
||||||
savepath_fromurl[url] = save_path;
|
savepath_fromurl[url] = save_path;
|
||||||
@ -1763,8 +1763,8 @@ void bittorrent::downloadUrlAndSkipDialog(QString url, QString save_path) {
|
|||||||
downloader->downloadUrl(url);
|
downloader->downloadUrl(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add to bittorrent session the downloaded torrent file
|
// Add to Bittorrent session the downloaded torrent file
|
||||||
void bittorrent::processDownloadedFile(QString url, QString file_path) {
|
void Bittorrent::processDownloadedFile(QString url, QString file_path) {
|
||||||
int index = url_skippingDlg.indexOf(url);
|
int index = url_skippingDlg.indexOf(url);
|
||||||
if(index < 0) {
|
if(index < 0) {
|
||||||
// Add file to torrent download list
|
// Add file to torrent download list
|
||||||
@ -1778,7 +1778,7 @@ void bittorrent::processDownloadedFile(QString url, QString file_path) {
|
|||||||
// Return current download rate for the BT
|
// Return current download rate for the BT
|
||||||
// session. Payload means that it only take into
|
// session. Payload means that it only take into
|
||||||
// account "useful" part of the rate
|
// account "useful" part of the rate
|
||||||
float bittorrent::getPayloadDownloadRate() const{
|
float Bittorrent::getPayloadDownloadRate() const{
|
||||||
session_status sessionStatus = s->status();
|
session_status sessionStatus = s->status();
|
||||||
return sessionStatus.payload_download_rate;
|
return sessionStatus.payload_download_rate;
|
||||||
}
|
}
|
||||||
@ -1786,13 +1786,13 @@ float bittorrent::getPayloadDownloadRate() const{
|
|||||||
// Return current upload rate for the BT
|
// Return current upload rate for the BT
|
||||||
// session. Payload means that it only take into
|
// session. Payload means that it only take into
|
||||||
// account "useful" part of the rate
|
// account "useful" part of the rate
|
||||||
float bittorrent::getPayloadUploadRate() const{
|
float Bittorrent::getPayloadUploadRate() const{
|
||||||
session_status sessionStatus = s->status();
|
session_status sessionStatus = s->status();
|
||||||
return sessionStatus.payload_upload_rate;
|
return sessionStatus.payload_upload_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save DHT entry to hard drive
|
// Save DHT entry to hard drive
|
||||||
void bittorrent::saveDHTEntry() {
|
void Bittorrent::saveDHTEntry() {
|
||||||
// Save DHT entry
|
// Save DHT entry
|
||||||
if(DHTEnabled) {
|
if(DHTEnabled) {
|
||||||
try{
|
try{
|
||||||
@ -1807,14 +1807,14 @@ void bittorrent::saveDHTEntry() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::applyEncryptionSettings(pe_settings se) {
|
void Bittorrent::applyEncryptionSettings(pe_settings se) {
|
||||||
qDebug("Applying encryption settings");
|
qDebug("Applying encryption settings");
|
||||||
s->set_pe_settings(se);
|
s->set_pe_settings(se);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Will fast resume torrents in
|
// Will fast resume torrents in
|
||||||
// backup directory
|
// backup directory
|
||||||
void bittorrent::startUpTorrents() {
|
void Bittorrent::startUpTorrents() {
|
||||||
qDebug("Resuming unfinished torrents");
|
qDebug("Resuming unfinished torrents");
|
||||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
QDir torrentBackup(misc::qBittorrentPath() + "BT_backup");
|
QDir torrentBackup(misc::qBittorrentPath() + "BT_backup");
|
||||||
@ -1880,7 +1880,7 @@ void bittorrent::startUpTorrents() {
|
|||||||
|
|
||||||
// Import torrents temp data from v1.4.0 or earlier: save_path, filtered pieces
|
// Import torrents temp data from v1.4.0 or earlier: save_path, filtered pieces
|
||||||
// TODO: Remove in qBittorrent v1.6.0
|
// TODO: Remove in qBittorrent v1.6.0
|
||||||
void bittorrent::importOldTempData(QString torrent_path) {
|
void Bittorrent::importOldTempData(QString torrent_path) {
|
||||||
// Create torrent hash
|
// Create torrent hash
|
||||||
boost::intrusive_ptr<torrent_info> t;
|
boost::intrusive_ptr<torrent_info> t;
|
||||||
try {
|
try {
|
||||||
@ -1930,7 +1930,7 @@ void bittorrent::importOldTempData(QString torrent_path) {
|
|||||||
|
|
||||||
// Trackers, web seeds, speed limits
|
// Trackers, web seeds, speed limits
|
||||||
// TODO: Remove in qBittorrent v1.6.0
|
// TODO: Remove in qBittorrent v1.6.0
|
||||||
void bittorrent::applyFormerAttributeFiles(QTorrentHandle h) {
|
void Bittorrent::applyFormerAttributeFiles(QTorrentHandle h) {
|
||||||
// Load trackers
|
// Load trackers
|
||||||
QDir torrentBackup(misc::qBittorrentPath() + "BT_backup");
|
QDir torrentBackup(misc::qBittorrentPath() + "BT_backup");
|
||||||
QFile tracker_file(torrentBackup.path()+QDir::separator()+ h.hash() + ".trackers");
|
QFile tracker_file(torrentBackup.path()+QDir::separator()+ h.hash() + ".trackers");
|
||||||
@ -1999,7 +1999,7 @@ void bittorrent::applyFormerAttributeFiles(QTorrentHandle h) {
|
|||||||
|
|
||||||
// Import torrents from v1.4.0 or earlier
|
// Import torrents from v1.4.0 or earlier
|
||||||
// TODO: Remove in qBittorrent v1.6.0
|
// TODO: Remove in qBittorrent v1.6.0
|
||||||
void bittorrent::importOldTorrents() {
|
void Bittorrent::importOldTorrents() {
|
||||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
Q_ASSERT(!settings.value("v1_4_x_torrent_imported", false).toBool());
|
Q_ASSERT(!settings.value("v1_4_x_torrent_imported", false).toBool());
|
||||||
// Import old torrent
|
// Import old torrent
|
||||||
|
@ -67,7 +67,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class bittorrent : public QObject {
|
class Bittorrent : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -115,8 +115,8 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor / Destructor
|
// Constructor / Destructor
|
||||||
bittorrent();
|
Bittorrent();
|
||||||
~bittorrent();
|
~Bittorrent();
|
||||||
QTorrentHandle getTorrentHandle(QString hash) const;
|
QTorrentHandle getTorrentHandle(QString hash) const;
|
||||||
std::vector<torrent_handle> getTorrents() const;
|
std::vector<torrent_handle> getTorrents() const;
|
||||||
bool isFilePreviewPossible(QString fileHash) const;
|
bool isFilePreviewPossible(QString fileHash) const;
|
||||||
|
@ -40,10 +40,10 @@ class consoleDlg : public QDialog, private Ui_ConsoleDlg{
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bittorrent *BTSession;
|
Bittorrent *BTSession;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
consoleDlg(QWidget *parent, bittorrent* _BTSession) : QDialog(parent) {
|
consoleDlg(QWidget *parent, Bittorrent* _BTSession) : QDialog(parent) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
BTSession = _BTSession;
|
BTSession = _BTSession;
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include "bittorrent.h"
|
#include "bittorrent.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
EventManager::EventManager(QObject *parent, bittorrent *BTSession)
|
EventManager::EventManager(QObject *parent, Bittorrent *BTSession)
|
||||||
: QObject(parent), BTSession(BTSession)
|
: QObject(parent), BTSession(BTSession)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -36,20 +36,20 @@
|
|||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
struct bittorrent;
|
class Bittorrent;
|
||||||
|
|
||||||
class EventManager : public QObject
|
class EventManager : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
QHash<QString, QVariantMap> event_list;
|
QHash<QString, QVariantMap> event_list;
|
||||||
bittorrent* BTSession;
|
Bittorrent* BTSession;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void update(QVariantMap event);
|
void update(QVariantMap event);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EventManager(QObject *parent, bittorrent* BTSession);
|
EventManager(QObject *parent, Bittorrent* BTSession);
|
||||||
QList<QVariantMap> getEventList() const;
|
QList<QVariantMap> getEventList() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -228,11 +228,11 @@ private:
|
|||||||
QString feed_url;
|
QString feed_url;
|
||||||
QString feed_name;
|
QString feed_name;
|
||||||
FeedFilters filters;
|
FeedFilters filters;
|
||||||
bittorrent *BTSession;
|
Bittorrent *BTSession;
|
||||||
QString selected_filter; // name
|
QString selected_filter; // name
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FeedDownloaderDlg(QWidget *parent, QString feed_url, QString feed_name, bittorrent* BTSession): QDialog(parent), feed_url(feed_url), feed_name(feed_name), BTSession(BTSession), selected_filter(QString::null){
|
FeedDownloaderDlg(QWidget *parent, QString feed_url, QString feed_name, Bittorrent* BTSession): QDialog(parent), feed_url(feed_url), feed_name(feed_name), BTSession(BTSession), selected_filter(QString::null){
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
Q_ASSERT(!feed_name.isEmpty());
|
Q_ASSERT(!feed_name.isEmpty());
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
|
|
||||||
HttpConnection::HttpConnection(QTcpSocket *socket, bittorrent *BTSession, HttpServer *parent)
|
HttpConnection::HttpConnection(QTcpSocket *socket, Bittorrent *BTSession, HttpServer *parent)
|
||||||
: QObject(parent), socket(socket), parent(parent), BTSession(BTSession)
|
: QObject(parent), socket(socket), parent(parent), BTSession(BTSession)
|
||||||
{
|
{
|
||||||
socket->setParent(this);
|
socket->setParent(this);
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
class QTcpSocket;
|
class QTcpSocket;
|
||||||
class HttpServer;
|
class HttpServer;
|
||||||
class bittorrent;
|
class Bittorrent;
|
||||||
|
|
||||||
class HttpConnection : public QObject
|
class HttpConnection : public QObject
|
||||||
{
|
{
|
||||||
@ -46,7 +46,7 @@ class HttpConnection : public QObject
|
|||||||
private:
|
private:
|
||||||
QTcpSocket *socket;
|
QTcpSocket *socket;
|
||||||
HttpServer *parent;
|
HttpServer *parent;
|
||||||
bittorrent *BTSession;
|
Bittorrent *BTSession;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
HttpRequestParser parser;
|
HttpRequestParser parser;
|
||||||
@ -64,7 +64,7 @@ class HttpConnection : public QObject
|
|||||||
void recheckAllTorrents();
|
void recheckAllTorrents();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HttpConnection(QTcpSocket *socket, bittorrent* BTSession, HttpServer *parent);
|
HttpConnection(QTcpSocket *socket, Bittorrent* BTSession, HttpServer *parent);
|
||||||
~HttpConnection();
|
~HttpConnection();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include "bittorrent.h"
|
#include "bittorrent.h"
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
HttpServer::HttpServer(bittorrent *_BTSession, int msec, QObject* parent) : QTcpServer(parent)
|
HttpServer::HttpServer(Bittorrent *_BTSession, int msec, QObject* parent) : QTcpServer(parent)
|
||||||
{
|
{
|
||||||
base64 = QByteArray(":").toBase64();
|
base64 = QByteArray(":").toBase64();
|
||||||
connect(this, SIGNAL(newConnection()), this, SLOT(newHttpConnection()));
|
connect(this, SIGNAL(newConnection()), this, SLOT(newHttpConnection()));
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
#include <QTcpServer>
|
#include <QTcpServer>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
|
|
||||||
class bittorrent;
|
class Bittorrent;
|
||||||
class QTimer;
|
class QTimer;
|
||||||
class EventManager;
|
class EventManager;
|
||||||
|
|
||||||
@ -46,12 +46,12 @@ class HttpServer : public QTcpServer
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QByteArray base64;
|
QByteArray base64;
|
||||||
bittorrent *BTSession;
|
Bittorrent *BTSession;
|
||||||
EventManager *manager;
|
EventManager *manager;
|
||||||
QTimer *timer;
|
QTimer *timer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HttpServer(bittorrent *BTSession, int msec, QObject* parent = 0);
|
HttpServer(Bittorrent *BTSession, int msec, QObject* parent = 0);
|
||||||
~HttpServer();
|
~HttpServer();
|
||||||
void setAuthorization(QString username, QString password);
|
void setAuthorization(QString username, QString password);
|
||||||
bool isAuthorized(QByteArray auth) const;
|
bool isAuthorized(QByteArray auth) const;
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
#define SELECTED_BUTTON_CSS "QPushButton {border: 1px solid rgb(85, 81, 91);border-radius: 3px;padding: 2px;background-color: rgb(255, 208, 105); margin-left: 3px; margin-right: 3px;}"
|
#define SELECTED_BUTTON_CSS "QPushButton {border: 1px solid rgb(85, 81, 91);border-radius: 3px;padding: 2px;background-color: rgb(255, 208, 105); margin-left: 3px; margin-right: 3px;}"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PropertiesWidget::PropertiesWidget(QWidget *parent, TransferListWidget *transferList, bittorrent* BTSession): QWidget(parent), transferList(transferList), BTSession(BTSession) {
|
PropertiesWidget::PropertiesWidget(QWidget *parent, TransferListWidget *transferList, Bittorrent* BTSession): QWidget(parent), transferList(transferList), BTSession(BTSession) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
state = VISIBLE;
|
state = VISIBLE;
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ const QTorrentHandle& PropertiesWidget::getCurrentTorrent() const {
|
|||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
bittorrent* PropertiesWidget::getBTSession() const {
|
Bittorrent* PropertiesWidget::getBTSession() const {
|
||||||
return BTSession;
|
return BTSession;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ class TransferListWidget;
|
|||||||
class QTimer;
|
class QTimer;
|
||||||
class RealProgressBar;
|
class RealProgressBar;
|
||||||
class RealProgressBarThread;
|
class RealProgressBarThread;
|
||||||
class bittorrent;
|
class Bittorrent;
|
||||||
class TorrentFilesModel;
|
class TorrentFilesModel;
|
||||||
class PropListDelegate;
|
class PropListDelegate;
|
||||||
class QAction;
|
class QAction;
|
||||||
@ -60,7 +60,7 @@ private:
|
|||||||
QTimer *refreshTimer;
|
QTimer *refreshTimer;
|
||||||
RealProgressBar *progressBar;
|
RealProgressBar *progressBar;
|
||||||
RealProgressBarThread *progressBarUpdater;
|
RealProgressBarThread *progressBarUpdater;
|
||||||
bittorrent* BTSession;
|
Bittorrent* BTSession;
|
||||||
SlideState state;
|
SlideState state;
|
||||||
TorrentFilesModel *PropListModel;
|
TorrentFilesModel *PropListModel;
|
||||||
PropListDelegate *PropDelegate;
|
PropListDelegate *PropDelegate;
|
||||||
@ -105,10 +105,10 @@ public slots:
|
|||||||
void reloadPreferences();
|
void reloadPreferences();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PropertiesWidget(QWidget *parent, TransferListWidget *transferList, bittorrent* BTSession);
|
PropertiesWidget(QWidget *parent, TransferListWidget *transferList, Bittorrent* BTSession);
|
||||||
~PropertiesWidget();
|
~PropertiesWidget();
|
||||||
const QTorrentHandle& getCurrentTorrent() const;
|
const QTorrentHandle& getCurrentTorrent() const;
|
||||||
bittorrent* getBTSession() const;
|
Bittorrent* getBTSession() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PROPERTIESWIDGET_H
|
#endif // PROPERTIESWIDGET_H
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
/** RssFolder **/
|
/** RssFolder **/
|
||||||
|
|
||||||
RssFolder::RssFolder(RssFolder *parent, RssManager *rssmanager, bittorrent *BTSession, QString name): parent(parent), rssmanager(rssmanager), BTSession(BTSession), name(name) {
|
RssFolder::RssFolder(RssFolder *parent, RssManager *rssmanager, Bittorrent *BTSession, QString name): parent(parent), rssmanager(rssmanager), BTSession(BTSession), name(name) {
|
||||||
downloader = new downloadThread(this);
|
downloader = new downloadThread(this);
|
||||||
connect(downloader, SIGNAL(downloadFinished(QString, QString)), this, SLOT(processFinishedDownload(QString, QString)));
|
connect(downloader, SIGNAL(downloadFinished(QString, QString)), this, SLOT(processFinishedDownload(QString, QString)));
|
||||||
connect(downloader, SIGNAL(downloadFailure(QString, QString)), this, SLOT(handleDownloadFailure(QString, QString)));
|
connect(downloader, SIGNAL(downloadFailure(QString, QString)), this, SLOT(handleDownloadFailure(QString, QString)));
|
||||||
@ -277,7 +277,7 @@ void RssFolder::addFile(RssFile * item) {
|
|||||||
|
|
||||||
/** RssManager **/
|
/** RssManager **/
|
||||||
|
|
||||||
RssManager::RssManager(bittorrent *BTSession): RssFolder(0, this, BTSession, QString::null) {
|
RssManager::RssManager(Bittorrent *BTSession): RssFolder(0, this, BTSession, QString::null) {
|
||||||
loadStreamList();
|
loadStreamList();
|
||||||
connect(&newsRefresher, SIGNAL(timeout()), this, SLOT(refreshAll()));
|
connect(&newsRefresher, SIGNAL(timeout()), this, SLOT(refreshAll()));
|
||||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
@ -368,7 +368,7 @@ void RssManager::saveStreamList(){
|
|||||||
|
|
||||||
/** RssStream **/
|
/** RssStream **/
|
||||||
|
|
||||||
RssStream::RssStream(RssFolder* parent, RssManager *rssmanager, bittorrent *BTSession, QString _url): parent(parent), rssmanager(rssmanager), BTSession(BTSession), alias(""), iconPath(":/Icons/rss16.png"), refreshed(false), downloadFailure(false), currently_loading(false) {
|
RssStream::RssStream(RssFolder* parent, RssManager *rssmanager, Bittorrent *BTSession, QString _url): parent(parent), rssmanager(rssmanager), BTSession(BTSession), alias(""), iconPath(":/Icons/rss16.png"), refreshed(false), downloadFailure(false), currently_loading(false) {
|
||||||
has_attachments = false;
|
has_attachments = false;
|
||||||
qDebug("RSSStream constructed");
|
qDebug("RSSStream constructed");
|
||||||
QSettings qBTRSS("qBittorrent", "qBittorrent-rss");
|
QSettings qBTRSS("qBittorrent", "qBittorrent-rss");
|
||||||
|
12
src/rss.h
12
src/rss.h
@ -372,7 +372,7 @@ class RssStream: public RssFile, public QHash<QString, RssItem*> {
|
|||||||
private:
|
private:
|
||||||
RssFolder *parent;
|
RssFolder *parent;
|
||||||
RssManager *rssmanager;
|
RssManager *rssmanager;
|
||||||
bittorrent *BTSession;
|
Bittorrent *BTSession;
|
||||||
QString title;
|
QString title;
|
||||||
QString link;
|
QString link;
|
||||||
QString description;
|
QString description;
|
||||||
@ -392,7 +392,7 @@ public slots:
|
|||||||
void setDownloadFailed();
|
void setDownloadFailed();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RssStream(RssFolder* parent, RssManager *rssmanager, bittorrent *BTSession, QString _url);
|
RssStream(RssFolder* parent, RssManager *rssmanager, Bittorrent *BTSession, QString _url);
|
||||||
~RssStream();
|
~RssStream();
|
||||||
RssFolder* getParent() const { return parent; }
|
RssFolder* getParent() const { return parent; }
|
||||||
void setParent(RssFolder* _parent) { parent = _parent; }
|
void setParent(RssFolder* _parent) { parent = _parent; }
|
||||||
@ -436,11 +436,11 @@ private:
|
|||||||
RssFolder *parent;
|
RssFolder *parent;
|
||||||
RssManager *rssmanager;
|
RssManager *rssmanager;
|
||||||
downloadThread *downloader;
|
downloadThread *downloader;
|
||||||
bittorrent *BTSession;
|
Bittorrent *BTSession;
|
||||||
QString name;
|
QString name;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RssFolder(RssFolder *parent, RssManager *rssmanager, bittorrent *BTSession, QString name);
|
RssFolder(RssFolder *parent, RssManager *rssmanager, Bittorrent *BTSession, QString name);
|
||||||
~RssFolder();
|
~RssFolder();
|
||||||
RssFolder* getParent() const { return parent; }
|
RssFolder* getParent() const { return parent; }
|
||||||
void setParent(RssFolder* _parent) { parent = _parent; }
|
void setParent(RssFolder* _parent) { parent = _parent; }
|
||||||
@ -476,7 +476,7 @@ class RssManager: public RssFolder{
|
|||||||
private:
|
private:
|
||||||
QTimer newsRefresher;
|
QTimer newsRefresher;
|
||||||
unsigned int refreshInterval;
|
unsigned int refreshInterval;
|
||||||
bittorrent *BTSession;
|
Bittorrent *BTSession;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void feedInfosChanged(QString url, QString aliasOrUrl, unsigned int nbUnread);
|
void feedInfosChanged(QString url, QString aliasOrUrl, unsigned int nbUnread);
|
||||||
@ -491,7 +491,7 @@ public slots:
|
|||||||
void updateRefreshInterval(unsigned int val);
|
void updateRefreshInterval(unsigned int val);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RssManager(bittorrent *BTSession);
|
RssManager(Bittorrent *BTSession);
|
||||||
~RssManager();
|
~RssManager();
|
||||||
static void insertSortElem(QList<RssItem*> &list, RssItem *item) {
|
static void insertSortElem(QList<RssItem*> &list, RssItem *item) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -565,7 +565,7 @@ void RSSImp::updateRefreshInterval(unsigned int val) {
|
|||||||
rssmanager->updateRefreshInterval(val);
|
rssmanager->updateRefreshInterval(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
RSSImp::RSSImp(bittorrent *BTSession) : QWidget(), BTSession(BTSession){
|
RSSImp::RSSImp(Bittorrent *BTSession) : QWidget(), BTSession(BTSession){
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
rssmanager = new RssManager(BTSession);
|
rssmanager = new RssManager(BTSession);
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#include "ui_rss.h"
|
#include "ui_rss.h"
|
||||||
#include "rss.h"
|
#include "rss.h"
|
||||||
|
|
||||||
class bittorrent;
|
class Bittorrent;
|
||||||
class FeedList;
|
class FeedList;
|
||||||
class QTreeWidgetItem;
|
class QTreeWidgetItem;
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ class RSSImp : public QWidget, public Ui::RSS{
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
RssManager *rssmanager;
|
RssManager *rssmanager;
|
||||||
bittorrent *BTSession;
|
Bittorrent *BTSession;
|
||||||
FeedList *listStreams;
|
FeedList *listStreams;
|
||||||
QTreeWidgetItem* previous_news;
|
QTreeWidgetItem* previous_news;
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ protected slots:
|
|||||||
void displayOverwriteError(QString filename);
|
void displayOverwriteError(QString filename);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RSSImp(bittorrent *BTSession);
|
RSSImp(Bittorrent *BTSession);
|
||||||
~RSSImp();
|
~RSSImp();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
#define SEARCHHISTORY_MAXSIZE 50
|
#define SEARCHHISTORY_MAXSIZE 50
|
||||||
|
|
||||||
/*SEARCH ENGINE START*/
|
/*SEARCH ENGINE START*/
|
||||||
SearchEngine::SearchEngine(bittorrent *BTSession, QSystemTrayIcon *systrayIcon) : QWidget(), BTSession(BTSession), systrayIcon(systrayIcon) {
|
SearchEngine::SearchEngine(Bittorrent *BTSession, QSystemTrayIcon *systrayIcon) : QWidget(), BTSession(BTSession), systrayIcon(systrayIcon) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
// new qCompleter to the search pattern
|
// new qCompleter to the search pattern
|
||||||
startSearchHistory();
|
startSearchHistory();
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
#include "searchtab.h"
|
#include "searchtab.h"
|
||||||
#include "supportedengines.h"
|
#include "supportedengines.h"
|
||||||
|
|
||||||
class bittorrent;
|
class Bittorrent;
|
||||||
class QSystemTrayIcon;
|
class QSystemTrayIcon;
|
||||||
class downloadThread;
|
class downloadThread;
|
||||||
class QTimer;
|
class QTimer;
|
||||||
@ -62,7 +62,7 @@ private:
|
|||||||
unsigned long nb_search_results;
|
unsigned long nb_search_results;
|
||||||
QPointer<QCompleter> searchCompleter;
|
QPointer<QCompleter> searchCompleter;
|
||||||
QStringListModel searchHistory;
|
QStringListModel searchHistory;
|
||||||
bittorrent *BTSession;
|
Bittorrent *BTSession;
|
||||||
QSystemTrayIcon *systrayIcon;
|
QSystemTrayIcon *systrayIcon;
|
||||||
SupportedEngines *supported_engines;
|
SupportedEngines *supported_engines;
|
||||||
QTimer *searchTimeout;
|
QTimer *searchTimeout;
|
||||||
@ -71,7 +71,7 @@ private:
|
|||||||
QList<SearchTab*> all_tab; // To store all tabs
|
QList<SearchTab*> all_tab; // To store all tabs
|
||||||
const SearchCategories full_cat_names;
|
const SearchCategories full_cat_names;
|
||||||
public:
|
public:
|
||||||
SearchEngine(bittorrent *BTSession, QSystemTrayIcon *systrayIcon);
|
SearchEngine(Bittorrent *BTSession, QSystemTrayIcon *systrayIcon);
|
||||||
~SearchEngine();
|
~SearchEngine();
|
||||||
float getPluginVersion(QString filePath) const;
|
float getPluginVersion(QString filePath) const;
|
||||||
QString selectedCategory() const;
|
QString selectedCategory() const;
|
||||||
|
@ -58,10 +58,10 @@ private:
|
|||||||
QTimer *refreshTimer;
|
QTimer *refreshTimer;
|
||||||
QWidget *container;
|
QWidget *container;
|
||||||
QGridLayout *layout;
|
QGridLayout *layout;
|
||||||
bittorrent *BTSession;
|
Bittorrent *BTSession;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StatusBar(QStatusBar *bar, bittorrent *BTSession): bar(bar), BTSession(BTSession) {
|
StatusBar(QStatusBar *bar, Bittorrent *BTSession): bar(bar), BTSession(BTSession) {
|
||||||
container = new QWidget();
|
container = new QWidget();
|
||||||
layout = new QGridLayout(container);
|
layout = new QGridLayout(container);
|
||||||
layout->setVerticalSpacing(0);
|
layout->setVerticalSpacing(0);
|
||||||
|
@ -55,7 +55,7 @@ class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bittorrent *BTSession;
|
Bittorrent *BTSession;
|
||||||
QString fileName;
|
QString fileName;
|
||||||
QString hash;
|
QString hash;
|
||||||
QString filePath;
|
QString filePath;
|
||||||
@ -66,7 +66,7 @@ private:
|
|||||||
boost::intrusive_ptr<torrent_info> t;
|
boost::intrusive_ptr<torrent_info> t;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
torrentAdditionDialog(QWidget *parent, bittorrent* _BTSession) : QDialog(parent) {
|
torrentAdditionDialog(QWidget *parent, Bittorrent* _BTSession) : QDialog(parent) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
BTSession = _BTSession;
|
BTSession = _BTSession;
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
TransferListWidget::TransferListWidget(QWidget *parent, bittorrent *_BTSession): QTreeView(parent) {
|
TransferListWidget::TransferListWidget(QWidget *parent, Bittorrent *_BTSession): QTreeView(parent) {
|
||||||
QSettings settings("qBittorrent", "qBittorrent");
|
QSettings settings("qBittorrent", "qBittorrent");
|
||||||
BTSession = _BTSession;
|
BTSession = _BTSession;
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
class QStandardItemModel;
|
class QStandardItemModel;
|
||||||
class QSortFilterProxyModel;
|
class QSortFilterProxyModel;
|
||||||
class bittorrent;
|
class Bittorrent;
|
||||||
class QTimer;
|
class QTimer;
|
||||||
class TransferListDelegate;
|
class TransferListDelegate;
|
||||||
|
|
||||||
@ -49,11 +49,11 @@ private:
|
|||||||
TransferListDelegate *listDelegate;
|
TransferListDelegate *listDelegate;
|
||||||
QStandardItemModel *listModel;
|
QStandardItemModel *listModel;
|
||||||
QSortFilterProxyModel *proxyModel;
|
QSortFilterProxyModel *proxyModel;
|
||||||
bittorrent* BTSession;
|
Bittorrent* BTSession;
|
||||||
QTimer *refreshTimer;
|
QTimer *refreshTimer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TransferListWidget(QWidget *parent, bittorrent* BTSession);
|
TransferListWidget(QWidget *parent, Bittorrent* BTSession);
|
||||||
~TransferListWidget();
|
~TransferListWidget();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
Reference in New Issue
Block a user