mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
- Optimized Bittorrent class for faster compilation
This commit is contained in:
parent
58b5d4378d
commit
8fdc59c37c
@ -22,6 +22,7 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
#include <libtorrent/extensions/metadata_transfer.hpp>
|
#include <libtorrent/extensions/metadata_transfer.hpp>
|
||||||
#include <libtorrent/extensions/ut_pex.hpp>
|
#include <libtorrent/extensions/ut_pex.hpp>
|
||||||
@ -43,6 +44,7 @@
|
|||||||
bittorrent::bittorrent(){
|
bittorrent::bittorrent(){
|
||||||
// To avoid some exceptions
|
// To avoid some exceptions
|
||||||
fs::path::default_name_check(fs::no_check);
|
fs::path::default_name_check(fs::no_check);
|
||||||
|
timerScan = 0;
|
||||||
// Supported preview extensions
|
// Supported preview extensions
|
||||||
// XXX: A bit dirty to do it this way (use mime types?)
|
// XXX: A bit dirty to do it this way (use mime types?)
|
||||||
supported_preview_extensions << "AVI" << "DIVX" << "MPG" << "MPEG" << "MPE" << "MP3" << "OGG" << "WMV" << "WMA" << "RMV" << "RMVB" << "ASF" << "MOV" << "WAV" << "MP2" << "SWF" << "AC3" << "OGM" << "MP4" << "FLV" << "VOB" << "QT" << "MKV" << "AIF" << "AIFF" << "AIFC" << "MID" << "MPG" << "RA" << "RAM" << "AU" << "M4A" << "FLAC" << "M4P" << "3GP" << "AAC" << "RM" << "SWA" << "MPC" << "MPP";
|
supported_preview_extensions << "AVI" << "DIVX" << "MPG" << "MPEG" << "MPE" << "MP3" << "OGG" << "WMV" << "WMA" << "RMV" << "RMVB" << "ASF" << "MOV" << "WAV" << "MP2" << "SWF" << "AC3" << "OGM" << "MP4" << "FLV" << "VOB" << "QT" << "MKV" << "AIF" << "AIFF" << "AIFC" << "MID" << "MPG" << "RA" << "RAM" << "AU" << "M4A" << "FLAC" << "M4P" << "3GP" << "AAC" << "RM" << "SWA" << "MPC" << "MPP";
|
||||||
@ -54,10 +56,12 @@ bittorrent::bittorrent(){
|
|||||||
DHTEnabled = false;
|
DHTEnabled = false;
|
||||||
// Enabling metadata plugin
|
// Enabling metadata plugin
|
||||||
s->add_extension(&create_metadata_plugin);
|
s->add_extension(&create_metadata_plugin);
|
||||||
connect(&timerAlerts, SIGNAL(timeout()), this, SLOT(readAlerts()));
|
timerAlerts = new QTimer();
|
||||||
timerAlerts.start(3000);
|
connect(timerAlerts, SIGNAL(timeout()), this, SLOT(readAlerts()));
|
||||||
connect(&ETARefresher, SIGNAL(timeout()), this, SLOT(updateETAs()));
|
timerAlerts->start(3000);
|
||||||
ETARefresher.start(6000);
|
ETARefresher = new QTimer();
|
||||||
|
connect(ETARefresher, SIGNAL(timeout()), this, SLOT(updateETAs()));
|
||||||
|
ETARefresher->start(6000);
|
||||||
// To download from urls
|
// To download from urls
|
||||||
downloader = new downloadThread(this);
|
downloader = new downloadThread(this);
|
||||||
connect(downloader, SIGNAL(downloadFinished(QString, QString)), this, SLOT(processDownloadedFile(QString, QString)));
|
connect(downloader, SIGNAL(downloadFinished(QString, QString)), this, SLOT(processDownloadedFile(QString, QString)));
|
||||||
@ -72,6 +76,8 @@ bittorrent::~bittorrent(){
|
|||||||
saveDHTEntry();
|
saveDHTEntry();
|
||||||
saveFastResumeAndRatioData();
|
saveFastResumeAndRatioData();
|
||||||
// Delete our objects
|
// Delete our objects
|
||||||
|
delete timerAlerts;
|
||||||
|
delete ETARefresher;
|
||||||
delete downloader;
|
delete downloader;
|
||||||
delete s;
|
delete s;
|
||||||
}
|
}
|
||||||
@ -752,8 +758,9 @@ void bittorrent::disableDirectoryScanning(){
|
|||||||
if(timerScan->isActive()){
|
if(timerScan->isActive()){
|
||||||
timerScan->stop();
|
timerScan->stop();
|
||||||
}
|
}
|
||||||
delete timerScan;
|
|
||||||
}
|
}
|
||||||
|
if(timerScan != 0)
|
||||||
|
delete timerScan;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the ports range in which is chosen the port the bittorrent
|
// Set the ports range in which is chosen the port the bittorrent
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#define __BITTORRENT_H__
|
#define __BITTORRENT_H__
|
||||||
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QTimer>
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
@ -34,6 +33,7 @@ using namespace libtorrent;
|
|||||||
|
|
||||||
class downloadThread;
|
class downloadThread;
|
||||||
class deleteThread;
|
class deleteThread;
|
||||||
|
class QTimer;
|
||||||
|
|
||||||
class bittorrent : public QObject{
|
class bittorrent : public QObject{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -43,7 +43,7 @@ class bittorrent : public QObject{
|
|||||||
bool DHTEnabled;
|
bool DHTEnabled;
|
||||||
QString scan_dir;
|
QString scan_dir;
|
||||||
QTimer *timerScan;
|
QTimer *timerScan;
|
||||||
QTimer timerAlerts;
|
QTimer *timerAlerts;
|
||||||
downloadThread *downloader;
|
downloadThread *downloader;
|
||||||
QStringList supported_preview_extensions;
|
QStringList supported_preview_extensions;
|
||||||
QString defaultSavePath;
|
QString defaultSavePath;
|
||||||
@ -52,7 +52,7 @@ class bittorrent : public QObject{
|
|||||||
QHash<QString, QList<long> > ETAstats;
|
QHash<QString, QList<long> > ETAstats;
|
||||||
QHash<QString, long> ETAs;
|
QHash<QString, long> ETAs;
|
||||||
QHash<QString, QPair<size_type,size_type> > ratioData;
|
QHash<QString, QPair<size_type,size_type> > ratioData;
|
||||||
QTimer ETARefresher;
|
QTimer *ETARefresher;
|
||||||
QList<QString> fullAllocationModeList;
|
QList<QString> fullAllocationModeList;
|
||||||
QHash<QString, QList<QPair<QString, QString> > > trackersErrors;
|
QHash<QString, QList<QPair<QString, QString> > > trackersErrors;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user