1
mirror of https://github.com/qbittorrent/qBittorrent synced 2025-10-19 05:12:18 +02:00

Compare commits

..

75 Commits

Author SHA1 Message Date
Christophe Dumez
726e3b2eae - Tagged v1.0.0final 2008-04-11 17:01:38 +00:00
Christophe Dumez
755a5a4aa7 - Fixed unlimited download limit problem (trayicon) 2008-03-14 20:55:37 +00:00
Christophe Dumez
45c2044634 - Fixed mistake in french translation 2008-03-14 20:46:07 +00:00
Christophe Dumez
b7ea2c7401 - Fixed index problem in preview selection (closes #192495) 2008-02-17 13:34:50 +00:00
Christophe Dumez
84fd2ec218 - Attempt to fix compilation on vc++ 2008-02-03 10:47:01 +00:00
Christophe Dumez
bf2e0f5982 - Fixed torrents' names in mininova search engine 2008-01-28 12:27:39 +00:00
Christophe Dumez
a270c87b28 Updated language files 2008-01-04 20:51:58 +00:00
Christophe Dumez
1e95bac659 BUGFIX: Catch all possible exceptions when adding a torrent to avoid crashing 2008-01-04 20:48:03 +00:00
Christophe Dumez
729adf06c3 - Fixed systray integration when qbittorrent is launched on system startup 2008-01-04 20:11:32 +00:00
Christophe Dumez
0b9452ac30 - Use 16px tray icon on windows
- Updated TODO
2008-01-04 19:49:19 +00:00
Christophe Dumez
71149e7baa - Threadified torrent creation
- Added a progress bar in torrent creation
- Display if UPnP/NAT-PMP was successful or not
2007-12-31 16:57:35 +00:00
Christophe Dumez
032ba42ef3 - version bump to rc11 2007-12-30 18:16:43 +00:00
Christophe Dumez
2f689208be - BUGFIX: Fixed torrent creation from a directory
- BUGFIX: Fixed save path when seeding automatically after torrent creation
2007-12-30 18:13:00 +00:00
Christophe Dumez
faa33b0d7e - Removed debug mode 2007-12-28 10:00:28 +00:00
Christophe Dumez
8fdf3d520c - Fixed btjunkie search engine 2007-12-28 09:58:14 +00:00
Christophe Dumez
b238a4ed69 - Fixed eol problems on Windows 2007-12-12 22:01:49 +00:00
Christophe Dumez
ba53bdc708 should fix eol problems on windows 2007-12-12 21:47:31 +00:00
Christophe Dumez
f2a65e07b5 - Fix for windows 2007-12-12 18:21:08 +00:00
Christophe Dumez
62afd4f98b - Forgot to call one script with python executable 2007-12-12 17:55:56 +00:00
Christophe Dumez
6c11fd5a0d - Call python script with python executable (fix for windows) 2007-12-12 17:15:13 +00:00
Christophe Dumez
cc39504a61 - Attempt to fix search engine plugins copy on windows 2007-12-12 16:57:33 +00:00
Christophe Dumez
1baec5378f - Updated rc11 changelog 2007-12-12 12:32:38 +00:00
Christophe Dumez
b60b4fafff - DownloadThread now write in binary mode (should fix problems on Windows) 2007-12-12 12:24:12 +00:00
Christophe Dumez
3325dd0550 - Removed libcurl debug output 2007-12-11 20:31:20 +00:00
Christophe Dumez
29dc0fede0 - DownloadThread can now follow redirections (fixes Mininova search engine) 2007-12-11 20:23:13 +00:00
Christophe Dumez
19f6b8491e - Forgot to remove the temporary download file when addition fails 2007-12-11 20:01:33 +00:00
Christophe Dumez
01b1e78dcd - Fixed torrentreactor search engine 2007-12-11 19:33:19 +00:00
Christophe Dumez
bd546e3d18 - BUGFIX: Bypass exit confirmation on system shutdown 2007-12-09 16:39:55 +00:00
Christophe Dumez
6ca93dfbae - Fixed a compilation warning 2007-12-09 15:52:00 +00:00
Christophe Dumez
f175ce5249 - Fixed preview when path contains spaces (closes #175015)
- Version bump to rc10
2007-12-09 09:32:01 +00:00
Christophe Dumez
940a8b28e4 - BUGFIX: Fixed possible problem when closing to systray and cancelling app exit
( closes #173832)
2007-12-04 12:07:00 +00:00
Christophe Dumez
9ee9c7d362 - Disabled debug mode 2007-12-03 20:31:50 +00:00
Christophe Dumez
2899494ef3 - fix for windows compilation 2007-12-03 20:22:57 +00:00
Christophe Dumez
624e2b287a - Still trying to fix windows compilation 2007-12-03 20:14:00 +00:00
Christophe Dumez
681d538163 - Fix last commit 2007-12-03 20:07:42 +00:00
Christophe Dumez
60f1a1989c - Attempt to fix compilation on windows 2007-12-03 20:02:18 +00:00
Christophe Dumez
050dc9de44 - Fixed nbResult != 0 when clearing results while a search is running 2007-12-03 19:31:19 +00:00
Christophe Dumez
d80f94643f - Attempt to fix downloadFromUrl on windows 2007-11-30 16:06:07 +00:00
Christophe Dumez
1b4bb7655f limit search engine plugins to 10 result pages 2007-11-30 11:55:50 +00:00
Christophe Dumez
e8ffaa2f87 - BUGFIX: Added a 3 minutes search engine timeout 2007-11-30 10:49:20 +00:00
Christophe Dumez
a89188acc3 - Commited Peerkoel's windows building script 2007-11-29 21:56:01 +00:00
Christophe Dumez
993002a151 - BUGFIX: Fixed proxy host max length in preferences 2007-11-28 12:51:27 +00:00
Christophe Dumez
8bcaf55439 - Fixed compilation on windows (closes #172391) 2007-11-27 19:38:40 +00:00
Christophe Dumez
48aac758c9 - COSMETIC: Use more skin colors instead of hard coded ones 2007-11-24 23:50:27 +00:00
Christophe Dumez
4ba2c3d385 - FEATURE: Greatly improved ETA calculation algorithm (use GASA) 2007-11-24 22:01:31 +00:00
Christophe Dumez
d96e21c07f - Updated TODO 2007-11-24 19:40:14 +00:00
Christophe Dumez
1204cebaa1 - bump to rc9 2007-11-23 23:43:14 +00:00
Christophe Dumez
1695e85bdf - Added some errors code for libcurl
- Added HTTPS download support
2007-11-23 23:07:07 +00:00
Christophe Dumez
33305cca9f - Moved from libcommoncpp2 to libcurl for downloads from urls
- Added SOCKS5 proxy support in downloads from urls, RSS
2007-11-23 23:00:38 +00:00
Christophe Dumez
04b683c38c - Do not use SOCKS5 proxy in downloadThread.cpp (code does not work). HTTP is ok though. 2007-11-23 20:51:03 +00:00
Christophe Dumez
d55cd9aec8 - Fixed HTTP proxy support in downloadThread.cpp 2007-11-23 15:59:18 +00:00
Christophe Dumez
0b5652bd72 - BUGFIX: Fixed everlasting libtorrent session destruction on exit 2007-11-23 15:22:12 +00:00
Christophe Dumez
878787e965 - BUGFIX: Fixed proxy layout in program preferences 2007-11-23 00:25:34 +00:00
Christophe Dumez
3536577af6 Added a h.is_valid check 2007-11-22 21:54:24 +00:00
Christophe Dumez
9f2d9e4d3f - Do not save fastresume data for paused torrents anymore 2007-11-22 21:51:22 +00:00
Christophe Dumez
efe0dbabaa - Fixed proxy auth disable problem when disabling proxy 2007-11-22 21:33:31 +00:00
Christophe Dumez
b1d8fb0f11 - Some bug fixes (Proxy) 2007-11-22 10:49:10 +00:00
Christophe Dumez
78fc5d4865 - BUGFIX: Added proxy support in search engine, RSS, downloads from urls
- Must add SOCKS5 proxy support in search engine plugins (python -> urllib2?)
2007-11-21 22:33:32 +00:00
Christophe Dumez
19996736d6 do not save fastresume data regularly for seeding torrents 2007-11-21 20:34:17 +00:00
Christophe Dumez
6f9d22af03 - BUGFIX: title bar is now reset when "Display speed in title" is disabled 2007-11-21 20:18:11 +00:00
Christophe Dumez
6b6d05a380 - BUGFIX: Fixed possible overflow in ETA calculation 2007-11-21 19:01:24 +00:00
Christophe Dumez
df92e3e5e9 - Save fastresume data every minute instead of every 10 sec 2007-11-21 16:50:26 +00:00
Christophe Dumez
26b6c26ea8 - Fixed segfault that would happen when unfiltering files in torrent addition dialog (closes #163379) 2007-11-19 21:44:21 +00:00
Christophe Dumez
1b6183bfa3 - BUGFIX: Saving trackers file only when necessary 2007-11-19 21:22:48 +00:00
Christophe Dumez
7edbaa3847 - BUGFIX: Do not save fastresume data for checking torrents anymore 2007-11-19 20:45:35 +00:00
Christophe Dumez
2ee152a374 - BUGFIX: Do no pause torrents before saving fastresume data anymore (no longer needed)
- BUGFIX: Save fast resume data regularly (every 10 seconds) to avoid downloading from s
cratch if qBittorrent crashes
2007-11-19 20:36:01 +00:00
Christophe Dumez
bc8ac43a54 - BUGFIX: Improved proxy support in search engine (HTTP only) 2007-11-16 20:01:15 +00:00
Christophe Dumez
5f48a51070 - BUGFIX: Remember properties window size and position 2007-11-16 19:35:12 +00:00
Christophe Dumez
c3a6b24ed1 - FEATURE: Better media file preview (player detected automatically) 2007-11-16 18:39:50 +00:00
Christophe Dumez
c3b22c9a01 bump version to rc8 2007-11-14 21:50:33 +00:00
Christophe Dumez
5d09ace7eb - Removed a fedora 7 workaround 2007-11-13 10:31:42 +00:00
Christophe Dumez
fe37724338 - Removed Fedora pkg-config workaround because Fedora 8 fixed the problem 2007-11-10 09:27:25 +00:00
Christophe Dumez
8aaacbe38d - BUGFIX: Stop search when clearing results 2007-11-07 11:18:09 +00:00
Christophe Dumez
edc625c9c9 - fixed torrent files filtering (closes #158846) 2007-11-06 20:57:36 +00:00
Christophe Dumez
6ae21c2919 - Moved v1.0.x to a branch so that we work on v1.1.x in trunk 2007-11-06 11:07:07 +00:00
91 changed files with 7034 additions and 6891 deletions

View File

@@ -41,21 +41,25 @@
- 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: 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)
- BUGFIX: qBittorrent is not exiting anymore when a dialog is closed and main window is hidden
- BUGFIX: Catch all possible exceptions when adding a torrent to avoid crashing
- BUGFIX: Search plugin update is not making the GUI freeze anymore (moved to a thread)
- BUGFIX: DHT settings were not saved correctly
- BUGFIX: Workaround to build on Fedora system (pkg-config problem)
- BUGFIX: search plugin update - do not display only last version changelog
- BUGFIX: Search plugin update - fixed missing new lines in changelog
- BUGFIX: The number of search results was not reset when clicking on 'Clear' button
- BUGFIX: Fixed systray integration when qbittorrent is launched on system startup
- BUGFIX: Update torrent progress when its content changed (filtered files)
- BUGFIX: Improved the way menu icons are installed to avoid problems on some systems
- BUGFIX: Improved incremental download
@@ -66,6 +70,8 @@
- 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: Totally redesigned program preferences
- COSMETIC: Display more logs messages concerning features

View File

@@ -25,7 +25,7 @@ Dependencies:
- libboost: libboost-filesystem, libboost-date-time, libboost-thread, libboost-serialization
- libcommoncpp2
- libcurl
- python >= 2.3 (needed by search engine)

24
TODO
View File

@@ -8,11 +8,9 @@
- Skins support? (contact Mateusz)
// Harder
- Display a progress bar that really represents the pieces we have (like in eMule)
- Torrent scheduler ala µtorrent/Bitcomet
// Waiting for libtorrent
- File selection in a torrent in compact mode
- Allow to prioritize torrents (may code this in qBittorrent?)
// Unsure
@@ -32,7 +30,6 @@
// in v1.1.0
- Tabs support in search
- Allow to hide columns?
- Allow to scan multiple directories? (useful?)
- Web interface (turbogears? php? python?)
* Webserver? Try to write a webserver as a plugin for qBittorrent in Python
@@ -46,22 +43,7 @@
- Display in torrent addition dialog:
* free disk space on selected drive
* 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
-> in download list
-> in seeding list
// in v1.0.0 - FEATURE FREEZE
- Fix all (or almost all) opened bugs in bug tracker
- Recheck doc
- Translations update (IN PROGRESS)
rc6->rc7 changelog:
- BUGFIX: Catching DHT exception in case there is a problem
- BUGFIX: Removed build dependency on Python
- BUGFIX: Fixed a bug in children update when changing files priorities
- BUGFIX: Pause/Start All now affect all tabs, not only the current one
- BUGFIX: Don't reload all torrents everytime settings are saved
- BUGFIX: Don't reload seeding torrents anymore (no point)
- I18N: Updated Turkish translation
rc11 -> final? changelog:
BUGFIX: Fixed systray integration when qbittorrent is launched on system startup
BUGFIX: Catch all possible exceptions when adding a torrent to avoid crashing

88
configure vendored
View File

@@ -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
@@ -425,16 +425,6 @@ public:
if(!found) return false;
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;
}
};
@@ -495,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{
@@ -522,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;
}
@@ -533,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;
@@ -548,26 +536,14 @@ 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;
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;
}
};
@@ -618,9 +594,9 @@ public:
s = conf->getenv("QC_WITH_LIBMAGICK_LIB");
if(!s.isEmpty()) {
if(!QFile::exists(s+QString("/libMagick++.so"))){
return false;
}
if(!conf->checkLibrary(s, "Magick++")) {
return false;
}
}else{
QStringList sl;
sl << "/usr/lib/";
@@ -629,9 +605,9 @@ public:
sl << "/usr/local/lib64/";
bool found = false;
foreach(s, sl){
if(QFile::exists(s+QString("libMagick++.so"))){
if(conf->checkLibrary(s, "Magick++")) {
found = true;
break;
break;
}
}
if(!found)
@@ -735,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);
@@ -1693,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

View File

@@ -12,7 +12,7 @@
<dep type='libboost'>
<required/>
</dep>
<dep type='libcommoncpp2'>
<dep type='libcurl'>
<required/>
</dep>
<dep type='libmagick'/>

View File

@@ -60,16 +60,6 @@ public:
if(!found) return false;
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;
}
};

