You've already forked qBittorrent
mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-11-16 11:53:28 +01:00
Compare commits
63 Commits
release-1.
...
release-1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
603b14dd4c | ||
|
|
faa33b0d7e | ||
|
|
8fdf3d520c | ||
|
|
b238a4ed69 | ||
|
|
ba53bdc708 | ||
|
|
f2a65e07b5 | ||
|
|
62afd4f98b | ||
|
|
6c11fd5a0d | ||
|
|
cc39504a61 | ||
|
|
1baec5378f | ||
|
|
b60b4fafff | ||
|
|
3325dd0550 | ||
|
|
29dc0fede0 | ||
|
|
19f6b8491e | ||
|
|
01b1e78dcd | ||
|
|
bd546e3d18 | ||
|
|
6ca93dfbae | ||
|
|
f175ce5249 | ||
|
|
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 | ||
|
|
b1d8fb0f11 | ||
|
|
78fc5d4865 | ||
|
|
19996736d6 | ||
|
|
6f9d22af03 | ||
|
|
6b6d05a380 | ||
|
|
df92e3e5e9 | ||
|
|
26b6c26ea8 | ||
|
|
1b6183bfa3 | ||
|
|
7edbaa3847 | ||
|
|
2ee152a374 | ||
|
|
bc8ac43a54 | ||
|
|
5f48a51070 | ||
|
|
c3a6b24ed1 | ||
|
|
c3b22c9a01 | ||
|
|
5d09ace7eb | ||
|
|
fe37724338 | ||
|
|
8aaacbe38d | ||
|
|
edc625c9c9 | ||
|
|
6ae21c2919 |
@@ -41,11 +41,13 @@
|
|||||||
- FEATURE: Added an option to automatically delete torrents when they reach a given ratio (>= 1.0)
|
- FEATURE: Added an option to automatically delete torrents when they reach a given ratio (>= 1.0)
|
||||||
- FEATURE: Added an option to display current transfer speeds in title bar
|
- FEATURE: Added an option to display current transfer speeds in title bar
|
||||||
- FEATURE: Torrent content is now displayed as a tree
|
- 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 Hungarian translation
|
||||||
- I18N: Added Brazilian translation
|
- I18N: Added Brazilian translation
|
||||||
- BUGFIX: Progress of paused torrents is now correct on restart
|
- 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: 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: 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: Fixed a crash when filtering all the files in a torrent
|
||||||
- BUGFIX: Reload torrent only when necessary (properties)
|
- BUGFIX: Reload torrent only when necessary (properties)
|
||||||
@@ -64,6 +66,10 @@
|
|||||||
- BUGFIX: Prevent downloadFromUrl flooding
|
- BUGFIX: Prevent downloadFromUrl flooding
|
||||||
- BUGFIX: ETA was wrong for torrents with filtered files
|
- BUGFIX: ETA was wrong for torrents with filtered files
|
||||||
- BUGFIX: Fixed drag'n drop on non-KDE systems
|
- BUGFIX: Fixed drag'n drop on non-KDE systems
|
||||||
|
- BUGFIX: Removed build dependency on Python
|
||||||
|
- BUGFIX: Catching DHT exception in case there is a problem
|
||||||
|
- BUGFIX: Remember properties window size and position
|
||||||
|
- BUGFIX: Improved proxy support in search engine (HTTP only)
|
||||||
- COSMETIC: Redesigned torrent properties a little
|
- COSMETIC: Redesigned torrent properties a little
|
||||||
- COSMETIC: Totally redesigned program preferences
|
- COSMETIC: Totally redesigned program preferences
|
||||||
- COSMETIC: Display more logs messages concerning features
|
- COSMETIC: Display more logs messages concerning features
|
||||||
|
|||||||
2
INSTALL
2
INSTALL
@@ -25,7 +25,7 @@ Dependencies:
|
|||||||
|
|
||||||
- libboost: libboost-filesystem, libboost-date-time, libboost-thread, libboost-serialization
|
- libboost: libboost-filesystem, libboost-date-time, libboost-thread, libboost-serialization
|
||||||
|
|
||||||
- libcommoncpp2
|
- libcurl
|
||||||
|
|
||||||
- python >= 2.3 (needed by search engine)
|
- python >= 2.3 (needed by search engine)
|
||||||
|
|
||||||
|
|||||||
28
TODO
28
TODO
@@ -8,11 +8,9 @@
|
|||||||
- Skins support? (contact Mateusz)
|
- Skins support? (contact Mateusz)
|
||||||
|
|
||||||
// Harder
|
// Harder
|
||||||
- Display a progress bar that really represents the pieces we have (like in eMule)
|
|
||||||
- Torrent scheduler ala µtorrent/Bitcomet
|
- Torrent scheduler ala µtorrent/Bitcomet
|
||||||
|
|
||||||
// Waiting for libtorrent
|
// Waiting for libtorrent
|
||||||
- File selection in a torrent in compact mode
|
|
||||||
- Allow to prioritize torrents (may code this in qBittorrent?)
|
- Allow to prioritize torrents (may code this in qBittorrent?)
|
||||||
|
|
||||||
// Unsure
|
// Unsure
|
||||||
@@ -46,22 +44,20 @@
|
|||||||
- Display in torrent addition dialog:
|
- Display in torrent addition dialog:
|
||||||
* free disk space on selected drive
|
* free disk space on selected drive
|
||||||
* free disk space after torrent download (and/or torrent size)
|
* free disk space after torrent download (and/or torrent size)
|
||||||
|
- Start minimized option in program preferences
|
||||||
|
- In finished list, replace "Seeds/Leechs" column by "Leechers" because Seeds are always 0.
|
||||||
- Allow to change action on double-click
|
- Allow to change action on double-click
|
||||||
-> in download list
|
-> in download list
|
||||||
-> in seeding list
|
-> in seeding list
|
||||||
|
|
||||||
// in v1.0.0 - FEATURE FREEZE
|
TODO:
|
||||||
- Fix all (or almost all) opened bugs in bug tracker
|
- Check search engine cpu usage
|
||||||
- Recheck doc
|
|
||||||
- Translations update (IN PROGRESS)
|
|
||||||
- add qt4-qtconfig as package dependency
|
|
||||||
|
|
||||||
rc4->rc5 changelog:
|
rc10->rc11? changelog:
|
||||||
- BUGFIX: Now filtered don't appear on hard drive anymore (libtorrent >= r1659)
|
- BUGFIX: Bypass exit confirmation on system shutdown
|
||||||
- BUGFIX: AddInPause setting doesn't pause downloads on startup anymore
|
- BUGFIX: Download from urls are now able to follow redirections
|
||||||
- BUGFIX: Fixed an ETA calculation problem when the torrent has filtered files
|
- BUGFIX: Clean up for failed torrents downloaded from urls
|
||||||
- BUGFIX: Fixed possible overflow in ETA calculation
|
- BUGFIX: Fixed downloads from URLs on Windows
|
||||||
- BUGFIX: Fixed "Missing Input path" error when creating a torrent
|
- BUGFIX: Fixed search engine on Windows
|
||||||
- BUGFIX: Fixed some notification messages for torrent addition dialog
|
- BUGFIX: Fixed torrent creation from a directory
|
||||||
- BUGFIX: Fixed "Automatically start seeding" feature in torrent creation tool
|
- BUGFIX: Fixed save path when seeding automatically after torrent creation
|
||||||
- COSMETIC: Improved progress bar text rendering
|
|
||||||
|
|||||||
113
configure
vendored
113
configure
vendored
@@ -22,8 +22,8 @@ Dependency options:
|
|||||||
--with-libtorrent-lib=[path] Path to libtorrent library files
|
--with-libtorrent-lib=[path] Path to libtorrent library files
|
||||||
--with-libtorrent-static-lib=[path] Path to libtorrent .a file
|
--with-libtorrent-static-lib=[path] Path to libtorrent .a file
|
||||||
--with-libboost-inc=[path] Path to libboost include files
|
--with-libboost-inc=[path] Path to libboost include files
|
||||||
--with-libcommoncpp2-inc=[path] Path to libcommoncpp2 include files
|
--with-libcurl-inc=[path] Path to libcurl include files
|
||||||
--with-libcommoncpp2-lib=[path] Path to libcommoncpp2 library files
|
--with-libcurl-lib=[path] Path to libcurl library files
|
||||||
--disable-libmagick Disable use of libmagick
|
--disable-libmagick Disable use of libmagick
|
||||||
--with-libmagick-inc=[path] Path to libmagick++ include files
|
--with-libmagick-inc=[path] Path to libmagick++ include files
|
||||||
--with-libmagick-lib=[path] Path to libmagick++ library files
|
--with-libmagick-lib=[path] Path to libmagick++ library files
|
||||||
@@ -166,13 +166,13 @@ while [ $# -gt 0 ]; do
|
|||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
||||||
--with-libcommoncpp2-inc=*)
|
--with-libcurl-inc=*)
|
||||||
QC_WITH_LIBCOMMONCPP2_INC=$optarg
|
QC_WITH_LIBCURL_INC=$optarg
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
||||||
--with-libcommoncpp2-lib=*)
|
--with-libcurl-lib=*)
|
||||||
QC_WITH_LIBCOMMONCPP2_LIB=$optarg
|
QC_WITH_LIBCURL_LIB=$optarg
|
||||||
shift
|
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_LIB=$QC_WITH_LIBTORRENT_LIB
|
||||||
echo QC_WITH_LIBTORRENT_STATIC_LIB=$QC_WITH_LIBTORRENT_STATIC_LIB
|
echo QC_WITH_LIBTORRENT_STATIC_LIB=$QC_WITH_LIBTORRENT_STATIC_LIB
|
||||||
echo QC_WITH_LIBBOOST_INC=$QC_WITH_LIBBOOST_INC
|
echo QC_WITH_LIBBOOST_INC=$QC_WITH_LIBBOOST_INC
|
||||||
echo QC_WITH_LIBCOMMONCPP2_INC=$QC_WITH_LIBCOMMONCPP2_INC
|
echo QC_WITH_LIBCURL_INC=$QC_WITH_LIBCURL_INC
|
||||||
echo QC_WITH_LIBCOMMONCPP2_LIB=$QC_WITH_LIBCOMMONCPP2_LIB
|
echo QC_WITH_LIBCURL_LIB=$QC_WITH_LIBCURL_LIB
|
||||||
echo QC_DISABLE_libmagick=$QC_DISABLE_libmagick
|
echo QC_DISABLE_libmagick=$QC_DISABLE_libmagick
|
||||||
echo QC_WITH_LIBMAGICK_INC=$QC_WITH_LIBMAGICK_INC
|
echo QC_WITH_LIBMAGICK_INC=$QC_WITH_LIBMAGICK_INC
|
||||||
echo QC_WITH_LIBMAGICK_LIB=$QC_WITH_LIBMAGICK_LIB
|
echo QC_WITH_LIBMAGICK_LIB=$QC_WITH_LIBMAGICK_LIB
|
||||||
@@ -412,7 +412,9 @@ public:
|
|||||||
}else{
|
}else{
|
||||||
QStringList sl;
|
QStringList sl;
|
||||||
sl << "/usr/lib/";
|
sl << "/usr/lib/";
|
||||||
|
sl << "/usr/lib64/";
|
||||||
sl << "/usr/local/lib/";
|
sl << "/usr/local/lib/";
|
||||||
|
sl << "/usr/local/lib64/";
|
||||||
bool found = false;
|
bool found = false;
|
||||||
foreach(s, sl){
|
foreach(s, sl){
|
||||||
if(conf->checkLibrary(s, "torrent")){
|
if(conf->checkLibrary(s, "torrent")){
|
||||||
@@ -423,16 +425,6 @@ public:
|
|||||||
if(!found) return false;
|
if(!found) return false;
|
||||||
conf->addLib(QString("-L") + s);
|
conf->addLib(QString("-L") + s);
|
||||||
}
|
}
|
||||||
// BUGFIX for Fedora (doesn't support pkg-config?)
|
|
||||||
QFile issue_file("/etc/issue");
|
|
||||||
if(issue_file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
|
||||||
QString content = issue_file.readAll();
|
|
||||||
issue_file.close();
|
|
||||||
if(content.indexOf("Fedora") != -1){
|
|
||||||
qWarning("Fedora detected. WORKAROUND for Fedora pkg-config problem enabled");
|
|
||||||
conf->addLib("-lssl -lcrypto -lboost_date_time -lboost_filesystem -lboost_thread -lz -ltorrent");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -493,25 +485,25 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#line 1 "libcommoncpp2.qcm"
|
#line 1 "libcurl.qcm"
|
||||||
/*
|
/*
|
||||||
-----BEGIN QCMOD-----
|
-----BEGIN QCMOD-----
|
||||||
name: libcommoncpp2
|
name: libcommoncpp2
|
||||||
arg: with-libcommoncpp2-inc=[path], Path to libcommoncpp2 include files
|
arg: with-libcurl-inc=[path], Path to libcurl include files
|
||||||
arg: with-libcommoncpp2-lib=[path], Path to libcommoncpp2 library files
|
arg: with-libcurl-lib=[path], Path to libcurl library files
|
||||||
-----END QCMOD-----
|
-----END QCMOD-----
|
||||||
*/
|
*/
|
||||||
class qc_libcommoncpp2 : public ConfObj
|
class qc_libcurl : public ConfObj
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
qc_libcommoncpp2(Conf *c) : ConfObj(c) {}
|
qc_libcurl(Conf *c) : ConfObj(c) {}
|
||||||
QString name() const { return "GNU Common C++ library (libcommoncpp2)"; }
|
QString name() const { return "libcurl"; }
|
||||||
QString shortname() const { return "libcommoncpp2"; }
|
QString shortname() const { return "libcurl"; }
|
||||||
bool exec(){
|
bool exec(){
|
||||||
QString s;
|
QString s;
|
||||||
s = conf->getenv("QC_WITH_LIBCOMMONCPP2_INC");
|
s = conf->getenv("QC_WITH_LIBCURL_INC");
|
||||||
if(!s.isEmpty()) {
|
if(!s.isEmpty()) {
|
||||||
if(!conf->checkHeader(s, "cc++/url.h")) {
|
if(!conf->checkHeader(s, "curl/curl.h")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
@@ -520,7 +512,7 @@ public:
|
|||||||
sl << "/usr/local/include";
|
sl << "/usr/local/include";
|
||||||
bool found = false;
|
bool found = false;
|
||||||
foreach(s, sl){
|
foreach(s, sl){
|
||||||
if(conf->checkHeader(s, "cc++/url.h")){
|
if(conf->checkHeader(s, "curl/curl.h")){
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -531,39 +523,27 @@ public:
|
|||||||
}
|
}
|
||||||
conf->addIncludePath(s);
|
conf->addIncludePath(s);
|
||||||
|
|
||||||
s = conf->getenv("QC_WITH_LIBCOMMONCPP2_LIB");
|
s = conf->getenv("QC_WITH_LIBCURL_LIB");
|
||||||
if(!s.isEmpty()) {
|
if(!s.isEmpty()) {
|
||||||
if(!QFile::exists(s+QString("libccext2.so")))
|
if(!QFile::exists(s+QString("/libcurl.so")))
|
||||||
return false;
|
return false;
|
||||||
if(!QFile::exists(s+QString("libccgnu2.so")))
|
|
||||||
return false;
|
|
||||||
conf->addLib(QString("-L") + s);
|
conf->addLib(QString("-L") + s);
|
||||||
}else{
|
}else{
|
||||||
QStringList sl;
|
QStringList sl;
|
||||||
sl << "/usr/lib/";
|
sl << "/usr/lib/";
|
||||||
|
sl << "/usr/lib64/";
|
||||||
sl << "/usr/local/lib/";
|
sl << "/usr/local/lib/";
|
||||||
|
sl << "/usr/local/lib64/";
|
||||||
bool found = false;
|
bool found = false;
|
||||||
foreach(s, sl){
|
foreach(s, sl){
|
||||||
if(QFile::exists(s+QString("libccext2.so"))){
|
if(QFile::exists(s+QString("libcurl.so"))){
|
||||||
if(QFile::exists(s+QString("libccgnu2.so"))){
|
found = true;
|
||||||
found = true;
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!found) return false;
|
if(!found) return false;
|
||||||
conf->addLib(QString("-L") + s);
|
conf->addLib(QString("-L") + s);
|
||||||
}
|
}
|
||||||
// BUGFIX for Fedora (doesn't support pkg-config?)
|
|
||||||
QFile issue_file("/etc/issue");
|
|
||||||
if(issue_file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
|
||||||
QString content = issue_file.readAll();
|
|
||||||
issue_file.close();
|
|
||||||
if(content.indexOf("Fedora") != -1){
|
|
||||||
qWarning("Fedora detected. WORKAROUND for Fedora pkg-config problem enabled");
|
|
||||||
conf->addLib("-pthread -lccext2 -lz -lccgnu2 -ldl -lrt");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -614,13 +594,15 @@ public:
|
|||||||
|
|
||||||
s = conf->getenv("QC_WITH_LIBMAGICK_LIB");
|
s = conf->getenv("QC_WITH_LIBMAGICK_LIB");
|
||||||
if(!s.isEmpty()) {
|
if(!s.isEmpty()) {
|
||||||
if(!QFile::exists(s+QString("libMagick++.so"))){
|
if(!QFile::exists(s+QString("/libMagick++.so"))){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
QStringList sl;
|
QStringList sl;
|
||||||
sl << "/usr/lib/";
|
sl << "/usr/lib/";
|
||||||
|
sl << "/usr/lib64/";
|
||||||
sl << "/usr/local/lib/";
|
sl << "/usr/local/lib/";
|
||||||
|
sl << "/usr/local/lib64/";
|
||||||
bool found = false;
|
bool found = false;
|
||||||
foreach(s, sl){
|
foreach(s, sl){
|
||||||
if(QFile::exists(s+QString("libMagick++.so"))){
|
if(QFile::exists(s+QString("libMagick++.so"))){
|
||||||
@@ -692,13 +674,15 @@ public:
|
|||||||
|
|
||||||
s = conf->getenv("QC_WITH_LIBZZIP_LIB");
|
s = conf->getenv("QC_WITH_LIBZZIP_LIB");
|
||||||
if(!s.isEmpty()) {
|
if(!s.isEmpty()) {
|
||||||
if(!QFile::exists(s+QString("libzzip.so"))){
|
if(!QFile::exists(s+QString("/libzzip.so"))){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
QStringList sl;
|
QStringList sl;
|
||||||
sl << "/usr/lib/";
|
sl << "/usr/lib/";
|
||||||
|
sl << "/usr/lib64/";
|
||||||
sl << "/usr/local/lib/";
|
sl << "/usr/local/lib/";
|
||||||
|
sl << "/usr/local/lib64/";
|
||||||
bool found = false;
|
bool found = false;
|
||||||
foreach(s, sl){
|
foreach(s, sl){
|
||||||
if(QFile::exists(s+QString("libzzip.so"))){
|
if(QFile::exists(s+QString("libzzip.so"))){
|
||||||
@@ -715,26 +699,6 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#line 1 "python.qcm"
|
|
||||||
/*
|
|
||||||
-----BEGIN QCMOD-----
|
|
||||||
name: python
|
|
||||||
-----END QCMOD-----
|
|
||||||
*/
|
|
||||||
class qc_python : public ConfObj
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
qc_python(Conf *c) : ConfObj(c) {}
|
|
||||||
QString name() const { return "python >= 2.3"; }
|
|
||||||
QString shortname() const { return "python"; }
|
|
||||||
bool exec(){
|
|
||||||
int r = conf->doCommand("python testpython.py");
|
|
||||||
if(r == 0)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
EOT
|
EOT
|
||||||
cat >$1/modules_new.cpp <<EOT
|
cat >$1/modules_new.cpp <<EOT
|
||||||
@@ -747,7 +711,7 @@ cat >$1/modules_new.cpp <<EOT
|
|||||||
o = new qc_libboost(conf);
|
o = new qc_libboost(conf);
|
||||||
o->required = true;
|
o->required = true;
|
||||||
o->disabled = false;
|
o->disabled = false;
|
||||||
o = new qc_libcommoncpp2(conf);
|
o = new qc_libcurl(conf);
|
||||||
o->required = true;
|
o->required = true;
|
||||||
o->disabled = false;
|
o->disabled = false;
|
||||||
o = new qc_libmagick(conf);
|
o = new qc_libmagick(conf);
|
||||||
@@ -756,9 +720,6 @@ cat >$1/modules_new.cpp <<EOT
|
|||||||
o = new qc_libzzip(conf);
|
o = new qc_libzzip(conf);
|
||||||
o->required = false;
|
o->required = false;
|
||||||
o->disabled = false;
|
o->disabled = false;
|
||||||
o = new qc_python(conf);
|
|
||||||
o->required = true;
|
|
||||||
o->disabled = false;
|
|
||||||
|
|
||||||
EOT
|
EOT
|
||||||
cat >$1/conf4.h <<EOT
|
cat >$1/conf4.h <<EOT
|
||||||
@@ -1708,8 +1669,8 @@ export QC_WITH_LIBTORRENT_INC
|
|||||||
export QC_WITH_LIBTORRENT_LIB
|
export QC_WITH_LIBTORRENT_LIB
|
||||||
export QC_WITH_LIBTORRENT_STATIC_LIB
|
export QC_WITH_LIBTORRENT_STATIC_LIB
|
||||||
export QC_WITH_LIBBOOST_INC
|
export QC_WITH_LIBBOOST_INC
|
||||||
export QC_WITH_LIBCOMMONCPP2_INC
|
export QC_WITH_LIBCURL_INC
|
||||||
export QC_WITH_LIBCOMMONCPP2_LIB
|
export QC_WITH_LIBCURL_LIB
|
||||||
export QC_DISABLE_libmagick
|
export QC_DISABLE_libmagick
|
||||||
export QC_WITH_LIBMAGICK_INC
|
export QC_WITH_LIBMAGICK_INC
|
||||||
export QC_WITH_LIBMAGICK_LIB
|
export QC_WITH_LIBMAGICK_LIB
|
||||||
|
|||||||
@@ -12,12 +12,9 @@
|
|||||||
<dep type='libboost'>
|
<dep type='libboost'>
|
||||||
<required/>
|
<required/>
|
||||||
</dep>
|
</dep>
|
||||||
<dep type='libcommoncpp2'>
|
<dep type='libcurl'>
|
||||||
<required/>
|
<required/>
|
||||||
</dep>
|
</dep>
|
||||||
<dep type='libmagick'/>
|
<dep type='libmagick'/>
|
||||||
<dep type='libzzip'/>
|
<dep type='libzzip'/>
|
||||||
<dep type='python'>
|
|
||||||
<required/>
|
|
||||||
</dep>
|
|
||||||
</qconf>
|
</qconf>
|
||||||
|
|||||||
@@ -37,15 +37,17 @@ public:
|
|||||||
|
|
||||||
s = conf->getenv("QC_WITH_LIBCOMMONCPP2_LIB");
|
s = conf->getenv("QC_WITH_LIBCOMMONCPP2_LIB");
|
||||||
if(!s.isEmpty()) {
|
if(!s.isEmpty()) {
|
||||||
if(!QFile::exists(s+QString("libccext2.so")))
|
if(!QFile::exists(s+QString("/libccext2.so")))
|
||||||
return false;
|
return false;
|
||||||
if(!QFile::exists(s+QString("libccgnu2.so")))
|
if(!QFile::exists(s+QString("/libccgnu2.so")))
|
||||||
return false;
|
return false;
|
||||||
conf->addLib(QString("-L") + s);
|
conf->addLib(QString("-L") + s);
|
||||||
}else{
|
}else{
|
||||||
QStringList sl;
|
QStringList sl;
|
||||||
sl << "/usr/lib/";
|
sl << "/usr/lib/";
|
||||||
|
sl << "/usr/lib64/";
|
||||||
sl << "/usr/local/lib/";
|
sl << "/usr/local/lib/";
|
||||||
|
sl << "/usr/local/lib64/";
|
||||||
bool found = false;
|
bool found = false;
|
||||||
foreach(s, sl){
|
foreach(s, sl){
|
||||||
if(QFile::exists(s+QString("libccext2.so"))){
|
if(QFile::exists(s+QString("libccext2.so"))){
|
||||||
@@ -58,16 +60,6 @@ public:
|
|||||||
if(!found) return false;
|
if(!found) return false;
|
||||||
conf->addLib(QString("-L") + s);
|
conf->addLib(QString("-L") + s);
|
||||||
}
|
}
|
||||||
// BUGFIX for Fedora (doesn't support pkg-config?)
|
|
||||||
QFile issue_file("/etc/issue");
|
|
||||||
if(issue_file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
|
||||||
QString content = issue_file.readAll();
|
|
||||||
issue_file.close();
|
|
||||||
if(content.indexOf("Fedora") != -1){
|
|
||||||
qWarning("Fedora detected. WORKAROUND for Fedora pkg-config problem enabled");
|
|
||||||
conf->addLib("-pthread -lccext2 -lz -lccgnu2 -ldl -lrt");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
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;
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -44,13 +44,15 @@ public:
|
|||||||
|
|
||||||
s = conf->getenv("QC_WITH_LIBMAGICK_LIB");
|
s = conf->getenv("QC_WITH_LIBMAGICK_LIB");
|
||||||
if(!s.isEmpty()) {
|
if(!s.isEmpty()) {
|
||||||
if(!QFile::exists(s+QString("libMagick++.so"))){
|
if(!QFile::exists(s+QString("/libMagick++.so"))){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
QStringList sl;
|
QStringList sl;
|
||||||
sl << "/usr/lib/";
|
sl << "/usr/lib/";
|
||||||
|
sl << "/usr/lib64/";
|
||||||
sl << "/usr/local/lib/";
|
sl << "/usr/local/lib/";
|
||||||
|
sl << "/usr/local/lib64/";
|
||||||
bool found = false;
|
bool found = false;
|
||||||
foreach(s, sl){
|
foreach(s, sl){
|
||||||
if(QFile::exists(s+QString("libMagick++.so"))){
|
if(QFile::exists(s+QString("libMagick++.so"))){
|
||||||
|
|||||||
@@ -52,7 +52,9 @@ public:
|
|||||||
}else{
|
}else{
|
||||||
QStringList sl;
|
QStringList sl;
|
||||||
sl << "/usr/lib/";
|
sl << "/usr/lib/";
|
||||||
|
sl << "/usr/lib64/";
|
||||||
sl << "/usr/local/lib/";
|
sl << "/usr/local/lib/";
|
||||||
|
sl << "/usr/local/lib64/";
|
||||||
bool found = false;
|
bool found = false;
|
||||||
foreach(s, sl){
|
foreach(s, sl){
|
||||||
if(conf->checkLibrary(s, "torrent")){
|
if(conf->checkLibrary(s, "torrent")){
|
||||||
@@ -63,16 +65,6 @@ public:
|
|||||||
if(!found) return false;
|
if(!found) return false;
|
||||||
conf->addLib(QString("-L") + s);
|
conf->addLib(QString("-L") + s);
|
||||||
}
|
}
|
||||||
// BUGFIX for Fedora (doesn't support pkg-config?)
|
|
||||||
QFile issue_file("/etc/issue");
|
|
||||||
if(issue_file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
|
||||||
QString content = issue_file.readAll();
|
|
||||||
issue_file.close();
|
|
||||||
if(content.indexOf("Fedora") != -1){
|
|
||||||
qWarning("Fedora detected. WORKAROUND for Fedora pkg-config problem enabled");
|
|
||||||
conf->addLib("-lssl -lcrypto -lboost_date_time -lboost_filesystem -lboost_thread -lz -ltorrent");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -44,13 +44,15 @@ public:
|
|||||||
|
|
||||||
s = conf->getenv("QC_WITH_LIBZZIP_LIB");
|
s = conf->getenv("QC_WITH_LIBZZIP_LIB");
|
||||||
if(!s.isEmpty()) {
|
if(!s.isEmpty()) {
|
||||||
if(!QFile::exists(s+QString("libzzip.so"))){
|
if(!QFile::exists(s+QString("/libzzip.so"))){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
QStringList sl;
|
QStringList sl;
|
||||||
sl << "/usr/lib/";
|
sl << "/usr/lib/";
|
||||||
|
sl << "/usr/lib64/";
|
||||||
sl << "/usr/local/lib/";
|
sl << "/usr/local/lib/";
|
||||||
|
sl << "/usr/local/lib64/";
|
||||||
bool found = false;
|
bool found = false;
|
||||||
foreach(s, sl){
|
foreach(s, sl){
|
||||||
if(QFile::exists(s+QString("libzzip.so"))){
|
if(QFile::exists(s+QString("libzzip.so"))){
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
/*
|
|
||||||
-----BEGIN QCMOD-----
|
|
||||||
name: python
|
|
||||||
-----END QCMOD-----
|
|
||||||
*/
|
|
||||||
class qc_python : public ConfObj
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
qc_python(Conf *c) : ConfObj(c) {}
|
|
||||||
QString name() const { return "python >= 2.3"; }
|
|
||||||
QString shortname() const { return "python"; }
|
|
||||||
bool exec(){
|
|
||||||
int r = conf->doCommand("python testpython.py");
|
|
||||||
if(r == 0)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -313,8 +313,6 @@ void FinishedTorrents::displayFinishedListMenu(const QPoint& pos){
|
|||||||
QModelIndex index;
|
QModelIndex index;
|
||||||
// Enable/disable pause/start action given the DL state
|
// Enable/disable pause/start action given the DL state
|
||||||
QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes();
|
QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes();
|
||||||
QSettings settings("qBittorrent", "qBittorrent");
|
|
||||||
QString previewProgram = settings.value("Preferences/general/MediaPlayer", QString()).toString();
|
|
||||||
bool has_pause = false, has_start = false, has_preview = false;
|
bool has_pause = false, has_start = false, has_preview = false;
|
||||||
foreach(index, selectedIndexes) {
|
foreach(index, selectedIndexes) {
|
||||||
if(index.column() == F_NAME) {
|
if(index.column() == F_NAME) {
|
||||||
@@ -334,7 +332,7 @@ void FinishedTorrents::displayFinishedListMenu(const QPoint& pos){
|
|||||||
has_pause = true;
|
has_pause = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!previewProgram.isEmpty() && BTSession->isFilePreviewPossible(hash) && !has_preview) {
|
if(BTSession->isFilePreviewPossible(hash) && !has_preview) {
|
||||||
myFinishedListMenu.addAction(actionPreview_file);
|
myFinishedListMenu.addAction(actionPreview_file);
|
||||||
has_preview = true;
|
has_preview = true;
|
||||||
}
|
}
|
||||||
|
|||||||
150
src/GUI.cpp
150
src/GUI.cpp
@@ -45,9 +45,9 @@
|
|||||||
#include "options_imp.h"
|
#include "options_imp.h"
|
||||||
#include "previewSelect.h"
|
#include "previewSelect.h"
|
||||||
#include "allocationDlg.h"
|
#include "allocationDlg.h"
|
||||||
|
#include "stdlib.h"
|
||||||
|
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
namespace fs = boost::filesystem;
|
|
||||||
|
|
||||||
/*****************************************************
|
/*****************************************************
|
||||||
* *
|
* *
|
||||||
@@ -160,8 +160,6 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
|
|||||||
checkConnect = new QTimer(this);
|
checkConnect = new QTimer(this);
|
||||||
connect(checkConnect, SIGNAL(timeout()), this, SLOT(checkConnectionStatus()));
|
connect(checkConnect, SIGNAL(timeout()), this, SLOT(checkConnectionStatus()));
|
||||||
checkConnect->start(5000);
|
checkConnect->start(5000);
|
||||||
previewProcess = new QProcess(this);
|
|
||||||
connect(previewProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(cleanTempPreviewFile(int, QProcess::ExitStatus)));
|
|
||||||
// Accept drag 'n drops
|
// Accept drag 'n drops
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
show();
|
show();
|
||||||
@@ -183,9 +181,6 @@ GUI::~GUI() {
|
|||||||
delete myTrayIconMenu;
|
delete myTrayIconMenu;
|
||||||
}
|
}
|
||||||
delete tcpServer;
|
delete tcpServer;
|
||||||
previewProcess->kill();
|
|
||||||
previewProcess->waitForFinished();
|
|
||||||
delete previewProcess;
|
|
||||||
delete connecStatusLblIcon;
|
delete connecStatusLblIcon;
|
||||||
delete tabs;
|
delete tabs;
|
||||||
// Keyboard shortcuts
|
// Keyboard shortcuts
|
||||||
@@ -389,12 +384,6 @@ void GUI::on_actionPreview_file_triggered() {
|
|||||||
new previewSelect(this, h);
|
new previewSelect(this, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::cleanTempPreviewFile(int, QProcess::ExitStatus) const {
|
|
||||||
if(!QFile::remove(QDir::tempPath()+QDir::separator()+QString::fromUtf8("qBT_preview.tmp"))) {
|
|
||||||
std::cerr << "Couldn't remove temporary file: " << (QDir::tempPath()+QDir::separator()+QString::fromUtf8("qBT_preview.tmp")).toUtf8().data() << "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Necessary if we want to close the window
|
// Necessary if we want to close the window
|
||||||
// in one time if "close to systray" is enabled
|
// in one time if "close to systray" is enabled
|
||||||
void GUI::on_actionExit_triggered() {
|
void GUI::on_actionExit_triggered() {
|
||||||
@@ -403,24 +392,10 @@ void GUI::on_actionExit_triggered() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GUI::previewFile(QString filePath) {
|
void GUI::previewFile(QString filePath) {
|
||||||
// Check if there is already one preview running
|
QDesktopServices::openUrl(QString("file://")+filePath);
|
||||||
if(previewProcess->state() == QProcess::NotRunning) {
|
|
||||||
// First copy temporarily (XXX: is it necessary?)
|
|
||||||
QString tmpPath = QDir::tempPath()+QDir::separator()+QString::fromUtf8("qBT_preview.tmp");
|
|
||||||
QFile::remove(tmpPath);
|
|
||||||
QFile::copy(filePath, tmpPath);
|
|
||||||
// Launch program preview
|
|
||||||
QStringList params;
|
|
||||||
params << tmpPath;
|
|
||||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
|
||||||
QString previewProgram = settings.value(QString::fromUtf8("Preferences/General/MediaPlayer"), QString()).toString();
|
|
||||||
previewProcess->start(previewProgram, params, QIODevice::ReadOnly);
|
|
||||||
}else{
|
|
||||||
QMessageBox::critical(0, tr("Preview process already running"), tr("There is already another preview process running.\nPlease close the other one first."));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int GUI::getCurrentTabIndex() const{
|
int GUI::getCurrentTabIndex() const{
|
||||||
if(isMinimized() || isHidden())
|
if(isMinimized() || isHidden())
|
||||||
return -1;
|
return -1;
|
||||||
return tabs->currentIndex();
|
return tabs->currentIndex();
|
||||||
@@ -474,7 +449,7 @@ void GUI::on_actionAbout_triggered() {
|
|||||||
|
|
||||||
// Called when we close the program
|
// Called when we close the program
|
||||||
void GUI::closeEvent(QCloseEvent *e) {
|
void GUI::closeEvent(QCloseEvent *e) {
|
||||||
qDebug("Mainwindow received closeEvent");
|
|
||||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
bool goToSystrayOnExit = settings.value(QString::fromUtf8("Preferences/General/CloseToTray"), false).toBool();
|
bool goToSystrayOnExit = settings.value(QString::fromUtf8("Preferences/General/CloseToTray"), false).toBool();
|
||||||
if(!force_exit && systrayIntegration && goToSystrayOnExit && !this->isHidden()) {
|
if(!force_exit && systrayIntegration && goToSystrayOnExit && !this->isHidden()) {
|
||||||
@@ -486,13 +461,16 @@ void GUI::closeEvent(QCloseEvent *e) {
|
|||||||
show();
|
show();
|
||||||
if(!isMaximized())
|
if(!isMaximized())
|
||||||
showNormal();
|
showNormal();
|
||||||
if(QMessageBox::question(this,
|
if(e->spontaneous() == true || force_exit == true) {
|
||||||
tr("Are you sure you want to quit?")+QString::fromUtf8(" -- ")+tr("qBittorrent"),
|
if(QMessageBox::question(this,
|
||||||
tr("The download list is not empty.\nAre you sure you want to quit qBittorrent?"),
|
tr("Are you sure you want to quit?")+QString::fromUtf8(" -- ")+tr("qBittorrent"),
|
||||||
tr("&Yes"), tr("&No"),
|
tr("The download list is not empty.\nAre you sure you want to quit qBittorrent?"),
|
||||||
QString(), 0, 1)) {
|
tr("&Yes"), tr("&No"),
|
||||||
e->ignore();
|
QString(), 0, 1)) {
|
||||||
return;
|
e->ignore();
|
||||||
|
force_exit = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hide();
|
hide();
|
||||||
@@ -510,6 +488,7 @@ void GUI::closeEvent(QCloseEvent *e) {
|
|||||||
qApp->exit();
|
qApp->exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Display window to create a torrent
|
// Display window to create a torrent
|
||||||
void GUI::on_actionCreate_torrent_triggered() {
|
void GUI::on_actionCreate_torrent_triggered() {
|
||||||
createtorrent *ct = new createtorrent(this);
|
createtorrent *ct = new createtorrent(this);
|
||||||
@@ -519,7 +498,7 @@ void GUI::on_actionCreate_torrent_triggered() {
|
|||||||
// Called when we minimize the program
|
// Called when we minimize the program
|
||||||
void GUI::hideEvent(QHideEvent *e) {
|
void GUI::hideEvent(QHideEvent *e) {
|
||||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
if(systrayIntegration && settings.value(QString::fromUtf8("Preferences/General/MinimizeToTray"), false).toBool() && !e->spontaneous()) {
|
if(systrayIntegration && settings.value(QString::fromUtf8("Preferences/General/MinimizeToTray"), false).toBool()) {
|
||||||
// Hide window
|
// Hide window
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
@@ -789,7 +768,12 @@ void GUI::processDownloadedFiles(QString path, QString url) {
|
|||||||
void GUI::configureSession(bool deleteOptions) {
|
void GUI::configureSession(bool deleteOptions) {
|
||||||
qDebug("Configuring session");
|
qDebug("Configuring session");
|
||||||
// General
|
// General
|
||||||
displaySpeedInTitle = options->speedInTitleBar();
|
bool new_displaySpeedInTitle = options->speedInTitleBar();
|
||||||
|
if(!new_displaySpeedInTitle && new_displaySpeedInTitle != displaySpeedInTitle) {
|
||||||
|
// Reset title
|
||||||
|
setWindowTitle(tr("qBittorrent %1", "e.g: qBittorrent v0.x").arg(QString::fromUtf8(VERSION)));
|
||||||
|
}
|
||||||
|
displaySpeedInTitle = new_displaySpeedInTitle;
|
||||||
unsigned int new_refreshInterval = options->getRefreshInterval();
|
unsigned int new_refreshInterval = options->getRefreshInterval();
|
||||||
if(refreshInterval != new_refreshInterval) {
|
if(refreshInterval != new_refreshInterval) {
|
||||||
refreshInterval = new_refreshInterval;
|
refreshInterval = new_refreshInterval;
|
||||||
@@ -850,12 +834,21 @@ void GUI::configureSession(bool deleteOptions) {
|
|||||||
// * Proxy settings
|
// * Proxy settings
|
||||||
proxy_settings proxySettings;
|
proxy_settings proxySettings;
|
||||||
if(options->isProxyEnabled()) {
|
if(options->isProxyEnabled()) {
|
||||||
|
proxySettings.hostname = options->getProxyIp().toStdString();
|
||||||
|
proxySettings.port = options->getProxyPort();
|
||||||
|
if(options->isProxyAuthEnabled()) {
|
||||||
|
proxySettings.username = options->getProxyUsername().toStdString();
|
||||||
|
proxySettings.password = options->getProxyPassword().toStdString();
|
||||||
|
}
|
||||||
|
QString proxy_str;
|
||||||
switch(options->getProxyType()) {
|
switch(options->getProxyType()) {
|
||||||
case HTTP:
|
case HTTP:
|
||||||
proxySettings.type = proxy_settings::http;
|
proxySettings.type = proxy_settings::http;
|
||||||
|
proxy_str = misc::toQString("http://")+options->getProxyIp()+":"+misc::toQString(proxySettings.port);
|
||||||
break;
|
break;
|
||||||
case HTTP_PW:
|
case HTTP_PW:
|
||||||
proxySettings.type = proxy_settings::http_pw;
|
proxySettings.type = proxy_settings::http_pw;
|
||||||
|
proxy_str = misc::toQString("http://")+options->getProxyUsername()+":"+options->getProxyPassword()+"@"+options->getProxyIp()+":"+misc::toQString(proxySettings.port);
|
||||||
break;
|
break;
|
||||||
case SOCKS5:
|
case SOCKS5:
|
||||||
proxySettings.type = proxy_settings::socks5;
|
proxySettings.type = proxy_settings::socks5;
|
||||||
@@ -864,12 +857,22 @@ void GUI::configureSession(bool deleteOptions) {
|
|||||||
proxySettings.type = proxy_settings::socks5_pw;
|
proxySettings.type = proxy_settings::socks5_pw;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
proxySettings.hostname = options->getProxyIp().toStdString();
|
if(!proxy_str.isEmpty()) {
|
||||||
proxySettings.port = options->getProxyPort();
|
// We need this for urllib in search engine plugins
|
||||||
if(options->isProxyAuthEnabled()) {
|
#ifdef Q_WS_WIN
|
||||||
proxySettings.username = options->getProxyUsername().toStdString();
|
char proxystr[512];
|
||||||
proxySettings.password = options->getProxyPassword().toStdString();
|
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());
|
BTSession->setProxySettings(proxySettings, options->useProxyForTrackers(), options->useProxyForPeers(), options->useProxyForWebseeds(), options->useProxyForDHT());
|
||||||
// * Session settings
|
// * Session settings
|
||||||
@@ -885,11 +888,14 @@ void GUI::configureSession(bool deleteOptions) {
|
|||||||
BTSession->setMaxUploadsPerTorrent(options->getMaxUploadsPerTorrent());
|
BTSession->setMaxUploadsPerTorrent(options->getMaxUploadsPerTorrent());
|
||||||
// * DHT
|
// * DHT
|
||||||
if(options->isDHTEnabled()) {
|
if(options->isDHTEnabled()) {
|
||||||
BTSession->enableDHT(true);
|
|
||||||
downloadingTorrentTab->setInfoBar(tr("DHT support [ON], port: %1").arg(new_listenPort), QString::fromUtf8("blue"));
|
|
||||||
// Set DHT Port
|
// Set DHT Port
|
||||||
BTSession->setDHTPort(new_listenPort);
|
BTSession->setDHTPort(new_listenPort);
|
||||||
}else{
|
if(BTSession->enableDHT(true)) {
|
||||||
|
downloadingTorrentTab->setInfoBar(tr("DHT support [ON], port: %1").arg(new_listenPort), QString::fromUtf8("blue"));
|
||||||
|
} else {
|
||||||
|
downloadingTorrentTab->setInfoBar(tr("DHT support [OFF]"), QString::fromUtf8("red"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
BTSession->enableDHT(false);
|
BTSession->enableDHT(false);
|
||||||
downloadingTorrentTab->setInfoBar(tr("DHT support [OFF]"), QString::fromUtf8("blue"));
|
downloadingTorrentTab->setInfoBar(tr("DHT support [OFF]"), QString::fromUtf8("blue"));
|
||||||
}
|
}
|
||||||
@@ -988,30 +994,8 @@ void GUI::togglePausedState(QString hash) {
|
|||||||
// Pause All Downloads in DL list
|
// Pause All Downloads in DL list
|
||||||
void GUI::on_actionPause_All_triggered() {
|
void GUI::on_actionPause_All_triggered() {
|
||||||
bool change = false;
|
bool change = false;
|
||||||
bool inDownloadList = true;
|
QStringList DL_hashes = BTSession->getUnfinishedTorrents();
|
||||||
bool hidden = false;
|
QStringList F_hashes = BTSession->getFinishedTorrents();
|
||||||
switch(getCurrentTabIndex()) {
|
|
||||||
case -1:
|
|
||||||
hidden = true;
|
|
||||||
inDownloadList = false;
|
|
||||||
break;
|
|
||||||
case 0:
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
inDownloadList = false;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList DL_hashes;
|
|
||||||
QStringList F_hashes;
|
|
||||||
if(hidden || inDownloadList) {
|
|
||||||
DL_hashes = BTSession->getUnfinishedTorrents();
|
|
||||||
}
|
|
||||||
if(hidden || !inDownloadList) {
|
|
||||||
F_hashes = BTSession->getFinishedTorrents();
|
|
||||||
}
|
|
||||||
QString hash;
|
QString hash;
|
||||||
foreach(hash, DL_hashes) {
|
foreach(hash, DL_hashes) {
|
||||||
if(BTSession->pauseTorrent(hash)){
|
if(BTSession->pauseTorrent(hash)){
|
||||||
@@ -1057,30 +1041,8 @@ void GUI::on_actionPause_triggered() {
|
|||||||
// Resume All Downloads in DL list
|
// Resume All Downloads in DL list
|
||||||
void GUI::on_actionStart_All_triggered() {
|
void GUI::on_actionStart_All_triggered() {
|
||||||
bool change = false;
|
bool change = false;
|
||||||
bool inDownloadList = true;
|
QStringList DL_hashes = BTSession->getUnfinishedTorrents();
|
||||||
bool hidden = false;
|
QStringList F_hashes = BTSession->getFinishedTorrents();
|
||||||
switch(getCurrentTabIndex()) {
|
|
||||||
case -1:
|
|
||||||
hidden = true;
|
|
||||||
inDownloadList = false;
|
|
||||||
break;
|
|
||||||
case 0:
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
inDownloadList = false;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList DL_hashes;
|
|
||||||
QStringList F_hashes;
|
|
||||||
if(hidden || inDownloadList) {
|
|
||||||
DL_hashes = BTSession->getUnfinishedTorrents();
|
|
||||||
}
|
|
||||||
if(hidden || !inDownloadList) {
|
|
||||||
F_hashes = BTSession->getFinishedTorrents();
|
|
||||||
}
|
|
||||||
QString hash;
|
QString hash;
|
||||||
foreach(hash, DL_hashes) {
|
foreach(hash, DL_hashes) {
|
||||||
if(BTSession->resumeTorrent(hash)){
|
if(BTSession->resumeTorrent(hash)){
|
||||||
|
|||||||
@@ -74,8 +74,6 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
|||||||
QShortcut *switchDownShortcut;
|
QShortcut *switchDownShortcut;
|
||||||
QShortcut *switchUpShortcut;
|
QShortcut *switchUpShortcut;
|
||||||
QShortcut *switchRSSShortcut;
|
QShortcut *switchRSSShortcut;
|
||||||
// Preview
|
|
||||||
QProcess *previewProcess;
|
|
||||||
// Search
|
// Search
|
||||||
SearchEngine *searchEngine;
|
SearchEngine *searchEngine;
|
||||||
// RSS
|
// RSS
|
||||||
@@ -98,7 +96,6 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
|||||||
void togglePausedState(QString hash);
|
void togglePausedState(QString hash);
|
||||||
void on_actionPreview_file_triggered();
|
void on_actionPreview_file_triggered();
|
||||||
void previewFile(QString filePath);
|
void previewFile(QString filePath);
|
||||||
void cleanTempPreviewFile(int, QProcess::ExitStatus) const;
|
|
||||||
void balloonClicked();
|
void balloonClicked();
|
||||||
void writeSettings();
|
void writeSettings();
|
||||||
void readSettings();
|
void readSettings();
|
||||||
@@ -158,7 +155,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
|||||||
GUI(QWidget *parent=0, QStringList torrentCmdLine=QStringList());
|
GUI(QWidget *parent=0, QStringList torrentCmdLine=QStringList());
|
||||||
~GUI();
|
~GUI();
|
||||||
// Methods
|
// Methods
|
||||||
unsigned int getCurrentTabIndex() const;
|
int getCurrentTabIndex() const;
|
||||||
QPoint screenCenter() const;
|
QPoint screenCenter() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
BIN
src/Icons/edit_clear.png
Normal file
BIN
src/Icons/edit_clear.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 575 B |
@@ -174,14 +174,16 @@ class PropListDelegate: public QItemDelegate {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if(old_val != NORMAL){
|
// if(old_val != NORMAL){
|
||||||
|
// model->setData(index, QVariant(NORMAL));
|
||||||
|
// if(filteredFilesChanged != 0)
|
||||||
|
// *filteredFilesChanged = true;
|
||||||
|
// } else {
|
||||||
|
model->setData(index, QVariant(HIGH));
|
||||||
model->setData(index, QVariant(NORMAL));
|
model->setData(index, QVariant(NORMAL));
|
||||||
if(filteredFilesChanged != 0)
|
if(filteredFilesChanged != 0)
|
||||||
*filteredFilesChanged = true;
|
*filteredFilesChanged = true;
|
||||||
} else {
|
// }
|
||||||
model->setData(index, QVariant(HIGH));
|
|
||||||
model->setData(index, QVariant(NORMAL));
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if(old_val != HIGH){
|
if(old_val != HIGH){
|
||||||
|
|||||||
@@ -62,12 +62,20 @@ class file {
|
|||||||
|
|
||||||
void updateProgress() {
|
void updateProgress() {
|
||||||
Q_ASSERT(is_dir);
|
Q_ASSERT(is_dir);
|
||||||
float sum = 0;
|
if(children.isEmpty()) {
|
||||||
|
progress = 0.;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
float wanted = 0.;
|
||||||
|
float done = 0.;
|
||||||
file *child;
|
file *child;
|
||||||
foreach(child, children) {
|
foreach(child, children) {
|
||||||
sum += child->getProgress();
|
wanted += child->getSize();
|
||||||
|
done += child->getSize()*child->getProgress();
|
||||||
}
|
}
|
||||||
progress = sum / (float)children.size();
|
progress = done / wanted;
|
||||||
|
Q_ASSERT(progress >= 0.);
|
||||||
|
Q_ASSERT(progress <= 1.);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updatePriority(int prio) {
|
void updatePriority(int prio) {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -25,6 +25,7 @@
|
|||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <QDateTime>
|
||||||
|
|
||||||
#include <libtorrent/session.hpp>
|
#include <libtorrent/session.hpp>
|
||||||
#include <libtorrent/ip_filter.hpp>
|
#include <libtorrent/ip_filter.hpp>
|
||||||
@@ -33,6 +34,7 @@
|
|||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
|
||||||
class downloadThread;
|
class downloadThread;
|
||||||
|
class deleteThread;
|
||||||
class QTimer;
|
class QTimer;
|
||||||
|
|
||||||
class bittorrent : public QObject{
|
class bittorrent : public QObject{
|
||||||
@@ -43,17 +45,17 @@ class bittorrent : public QObject{
|
|||||||
QString scan_dir;
|
QString scan_dir;
|
||||||
QTimer *timerScan;
|
QTimer *timerScan;
|
||||||
QTimer *timerAlerts;
|
QTimer *timerAlerts;
|
||||||
|
QTimer *fastResumeSaver;
|
||||||
|
QTimer *BigRatioTimer;
|
||||||
bool DHTEnabled;
|
bool DHTEnabled;
|
||||||
downloadThread *downloader;
|
downloadThread *downloader;
|
||||||
QString defaultSavePath;
|
QString defaultSavePath;
|
||||||
QStringList torrentsToPauseAfterChecking;
|
QStringList torrentsToPauseAfterChecking;
|
||||||
QHash<QString, bool> reloadingTorrents;
|
QHash<QString, QDateTime> TorrentsStartTime;
|
||||||
QHash<QString, QList<qlonglong> > ETAstats;
|
QHash<QString, size_type> TorrentsStartData;
|
||||||
QHash<QString, qlonglong> ETAs;
|
|
||||||
QHash<QString, QPair<size_type,size_type> > ratioData;
|
QHash<QString, QPair<size_type,size_type> > ratioData;
|
||||||
QTimer *ETARefresher;
|
|
||||||
QHash<QString, QList<QPair<QString, QString> > > trackersErrors;
|
QHash<QString, QList<QPair<QString, QString> > > trackersErrors;
|
||||||
QStringList waitingForPause;
|
deleteThread *deleter;
|
||||||
QStringList finishedTorrents;
|
QStringList finishedTorrents;
|
||||||
QStringList unfinishedTorrents;
|
QStringList unfinishedTorrents;
|
||||||
bool preAllocateAll;
|
bool preAllocateAll;
|
||||||
@@ -61,6 +63,9 @@ class bittorrent : public QObject{
|
|||||||
int maxConnecsPerTorrent;
|
int maxConnecsPerTorrent;
|
||||||
int maxUploadsPerTorrent;
|
int maxUploadsPerTorrent;
|
||||||
float max_ratio;
|
float max_ratio;
|
||||||
|
bool UPnPEnabled;
|
||||||
|
bool NATPMPEnabled;
|
||||||
|
bool LSDEnabled;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QString getSavePath(QString hash);
|
QString getSavePath(QString hash);
|
||||||
@@ -78,7 +83,7 @@ class bittorrent : public QObject{
|
|||||||
session_status getSessionStatus() const;
|
session_status getSessionStatus() const;
|
||||||
int getListenPort() const;
|
int getListenPort() const;
|
||||||
QStringList getTorrentsToPauseAfterChecking() const;
|
QStringList getTorrentsToPauseAfterChecking() const;
|
||||||
long getETA(QString hash) const;
|
qlonglong getETA(QString hash) const;
|
||||||
float getRealRatio(QString hash) const;
|
float getRealRatio(QString hash) const;
|
||||||
session* getSession() const;
|
session* getSession() const;
|
||||||
QList<QPair<QString, QString> > getTrackersErrors(QString hash) const;
|
QList<QPair<QString, QString> > getTrackersErrors(QString hash) const;
|
||||||
@@ -97,13 +102,13 @@ class bittorrent : public QObject{
|
|||||||
void saveDHTEntry();
|
void saveDHTEntry();
|
||||||
void preAllocateAllFiles(bool b);
|
void preAllocateAllFiles(bool b);
|
||||||
void saveFastResumeAndRatioData();
|
void saveFastResumeAndRatioData();
|
||||||
|
void saveFastResumeAndRatioData(QString hash);
|
||||||
void enableDirectoryScanning(QString scan_dir);
|
void enableDirectoryScanning(QString scan_dir);
|
||||||
void disableDirectoryScanning();
|
void disableDirectoryScanning();
|
||||||
void enablePeerExchange();
|
void enablePeerExchange();
|
||||||
void enableIPFilter(ip_filter filter);
|
void enableIPFilter(ip_filter filter);
|
||||||
void disableIPFilter();
|
void disableIPFilter();
|
||||||
void resumeUnfinishedTorrents();
|
void resumeUnfinishedTorrents();
|
||||||
void updateETAs();
|
|
||||||
void saveTorrentSpeedLimits(QString hash);
|
void saveTorrentSpeedLimits(QString hash);
|
||||||
void loadTorrentSpeedLimits(QString hash);
|
void loadTorrentSpeedLimits(QString hash);
|
||||||
void saveDownloadUploadForTorrent(QString hash);
|
void saveDownloadUploadForTorrent(QString hash);
|
||||||
@@ -133,7 +138,8 @@ class bittorrent : public QObject{
|
|||||||
void enableUPnP(bool b);
|
void enableUPnP(bool b);
|
||||||
void enableNATPMP(bool b);
|
void enableNATPMP(bool b);
|
||||||
void enableLSD(bool b);
|
void enableLSD(bool b);
|
||||||
void enableDHT(bool b);
|
bool enableDHT(bool b);
|
||||||
|
void reloadTorrent(const QTorrentHandle &h, bool full_alloc);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void scanDirectory();
|
void scanDirectory();
|
||||||
@@ -141,8 +147,6 @@ class bittorrent : public QObject{
|
|||||||
void processDownloadedFile(QString, QString);
|
void processDownloadedFile(QString, QString);
|
||||||
bool loadTrackerFile(QString hash);
|
bool loadTrackerFile(QString hash);
|
||||||
void saveTrackerFile(QString hash);
|
void saveTrackerFile(QString hash);
|
||||||
void pauseAndReloadTorrent(QTorrentHandle h, bool full_alloc);
|
|
||||||
void reloadTorrent(const QTorrentHandle &h, bool full_alloc); // This is protected now, call pauseAndReloadTorrent() instead
|
|
||||||
void deleteBigRatios();
|
void deleteBigRatios();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#include <libtorrent/file_pool.hpp>
|
#include <libtorrent/file_pool.hpp>
|
||||||
|
|
||||||
#include "createtorrent_imp.h"
|
#include "createtorrent_imp.h"
|
||||||
|
#include "misc.h"
|
||||||
|
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
using namespace boost::filesystem;
|
using namespace boost::filesystem;
|
||||||
@@ -120,11 +121,13 @@ void createtorrent::on_addURLSeed_button_clicked(){
|
|||||||
// Subfunction to add files to a torrent_info structure
|
// Subfunction to add files to a torrent_info structure
|
||||||
// Written by Arvid Norberg (libtorrent Author)
|
// Written by Arvid Norberg (libtorrent Author)
|
||||||
void add_files(torrent_info& t, path const& p, path const& l){
|
void add_files(torrent_info& t, path const& p, path const& l){
|
||||||
|
qDebug("p: %s, l: %s, l.leaf(): %s", p.string().c_str(), l.string().c_str(), l.leaf().c_str());
|
||||||
path f(p / l);
|
path f(p / l);
|
||||||
if (is_directory(f)){
|
if (is_directory(f)){
|
||||||
for (directory_iterator i(f), end; i != end; ++i)
|
for (directory_iterator i(f), end; i != end; ++i)
|
||||||
add_files(t, p, l / i->leaf());
|
add_files(t, p, l / i->leaf());
|
||||||
}else{
|
}else{
|
||||||
|
qDebug("Adding %s", l.string().c_str());
|
||||||
t.add_file(l, file_size(f));
|
t.add_file(l, file_size(f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -141,6 +144,8 @@ QStringList createtorrent::allItems(QListWidget *list){
|
|||||||
// Main function that create a .torrent file
|
// Main function that create a .torrent file
|
||||||
void createtorrent::on_createButton_clicked(){
|
void createtorrent::on_createButton_clicked(){
|
||||||
QString input = textInputPath->text().trimmed();
|
QString input = textInputPath->text().trimmed();
|
||||||
|
if (input.endsWith(QDir::separator()))
|
||||||
|
input.chop(1);
|
||||||
if(input.isEmpty()){
|
if(input.isEmpty()){
|
||||||
QMessageBox::critical(0, tr("No input path set"), tr("Please type an input path first"));
|
QMessageBox::critical(0, tr("No input path set"), tr("Please type an input path first"));
|
||||||
return;
|
return;
|
||||||
@@ -161,9 +166,8 @@ void createtorrent::on_createButton_clicked(){
|
|||||||
try {
|
try {
|
||||||
boost::intrusive_ptr<torrent_info> t(new torrent_info);
|
boost::intrusive_ptr<torrent_info> t(new torrent_info);
|
||||||
ofstream out(complete(path((const char*)destination.toUtf8())), std::ios_base::binary);
|
ofstream out(complete(path((const char*)destination.toUtf8())), std::ios_base::binary);
|
||||||
path full_path;
|
|
||||||
// Adding files to the torrent
|
// Adding files to the torrent
|
||||||
full_path = complete(path(input.toUtf8().data()));
|
path full_path = complete(path(input.toUtf8().data()));
|
||||||
add_files(*t, full_path.branch_path(), full_path.leaf());
|
add_files(*t, full_path.branch_path(), full_path.leaf());
|
||||||
// Set piece size
|
// Set piece size
|
||||||
int piece_size = getPieceSize();
|
int piece_size = getPieceSize();
|
||||||
@@ -200,8 +204,14 @@ void createtorrent::on_createButton_clicked(){
|
|||||||
entry e = t->create_torrent();
|
entry e = t->create_torrent();
|
||||||
libtorrent::bencode(std::ostream_iterator<char>(out), e);
|
libtorrent::bencode(std::ostream_iterator<char>(out), e);
|
||||||
out.flush();
|
out.flush();
|
||||||
if(checkStartSeeding->isChecked())
|
if(checkStartSeeding->isChecked()) {
|
||||||
|
// Create save path file
|
||||||
|
QFile savepath_file(misc::qBittorrentPath()+QString::fromUtf8("BT_backup")+QDir::separator()+misc::toQString(t->info_hash())+QString::fromUtf8(".savepath"));
|
||||||
|
savepath_file.open(QIODevice::WriteOnly | QIODevice::Text);
|
||||||
|
savepath_file.write(full_path.branch_path().string().c_str());
|
||||||
|
savepath_file.close();
|
||||||
emit torrent_to_seed(destination);
|
emit torrent_to_seed(destination);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (std::exception& e){
|
catch (std::exception& e){
|
||||||
std::cerr << e.what() << "\n";
|
std::cerr << e.what() << "\n";
|
||||||
|
|||||||
@@ -21,43 +21,48 @@
|
|||||||
|
|
||||||
#include "downloadThread.h"
|
#include "downloadThread.h"
|
||||||
#include <iostream>
|
#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){
|
switch(status){
|
||||||
case 1://ost::URLStream::errUnreachable:
|
case CURLE_FTP_CANT_GET_HOST:
|
||||||
|
case CURLE_COULDNT_RESOLVE_HOST:
|
||||||
return tr("Host is unreachable");
|
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)");
|
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");
|
return tr("Connection was denied");
|
||||||
case 4://ost::URLStream::errInvalid:
|
case CURLE_URL_MALFORMAT:
|
||||||
return tr("Url is invalid");
|
return tr("Url is invalid");
|
||||||
case 5://ost::URLStream::errForbidden:
|
case CURLE_COULDNT_RESOLVE_PROXY:
|
||||||
return tr("Connection forbidden (403)");
|
return tr("Could not resolve proxy");
|
||||||
case 6://ost::URLStream::errUnauthorized:
|
//case 5:
|
||||||
return tr("Connection was not authorized (401)");
|
// return tr("Connection forbidden (403)");
|
||||||
case 7://ost::URLStream::errRelocated:
|
//case 6:
|
||||||
return tr("Content has moved (301)");
|
// return tr("Connection was not authorized (401)");
|
||||||
case 8://ost::URLStream::errFailure:
|
//case 7:
|
||||||
|
// return tr("Content has moved (301)");
|
||||||
|
case CURLE_COULDNT_CONNECT:
|
||||||
return tr("Connection failure");
|
return tr("Connection failure");
|
||||||
case 9://ost::URLStream::errTimeout:
|
case CURLE_OPERATION_TIMEOUTED:
|
||||||
return tr("Connection was timed out");
|
return tr("Connection was timed out");
|
||||||
case 10://ost::URLStream::errInterface:
|
case CURLE_INTERFACE_FAILED:
|
||||||
return tr("Incorrect network interface");
|
return tr("Incorrect network interface");
|
||||||
default:
|
default:
|
||||||
return tr("Unknown error");
|
return tr("Unknown error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subDownloadThread::subDownloadThread(QObject *parent, QString url) : QThread(parent), url(url), abort(false){
|
subDownloadThread::subDownloadThread(QObject *parent, QString url) : QThread(parent), url(url), abort(false){}
|
||||||
url_stream = new ost::URLStream();
|
|
||||||
}
|
|
||||||
|
|
||||||
subDownloadThread::~subDownloadThread(){
|
subDownloadThread::~subDownloadThread(){
|
||||||
abort = true;
|
abort = true;
|
||||||
wait();
|
wait();
|
||||||
delete url_stream;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void subDownloadThread::run(){
|
void subDownloadThread::run(){
|
||||||
@@ -68,38 +73,66 @@ void subDownloadThread::run(){
|
|||||||
filePath = tmpfile->fileName();
|
filePath = tmpfile->fileName();
|
||||||
}
|
}
|
||||||
delete tmpfile;
|
delete tmpfile;
|
||||||
QFile dest_file(filePath);
|
FILE *f = fopen(filePath.toUtf8().data(), "wb");
|
||||||
if(!dest_file.open(QIODevice::WriteOnly | QIODevice::Text)){
|
if(!f) {
|
||||||
std::cerr << "Error: could't create temporary file: " << (const char*)filePath.toUtf8() << '\n';
|
std::cerr << "couldn't open destination file" << "\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ost::URLStream::Error status = url_stream->get((const char*)url.toUtf8());
|
CURL *curl;
|
||||||
if(status){
|
CURLcode res;
|
||||||
// Failure
|
curl = curl_easy_init();
|
||||||
QString error_msg = errorCodeToString((int)status);
|
if(curl) {
|
||||||
qDebug("Download failed for %s, reason: %s", (const char*)url.toUtf8(), (const char*)error_msg.toUtf8());
|
std::string c_url = url.toUtf8().data();
|
||||||
url_stream->close();
|
curl_easy_setopt(curl, CURLOPT_URL, c_url.c_str());
|
||||||
emit downloadFailureST(this, url, error_msg);
|
// SSL support
|
||||||
return;
|
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
|
||||||
}
|
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
|
||||||
qDebug("Downloading %s...", (const char*)url.toUtf8());
|
// PROXY SUPPORT
|
||||||
char cbuf[1024];
|
QSettings settings("qBittorrent", "qBittorrent");
|
||||||
int len;
|
int intValue = settings.value(QString::fromUtf8("Preferences/Connection/ProxyType"), 0).toInt();
|
||||||
while(!url_stream->eof()) {
|
if(intValue > 0) {
|
||||||
url_stream->read(cbuf, sizeof(cbuf));
|
// Proxy enabled
|
||||||
len = url_stream->gcount();
|
QString IP = settings.value(QString::fromUtf8("Preferences/Connection/Proxy/IP"), "0.0.0.0").toString();
|
||||||
if(len > 0)
|
QString port = settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Port"), 8080).toString();
|
||||||
dest_file.write(cbuf, len);
|
qDebug("Using proxy: %s", (IP+QString(":")+port).toUtf8().data());
|
||||||
if(abort){
|
curl_easy_setopt(curl, CURLOPT_PROXYPORT, (IP+QString(":")+port).toUtf8().data());
|
||||||
dest_file.close();
|
// Default proxy type is HTTP, we must change if it is SOCKS5
|
||||||
url_stream->close();
|
if(intValue%2==0) {
|
||||||
return;
|
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);
|
||||||
|
// Verbose
|
||||||
|
// curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
|
||||||
|
// No progress info (we don't use it)
|
||||||
|
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1);
|
||||||
|
// Redirections
|
||||||
|
curl_easy_setopt(curl, CURLOPT_AUTOREFERER, 1);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_MAXREDIRS, -1);
|
||||||
|
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 **/
|
/** Download Thread **/
|
||||||
|
|||||||
@@ -29,22 +29,18 @@
|
|||||||
#include <QMutexLocker>
|
#include <QMutexLocker>
|
||||||
#include <QWaitCondition>
|
#include <QWaitCondition>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <curl/curl.h>
|
||||||
namespace ost {
|
|
||||||
class URLStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
class subDownloadThread : public QThread {
|
class subDownloadThread : public QThread {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
QString url;
|
QString url;
|
||||||
ost::URLStream *url_stream;
|
|
||||||
bool abort;
|
bool abort;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
subDownloadThread(QObject *parent, QString url);
|
subDownloadThread(QObject *parent, QString url);
|
||||||
~subDownloadThread();
|
~subDownloadThread();
|
||||||
QString errorCodeToString(int status);
|
QString errorCodeToString(CURLcode status);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
// For subthreads
|
// For subthreads
|
||||||
@@ -76,13 +72,13 @@ class downloadThread : public QThread {
|
|||||||
~downloadThread();
|
~downloadThread();
|
||||||
|
|
||||||
void downloadUrl(QString url);
|
void downloadUrl(QString url);
|
||||||
|
void setProxy(QString IP, int port, QString username, QString password);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void propagateDownloadedFile(subDownloadThread* st, QString url, QString path);
|
void propagateDownloadedFile(subDownloadThread* st, QString url, QString path);
|
||||||
|
|
||||||
void propagateDownloadFailure(subDownloadThread* st, QString url, QString reason);
|
void propagateDownloadFailure(subDownloadThread* st, QString url, QString reason);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -190,7 +190,6 @@ void DownloadingTorrents::setInfoBar(QString info, QColor color) {
|
|||||||
infoBar->clear();
|
infoBar->clear();
|
||||||
nbLines = 1;
|
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>"));
|
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>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,8 +245,6 @@ void DownloadingTorrents::displayDLListMenu(const QPoint& pos) {
|
|||||||
QModelIndex index;
|
QModelIndex index;
|
||||||
// Enable/disable pause/start action given the DL state
|
// Enable/disable pause/start action given the DL state
|
||||||
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
||||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
|
||||||
QString previewProgram = settings.value(QString::fromUtf8("Preferences/general/MediaPlayer"), QString()).toString();
|
|
||||||
bool has_pause = false, has_start = false, has_preview = false;
|
bool has_pause = false, has_start = false, has_preview = false;
|
||||||
foreach(index, selectedIndexes) {
|
foreach(index, selectedIndexes) {
|
||||||
if(index.column() == NAME) {
|
if(index.column() == NAME) {
|
||||||
@@ -267,7 +264,7 @@ void DownloadingTorrents::displayDLListMenu(const QPoint& pos) {
|
|||||||
has_pause = true;
|
has_pause = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!previewProgram.isEmpty() && BTSession->isFilePreviewPossible(hash) && !has_preview) {
|
if(BTSession->isFilePreviewPossible(hash) && !has_preview) {
|
||||||
myDLLlistMenu.addAction(actionPreview_file);
|
myDLLlistMenu.addAction(actionPreview_file);
|
||||||
has_preview = true;
|
has_preview = true;
|
||||||
}
|
}
|
||||||
@@ -417,7 +414,7 @@ void DownloadingTorrents::updateDlList() {
|
|||||||
}else{
|
}else{
|
||||||
DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/stalled.png"))), Qt::DecorationRole);
|
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));
|
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, PROGRESS), QVariant((double)h.progress()));
|
||||||
DLListModel->setData(DLListModel->index(row, DLSPEED), QVariant((double)h.download_payload_rate()));
|
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:
|
public slots:
|
||||||
void updateDlList();
|
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 pauseTorrent(QString hash);
|
||||||
void resumeTorrent(QString hash);
|
void resumeTorrent(QString hash);
|
||||||
void updateRatio();
|
void updateRatio();
|
||||||
|
|||||||
@@ -250,11 +250,13 @@ void engineSelectDlg::setRowColor(int row, QString color){
|
|||||||
bool engineSelectDlg::checkInstalled(QString plugin_name) const {
|
bool engineSelectDlg::checkInstalled(QString plugin_name) const {
|
||||||
QProcess nova;
|
QProcess nova;
|
||||||
QStringList params;
|
QStringList params;
|
||||||
|
params << misc::qBittorrentPath()+"search_engine"+QDir::separator()+"nova2.py";
|
||||||
params << "--supported_engines";
|
params << "--supported_engines";
|
||||||
nova.start(misc::qBittorrentPath()+"search_engine"+QDir::separator()+"nova2.py", params, QIODevice::ReadOnly);
|
nova.start("python", params, QIODevice::ReadOnly);
|
||||||
nova.waitForStarted();
|
nova.waitForStarted();
|
||||||
nova.waitForFinished();
|
nova.waitForFinished();
|
||||||
QByteArray result = nova.readAll();
|
QByteArray result = nova.readAll();
|
||||||
|
result = result.replace("\r", "");
|
||||||
result = result.replace("\n", "");
|
result = result.replace("\n", "");
|
||||||
QList<QByteArray> plugins_list = result.split(',');
|
QList<QByteArray> plugins_list = result.split(',');
|
||||||
return plugins_list.contains(plugin_name.toUtf8());
|
return plugins_list.contains(plugin_name.toUtf8());
|
||||||
@@ -280,11 +282,13 @@ void engineSelectDlg::loadSupportedSearchEngines(bool first) {
|
|||||||
QStringList params;
|
QStringList params;
|
||||||
// Ask nova core for the supported search engines
|
// Ask nova core for the supported search engines
|
||||||
QProcess nova;
|
QProcess nova;
|
||||||
|
params << misc::qBittorrentPath()+"search_engine"+QDir::separator()+"nova2.py";
|
||||||
params << "--supported_engines";
|
params << "--supported_engines";
|
||||||
nova.start(misc::qBittorrentPath()+"search_engine"+QDir::separator()+"nova2.py", params, QIODevice::ReadOnly);
|
nova.start("python", params, QIODevice::ReadOnly);
|
||||||
nova.waitForStarted();
|
nova.waitForStarted();
|
||||||
nova.waitForFinished();
|
nova.waitForFinished();
|
||||||
QByteArray result = nova.readAll();
|
QByteArray result = nova.readAll();
|
||||||
|
result = result.replace("\r", "");
|
||||||
result = result.replace("\n", "");
|
result = result.replace("\n", "");
|
||||||
qDebug("read: %s", result.data());
|
qDebug("read: %s", result.data());
|
||||||
QByteArray e;
|
QByteArray e;
|
||||||
@@ -295,11 +299,13 @@ void engineSelectDlg::loadSupportedSearchEngines(bool first) {
|
|||||||
installed_engines[en] = old_engines.value(en, true);
|
installed_engines[en] = old_engines.value(en, true);
|
||||||
}
|
}
|
||||||
params.clear();
|
params.clear();
|
||||||
|
params << misc::qBittorrentPath()+"search_engine"+QDir::separator()+"nova2.py";
|
||||||
params << "--supported_engines_infos";
|
params << "--supported_engines_infos";
|
||||||
nova.start(misc::qBittorrentPath()+"search_engine"+QDir::separator()+"nova2.py", params, QIODevice::ReadOnly);
|
nova.start("python", params, QIODevice::ReadOnly);
|
||||||
nova.waitForStarted();
|
nova.waitForStarted();
|
||||||
nova.waitForFinished();
|
nova.waitForFinished();
|
||||||
result = nova.readAll();
|
result = nova.readAll();
|
||||||
|
result = result.replace("\r", "");
|
||||||
result = result.replace("\n", "");
|
result = result.replace("\n", "");
|
||||||
qDebug("read: %s", result.data());
|
qDebug("read: %s", result.data());
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
<file>Icons/configure.png</file>
|
<file>Icons/configure.png</file>
|
||||||
<file>Icons/download.png</file>
|
<file>Icons/download.png</file>
|
||||||
<file>Icons/folder.png</file>
|
<file>Icons/folder.png</file>
|
||||||
|
<file>Icons/edit_clear.png</file>
|
||||||
<file>Icons/flags/portugal.png</file>
|
<file>Icons/flags/portugal.png</file>
|
||||||
<file>Icons/flags/france.png</file>
|
<file>Icons/flags/france.png</file>
|
||||||
<file>Icons/flags/ukraine.png</file>
|
<file>Icons/flags/ukraine.png</file>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user