You've already forked qBittorrent
mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-10-12 03:12:18 +02:00
Compare commits
27 Commits
release-1.
...
release-1.
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d5b790d240 | ||
![]() |
940a8b28e4 | ||
![]() |
9ee9c7d362 | ||
![]() |
2899494ef3 | ||
![]() |
624e2b287a | ||
![]() |
681d538163 | ||
![]() |
60f1a1989c | ||
![]() |
050dc9de44 | ||
![]() |
d80f94643f | ||
![]() |
1b4bb7655f | ||
![]() |
e8ffaa2f87 | ||
![]() |
a89188acc3 | ||
![]() |
993002a151 | ||
![]() |
8bcaf55439 | ||
![]() |
48aac758c9 | ||
![]() |
4ba2c3d385 | ||
![]() |
d96e21c07f | ||
![]() |
1204cebaa1 | ||
![]() |
1695e85bdf | ||
![]() |
33305cca9f | ||
![]() |
04b683c38c | ||
![]() |
d55cd9aec8 | ||
![]() |
0b5652bd72 | ||
![]() |
878787e965 | ||
![]() |
3536577af6 | ||
![]() |
9f2d9e4d3f | ||
![]() |
efe0dbabaa |
@@ -42,12 +42,12 @@
|
||||
- FEATURE: Added an option to display current transfer speeds in title bar
|
||||
- FEATURE: Torrent content is now displayed as a tree
|
||||
- FEATURE: Better media file preview (player detected automatically)
|
||||
- FEATURE: Greatly improved ETA calculation algorithm (use GASA)
|
||||
- I18N: Added Hungarian translation
|
||||
- I18N: Added Brazilian translation
|
||||
- BUGFIX: Progress of paused torrents is now correct on restart
|
||||
- BUGFIX: clear the results of a search stops searching
|
||||
- BUGFIX: Progress column gets sorted on restart it is was during last execution
|
||||
- BUGFIX: Made ETA more reliable using stats instead of instant values
|
||||
- BUGFIX: Remove torrent from hard drive used to delete parent folder if empty
|
||||
- BUGFIX: Fixed a crash when filtering all the files in a torrent
|
||||
- BUGFIX: Reload torrent only when necessary (properties)
|
||||
|
2
INSTALL
2
INSTALL
@@ -25,7 +25,7 @@ Dependencies:
|
||||
|
||||
- libboost: libboost-filesystem, libboost-date-time, libboost-thread, libboost-serialization
|
||||
|
||||
- libcommoncpp2
|
||||
- libcurl
|
||||
|
||||
- python >= 2.3 (needed by search engine)
|
||||
|
||||
|
26
TODO
26
TODO
@@ -50,19 +50,15 @@
|
||||
-> in download list
|
||||
-> in seeding list
|
||||
|
||||
// TODO v1.0.0
|
||||
- Fix libcommoncpp proxy support
|
||||
- Fix layout in preferences/Proxy
|
||||
TODO:
|
||||
- Check search engine cpu usage
|
||||
|
||||
rc8->rc9 changelog:
|
||||
- FEATURE: Better media file preview (player detected automatically)
|
||||
- BUGFIX: Remember properties window size and position
|
||||
- BUGFIX: Added proxy support in search engine, RSS, downloads from urls
|
||||
- BUGFIX: Do no pause torrents before saving fastresume data anymore (no longer needed)
|
||||
- BUGFIX: Save fast resume data regularly (every 60 seconds) to avoid downloading from scratch if qBittorrent crashes
|
||||
- BUGFIX: Do not save fastresume data for checking torrents anymore
|
||||
- BUGFIX: Saving trackers file only when necessary
|
||||
- BUGFIX: Fixed possible segfault when unfiltering files in torrent addition dialog
|
||||
- BUGFIX: Fixed possible overflow in ETA calculation
|
||||
- BUGFIX: title bar is now reset when "Display speed in title" is disabled
|
||||
- BUGFIX: Fixed HTTP_PW and SOCKS5_PW in proxy combobox
|
||||
rc9->rc10 changelog:
|
||||
- FEATURE: Greatly improved ETA calculation algorithm (use GASA)
|
||||
- BUGFIX: Fixed proxy host max length in preferences
|
||||
- BUGFIX: Added a 3 minutes search engine timeout
|
||||
- BUGFIX: Limit search engine plugins to 10 result pages
|
||||
- BUGFIX: Fixed nbResults != 0 when clearing results while a search is running
|
||||
- BUGFIX: Fixed possible problem when closing to systray and cancelling app exit
|
||||
- BUGFIX: Fixed preview when path contains spaces
|
||||
- COSMETIC: Use more skin colors instead of hard coded ones
|
||||
|
58
configure
vendored
58
configure
vendored
@@ -22,8 +22,8 @@ Dependency options:
|
||||
--with-libtorrent-lib=[path] Path to libtorrent library files
|
||||
--with-libtorrent-static-lib=[path] Path to libtorrent .a file
|
||||
--with-libboost-inc=[path] Path to libboost include files
|
||||
--with-libcommoncpp2-inc=[path] Path to libcommoncpp2 include files
|
||||
--with-libcommoncpp2-lib=[path] Path to libcommoncpp2 library files
|
||||
--with-libcurl-inc=[path] Path to libcurl include files
|
||||
--with-libcurl-lib=[path] Path to libcurl library files
|
||||
--disable-libmagick Disable use of libmagick
|
||||
--with-libmagick-inc=[path] Path to libmagick++ include files
|
||||
--with-libmagick-lib=[path] Path to libmagick++ library files
|
||||
@@ -166,13 +166,13 @@ while [ $# -gt 0 ]; do
|
||||
shift
|
||||
;;
|
||||
|
||||
--with-libcommoncpp2-inc=*)
|
||||
QC_WITH_LIBCOMMONCPP2_INC=$optarg
|
||||
--with-libcurl-inc=*)
|
||||
QC_WITH_LIBCURL_INC=$optarg
|
||||
shift
|
||||
;;
|
||||
|
||||
--with-libcommoncpp2-lib=*)
|
||||
QC_WITH_LIBCOMMONCPP2_LIB=$optarg
|
||||
--with-libcurl-lib=*)
|
||||
QC_WITH_LIBCURL_LIB=$optarg
|
||||
shift
|
||||
;;
|
||||
|
||||
@@ -231,8 +231,8 @@ echo QC_WITH_LIBTORRENT_INC=$QC_WITH_LIBTORRENT_INC
|
||||
echo QC_WITH_LIBTORRENT_LIB=$QC_WITH_LIBTORRENT_LIB
|
||||
echo QC_WITH_LIBTORRENT_STATIC_LIB=$QC_WITH_LIBTORRENT_STATIC_LIB
|
||||
echo QC_WITH_LIBBOOST_INC=$QC_WITH_LIBBOOST_INC
|
||||
echo QC_WITH_LIBCOMMONCPP2_INC=$QC_WITH_LIBCOMMONCPP2_INC
|
||||
echo QC_WITH_LIBCOMMONCPP2_LIB=$QC_WITH_LIBCOMMONCPP2_LIB
|
||||
echo QC_WITH_LIBCURL_INC=$QC_WITH_LIBCURL_INC
|
||||
echo QC_WITH_LIBCURL_LIB=$QC_WITH_LIBCURL_LIB
|
||||
echo QC_DISABLE_libmagick=$QC_DISABLE_libmagick
|
||||
echo QC_WITH_LIBMAGICK_INC=$QC_WITH_LIBMAGICK_INC
|
||||
echo QC_WITH_LIBMAGICK_LIB=$QC_WITH_LIBMAGICK_LIB
|
||||
@@ -485,25 +485,25 @@ public:
|
||||
return true;
|
||||
}
|
||||
};
|
||||
#line 1 "libcommoncpp2.qcm"
|
||||
#line 1 "libcurl.qcm"
|
||||
/*
|
||||
-----BEGIN QCMOD-----
|
||||
name: libcommoncpp2
|
||||
arg: with-libcommoncpp2-inc=[path], Path to libcommoncpp2 include files
|
||||
arg: with-libcommoncpp2-lib=[path], Path to libcommoncpp2 library files
|
||||
arg: with-libcurl-inc=[path], Path to libcurl include files
|
||||
arg: with-libcurl-lib=[path], Path to libcurl library files
|
||||
-----END QCMOD-----
|
||||
*/
|
||||
class qc_libcommoncpp2 : public ConfObj
|
||||
class qc_libcurl : public ConfObj
|
||||
{
|
||||
public:
|
||||
qc_libcommoncpp2(Conf *c) : ConfObj(c) {}
|
||||
QString name() const { return "GNU Common C++ library (libcommoncpp2)"; }
|
||||
QString shortname() const { return "libcommoncpp2"; }
|
||||
qc_libcurl(Conf *c) : ConfObj(c) {}
|
||||
QString name() const { return "libcurl"; }
|
||||
QString shortname() const { return "libcurl"; }
|
||||
bool exec(){
|
||||
QString s;
|
||||
s = conf->getenv("QC_WITH_LIBCOMMONCPP2_INC");
|
||||
s = conf->getenv("QC_WITH_LIBCURL_INC");
|
||||
if(!s.isEmpty()) {
|
||||
if(!conf->checkHeader(s, "cc++/url.h")) {
|
||||
if(!conf->checkHeader(s, "curl/curl.h")) {
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
@@ -512,7 +512,7 @@ public:
|
||||
sl << "/usr/local/include";
|
||||
bool found = false;
|
||||
foreach(s, sl){
|
||||
if(conf->checkHeader(s, "cc++/url.h")){
|
||||
if(conf->checkHeader(s, "curl/curl.h")){
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
@@ -523,12 +523,10 @@ public:
|
||||
}
|
||||
conf->addIncludePath(s);
|
||||
|
||||
s = conf->getenv("QC_WITH_LIBCOMMONCPP2_LIB");
|
||||
s = conf->getenv("QC_WITH_LIBCURL_LIB");
|
||||
if(!s.isEmpty()) {
|
||||
if(!QFile::exists(s+QString("/libccext2.so")))
|
||||
return false;
|
||||
if(!QFile::exists(s+QString("/libccgnu2.so")))
|
||||
return false;
|
||||
if(!QFile::exists(s+QString("/libcurl.so")))
|
||||
return false;
|
||||
conf->addLib(QString("-L") + s);
|
||||
}else{
|
||||
QStringList sl;
|
||||
@@ -538,11 +536,9 @@ public:
|
||||
sl << "/usr/local/lib64/";
|
||||
bool found = false;
|
||||
foreach(s, sl){
|
||||
if(QFile::exists(s+QString("libccext2.so"))){
|
||||
if(QFile::exists(s+QString("libccgnu2.so"))){
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
if(QFile::exists(s+QString("libcurl.so"))){
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found) return false;
|
||||
@@ -715,7 +711,7 @@ cat >$1/modules_new.cpp <<EOT
|
||||
o = new qc_libboost(conf);
|
||||
o->required = true;
|
||||
o->disabled = false;
|
||||
o = new qc_libcommoncpp2(conf);
|
||||
o = new qc_libcurl(conf);
|
||||
o->required = true;
|
||||
o->disabled = false;
|
||||
o = new qc_libmagick(conf);
|
||||
@@ -1673,8 +1669,8 @@ export QC_WITH_LIBTORRENT_INC
|
||||
export QC_WITH_LIBTORRENT_LIB
|
||||
export QC_WITH_LIBTORRENT_STATIC_LIB
|
||||
export QC_WITH_LIBBOOST_INC
|
||||
export QC_WITH_LIBCOMMONCPP2_INC
|
||||
export QC_WITH_LIBCOMMONCPP2_LIB
|
||||
export QC_WITH_LIBCURL_INC
|
||||
export QC_WITH_LIBCURL_LIB
|
||||
export QC_DISABLE_libmagick
|
||||
export QC_WITH_LIBMAGICK_INC
|
||||
export QC_WITH_LIBMAGICK_LIB
|
||||
|
@@ -12,7 +12,7 @@
|
||||
<dep type='libboost'>
|
||||
<required/>
|
||||
</dep>
|
||||
<dep type='libcommoncpp2'>
|
||||
<dep type='libcurl'>
|
||||
<required/>
|
||||
</dep>
|
||||
<dep type='libmagick'/>
|
||||
|
61
qcm/libcurl.qcm
Normal file
61
qcm/libcurl.qcm
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
-----BEGIN QCMOD-----
|
||||
name: libcommoncpp2
|
||||
arg: with-libcurl-inc=[path], Path to libcurl include files
|
||||
arg: with-libcurl-lib=[path], Path to libcurl library files
|
||||
-----END QCMOD-----
|
||||
*/
|
||||
class qc_libcurl : public ConfObj
|
||||
{
|
||||
public:
|
||||
qc_libcurl(Conf *c) : ConfObj(c) {}
|
||||
QString name() const { return "libcurl"; }
|
||||
QString shortname() const { return "libcurl"; }
|
||||
bool exec(){
|
||||
QString s;
|
||||
s = conf->getenv("QC_WITH_LIBCURL_INC");
|
||||
if(!s.isEmpty()) {
|
||||
if(!conf->checkHeader(s, "curl/curl.h")) {
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
QStringList sl;
|
||||
sl << "/usr/include";
|
||||
sl << "/usr/local/include";
|
||||
bool found = false;
|
||||
foreach(s, sl){
|
||||
if(conf->checkHeader(s, "curl/curl.h")){
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
conf->addIncludePath(s);
|
||||
|
||||
s = conf->getenv("QC_WITH_LIBCURL_LIB");
|
||||
if(!s.isEmpty()) {
|
||||
if(!QFile::exists(s+QString("/libcurl.so")))
|
||||
return false;
|
||||
conf->addLib(QString("-L") + s);
|
||||
}else{
|
||||
QStringList sl;
|
||||
sl << "/usr/lib/";
|
||||
sl << "/usr/lib64/";
|
||||
sl << "/usr/local/lib/";
|
||||
sl << "/usr/local/lib64/";
|
||||
bool found = false;
|
||||
foreach(s, sl){
|
||||
if(QFile::exists(s+QString("libcurl.so"))){
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found) return false;
|
||||
conf->addLib(QString("-L") + s);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
13
src/GUI.cpp
13
src/GUI.cpp
@@ -392,7 +392,7 @@ void GUI::on_actionExit_triggered() {
|
||||
}
|
||||
|
||||
void GUI::previewFile(QString filePath) {
|
||||
QDesktopServices::openUrl(filePath);
|
||||
QDesktopServices::openUrl(QString("file://")+filePath);
|
||||
}
|
||||
|
||||
unsigned int GUI::getCurrentTabIndex() const{
|
||||
@@ -467,6 +467,7 @@ void GUI::closeEvent(QCloseEvent *e) {
|
||||
tr("&Yes"), tr("&No"),
|
||||
QString(), 0, 1)) {
|
||||
e->ignore();
|
||||
force_exit = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -855,10 +856,20 @@ void GUI::configureSession(bool deleteOptions) {
|
||||
}
|
||||
if(!proxy_str.isEmpty()) {
|
||||
// We need this for urllib in search engine plugins
|
||||
#ifdef Q_WS_WIN
|
||||
char proxystr[512];
|
||||
snprintf(proxystr, 512, "http_proxy=%s", proxy_str.toUtf8().data());
|
||||
putenv(proxystr);
|
||||
#else
|
||||
setenv("http_proxy", proxy_str.toUtf8().data(), 1);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
#ifdef Q_WS_WIN
|
||||
putenv("http_proxy=");
|
||||
#else
|
||||
unsetenv("http_proxy");
|
||||
#endif
|
||||
}
|
||||
BTSession->setProxySettings(proxySettings, options->useProxyForTrackers(), options->useProxyForPeers(), options->useProxyForWebseeds(), options->useProxyForDHT());
|
||||
// * Session settings
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -25,6 +25,7 @@
|
||||
#include <QList>
|
||||
#include <QPair>
|
||||
#include <QStringList>
|
||||
#include <QDateTime>
|
||||
|
||||
#include <libtorrent/session.hpp>
|
||||
#include <libtorrent/ip_filter.hpp>
|
||||
@@ -45,14 +46,14 @@ class bittorrent : public QObject{
|
||||
QTimer *timerScan;
|
||||
QTimer *timerAlerts;
|
||||
QTimer *fastResumeSaver;
|
||||
QTimer *BigRatioTimer;
|
||||
bool DHTEnabled;
|
||||
downloadThread *downloader;
|
||||
QString defaultSavePath;
|
||||
QStringList torrentsToPauseAfterChecking;
|
||||
QHash<QString, QList<qlonglong> > ETAstats;
|
||||
QHash<QString, qlonglong> ETAs;
|
||||
QHash<QString, QDateTime> TorrentsStartTime;
|
||||
QHash<QString, size_type> TorrentsStartData;
|
||||
QHash<QString, QPair<size_type,size_type> > ratioData;
|
||||
QTimer *ETARefresher;
|
||||
QHash<QString, QList<QPair<QString, QString> > > trackersErrors;
|
||||
deleteThread *deleter;
|
||||
QStringList finishedTorrents;
|
||||
@@ -62,6 +63,9 @@ class bittorrent : public QObject{
|
||||
int maxConnecsPerTorrent;
|
||||
int maxUploadsPerTorrent;
|
||||
float max_ratio;
|
||||
bool UPnPEnabled;
|
||||
bool NATPMPEnabled;
|
||||
bool LSDEnabled;
|
||||
|
||||
protected:
|
||||
QString getSavePath(QString hash);
|
||||
@@ -79,7 +83,7 @@ class bittorrent : public QObject{
|
||||
session_status getSessionStatus() const;
|
||||
int getListenPort() const;
|
||||
QStringList getTorrentsToPauseAfterChecking() const;
|
||||
long getETA(QString hash) const;
|
||||
qlonglong getETA(QString hash) const;
|
||||
float getRealRatio(QString hash) const;
|
||||
session* getSession() const;
|
||||
QList<QPair<QString, QString> > getTrackersErrors(QString hash) const;
|
||||
@@ -99,14 +103,12 @@ class bittorrent : public QObject{
|
||||
void preAllocateAllFiles(bool b);
|
||||
void saveFastResumeAndRatioData();
|
||||
void saveFastResumeAndRatioData(QString hash);
|
||||
void saveFastResumeAndRatioDataUnfinished();
|
||||
void enableDirectoryScanning(QString scan_dir);
|
||||
void disableDirectoryScanning();
|
||||
void enablePeerExchange();
|
||||
void enableIPFilter(ip_filter filter);
|
||||
void disableIPFilter();
|
||||
void resumeUnfinishedTorrents();
|
||||
void updateETAs();
|
||||
void saveTorrentSpeedLimits(QString hash);
|
||||
void loadTorrentSpeedLimits(QString hash);
|
||||
void saveDownloadUploadForTorrent(QString hash);
|
||||
|
@@ -21,56 +21,48 @@
|
||||
|
||||
#include "downloadThread.h"
|
||||
#include <iostream>
|
||||
#include <cc++/common.h>
|
||||
#include <QSettings>
|
||||
#include <stdio.h>
|
||||
|
||||
QString subDownloadThread::errorCodeToString(int status) {
|
||||
// http://curl.rtin.bz/libcurl/c/libcurl-errors.html
|
||||
QString subDownloadThread::errorCodeToString(CURLcode status) {
|
||||
switch(status){
|
||||
case 1://ost::URLStream::errUnreachable:
|
||||
case CURLE_FTP_CANT_GET_HOST:
|
||||
case CURLE_COULDNT_RESOLVE_HOST:
|
||||
return tr("Host is unreachable");
|
||||
case 2://ost::URLStream::errMissing:
|
||||
case CURLE_READ_ERROR:
|
||||
case CURLE_FILE_COULDNT_READ_FILE:
|
||||
return tr("File was not found (404)");
|
||||
case 3://ost::URLStream::errDenied:
|
||||
case CURLE_FTP_ACCESS_DENIED:
|
||||
case CURLE_LOGIN_DENIED:
|
||||
case CURLE_FTP_USER_PASSWORD_INCORRECT:
|
||||
return tr("Connection was denied");
|
||||
case 4://ost::URLStream::errInvalid:
|
||||
case CURLE_URL_MALFORMAT:
|
||||
return tr("Url is invalid");
|
||||
case 5://ost::URLStream::errForbidden:
|
||||
return tr("Connection forbidden (403)");
|
||||
case 6://ost::URLStream::errUnauthorized:
|
||||
return tr("Connection was not authorized (401)");
|
||||
case 7://ost::URLStream::errRelocated:
|
||||
return tr("Content has moved (301)");
|
||||
case 8://ost::URLStream::errFailure:
|
||||
case CURLE_COULDNT_RESOLVE_PROXY:
|
||||
return tr("Could not resolve proxy");
|
||||
//case 5:
|
||||
// return tr("Connection forbidden (403)");
|
||||
//case 6:
|
||||
// return tr("Connection was not authorized (401)");
|
||||
//case 7:
|
||||
// return tr("Content has moved (301)");
|
||||
case CURLE_COULDNT_CONNECT:
|
||||
return tr("Connection failure");
|
||||
case 9://ost::URLStream::errTimeout:
|
||||
case CURLE_OPERATION_TIMEOUTED:
|
||||
return tr("Connection was timed out");
|
||||
case 10://ost::URLStream::errInterface:
|
||||
case CURLE_INTERFACE_FAILED:
|
||||
return tr("Incorrect network interface");
|
||||
default:
|
||||
return tr("Unknown error");
|
||||
}
|
||||
}
|
||||
|
||||
subDownloadThread::subDownloadThread(QObject *parent, QString url) : QThread(parent), url(url), abort(false){
|
||||
url_stream = new ost::URLStream();
|
||||
// Proxy support
|
||||
QSettings settings("qBittorrent", "qBittorrent");
|
||||
int intValue = settings.value(QString::fromUtf8("Preferences/Connection/ProxyType"), 0).toInt();
|
||||
if(intValue > 0) {
|
||||
// Proxy enabled
|
||||
url_stream->setProxy(settings.value(QString::fromUtf8("Preferences/Connection/Proxy/IP"), "0.0.0.0").toString().toUtf8().data(), settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Port"), 8080).toInt());
|
||||
if(settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Authentication"), false).toBool()) {
|
||||
// Authentication required
|
||||
url_stream->setProxyUser(settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Username"), QString()).toString().toUtf8().data());
|
||||
url_stream->setProxyPassword(settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Password"), QString()).toString().toUtf8().data());
|
||||
}
|
||||
}
|
||||
}
|
||||
subDownloadThread::subDownloadThread(QObject *parent, QString url) : QThread(parent), url(url), abort(false){}
|
||||
|
||||
subDownloadThread::~subDownloadThread(){
|
||||
abort = true;
|
||||
wait();
|
||||
delete url_stream;
|
||||
}
|
||||
|
||||
void subDownloadThread::run(){
|
||||
@@ -81,38 +73,58 @@ void subDownloadThread::run(){
|
||||
filePath = tmpfile->fileName();
|
||||
}
|
||||
delete tmpfile;
|
||||
QFile dest_file(filePath);
|
||||
if(!dest_file.open(QIODevice::WriteOnly | QIODevice::Text)){
|
||||
std::cerr << "Error: could't create temporary file: " << (const char*)filePath.toUtf8() << '\n';
|
||||
FILE *f = fopen(filePath.toUtf8().data(), "w");
|
||||
if(!f) {
|
||||
std::cerr << "couldn't open destination file" << "\n";
|
||||
return;
|
||||
}
|
||||
ost::URLStream::Error status = url_stream->get((const char*)url.toUtf8());
|
||||
if(status){
|
||||
// Failure
|
||||
QString error_msg = errorCodeToString((int)status);
|
||||
qDebug("Download failed for %s, reason: %s", (const char*)url.toUtf8(), (const char*)error_msg.toUtf8());
|
||||
url_stream->close();
|
||||
emit downloadFailureST(this, url, error_msg);
|
||||
return;
|
||||
}
|
||||
qDebug("Downloading %s...", (const char*)url.toUtf8());
|
||||
char cbuf[1024];
|
||||
int len;
|
||||
while(!url_stream->eof()) {
|
||||
url_stream->read(cbuf, sizeof(cbuf));
|
||||
len = url_stream->gcount();
|
||||
if(len > 0)
|
||||
dest_file.write(cbuf, len);
|
||||
if(abort){
|
||||
dest_file.close();
|
||||
url_stream->close();
|
||||
return;
|
||||
CURL *curl;
|
||||
CURLcode res;
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
std::string c_url = url.toUtf8().data();
|
||||
curl_easy_setopt(curl, CURLOPT_URL, c_url.c_str());
|
||||
// SSL support
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
// PROXY SUPPORT
|
||||
QSettings settings("qBittorrent", "qBittorrent");
|
||||
int intValue = settings.value(QString::fromUtf8("Preferences/Connection/ProxyType"), 0).toInt();
|
||||
if(intValue > 0) {
|
||||
// Proxy enabled
|
||||
QString IP = settings.value(QString::fromUtf8("Preferences/Connection/Proxy/IP"), "0.0.0.0").toString();
|
||||
QString port = settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Port"), 8080).toString();
|
||||
qDebug("Using proxy: %s", (IP+QString(":")+port).toUtf8().data());
|
||||
curl_easy_setopt(curl, CURLOPT_PROXYPORT, (IP+QString(":")+port).toUtf8().data());
|
||||
// Default proxy type is HTTP, we must change if it is SOCKS5
|
||||
if(intValue%2==0) {
|
||||
qDebug("Proxy is SOCKS5, not HTTP");
|
||||
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
|
||||
}
|
||||
// Authentication?
|
||||
if(intValue > 2) {
|
||||
qDebug("Proxy requires authentication, authenticating");
|
||||
QString username = settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Username"), QString()).toString();
|
||||
QString password = settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Password"), QString()).toString();
|
||||
curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, (username+QString(":")+password).toUtf8().data());
|
||||
}
|
||||
}
|
||||
// We have to define CURLOPT_WRITEFUNCTION or it will crash on windows
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, f);
|
||||
qDebug("Downloading %s", url.toUtf8().data());
|
||||
res = curl_easy_perform(curl);
|
||||
/* always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
fclose(f);
|
||||
if(res) {
|
||||
emit downloadFailureST(this, url, errorCodeToString(res));
|
||||
} else {
|
||||
emit downloadFinishedST(this, url, filePath);
|
||||
}
|
||||
} else {
|
||||
std::cerr << "Could not initialize CURL" << "\n";
|
||||
}
|
||||
dest_file.close();
|
||||
url_stream->close();
|
||||
emit downloadFinishedST(this, url, filePath);
|
||||
qDebug("download completed here: %s", (const char*)filePath.toUtf8());
|
||||
}
|
||||
|
||||
/** Download Thread **/
|
||||
|
@@ -29,29 +29,18 @@
|
||||
#include <QMutexLocker>
|
||||
#include <QWaitCondition>
|
||||
#include <QStringList>
|
||||
|
||||
namespace ost {
|
||||
class URLStream;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
QString IP;
|
||||
int port;
|
||||
QString username;
|
||||
QString password;
|
||||
} tmp_proxy;
|
||||
#include <curl/curl.h>
|
||||
|
||||
class subDownloadThread : public QThread {
|
||||
Q_OBJECT
|
||||
private:
|
||||
QString url;
|
||||
ost::URLStream *url_stream;
|
||||
bool abort;
|
||||
|
||||
public:
|
||||
subDownloadThread(QObject *parent, QString url);
|
||||
~subDownloadThread();
|
||||
QString errorCodeToString(int status);
|
||||
QString errorCodeToString(CURLcode status);
|
||||
|
||||
signals:
|
||||
// For subthreads
|
||||
@@ -90,7 +79,6 @@ class downloadThread : public QThread {
|
||||
|
||||
protected slots:
|
||||
void propagateDownloadedFile(subDownloadThread* st, QString url, QString path);
|
||||
|
||||
void propagateDownloadFailure(subDownloadThread* st, QString url, QString reason);
|
||||
};
|
||||
|
||||
|
@@ -190,7 +190,6 @@ void DownloadingTorrents::setInfoBar(QString info, QColor color) {
|
||||
infoBar->clear();
|
||||
nbLines = 1;
|
||||
}
|
||||
qDebug("Color is %s", color.name().toUtf8().data());
|
||||
infoBar->append(QString::fromUtf8("<font color='grey'>")+ QTime::currentTime().toString(QString::fromUtf8("hh:mm:ss")) + QString::fromUtf8("</font> - <font color='") + color.name() +QString::fromUtf8("'><i>") + info + QString::fromUtf8("</i></font>"));
|
||||
}
|
||||
|
||||
@@ -415,7 +414,7 @@ void DownloadingTorrents::updateDlList() {
|
||||
}else{
|
||||
DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/stalled.png"))), Qt::DecorationRole);
|
||||
DLListModel->setData(DLListModel->index(row, ETA), QVariant((qlonglong)-1));
|
||||
setRowColor(row, QPalette::WindowText);
|
||||
setRowColor(row, QApplication::palette().color(QPalette::WindowText));
|
||||
}
|
||||
DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)h.progress()));
|
||||
DLListModel->setData(DLListModel->index(row, DLSPEED), QVariant((double)h.download_payload_rate()));
|
||||
|
@@ -82,7 +82,7 @@ class DownloadingTorrents : public QWidget, public Ui::downloading{
|
||||
|
||||
public slots:
|
||||
void updateDlList();
|
||||
void setInfoBar(QString info, QColor color=QPalette::WindowText);
|
||||
void setInfoBar(QString info, QColor color=QApplication::palette().color(QPalette::WindowText));
|
||||
void pauseTorrent(QString hash);
|
||||
void resumeTorrent(QString hash);
|
||||
void updateRatio();
|
||||
|
@@ -298,7 +298,7 @@ class misc : public QObject{
|
||||
|
||||
// Take a number of seconds and return an user-friendly
|
||||
// time duration like "1d 2h 10m".
|
||||
static QString userFriendlyDuration(const long int seconds) {
|
||||
static QString userFriendlyDuration(qlonglong seconds) {
|
||||
if(seconds < 0) {
|
||||
return tr("Unknown");
|
||||
}
|
||||
|
134
src/options.ui
134
src/options.ui
@@ -794,10 +794,10 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>0.0.0.0</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maxLength" >
|
||||
<number>15</number>
|
||||
<number>75</number>
|
||||
</property>
|
||||
<property name="echoMode" >
|
||||
<enum>QLineEdit::Normal</enum>
|
||||
@@ -947,70 +947,72 @@
|
||||
<property name="title" >
|
||||
<string>Affected connections</string>
|
||||
</property>
|
||||
<widget class="QCheckBox" name="checkProxyTrackers" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>341</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Use proxy for connections to trackers</string>
|
||||
</property>
|
||||
<property name="checked" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkProxyPeers" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>40</y>
|
||||
<width>341</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Use proxy for connections to regular peers</string>
|
||||
</property>
|
||||
<property name="checked" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkProxyWebseeds" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>60</y>
|
||||
<width>341</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Use proxy for connections to web seeds</string>
|
||||
</property>
|
||||
<property name="checked" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkProxyDHT" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>80</y>
|
||||
<width>341</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Use proxy for DHT messages</string>
|
||||
</property>
|
||||
<property name="checked" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkProxyTrackers" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Use proxy for connections to trackers</string>
|
||||
</property>
|
||||
<property name="checked" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkProxyPeers" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Use proxy for connections to regular peers</string>
|
||||
</property>
|
||||
<property name="checked" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkProxyDHT" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Use proxy for DHT messages</string>
|
||||
</property>
|
||||
<property name="checked" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkProxyWebseeds" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Use proxy for connections to web seeds</string>
|
||||
</property>
|
||||
<property name="checked" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@@ -871,6 +871,7 @@ void options_imp::enableProxy(int index){
|
||||
textProxyIP->setEnabled(false);
|
||||
lblProxyPort->setEnabled(false);
|
||||
spinProxyPort->setEnabled(false);
|
||||
checkProxyAuth->setChecked(false);
|
||||
checkProxyAuth->setEnabled(false);
|
||||
ProxyConnecsBox->setEnabled(false);
|
||||
}
|
||||
|
@@ -42,7 +42,7 @@ class QGnomeLookStyle : public QCleanlooksStyle {
|
||||
vertical = (pb2->orientation == Qt::Vertical);
|
||||
}
|
||||
if (!vertical) {
|
||||
QPalette::ColorRole textRole = QPalette::Dark;/*
|
||||
QPalette::ColorRole textRole = QPalette::WindowText;/*
|
||||
if ((pb->textAlignment & Qt::AlignCenter) && pb->textVisible
|
||||
&& ((qint64(pb->progress) - qint64(pb->minimum)) * 2 >= (qint64(pb->maximum) - qint64(pb->minimum)))) {
|
||||
textRole = QPalette::HighlightedText;
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include <QTemporaryFile>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <iostream>
|
||||
#include <QTimer>
|
||||
|
||||
#include "SearchListDelegate.h"
|
||||
#include "searchEngine.h"
|
||||
@@ -79,6 +80,9 @@ SearchEngine::SearchEngine(bittorrent *BTSession, QSystemTrayIcon *myTrayIcon, b
|
||||
connect(searchProcess, SIGNAL(started()), this, SLOT(searchStarted()));
|
||||
connect(searchProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readSearchOutput()));
|
||||
connect(searchProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(searchFinished(int,QProcess::ExitStatus)));
|
||||
searchTimeout = new QTimer(this);
|
||||
searchTimeout->setSingleShot(true);
|
||||
connect(searchTimeout, SIGNAL(timeout()), this, SLOT(on_stop_search_button_clicked()));
|
||||
// Check last enabled search engines
|
||||
loadEngineSettings();
|
||||
// Update nova.py search plugin if necessary
|
||||
@@ -92,6 +96,7 @@ SearchEngine::~SearchEngine(){
|
||||
saveColWidthSearchList();
|
||||
searchProcess->kill();
|
||||
searchProcess->waitForFinished();
|
||||
delete searchTimeout;
|
||||
delete searchProcess;
|
||||
delete searchCompleter;
|
||||
delete SearchListModel;
|
||||
@@ -245,6 +250,9 @@ void SearchEngine::on_search_button_clicked(){
|
||||
searchProcess->kill();
|
||||
searchProcess->waitForFinished();
|
||||
}
|
||||
if(searchTimeout->isActive()) {
|
||||
searchTimeout->stop();
|
||||
}
|
||||
QString pattern = search_pattern->text().trimmed();
|
||||
// No search pattern entered
|
||||
if(pattern.isEmpty()){
|
||||
@@ -279,6 +287,7 @@ void SearchEngine::on_search_button_clicked(){
|
||||
results_lbl->setText(tr("Results")+" <i>(0)</i>:");
|
||||
// Launch search
|
||||
searchProcess->start(misc::qBittorrentPath()+"search_engine"+QDir::separator()+"nova2.py", params, QIODevice::ReadOnly);
|
||||
searchTimeout->start(180000); // 3min
|
||||
}
|
||||
|
||||
void SearchEngine::searchStarted(){
|
||||
@@ -448,6 +457,7 @@ void SearchEngine::on_stop_search_button_clicked(){
|
||||
// Kill process
|
||||
searchProcess->terminate();
|
||||
search_stopped = true;
|
||||
searchTimeout->stop();
|
||||
}
|
||||
|
||||
// Clear search results list
|
||||
@@ -455,12 +465,13 @@ void SearchEngine::on_clear_button_clicked(){
|
||||
// Kill process
|
||||
searchProcess->terminate();
|
||||
search_stopped = true;
|
||||
|
||||
searchTimeout->stop();
|
||||
searchResultsUrls.clear();
|
||||
SearchListModel->removeRows(0, SearchListModel->rowCount());
|
||||
// Disable clear & download buttons
|
||||
clear_button->setEnabled(false);
|
||||
download_button->setEnabled(false);
|
||||
nb_search_results = 0;
|
||||
results_lbl->setText(tr("Results")+" <i>(0)</i>:");
|
||||
// focus on search pattern
|
||||
search_pattern->clear();
|
||||
|
@@ -33,6 +33,7 @@ class SearchListDelegate;
|
||||
class bittorrent;
|
||||
class QSystemTrayIcon;
|
||||
class downloadThread;
|
||||
class QTimer;
|
||||
|
||||
class SearchEngine : public QWidget, public Ui::search_engine{
|
||||
Q_OBJECT
|
||||
@@ -54,6 +55,7 @@ class SearchEngine : public QWidget, public Ui::search_engine{
|
||||
bool systrayIntegration;
|
||||
downloadThread *downloader;
|
||||
QStringList enabled_engines;
|
||||
QTimer *searchTimeout;
|
||||
|
||||
public:
|
||||
SearchEngine(bittorrent *BTSession, QSystemTrayIcon *myTrayIcon, bool systrayIntegration);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#VERSION: 1.10
|
||||
#VERSION: 1.11
|
||||
#AUTHORS: Fabien Devaux (fab@gnux.info)
|
||||
from novaprinter import prettyPrinter
|
||||
import urllib
|
||||
@@ -10,7 +10,7 @@ class btjunkie(object):
|
||||
|
||||
def search(self, what):
|
||||
i = 1
|
||||
while True:
|
||||
while True and i<11:
|
||||
res = 0
|
||||
dat = urllib.urlopen(self.url+'/search?q=%s&o=52&p=%d'%(what,i)).read().decode('utf8', 'replace')
|
||||
# I know it's not very readable, but the SGML parser feels in pain
|
||||
@@ -32,4 +32,4 @@ class btjunkie(object):
|
||||
res = res + 1
|
||||
if res == 0:
|
||||
break
|
||||
i = i + 1
|
||||
i = i + 1
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#VERSION: 1.00
|
||||
#VERSION: 1.01
|
||||
#AUTHORS: Gekko Dam Beer (gekko04@users.sourceforge.net)
|
||||
from novaprinter import prettyPrinter
|
||||
import sgmllib
|
||||
@@ -67,7 +67,7 @@ class isohunt(object):
|
||||
|
||||
def search(self, what):
|
||||
i = 1
|
||||
while True:
|
||||
while True and i<11:
|
||||
results = []
|
||||
parser = self.SimpleSGMLParser(results, self.url)
|
||||
dat = urllib.urlopen(self.url+'/torrents.php?ihq=%s&ihp=%s'%(what,i)).read().decode('utf-8', 'replace')
|
||||
@@ -75,4 +75,4 @@ class isohunt(object):
|
||||
parser.close()
|
||||
if len(results) <= 0:
|
||||
break
|
||||
i += 1
|
||||
i += 1
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#VERSION: 1.11
|
||||
#VERSION: 1.12
|
||||
#AUTHORS: Fabien Devaux (fab@gnux.info)
|
||||
from novaprinter import prettyPrinter
|
||||
import urllib
|
||||
@@ -29,7 +29,7 @@ class mininova(object):
|
||||
else:
|
||||
return ''.join([ get_text(n) for n in txt.childNodes])
|
||||
page = 1
|
||||
while True:
|
||||
while True and page<11:
|
||||
res = 0
|
||||
dat = urllib.urlopen(self.url+'/search/%s/seeds/%d'%(what, page)).read().decode('utf-8', 'replace')
|
||||
dat = re.sub("<a href=\"http://www.boardreader.com/index.php.*\"", "<a href=\"plop\"", dat)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#VERSION: 1.00
|
||||
#VERSION: 1.01
|
||||
#AUTHORS: Fabien Devaux (fab@gnux.info)
|
||||
from novaprinter import prettyPrinter
|
||||
import sgmllib
|
||||
@@ -68,7 +68,7 @@ class piratebay(object):
|
||||
ret = []
|
||||
i = 0
|
||||
order = 'se'
|
||||
while True:
|
||||
while True and i<11:
|
||||
results = []
|
||||
parser = self.SimpleSGMLParser(results, self.url)
|
||||
dat = urllib.urlopen(self.url+'/search/%s/%u/0/0' % (what, i)).read()
|
||||
@@ -76,4 +76,4 @@ class piratebay(object):
|
||||
parser.close()
|
||||
if len(results) <= 0:
|
||||
break
|
||||
i += 1
|
||||
i += 1
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#VERSION: 1.00
|
||||
#VERSION: 1.01
|
||||
#AUTHORS: Gekko Dam Beer (gekko04@users.sourceforge.net)
|
||||
from novaprinter import prettyPrinter
|
||||
import sgmllib
|
||||
@@ -67,7 +67,7 @@ class torrentreactor(object):
|
||||
|
||||
def search(self, what):
|
||||
i = 0
|
||||
while True:
|
||||
while True and i<11:
|
||||
results = []
|
||||
parser = self.SimpleSGMLParser(results, self.url)
|
||||
dat = urllib.urlopen(self.url+'/search.php?search=&words=%s&cid=&sid=&type=2&orderby=a.seeds&asc=0&skip=%s'%(what,(i*35))).read().decode('utf-8', 'replace')
|
||||
@@ -75,4 +75,4 @@ class torrentreactor(object):
|
||||
parser.close()
|
||||
if len(results) <= 0:
|
||||
break
|
||||
i += 1
|
||||
i += 1
|
||||
|
@@ -1,5 +1,5 @@
|
||||
isohunt: 1.00
|
||||
torrentreactor: 1.00
|
||||
btjunkie: 1.10
|
||||
mininova: 1.11
|
||||
piratebay: 1.00
|
||||
isohunt: 1.01
|
||||
torrentreactor: 1.01
|
||||
btjunkie: 1.11
|
||||
mininova: 1.12
|
||||
piratebay: 1.01
|
||||
|
@@ -11,7 +11,7 @@ TARGET = qbittorrent
|
||||
CONFIG += qt thread x11 network
|
||||
|
||||
# Update this VERSION for each release
|
||||
DEFINES += VERSION=\\\"v1.0.0rc8\\\"
|
||||
DEFINES += VERSION=\\\"v1.0.0rc10\\\"
|
||||
DEFINES += VERSION_MAJOR=1
|
||||
DEFINES += VERSION_MINOR=0
|
||||
DEFINES += VERSION_BUGFIX=0
|
||||
@@ -81,7 +81,7 @@ QMAKE_CXXFLAGS_RELEASE += -fwrapv -O2
|
||||
QMAKE_CXXFLAGS_DEBUG += -fwrapv -O1
|
||||
|
||||
CONFIG += link_pkgconfig
|
||||
PKGCONFIG += libtorrent libccext2 libccgnu2
|
||||
PKGCONFIG += "libtorrent libcurl"
|
||||
|
||||
!contains(DEFINES, HAVE_MAGICK){
|
||||
message(ImageMagick disabled)
|
||||
|
Reference in New Issue
Block a user