61
qcm/libcurl.qcm Normal file
View 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;
}
};

View File

@@ -44,9 +44,9 @@ public:
s = conf->getenv("QC_WITH_LIBMAGICK_LIB");
if(!s.isEmpty()) {
if(!QFile::exists(s+QString("/libMagick++.so"))){
return false;
}
if(!conf->checkLibrary(s, "Magick++")) {
return false;
}
}else{
QStringList sl;
sl << "/usr/lib/";
@@ -55,9 +55,9 @@ public:
sl << "/usr/local/lib64/";
bool found = false;
foreach(s, sl){
if(QFile::exists(s+QString("libMagick++.so"))){
if(conf->checkLibrary(s, "Magick++")) {
found = true;
break;
break;
}
}
if(!found)

View File

@@ -65,16 +65,6 @@ public:
if(!found) return false;
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;
}
};

View File

@@ -313,8 +313,6 @@ void FinishedTorrents::displayFinishedListMenu(const QPoint& pos){
QModelIndex index;
// Enable/disable pause/start action given the DL state
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;
foreach(index, selectedIndexes) {
if(index.column() == F_NAME) {
@@ -334,7 +332,7 @@ void FinishedTorrents::displayFinishedListMenu(const QPoint& pos){
has_pause = true;
}
}
if(!previewProgram.isEmpty() && BTSession->isFilePreviewPossible(hash) && !has_preview) {
if(BTSession->isFilePreviewPossible(hash) && !has_preview) {
myFinishedListMenu.addAction(actionPreview_file);
has_preview = true;
}

View File

@@ -45,6 +45,7 @@
#include "options_imp.h"
#include "previewSelect.h"
#include "allocationDlg.h"
#include "stdlib.h"
using namespace libtorrent;
@@ -60,14 +61,21 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
setWindowTitle(tr("qBittorrent %1", "e.g: qBittorrent v0.x").arg(QString::fromUtf8(VERSION)));
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
systrayIntegration = settings.value(QString::fromUtf8("Preferences/General/SystrayEnabled"), true).toBool();
systrayCreator = 0;
// Create tray icon
if (QSystemTrayIcon::isSystemTrayAvailable()) {
if(systrayIntegration) {
createTrayIcon();
}
}else{
if(systrayIntegration) {
// May be system startup, check again later
systrayCreator = new QTimer(this);
connect(systrayCreator, SIGNAL(timeout()), this, SLOT(createSystrayDelayed()));
systrayCreator->start(1000);
}
systrayIntegration = false;
qDebug("Info: System tray unavailable\n");
qDebug("Info: System tray unavailable");
}
// Setting icons
this->setWindowIcon(QIcon(QString::fromUtf8(":/Icons/qbittorrent32.png")));
@@ -159,8 +167,6 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
checkConnect = new QTimer(this);
connect(checkConnect, SIGNAL(timeout()), this, SLOT(checkConnectionStatus()));
checkConnect->start(5000);
previewProcess = new QProcess(this);
connect(previewProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(cleanTempPreviewFile(int, QProcess::ExitStatus)));
// Accept drag 'n drops
setAcceptDrops(true);
show();
@@ -177,14 +183,14 @@ GUI::~GUI() {
delete downloadingTorrentTab;
delete finishedTorrentTab;
delete checkConnect;
if(systrayCreator) {
delete systrayCreator;
}
if(systrayIntegration) {
delete myTrayIcon;
delete myTrayIconMenu;
}
delete tcpServer;
previewProcess->kill();
previewProcess->waitForFinished();
delete previewProcess;
delete connecStatusLblIcon;
delete tabs;
// Keyboard shortcuts
@@ -388,12 +394,6 @@ void GUI::on_actionPreview_file_triggered() {
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
// in one time if "close to systray" is enabled
void GUI::on_actionExit_triggered() {
@@ -402,24 +402,10 @@ void GUI::on_actionExit_triggered() {
}
void GUI::previewFile(QString filePath) {
// Check if there is already one preview running
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."));
}
QDesktopServices::openUrl(QString("file://")+filePath);
}
unsigned int GUI::getCurrentTabIndex() const{
int GUI::getCurrentTabIndex() const{
if(isMinimized() || isHidden())
return -1;
return tabs->currentIndex();
@@ -473,7 +459,7 @@ void GUI::on_actionAbout_triggered() {
// Called when we close the program
void GUI::closeEvent(QCloseEvent *e) {
qDebug("Mainwindow received closeEvent");
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
bool goToSystrayOnExit = settings.value(QString::fromUtf8("Preferences/General/CloseToTray"), false).toBool();
if(!force_exit && systrayIntegration && goToSystrayOnExit && !this->isHidden()) {
@@ -485,13 +471,16 @@ void GUI::closeEvent(QCloseEvent *e) {
show();
if(!isMaximized())
showNormal();
if(QMessageBox::question(this,
tr("Are you sure you want to quit?")+QString::fromUtf8(" -- ")+tr("qBittorrent"),
tr("The download list is not empty.\nAre you sure you want to quit qBittorrent?"),
tr("&Yes"), tr("&No"),
QString(), 0, 1)) {
e->ignore();
return;
if(e->spontaneous() == true || force_exit == true) {
if(QMessageBox::question(this,
tr("Are you sure you want to quit?")+QString::fromUtf8(" -- ")+tr("qBittorrent"),
tr("The download list is not empty.\nAre you sure you want to quit qBittorrent?"),
tr("&Yes"), tr("&No"),
QString(), 0, 1)) {
e->ignore();
force_exit = false;
return;
}
}
}
hide();
@@ -509,6 +498,7 @@ void GUI::closeEvent(QCloseEvent *e) {
qApp->exit();
}
// Display window to create a torrent
void GUI::on_actionCreate_torrent_triggered() {
createtorrent *ct = new createtorrent(this);
@@ -788,7 +778,12 @@ void GUI::processDownloadedFiles(QString path, QString url) {
void GUI::configureSession(bool deleteOptions) {
qDebug("Configuring session");
// 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();
if(refreshInterval != new_refreshInterval) {
refreshInterval = new_refreshInterval;
@@ -849,12 +844,21 @@ void GUI::configureSession(bool deleteOptions) {
// * Proxy settings
proxy_settings proxySettings;
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()) {
case HTTP:
proxySettings.type = proxy_settings::http;
proxy_str = misc::toQString("http://")+options->getProxyIp()+":"+misc::toQString(proxySettings.port);
break;
case HTTP_PW:
proxySettings.type = proxy_settings::http_pw;
proxy_str = misc::toQString("http://")+options->getProxyUsername()+":"+options->getProxyPassword()+"@"+options->getProxyIp()+":"+misc::toQString(proxySettings.port);
break;
case SOCKS5:
proxySettings.type = proxy_settings::socks5;
@@ -863,12 +867,22 @@ void GUI::configureSession(bool deleteOptions) {
proxySettings.type = proxy_settings::socks5_pw;
break;
}
proxySettings.hostname = options->getProxyIp().toStdString();
proxySettings.port = options->getProxyPort();
if(options->isProxyAuthEnabled()) {
proxySettings.username = options->getProxyUsername().toStdString();
proxySettings.password = options->getProxyPassword().toStdString();
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
@@ -1179,9 +1193,37 @@ void GUI::downloadFromURLList(const QStringList& urls) {
* *
*****************************************************/
void GUI::createSystrayDelayed() {
static int timeout = 10;
if(QSystemTrayIcon::isSystemTrayAvailable()) {
// Ok, systray integration is now supported
// Create systray icon
createTrayIcon();
systrayIntegration = true;
delete systrayCreator;
systrayCreator = 0;
} else {
if(timeout) {
// Retry a bit later
systrayCreator->start(1000);
--timeout;
} else {
// Timed out, apparently system really does not
// support systray icon
delete systrayCreator;
systrayCreator = 0;
}
}
}
void GUI::createTrayIcon() {
// Tray icon
#ifdef Q_WS_WIN
myTrayIcon = new QSystemTrayIcon(QIcon(QString::fromUtf8(":/Icons/qbittorrent16.png")), this);
#endif
#ifndef Q_WS_WIN
myTrayIcon = new QSystemTrayIcon(QIcon(QString::fromUtf8(":/Icons/qbittorrent22.png")), this);
#endif
// Tray icon Menu
myTrayIconMenu = new QMenu(this);
myTrayIconMenu->addAction(actionOpen);

View File

@@ -59,6 +59,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
QTabWidget *tabs;
options_imp *options;
QSystemTrayIcon *myTrayIcon;
QTimer *systrayCreator;
QMenu *myTrayIconMenu;
DownloadingTorrents *downloadingTorrentTab;
FinishedTorrents *finishedTorrentTab;
@@ -74,8 +75,6 @@ class GUI : public QMainWindow, private Ui::MainWindow{
QShortcut *switchDownShortcut;
QShortcut *switchUpShortcut;
QShortcut *switchRSSShortcut;
// Preview
QProcess *previewProcess;
// Search
SearchEngine *searchEngine;
// RSS
@@ -98,7 +97,6 @@ class GUI : public QMainWindow, private Ui::MainWindow{
void togglePausedState(QString hash);
void on_actionPreview_file_triggered();
void previewFile(QString filePath);
void cleanTempPreviewFile(int, QProcess::ExitStatus) const;
void balloonClicked();
void writeSettings();
void readSettings();
@@ -108,6 +106,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
void updateFinishedTorrentNumber(unsigned int nb);
void fullDiskError(QTorrentHandle& h) const;
void handleDownloadFromUrlFailure(QString, QString) const;
void createSystrayDelayed();
// Keyboard shortcuts
void createKeyboardShortcuts();
void displayDownTab() const;
@@ -158,7 +157,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
GUI(QWidget *parent=0, QStringList torrentCmdLine=QStringList());
~GUI();
// Methods
unsigned int getCurrentTabIndex() const;
int getCurrentTabIndex() const;
QPoint screenCenter() const;
};

View File

@@ -181,6 +181,8 @@ class PropListDelegate: public QItemDelegate {
// } else {
model->setData(index, QVariant(HIGH));
model->setData(index, QVariant(NORMAL));
if(filteredFilesChanged != 0)
*filteredFilesChanged = true;
// }
break;
case 2:

View File

@@ -27,19 +27,19 @@
#include <QDir>
#include "misc.h"
class file {
class torrent_file {
private:
file *parent;
torrent_file *parent;
bool is_dir;
QString rel_path;
QList<file*> children;
QList<torrent_file*> children;
size_type size;
float progress;
int priority;
int index; // Index in torrent_info
public:
file(file *parent, QString path, bool dir, size_type size=0, int index=-1, float progress=0., int priority=1): parent(parent), is_dir(dir), size(size), progress(progress), priority(priority), index(index){
torrent_file(torrent_file *parent, QString path, bool dir, size_type size=0, int index=-1, float progress=0., int priority=1): parent(parent), is_dir(dir), size(size), progress(progress), priority(priority), index(index){
qDebug("created a file with index %d", index);
rel_path = QDir::cleanPath(path);
if(parent) {
@@ -48,7 +48,7 @@ class file {
}
}
~file() {
~torrent_file() {
qDeleteAll(children);
}
@@ -68,7 +68,7 @@ class file {
}
float wanted = 0.;
float done = 0.;
file *child;
torrent_file *child;
foreach(child, children) {
wanted += child->getSize();
done += child->getSize()*child->getProgress();
@@ -80,7 +80,7 @@ class file {
void updatePriority(int prio) {
Q_ASSERT(is_dir);
file *child;
torrent_file *child;
foreach(child, children) {
if(child->getPriority() != prio) return;
}
@@ -111,13 +111,13 @@ class file {
return (!children.isEmpty());
}
QList<file*> getChildren() const {
QList<torrent_file*> getChildren() const {
return children;
}
file* getChild(QString fileName) const {
torrent_file* getChild(QString fileName) const {
Q_ASSERT(is_dir);
file* f;
torrent_file* f;
foreach(f, children) {
if(f->name() == fileName) return f;
}
@@ -130,10 +130,10 @@ class file {
parent->addBytes(b);
}
file* addChild(QString fileName, bool dir, size_type size=0, int index = -1, float progress=0., int priority=1) {
torrent_file* addChild(QString fileName, bool dir, size_type size=0, int index = -1, float progress=0., int priority=1) {
Q_ASSERT(is_dir);
qDebug("Adding a new child of size: %ld", (long)size);
file *f = new file(this, QDir::cleanPath(rel_path+QDir::separator()+fileName), dir, size, index, progress, priority);
torrent_file *f = new torrent_file(this, QDir::cleanPath(rel_path+QDir::separator()+fileName), dir, size, index, progress, priority);
children << f;
if(size) {
addBytes(size);
@@ -148,7 +148,7 @@ class file {
return true;
}
bool success = true;
file *f;
torrent_file *f;
qDebug("We have %d children", children.size());
foreach(f, children) {
bool s = f->removeFromFS(saveDir);
@@ -169,16 +169,16 @@ class file {
class arborescence {
private:
file *root;
torrent_file *root;
public:
arborescence(torrent_info t) {
torrent_info::file_iterator fi = t.begin_files();
if(t.num_files() > 1) {
root = new file(0, misc::toQString(t.name()), true);
root = new torrent_file(0, misc::toQString(t.name()), true);
} else {
// XXX: Will crash if there is no file in torrent
root = new file(0, misc::toQString(t.name()), false, fi->size, 0);
root = new torrent_file(0, misc::toQString(t.name()), false, fi->size, 0);
return;
}
int i = 0;
@@ -196,11 +196,11 @@ class arborescence {
torrent_info::file_iterator fi = t.begin_files();
if(t.num_files() > 1) {
qDebug("More than one file in the torrent, setting a folder as root");
root = new file(0, misc::toQString(t.name()), true);
root = new torrent_file(0, misc::toQString(t.name()), true);
} else {
// XXX: Will crash if there is no file in torrent
qDebug("one file in the torrent, setting it as root with index 0");
root = new file(0, misc::toQString(t.name()), false, fi->size, 0, fp[0], prioritiesTab[0]);
root = new torrent_file(0, misc::toQString(t.name()), false, fi->size, 0, fp[0], prioritiesTab[0]);
return;
}
int i = 0;
@@ -218,7 +218,7 @@ class arborescence {
delete root;
}
file* getRoot() const {
torrent_file* getRoot() const {
return root;
}
@@ -240,13 +240,13 @@ class arborescence {
relative_path.remove(0, 1);
QStringList fileNames = relative_path.split(QDir::separator());
QString fileName;
file *dad = root;
torrent_file *dad = root;
unsigned int nb_i = 0;
unsigned int size = fileNames.size();
foreach(fileName, fileNames) {
++nb_i;
if(fileName == ".") continue;
file* child = dad->getChild(fileName);
torrent_file* child = dad->getChild(fileName);
if(!child) {
if(nb_i != size) {
// Folder

File diff suppressed because it is too large Load Diff

View File

@@ -25,6 +25,7 @@
#include <QList>
#include <QPair>
#include <QStringList>
#include <QDateTime>
#include <libtorrent/session.hpp>
#include <libtorrent/ip_filter.hpp>
@@ -44,18 +45,17 @@ class bittorrent : public QObject{
QString scan_dir;
QTimer *timerScan;
QTimer *timerAlerts;
QTimer *fastResumeSaver;
QTimer *BigRatioTimer;
bool DHTEnabled;
downloadThread *downloader;
QString defaultSavePath;
QStringList torrentsToPauseAfterChecking;
QHash<QString, bool> reloadingTorrents;
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 waitingForPause;
QStringList finishedTorrents;
QStringList unfinishedTorrents;
bool preAllocateAll;
@@ -63,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);
@@ -80,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,13 +102,13 @@ class bittorrent : public QObject{
void saveDHTEntry();
void preAllocateAllFiles(bool b);
void saveFastResumeAndRatioData();
void saveFastResumeAndRatioData(QString hash);
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);
@@ -136,6 +139,7 @@ class bittorrent : public QObject{
void enableNATPMP(bool b);
void enableLSD(bool b);
bool enableDHT(bool b);
void reloadTorrent(const QTorrentHandle &h, bool full_alloc);
protected slots:
void scanDirectory();
@@ -143,8 +147,6 @@ class bittorrent : public QObject{
void processDownloadedFile(QString, QString);
bool loadTrackerFile(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();
signals:

View File

@@ -36,6 +36,7 @@
#include <libtorrent/file_pool.hpp>
#include "createtorrent_imp.h"
#include "misc.h"
using namespace libtorrent;
using namespace boost::filesystem;
@@ -120,11 +121,13 @@ void createtorrent::on_addURLSeed_button_clicked(){
// Subfunction to add files to a torrent_info structure
// Written by Arvid Norberg (libtorrent Author)
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);
if (is_directory(f)){
for (directory_iterator i(f), end; i != end; ++i)
add_files(t, p, l / i->leaf());
}else{
qDebug("Adding %s", l.string().c_str());
t.add_file(l, file_size(f));
}
}
@@ -141,6 +144,8 @@ QStringList createtorrent::allItems(QListWidget *list){
// Main function that create a .torrent file
void createtorrent::on_createButton_clicked(){
QString input = textInputPath->text().trimmed();
if (input.endsWith(QDir::separator()))
input.chop(1);
if(input.isEmpty()){
QMessageBox::critical(0, tr("No input path set"), tr("Please type an input path first"));
return;
@@ -161,9 +166,8 @@ void createtorrent::on_createButton_clicked(){
try {
boost::intrusive_ptr<torrent_info> t(new torrent_info);
ofstream out(complete(path((const char*)destination.toUtf8())), std::ios_base::binary);
path full_path;
// 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());
// Set piece size
int piece_size = getPieceSize();
@@ -200,8 +204,14 @@ void createtorrent::on_createButton_clicked(){
entry e = t->create_torrent();
libtorrent::bencode(std::ostream_iterator<char>(out), e);
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);
}
}
catch (std::exception& e){
std::cerr << e.what() << "\n";

View File

@@ -21,43 +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();
}
subDownloadThread::subDownloadThread(QObject *parent, QString url) : QThread(parent), url(url), abort(false){}
subDownloadThread::~subDownloadThread(){
abort = true;
wait();
delete url_stream;
}
void subDownloadThread::run(){
@@ -68,38 +73,66 @@ 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(), "wb");
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);
// 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 **/

View File

@@ -29,22 +29,18 @@
#include <QMutexLocker>
#include <QWaitCondition>
#include <QStringList>
namespace ost {
class URLStream;
}
#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
@@ -76,13 +72,13 @@ class downloadThread : public QThread {
~downloadThread();
void downloadUrl(QString url);
void setProxy(QString IP, int port, QString username, QString password);
protected:
void run();
protected slots:
void propagateDownloadedFile(subDownloadThread* st, QString url, QString path);
void propagateDownloadFailure(subDownloadThread* st, QString url, QString reason);
};

View File

@@ -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>"));
}
@@ -246,8 +245,6 @@ void DownloadingTorrents::displayDLListMenu(const QPoint& pos) {
QModelIndex index;
// Enable/disable pause/start action given the DL state
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;
foreach(index, selectedIndexes) {
if(index.column() == NAME) {
@@ -267,7 +264,7 @@ void DownloadingTorrents::displayDLListMenu(const QPoint& pos) {
has_pause = true;
}
}
if(!previewProgram.isEmpty() && BTSession->isFilePreviewPossible(hash) && !has_preview) {
if(BTSession->isFilePreviewPossible(hash) && !has_preview) {
myDLLlistMenu.addAction(actionPreview_file);
has_preview = true;
}
@@ -417,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()));

View File

@@ -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();

View File

@@ -250,11 +250,13 @@ void engineSelectDlg::setRowColor(int row, QString color){
bool engineSelectDlg::checkInstalled(QString plugin_name) const {
QProcess nova;
QStringList params;
params << misc::qBittorrentPath()+"search_engine"+QDir::separator()+"nova2.py";
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.waitForFinished();
QByteArray result = nova.readAll();
result = result.replace("\r", "");
result = result.replace("\n", "");
QList<QByteArray> plugins_list = result.split(',');
return plugins_list.contains(plugin_name.toUtf8());
@@ -280,11 +282,13 @@ void engineSelectDlg::loadSupportedSearchEngines(bool first) {
QStringList params;
// Ask nova core for the supported search engines
QProcess nova;
params << misc::qBittorrentPath()+"search_engine"+QDir::separator()+"nova2.py";
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.waitForFinished();
QByteArray result = nova.readAll();
result = result.replace("\r", "");
result = result.replace("\n", "");
qDebug("read: %s", result.data());
QByteArray e;
@@ -295,11 +299,13 @@ void engineSelectDlg::loadSupportedSearchEngines(bool first) {
installed_engines[en] = old_engines.value(en, true);
}
params.clear();
params << misc::qBittorrentPath()+"search_engine"+QDir::separator()+"nova2.py";
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.waitForFinished();
result = nova.readAll();
result = result.replace("\r", "");
result = result.replace("\n", "");
qDebug("read: %s", result.data());
unsigned int i = 0;

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

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