Compare commits

...

109 Commits

Author SHA1 Message Date
Christophe Dumez
445d000a87 - Removed rc2 from version 2009-08-13 03:54:35 +00:00
Christophe Dumez
3bf89e17e5 - Tagged v1.4.0 release 2009-08-13 03:51:59 +00:00
Christophe Dumez
a038616fe5 - Updated Changelog 2009-08-13 03:48:53 +00:00
Christophe Dumez
81e5c295b6 - Updated German translation 2009-08-13 01:29:57 +00:00
Christophe Dumez
08d079a563 - Updated Swedish, Bulgarian and Greek translations 2009-08-11 01:16:27 +00:00
Christophe Dumez
454c8dc2bc - Fix compilation with Qt 4.3 (closes #410138) 2009-08-07 10:26:02 +00:00
Christophe Dumez
337fc72ee6 - Updated Changelog 2009-08-06 14:19:49 +00:00
Christophe Dumez
b1e9c1ccf5 - Updated preference text since we are spoofing µtorrent now instead of Azureus 2009-08-06 13:14:50 +00:00
Christophe Dumez
64806cb199 - Torrent is moved to temp dir on startup if it is supposed to be complete but data could not be found 2009-08-06 08:58:49 +00:00
Christophe Dumez
8e8e7cd3e7 - Fixed finished torrents returning to download dir on restart when temp dir feature is enabled 2009-08-06 08:48:04 +00:00
Christophe Dumez
27a18e01e2 - Updated Hungarian translation 2009-08-06 04:01:31 +00:00
Christophe Dumez
fc9e7d74a3 - Bump to rc2 2009-08-02 06:36:13 +00:00
Christophe Dumez
037a1875f9 - Use findPkg (pkg-config) to find libtorrent-rasterbar and detected if version is sufficient
- Cleaned up libMagick compilation flags detection
- Minor fixes to About dialog
- Updated language files
- Fixed French translation
2009-08-02 06:33:43 +00:00
Christophe Dumez
66baa4d3dc - Fixed torrent name parsing in Mininova search plugin due to Web site changes (Thanks Lucas Moauro for the patch) 2009-08-02 01:42:38 +00:00
Christophe Dumez
9e522a8a6c - Updated language files 2009-08-02 01:19:02 +00:00
Christophe Dumez
cfa4edd140 - Updated Korean and Italian translations
- Fixes to about dialog
2009-08-02 01:08:14 +00:00
Christophe Dumez
9e9134cd44 - Polished Finnish translation 2009-07-27 07:59:48 +00:00
Christophe Dumez
83a798b07e - Updated Portuguese and Brazilian translations 2009-07-27 01:57:40 +00:00
Christophe Dumez
baee85684c - Updated romanian translation 2009-07-25 16:14:53 +00:00
Christophe Dumez
88afb0f0e7 - Updated Chinese Translation 2009-07-25 13:32:08 +00:00
Christophe Dumez
6f212f18f5 - Updated Russian translation 2009-07-25 12:07:13 +00:00
Christophe Dumez
f04e600340 - Updated Turkish translation 2009-07-25 08:46:07 +00:00
Christophe Dumez
5140886567 - Updated slovak translation 2009-07-24 13:24:10 +00:00
Christophe Dumez
0aa59694fd - Updated Czech translation 2009-07-24 11:29:45 +00:00
Christophe Dumez
66d31b5ca1 - Updated Finnish translation 2009-07-24 11:16:41 +00:00
Christophe Dumez
47135932a4 - Updated Finnish translation 2009-07-24 09:16:26 +00:00
Christophe Dumez
40d0e44f15 - Bump to rc1 2009-07-24 08:32:51 +00:00
Christophe Dumez
16c30a2f10 - Updated language files 2009-07-24 08:16:40 +00:00
Christophe Dumez
7f2639fcbd - Remember visual indexes of columns in transfer lists 2009-07-24 05:53:35 +00:00
Christophe Dumez
8ad987a672 - Save properties window size, position, columns width and restore them
- Set a minimum default width for NAME column in properties
2009-07-24 03:35:55 +00:00
Christophe Dumez
b24194068a - Fixed possible overflow in progress calculation in arborescence.h 2009-07-24 03:00:11 +00:00
Christophe Dumez
f4e9b00ce3 - Fixed a small typo 2009-07-24 02:40:36 +00:00
Christophe Dumez
5c0a24d58b - Fixed "infos" -> "info" typo in torrent properties
- Updated language files
- Updated French translation
2009-07-23 14:15:27 +00:00
Christophe Dumez
c4aa23c86b - Fixed torrent creation (closes #402025) 2009-07-23 09:11:05 +00:00
Christophe Dumez
96911a2c48 - Fixed broken icon for Website link 2009-07-15 11:13:52 +00:00
Christophe Dumez
85abb80f43 - Updated TODO 2009-07-15 11:02:56 +00:00
Christophe Dumez
2372f434cf Fixed a small bug in new DHT port setting code 2009-07-14 08:06:55 +00:00
Christophe Dumez
ee6bc3c2e9 - FEATURE: Allow to set a different port for DHT (UDP) than the one used for
Bittorrent
2009-07-14 07:50:00 +00:00
Christophe Dumez
b6c6637c3b Made IP filter more robust 2009-07-14 06:49:16 +00:00
Christophe Dumez
d358987316 - Updated french translation 2009-07-12 09:25:44 +00:00
Christophe Dumez
6f28711f9e - Updated Changelog 2009-07-12 09:16:29 +00:00
Christophe Dumez
7b4b568859 - Display date as well as time in log window 2009-07-12 09:08:38 +00:00
Christophe Dumez
c3aa2906bb - Tuned lists properties to make sure display is correct 2009-07-12 08:54:33 +00:00
Christophe Dumez
9509bbaed4 - Remove last separator in toolbar 2009-07-12 08:45:05 +00:00
Christophe Dumez
b7c7245fb5 - Display a ratio of 0.0 if total_upload and total_download are both 0 2009-07-12 08:21:06 +00:00
Christophe Dumez
0153b03160 BUGFIX: Stop enforcing UTF-8 and use system locale instead 2009-07-12 08:13:00 +00:00
Christophe Dumez
ca83fdecff - Display swarm information in download list too 2009-07-12 07:51:58 +00:00
Christophe Dumez
bca898d8b6 - torrents with an infinite ratio are no longer affected by ratio_limit set in program preferences 2009-07-12 07:23:11 +00:00
Christophe Dumez
c877c9c412 - Implemented cut/copy/paste actions on right click in search field
- Added icons for menu actions
2009-07-12 07:12:43 +00:00
Christophe Dumez
4dfd1f229b - Updated language files 2009-07-12 06:50:38 +00:00
Christophe Dumez
0d63f46035 - FEATURE: Added right click menu in search engine to clear completion history 2009-07-12 06:42:38 +00:00
Christophe Dumez
106f7cdd32 - Cleanly fixed popup menu positions in lists (no more workarounds) 2009-07-12 06:00:27 +00:00
Christophe Dumez
0308825c11 - Fixed right-click menu position in seeding list 2009-07-12 05:50:42 +00:00
Christophe Dumez
8c21ef5c04 - Updated Changelog 2009-07-12 05:39:08 +00:00
Christophe Dumez
53c2fe4a60 - Display Swarm infos in seeding list (closes #346955)
- Bump to beta3
2009-07-12 05:37:09 +00:00
Christophe Dumez
64fef21a86 - Forcing our own cleanlooks style instead of default one on startup (closes #181796) 2009-07-12 03:35:04 +00:00
Christophe Dumez
f6f4b5f219 - Suppressed QLayout: Attempting to add QLayout "" to properties "properties" warning message when opening a properties dialog (closes #380414) 2009-07-12 03:03:17 +00:00
Christophe Dumez
f809b8a014 - Fixing compiling with Qt 4.3 2009-06-21 15:04:46 +00:00
Christophe Dumez
cf8dbf22f8 - Fixed a bug in download_url() in helpers.py 2009-06-19 06:55:28 +00:00
Christophe Dumez
00d9f7c36b - Fixed IP filter file parsing on 64bits architecture (Fix by Eric Porter) 2009-05-03 15:37:17 +00:00
Christophe Dumez
9a314db530 - Ensured UTF-8 support in novaprinter another way so that we do not require an additional python library 2009-04-30 16:18:29 +00:00
Christophe Dumez
7db2ffc09f - Should fix logout cancelation on KDE 2009-04-28 14:54:43 +00:00
Christophe Dumez
9a02c12ec9 - Updated french and russian translations 2009-04-26 09:03:55 +00:00
Christophe Dumez
2a77de686c - Fix splash screen 2009-04-26 08:19:38 +00:00
Christophe Dumez
a79b294885 - Fix options matching between buttons and frames (closes #366957) 2009-04-26 08:16:12 +00:00
Christophe Dumez
13c670b96d - Code cleanup 2009-04-17 20:16:02 +00:00
Christophe Dumez
65c4da6f0e - BUGFIX: Provide more helpful explanation when an I/O error occured 2009-04-17 20:04:09 +00:00
Christophe Dumez
bf9dc052d3 - Fixed copyright in helpers.py 2009-04-07 06:46:52 +00:00
Christophe Dumez
0ea6ee32be - Now beta2 2009-04-06 20:27:37 +00:00
Christophe Dumez
019bd476db - Forgot to update those headers 2009-04-05 18:48:45 +00:00
Christophe Dumez
baf5cb31af - Fixed typo in novaprinter.py (Thanks Cristian Greco) 2009-04-05 17:06:33 +00:00
Christophe Dumez
fc3c123f5b - Cosmetic license fix 2009-04-05 17:01:22 +00:00
Christophe Dumez
7dfdebd593 - License fix due to problems with OpenSSL 2009-04-05 17:00:55 +00:00
Christophe Dumez
9835af4962 - Fix license due to problems with OpenSSL 2009-04-05 16:34:42 +00:00
Christophe Dumez
04cbd91f04 - Added some debug
- On torrent completion, save its fastresume data *AFTER* it was moved to final directory to avoid big problems (oops)
2009-03-30 22:01:33 +00:00
Christophe Dumez
66db20cb47 - Added ico favicon support to search engine plugins manager (until now, only png was supported)
- Updated server url for search plugins update (new search engine plugins are not compatible with qBittorrent < v1.3.3)
2009-03-30 21:38:56 +00:00
Christophe Dumez
2e0707bc0c - Enabled debug, updated nova2.py version to force update 2009-03-30 20:31:30 +00:00
Christophe Dumez
e9c12cbf78 - Fix search item download when a column was sorted 2009-03-30 13:40:33 +00:00
Christophe Dumez
031de096f5 - Updated Finnish translation 2009-03-30 07:39:10 +00:00
Christophe Dumez
b85ed8ff38 - fix compilation with Qt <= 4.3 2009-03-28 19:55:44 +00:00
Christophe Dumez
00c5127ba1 - Commited some code by mistake 2009-03-27 22:25:34 +00:00
Christophe Dumez
714bf4f2ab - Removed some debug 2009-03-27 22:22:01 +00:00
Christophe Dumez
c2244f746e - Torrent downloading is now handled by search engine plugins to allow for more flexibility 2009-03-27 22:11:41 +00:00
Christophe Dumez
8214d87ce5 - Removed useless variable 2009-03-27 19:52:16 +00:00
Christophe Dumez
e8454596ea - Force UTF-8 printing to terminal 2009-03-27 14:34:30 +00:00
Christophe Dumez
1cc039c147 - Fixed search engine bug that prevented a torrent from appearing more
than once among all tabs
2009-03-27 13:27:54 +00:00
Christophe Dumez
fe455970f1 - use std error output instead of debug output for file error message 2009-03-26 21:08:10 +00:00
Christophe Dumez
36871a34ad - Fix for last commit 2009-03-26 20:59:44 +00:00
Christophe Dumez
4ea6ca75ca - removed debug output 2009-03-26 20:24:34 +00:00
Christophe Dumez
9e46c6c047 - Should completly fix unicode problems for all search engines 2009-03-26 20:14:05 +00:00
Christophe Dumez
a2e9210665 - Fixed unicode in mininova and btjunkie search engines 2009-03-26 16:49:44 +00:00
Christophe Dumez
aaf79add0b - Unicode fix for search engine 2009-03-26 15:46:35 +00:00
Christophe Dumez
55743021e8 - Fixed bug in new temp dir feature
* Completed torrents were moved too
2009-03-17 17:38:41 +00:00
Christophe Dumez
a8d627e1df - resize program preferences window if it does not fit with current
screen resolution
2009-03-15 17:48:20 +00:00
Christophe Dumez
eead11427f - Fix compilation 2009-03-15 15:54:08 +00:00
Christophe Dumez
bec1388ba5 - forgot to commit this file 2009-03-14 15:22:40 +00:00
Christophe Dumez
1542ff98bc - Fixed upload form in web ui 2009-03-12 13:24:18 +00:00
Christophe Dumez
0e9fd2dc3f - bump to beta1 2009-03-09 21:35:06 +00:00
Christophe Dumez
cd618150b0 - Little code optimization 2009-03-09 21:25:39 +00:00
Christophe Dumez
a2bcfa9192 - FEATURE: Resizing a column in a search results tab affects all tabs
- FEATURE: Search results tab columns are now remembered upon startup
2009-03-09 21:24:40 +00:00
Christophe Dumez
1421f1450c - Fixed typo in french translation 2009-03-09 20:34:57 +00:00
Christophe Dumez
288300d264 - Rewrote btjunkie parser (it is now a lot faster and less cpu extensive) 2009-03-09 20:25:34 +00:00
Christophe Dumez
5e41a64c8b - FEATURE: Display total amount of uploaded data in finished list
- Updated language files
2009-03-09 18:37:17 +00:00
Christophe Dumez
f4502367f3 - Allow to define a temporary download folder 2009-03-08 16:26:02 +00:00
Christophe Dumez
273526b414 - Fix signal/slot 2009-03-08 16:14:03 +00:00
Christophe Dumez
5b7b4b2cf3 - Still working on temp folder 2009-03-08 15:40:25 +00:00
Christophe Dumez
ee99df0ba9 - Started work on temp folder
- Use a proper icon for browse buttons
2009-03-08 14:51:27 +00:00
Christophe Dumez
aec32db565 - Updated splash screen 2009-03-08 10:30:15 +00:00
Christophe Dumez
3894452840 - COSMETIC: Redesigned program preferences
- COSMETIC: Updated icons set
2009-03-08 10:28:58 +00:00
202 changed files with 18532 additions and 26503 deletions

View File

@@ -17,6 +17,11 @@ Images Authors:
license: GPLv2 license: GPLv2
url: http://ftp.acc.umu.se/pub/GNOME/sources/gnome-icon-theme url: http://ftp.acc.umu.se/pub/GNOME/sources/gnome-icon-theme
* files: src/oxygen/*.png
copyright: Oxygen Icon Theme (KDE)
license: LGPL
url: http://www.oxygen-icons.org
* files: src/Icons/flags/*.png * files: src/Icons/flags/*.png
copyright: Open Clip Art Library copyright: Open Clip Art Library
license: Creative Commons Public Domain Dedication license: Creative Commons Public Domain Dedication

14
COPYING
View File

@@ -1,3 +1,17 @@
qBittorrent is licensed under the GNU General Public License version 2 with the
addition of the following special exception:
In addition, as a special exception, the copyright holders give permission to
link this program with the OpenSSL project's "OpenSSL" library (or with
modified versions of it that use the same license as the "OpenSSL" library),
and distribute the linked executables. You must obey the GNU General Public
License in all respects for all of the code used other than "OpenSSL". If you
modify file(s), you may extend this exception to your version of the file(s),
but you are not obligated to do so. If you do not wish to do so, delete this
exception statement from your version.
----------
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
Version 2, June 1991 Version 2, June 1991

View File

@@ -1,3 +1,51 @@
* Thu Aug 13 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.4.0
- FEATURE: Display swarm information in lists
- FEATURE: Allow to define temporary download folder
- FEATURE: Display total amount of uploaded data in finished list
- FEATURE: Resizing a column in a search results tab affects all tabs
- FEATURE: Search results tab columns are now remembered upon startup
- FEATURE: Added right click menu in search engine to clear completion history
- FEATURE: Allow to set a different port for DHT (UDP) than the one used for Bittorrent
- FEATURE: Updated spoofing code to avoid trackers ban
- BUGFIX: Provide more helpful explanation when an I/O error occured
- BUGFIX: Stop enforcing UTF-8 and use system locale instead
- COSMETIC: Redesigned program preferences
- COSMETIC: Updated icons set
* Fri Jul 24 2009 - Christophe DUMEZ <chris@qbittorrent.org> - 1.3.5
- BUGFIX: Made IP filter parser more robust
- BUGFIX: Fixed torrent creation tool
- BUGFIX: Fixed possible overflow in progress calculation in arborescence.h
- BUGFIX: Save properties window size, position, columns width and restore them
- BUGFIX: Set a minimum default width for NAME column in properties
- BUGFIX: Remember visual indexes of columns in transfer lists
* Sun Jul 12 2009 - Christophe DUMEZ <chris@qbittorrent.org> - v1.3.4
- BUGFIX: Fixed IP filter file parsing on 64bits
- BUGFIX: Suppressed QLayout: Attempting to add QLayout "" to properties "properties" warning message when opening a properties dialog
- BUGFIX: Fixed a little bug in search engine plugins helper file
- BUGFIX: Fixed compilation problems with Qt 4.3
- BUGFIX: Percentages no longer disapear with default cleanlooks style
- BUGFIX: Cleanly fixed popup menus position in lists (no more workarounds)
- BUGFIX: Fixed memory leak in search engine
- BUGFIX: Torrents with an infinite ratio are no longer affected by ratio_limit set in program preferences
- BUGFIX: Display a ratio of 0.0 if total_upload and total_download are both 0
- BUGFIX: Remove last separator in top tool bar
- BUGFIX: Tuned lists properties to make sure display is correct
- COSMETIC: Display date as well as time in log window
* Sun Apr 5 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.3.3
- BUGFIX: Fixed Web UI torrent upload form
- BUGFIX: Fixed unicode support in search engine
- BUGFIX: Fixed search engine bug that prevented a torrent from appearing more than once among all tabs
- LICENSE: Added an exception to the license regarding OpenSSL.
- I18N: Updated Finnish translation
* Sat Mar 7 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.3.2
- BUGFIX: Fix top toolbar disabling
- BUGFIX: Fix building with Qt 4.5
- BUGFIX: RSS items read status is now remembered upon restart
* Mon Jan 26 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.3.1 * Mon Jan 26 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.3.1
- BUGFIX: Torrents paused due to an I/O error were displayed as queued - BUGFIX: Torrents paused due to an I/O error were displayed as queued
- BUGFIX: qBittorrent now prints backtrace in terminal when segfaulting - BUGFIX: qBittorrent now prints backtrace in terminal when segfaulting

25
TODO
View File

@@ -1,27 +1,2 @@
See https://blueprints.launchpad.net/qbittorrent/ See https://blueprints.launchpad.net/qbittorrent/
// TODO in v1.4.0
- Display peers information (disabled as a default)
- Automatically move torrent to another directory on completion (disabled as a default)
- Rework program preferences (make easier)
- Provide better errors messages to make debugging easier
// translations done in v1.3.0
- Romanian
- Russian
- Hungarian
- German
- Chinese (traditional)
- Chinese (simplified)
- Italian
- Swedish
- Turkish
- French
- Slovak
- Czech
- Korean
- Portuguese
- Brazilian
- Greek
- Bulgarian
- Finnish

109
configure vendored
View File

@@ -18,17 +18,12 @@ Main options:
--help This help text. --help This help text.
Dependency options: Dependency options:
--with-libtorrent-inc=[path] Path to libtorrent-rasterbar include --with-libboost-inc=[path] Path to libboost include files
files --with-libcurl-inc=[path] Path to libcurl include files
--with-libtorrent-lib=[path] Path to libtorrent-rasterbar library --with-libcurl-lib=[path] Path to libcurl library files
files --disable-libzzip Disable use of libzzip
--with-libtorrent-static-lib=[path] Path to libtorrent-rasterbar .a file --with-libzzip-inc=[path] Path to libzzip++ include files
--with-libboost-inc=[path] Path to libboost include files --with-libzzip-lib=[path] Path to libzzip++ library files
--with-libcurl-inc=[path] Path to libcurl include files
--with-libcurl-lib=[path] Path to libcurl library files
--disable-libzzip Disable use of libzzip
--with-libzzip-inc=[path] Path to libzzip++ include files
--with-libzzip-lib=[path] Path to libzzip++ library files
EOT EOT
} }
@@ -145,21 +140,6 @@ while [ $# -gt 0 ]; do
shift shift
;; ;;
--with-libtorrent-inc=*)
QC_WITH_LIBTORRENT_INC=$optarg
shift
;;
--with-libtorrent-lib=*)
QC_WITH_LIBTORRENT_LIB=$optarg
shift
;;
--with-libtorrent-static-lib=*)
QC_WITH_LIBTORRENT_STATIC_LIB=$optarg
shift
;;
--with-libboost-inc=*) --with-libboost-inc=*)
QC_WITH_LIBBOOST_INC=$optarg QC_WITH_LIBBOOST_INC=$optarg
shift shift
@@ -211,9 +191,6 @@ echo PREFIX=$PREFIX
echo BINDIR=$BINDIR echo BINDIR=$BINDIR
echo DATADIR=$DATADIR echo DATADIR=$DATADIR
echo EX_QTDIR=$EX_QTDIR echo EX_QTDIR=$EX_QTDIR
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_LIBBOOST_INC=$QC_WITH_LIBBOOST_INC
echo QC_WITH_LIBCURL_INC=$QC_WITH_LIBCURL_INC echo QC_WITH_LIBCURL_INC=$QC_WITH_LIBCURL_INC
echo QC_WITH_LIBCURL_LIB=$QC_WITH_LIBCURL_LIB echo QC_WITH_LIBCURL_LIB=$QC_WITH_LIBCURL_LIB
@@ -346,70 +323,29 @@ public:
/* /*
-----BEGIN QCMOD----- -----BEGIN QCMOD-----
name: libtorrent-rasterbar name: libtorrent-rasterbar
arg: with-libtorrent-inc=[path], Path to libtorrent-rasterbar include files
arg: with-libtorrent-lib=[path], Path to libtorrent-rasterbar library files
arg: with-libtorrent-static-lib=[path], Path to libtorrent-rasterbar .a file
-----END QCMOD----- -----END QCMOD-----
*/ */
// see Conf::findPkgConfig
class qc_libtorrent_rasterbar : public ConfObj class qc_libtorrent_rasterbar : public ConfObj
{ {
public: public:
qc_libtorrent_rasterbar(Conf *c) : ConfObj(c) {} qc_libtorrent_rasterbar(Conf *c) : ConfObj(c) {}
QString name() const { return "libtorrent-rasterbar >= 0.14"; } QString name() const { return "libtorrent-rasterbar >= 0.14.0 (>= 0.14.4 advised)"; }
QString shortname() const { return "libtorrent-rasterbar"; } QString shortname() const { return "libtorrent-rasterbar"; }
bool exec(){ bool exec(){
QString s; QStringList incs;
s = conf->getenv("QC_WITH_LIBTORRENT_INC"); QString req_ver = "0.14.0";
if(!s.isEmpty()) { QString adv_ver = "0.14.4";
if(!conf->checkHeader(s, "libtorrent/magnet_uri.hpp")) { QString version, libs, other;
return false; VersionMode mode = VersionMin;
} if(!conf->findPkgConfig("libtorrent-rasterbar", mode, req_ver, &version, &incs, &libs, &other))
}else{ return false;
QStringList sl; for(int n = 0; n < incs.count(); ++n)
sl << "/usr/include"; conf->addIncludePath(incs[n]);
sl << "/usr/local/include"; if(!libs.isEmpty())
bool found = false; conf->addLib(libs);
foreach(s, sl){ if(!conf->findPkgConfig("libtorrent-rasterbar", mode, adv_ver, &version, &incs, &libs, &other))
if(conf->checkHeader(s, "libtorrent/magnet_uri.hpp")){ printf("\nWarning: libtorrent-rasterbar v%s was detected. Although it will compile and run, you will probably experience some bugs. Please consider updating to v%s!\n", version.toUtf8().data(), adv_ver.toUtf8().data());
found = true;
break;
}
}
if(!found) {
return false;
}
}
conf->addIncludePath(s);
conf->addIncludePath(s+QDir::separator()+"libtorrent");
s = conf->getenv("QC_WITH_LIBTORRENT_STATIC_LIB");
if(!s.isEmpty() && QFile::exists(s) && s.endsWith(".a")){
conf->addLib(s);
return true;
}
s = conf->getenv("QC_WITH_LIBTORRENT_LIB");
if(!s.isEmpty()) {
if(!conf->checkLibrary(s, "torrent-rasterbar")) {
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(conf->checkLibrary(s, "torrent-rasterbar")){
found = true;
break;
}
}
if(!found) return false;
conf->addLib(QString("-L") + s);
}
return true; return true;
} }
}; };
@@ -1567,9 +1503,6 @@ export PREFIX
export BINDIR export BINDIR
export DATADIR export DATADIR
export EX_QTDIR export EX_QTDIR
export QC_WITH_LIBTORRENT_INC
export QC_WITH_LIBTORRENT_LIB
export QC_WITH_LIBTORRENT_STATIC_LIB
export QC_WITH_LIBBOOST_INC export QC_WITH_LIBBOOST_INC
export QC_WITH_LIBCURL_INC export QC_WITH_LIBCURL_INC
export QC_WITH_LIBCURL_LIB export QC_WITH_LIBCURL_LIB

View File

@@ -64,14 +64,11 @@ public:
return false; return false;
} }
conf->addLib(QString("-L") + s); conf->addLib(QString("-L") + s);
QProcess magickConfig; QString out = "";
QStringList params; QStringList params;
params << "--libs"; params << "--libs";
magickConfig.start("Magick++-config", params, QIODevice::ReadOnly); qconf->doCommand("Magick++-config", params, &out);
magickConfig.waitForStarted(); out = out.replace("\n", "");
magickConfig.waitForFinished();
QByteArray result = magickConfig.readAll();
result = result.replace("\n", "");
conf->addLib(result.data()); conf->addLib(result.data());
conf->addDefine("HAVE_MAGICK"); conf->addDefine("HAVE_MAGICK");
return true; return true;

View File

@@ -1,9 +1,6 @@
/* /*
-----BEGIN QCMOD----- -----BEGIN QCMOD-----
name: libtorrent-rasterbar name: libtorrent-rasterbar
arg: with-libtorrent-inc=[path], Path to libtorrent-rasterbar include files
arg: with-libtorrent-lib=[path], Path to libtorrent-rasterbar library files
arg: with-libtorrent-static-lib=[path], Path to libtorrent-rasterbar .a file
-----END QCMOD----- -----END QCMOD-----
*/ */
// see Conf::findPkgConfig // see Conf::findPkgConfig
@@ -11,61 +8,22 @@ class qc_libtorrent_rasterbar : public ConfObj
{ {
public: public:
qc_libtorrent_rasterbar(Conf *c) : ConfObj(c) {} qc_libtorrent_rasterbar(Conf *c) : ConfObj(c) {}
QString name() const { return "libtorrent-rasterbar >= 0.14"; } QString name() const { return "libtorrent-rasterbar >= 0.14.0 (>= 0.14.4 advised)"; }
QString shortname() const { return "libtorrent-rasterbar"; } QString shortname() const { return "libtorrent-rasterbar"; }
bool exec(){ bool exec(){
QString s; QStringList incs;
s = conf->getenv("QC_WITH_LIBTORRENT_INC"); QString req_ver = "0.14.0";
if(!s.isEmpty()) { QString adv_ver = "0.14.4";
if(!conf->checkHeader(s, "libtorrent/magnet_uri.hpp")) { QString version, libs, other;
return false; VersionMode mode = VersionMin;
} if(!conf->findPkgConfig("libtorrent-rasterbar", mode, req_ver, &version, &incs, &libs, &other))
}else{ return false;
QStringList sl; for(int n = 0; n < incs.count(); ++n)
sl << "/usr/include"; conf->addIncludePath(incs[n]);
sl << "/usr/local/include"; if(!libs.isEmpty())
bool found = false; conf->addLib(libs);
foreach(s, sl){ if(!conf->findPkgConfig("libtorrent-rasterbar", mode, adv_ver, &version, &incs, &libs, &other))
if(conf->checkHeader(s, "libtorrent/magnet_uri.hpp")){ printf("\nWarning: libtorrent-rasterbar v%s was detected. Although it will compile and run, you will probably experience some bugs. Please consider updating to v%s!\n", version.toUtf8().data(), adv_ver.toUtf8().data());
found = true;
break;
}
}
if(!found) {
return false;
}
}
conf->addIncludePath(s);
conf->addIncludePath(s+QDir::separator()+"libtorrent");
s = conf->getenv("QC_WITH_LIBTORRENT_STATIC_LIB");
if(!s.isEmpty() && QFile::exists(s) && s.endsWith(".a")){
conf->addLib(s);
return true;
}
s = conf->getenv("QC_WITH_LIBTORRENT_LIB");
if(!s.isEmpty()) {
if(!conf->checkLibrary(s, "torrent-rasterbar")) {
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(conf->checkLibrary(s, "torrent-rasterbar")){
found = true;
break;
}
}
if(!found) return false;
conf->addLib(QString("-L") + s);
}
return true; return true;
} }
}; };

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */
@@ -35,9 +44,13 @@
#define F_NAME 0 #define F_NAME 0
#define F_SIZE 1 #define F_SIZE 1
#define F_UPSPEED 2 #define F_UPSPEED 2
#define F_LEECH 3 #define F_SWARM 3
#define F_RATIO 4 #define F_PEERS 4
#define F_HASH 5 #define F_UPLOAD 5
#define F_RATIO 6
#define F_HASH 7
#define MAX_RATIO 100.
class FinishedListDelegate: public QItemDelegate { class FinishedListDelegate: public QItemDelegate {
Q_OBJECT Q_OBJECT
@@ -51,6 +64,7 @@ class FinishedListDelegate: public QItemDelegate {
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option); QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
switch(index.column()){ switch(index.column()){
case F_SIZE: case F_SIZE:
case F_UPLOAD:
QItemDelegate::drawBackground(painter, opt, index); QItemDelegate::drawBackground(painter, opt, index);
QItemDelegate::drawDisplay(painter, opt, option.rect, misc::friendlyUnit(index.data().toLongLong())); QItemDelegate::drawDisplay(painter, opt, option.rect, misc::friendlyUnit(index.data().toLongLong()));
break; break;
@@ -63,7 +77,7 @@ class FinishedListDelegate: public QItemDelegate {
case F_RATIO:{ case F_RATIO:{
QItemDelegate::drawBackground(painter, opt, index); QItemDelegate::drawBackground(painter, opt, index);
double ratio = index.data().toDouble(); double ratio = index.data().toDouble();
if(ratio > 100.) if(ratio > MAX_RATIO)
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::fromUtf8("")); QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::fromUtf8(""));
else else
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString(QByteArray::number(ratio, 'f', 1))); QItemDelegate::drawDisplay(painter, opt, opt.rect, QString(QByteArray::number(ratio, 'f', 1)));

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */
#include "FinishedTorrents.h" #include "FinishedTorrents.h"
@@ -37,13 +46,17 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par
setupUi(this); setupUi(this);
actionStart->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/play.png"))); actionStart->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/play.png")));
actionPause->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/pause.png"))); actionPause->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/pause.png")));
finishedListModel = new QStandardItemModel(0,6); finishedListModel = new QStandardItemModel(0,8);
finishedListModel->setHeaderData(F_NAME, Qt::Horizontal, tr("Name", "i.e: file name")); finishedListModel->setHeaderData(F_NAME, Qt::Horizontal, tr("Name", "i.e: file name"));
finishedListModel->setHeaderData(F_SIZE, Qt::Horizontal, tr("Size", "i.e: file size")); finishedListModel->setHeaderData(F_SIZE, Qt::Horizontal, tr("Size", "i.e: file size"));
finishedListModel->setHeaderData(F_UPSPEED, Qt::Horizontal, tr("UP Speed", "i.e: Upload speed")); finishedListModel->setHeaderData(F_UPSPEED, Qt::Horizontal, tr("UP Speed", "i.e: Upload speed"));
finishedListModel->setHeaderData(F_LEECH, Qt::Horizontal, tr("Leechers", "i.e: full/partial sources")); finishedListModel->setHeaderData(F_SWARM, Qt::Horizontal, tr("Seeds / Leechers"));
finishedListModel->setHeaderData(F_PEERS, Qt::Horizontal, tr("Connected peers"));
finishedListModel->setHeaderData(F_UPLOAD, Qt::Horizontal, tr("Total uploaded", "i.e: Total amount of uploaded data"));
finishedListModel->setHeaderData(F_RATIO, Qt::Horizontal, tr("Ratio")); finishedListModel->setHeaderData(F_RATIO, Qt::Horizontal, tr("Ratio"));
finishedList->setModel(finishedListModel); finishedList->setModel(finishedListModel);
finishedList->setRootIsDecorated(false);
finishedList->setAllColumnsShowFocus(true);
loadHiddenColumns(); loadHiddenColumns();
// Hide hash column // Hide hash column
finishedList->hideColumn(F_HASH); finishedList->hideColumn(F_HASH);
@@ -79,7 +92,9 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par
connect(actionHOSColName, SIGNAL(triggered()), this, SLOT(hideOrShowColumnName())); connect(actionHOSColName, SIGNAL(triggered()), this, SLOT(hideOrShowColumnName()));
connect(actionHOSColSize, SIGNAL(triggered()), this, SLOT(hideOrShowColumnSize())); connect(actionHOSColSize, SIGNAL(triggered()), this, SLOT(hideOrShowColumnSize()));
connect(actionHOSColUpSpeed, SIGNAL(triggered()), this, SLOT(hideOrShowColumnUpSpeed())); connect(actionHOSColUpSpeed, SIGNAL(triggered()), this, SLOT(hideOrShowColumnUpSpeed()));
connect(actionHOSColLeechers, SIGNAL(triggered()), this, SLOT(hideOrShowColumnLeechers())); connect(actionHOSColSwarm, SIGNAL(triggered()), this, SLOT(hideOrShowColumnSwarm()));
connect(actionHOSColPeers, SIGNAL(triggered()), this, SLOT(hideOrShowColumnPeers()));
connect(actionHOSColUpload, SIGNAL(triggered()), this, SLOT(hideOrShowColumnUpload()));
connect(actionHOSColRatio, SIGNAL(triggered()), this, SLOT(hideOrShowColumnRatio())); connect(actionHOSColRatio, SIGNAL(triggered()), this, SLOT(hideOrShowColumnRatio()));
} }
@@ -106,7 +121,9 @@ void FinishedTorrents::addTorrent(QString hash){
finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(h.name())); finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(h.name()));
finishedListModel->setData(finishedListModel->index(row, F_SIZE), QVariant((qlonglong)h.actual_size())); finishedListModel->setData(finishedListModel->index(row, F_SIZE), QVariant((qlonglong)h.actual_size()));
finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)0.)); finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)0.));
finishedListModel->setData(finishedListModel->index(row, F_LEECH), QVariant("0")); finishedListModel->setData(finishedListModel->index(row, F_SWARM), QVariant("-1/-1"));
finishedListModel->setData(finishedListModel->index(row, F_PEERS), QVariant("0"));
finishedListModel->setData(finishedListModel->index(row, F_UPLOAD), QVariant((qlonglong)h.all_time_upload()));
finishedListModel->setData(finishedListModel->index(row, F_RATIO), QVariant(QString::fromUtf8(misc::toString(BTSession->getRealRatio(hash)).c_str()))); finishedListModel->setData(finishedListModel->index(row, F_RATIO), QVariant(QString::fromUtf8(misc::toString(BTSession->getRealRatio(hash)).c_str())));
finishedListModel->setData(finishedListModel->index(row, F_HASH), QVariant(hash)); finishedListModel->setData(finishedListModel->index(row, F_HASH), QVariant(hash));
if(h.is_paused()) { if(h.is_paused()) {
@@ -165,6 +182,23 @@ bool FinishedTorrents::loadColWidthFinishedList(){
finishedList->header()->resizeSection(i, width_list.at(i).toInt()); finishedList->header()->resizeSection(i, width_list.at(i).toInt());
} }
loadLastSortedColumn(); loadLastSortedColumn();
QVariantList visualIndexes = settings.value(QString::fromUtf8("FinishedListVisualIndexes"), QVariantList()).toList();
if(visualIndexes.size() != finishedListModel->columnCount()-1) {
qDebug("Corrupted values for download list columns sizes");
return false;
}
bool change = false;
do {
change = false;
for(int i=0;i<visualIndexes.size(); ++i) {
int new_visual_index = visualIndexes.at(finishedList->header()->logicalIndex(i)).toInt();
if(i != new_visual_index) {
qDebug("Moving column from %d to %d", finishedList->header()->logicalIndex(i), new_visual_index);
finishedList->header()->moveSection(i, new_visual_index);
change = true;
}
}
}while(change);
qDebug("Finished list columns width loaded"); qDebug("Finished list columns width loaded");
return true; return true;
} }
@@ -199,7 +233,7 @@ void FinishedTorrents::saveColWidthFinishedList() const{
width_list = line.split(' '); width_list = line.split(' ');
} }
for(short i=0; i<nbColumns; ++i){ for(short i=0; i<nbColumns; ++i){
if(finishedList->columnWidth(i)<1 && width_list.size() == finishedListModel->columnCount()-1 && width_list.at(i).toInt()>=1) { if(finishedList->columnWidth(i)<1 && width_list.size() == nbColumns && width_list.at(i).toInt()>=1) {
// load the former width // load the former width
new_width_list << width_list.at(i); new_width_list << width_list.at(i);
} else if(finishedList->columnWidth(i)>=1) { } else if(finishedList->columnWidth(i)>=1) {
@@ -212,6 +246,11 @@ void FinishedTorrents::saveColWidthFinishedList() const{
} }
} }
settings.setValue("FinishedListColsWidth", new_width_list.join(" ")); settings.setValue("FinishedListColsWidth", new_width_list.join(" "));
QVariantList visualIndexes;
for(int i=0; i<nbColumns; ++i) {
visualIndexes.append(finishedList->header()->visualIndex(i));
}
settings.setValue(QString::fromUtf8("FinishedListVisualIndexes"), visualIndexes);
qDebug("Finished list columns width saved"); qDebug("Finished list columns width saved");
} }
@@ -236,22 +275,25 @@ void FinishedTorrents::updateTorrent(QTorrentHandle h) {
row = getRowFromHash(hash); row = getRowFromHash(hash);
} }
Q_ASSERT(row != -1); Q_ASSERT(row != -1);
if(!finishedList->isColumnHidden(F_SWARM)) {
finishedListModel->setData(finishedListModel->index(row, F_SWARM), misc::toQString(h.num_complete())+QString("/")+misc::toQString(h.num_incomplete()));
}
if(h.is_paused()) return; if(h.is_paused()) return;
// Update queued torrent // Update queued torrent
if(BTSession->isQueueingEnabled() && h.is_queued()) { if(BTSession->isQueueingEnabled() && h.is_queued()) {
if(h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking){ if(h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking){
finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/time.png"))), Qt::DecorationRole); finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/oxygen/time.png"))), Qt::DecorationRole);
} else { } else {
finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/queued.png"))), Qt::DecorationRole); finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/queued.png"))), Qt::DecorationRole);
} }
// Reset upload speed and seeds/leech // Reset upload speed and seeds/leech
finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), 0.); finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), 0.);
finishedListModel->setData(finishedListModel->index(row, F_LEECH), "0"); finishedListModel->setData(finishedListModel->index(row, F_PEERS), "0");
setRowColor(row, QString::fromUtf8("grey")); setRowColor(row, QString::fromUtf8("grey"));
return; return;
} }
if(h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking){ if(h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking){
finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/time.png"))), Qt::DecorationRole); finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/oxygen/time.png"))), Qt::DecorationRole);
setRowColor(row, QString::fromUtf8("grey")); setRowColor(row, QString::fromUtf8("grey"));
return; return;
} }
@@ -260,8 +302,11 @@ void FinishedTorrents::updateTorrent(QTorrentHandle h) {
if(!finishedList->isColumnHidden(F_UPSPEED)) { if(!finishedList->isColumnHidden(F_UPSPEED)) {
finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)h.upload_payload_rate())); finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)h.upload_payload_rate()));
} }
if(!finishedList->isColumnHidden(F_LEECH)) { if(!finishedList->isColumnHidden(F_PEERS)) {
finishedListModel->setData(finishedListModel->index(row, F_LEECH), misc::toQString(h.num_peers() - h.num_seeds(), true)); finishedListModel->setData(finishedListModel->index(row, F_PEERS), misc::toQString(h.num_peers() - h.num_seeds(), true));
}
if(!finishedList->isColumnHidden(F_UPLOAD)) {
finishedListModel->setData(finishedListModel->index(row, F_UPLOAD), QVariant((double)h.all_time_upload()));
} }
if(!finishedList->isColumnHidden(F_RATIO)) { if(!finishedList->isColumnHidden(F_RATIO)) {
finishedListModel->setData(finishedListModel->index(row, F_RATIO), QVariant(misc::toQString(BTSession->getRealRatio(hash)))); finishedListModel->setData(finishedListModel->index(row, F_RATIO), QVariant(misc::toQString(BTSession->getRealRatio(hash))));
@@ -285,7 +330,7 @@ void FinishedTorrents::pauseTorrent(QString hash) {
return; return;
finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)0.0)); finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)0.0));
finishedListModel->setData(finishedListModel->index(row, F_NAME), QIcon(QString::fromUtf8(":/Icons/skin/paused.png")), Qt::DecorationRole); finishedListModel->setData(finishedListModel->index(row, F_NAME), QIcon(QString::fromUtf8(":/Icons/skin/paused.png")), Qt::DecorationRole);
finishedListModel->setData(finishedListModel->index(row, F_LEECH), QVariant(QString::fromUtf8("0"))); finishedListModel->setData(finishedListModel->index(row, F_PEERS), QVariant(QString::fromUtf8("0")));
setRowColor(row, QString::fromUtf8("red")); setRowColor(row, QString::fromUtf8("red"));
} }
@@ -341,12 +386,13 @@ void FinishedTorrents::forceRecheck(){
if(index.column() == F_NAME){ if(index.column() == F_NAME){
QString hash = finishedListModel->data(finishedListModel->index(index.row(), F_HASH)).toString(); QString hash = finishedListModel->data(finishedListModel->index(index.row(), F_HASH)).toString();
QTorrentHandle h = BTSession->getTorrentHandle(hash); QTorrentHandle h = BTSession->getTorrentHandle(hash);
qDebug("Forcing recheck for torrent %s", hash.toLocal8Bit().data());
h.force_recheck(); h.force_recheck();
} }
} }
} }
void FinishedTorrents::displayFinishedListMenu(const QPoint& pos){ void FinishedTorrents::displayFinishedListMenu(const QPoint&){
QMenu myFinishedListMenu(this); QMenu myFinishedListMenu(this);
// 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();
@@ -390,8 +436,7 @@ void FinishedTorrents::displayFinishedListMenu(const QPoint& pos){
myFinishedListMenu.addAction(actionBuy_it); myFinishedListMenu.addAction(actionBuy_it);
// Call menu // Call menu
// XXX: why mapToGlobal() is not enough? myFinishedListMenu.exec(QCursor::pos());
myFinishedListMenu.exec(mapToGlobal(pos)+QPoint(10,58));
} }
@@ -426,12 +471,12 @@ void FinishedTorrents::hideOrShowColumn(int index) {
if(nbVisibleColumns <= 1) return; if(nbVisibleColumns <= 1) return;
// User can hide the column, do it. // User can hide the column, do it.
finishedList->setColumnHidden(index, true); finishedList->setColumnHidden(index, true);
getActionHoSCol(index)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_cancel.png"))); getActionHoSCol(index)->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/button_cancel.png")));
--nbVisibleColumns; --nbVisibleColumns;
} else { } else {
// User want to display the column // User want to display the column
finishedList->setColumnHidden(index, false); finishedList->setColumnHidden(index, false);
getActionHoSCol(index)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_ok.png"))); getActionHoSCol(index)->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/button_ok.png")));
++nbVisibleColumns; ++nbVisibleColumns;
} }
//resize all others non-hidden columns //resize all others non-hidden columns
@@ -454,8 +499,16 @@ void FinishedTorrents::hideOrShowColumnUpSpeed() {
hideOrShowColumn(F_UPSPEED); hideOrShowColumn(F_UPSPEED);
} }
void FinishedTorrents::hideOrShowColumnLeechers() { void FinishedTorrents::hideOrShowColumnSwarm() {
hideOrShowColumn(F_LEECH); hideOrShowColumn(F_SWARM);
}
void FinishedTorrents::hideOrShowColumnPeers() {
hideOrShowColumn(F_PEERS);
}
void FinishedTorrents::hideOrShowColumnUpload() {
hideOrShowColumn(F_UPLOAD);
} }
void FinishedTorrents::hideOrShowColumnRatio() { void FinishedTorrents::hideOrShowColumnRatio() {
@@ -481,9 +534,9 @@ bool FinishedTorrents::loadHiddenColumns() {
for(int i=0; i<finishedListModel->columnCount()-1; i++) { for(int i=0; i<finishedListModel->columnCount()-1; i++) {
if(loaded && ishidden_list.at(i) == "0") { if(loaded && ishidden_list.at(i) == "0") {
finishedList->setColumnHidden(i, true); finishedList->setColumnHidden(i, true);
getActionHoSCol(i)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_cancel.png"))); getActionHoSCol(i)->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/button_cancel.png")));
} else { } else {
getActionHoSCol(i)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_ok.png"))); getActionHoSCol(i)->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/button_ok.png")));
} }
} }
return loaded; return loaded;
@@ -517,8 +570,14 @@ QAction* FinishedTorrents::getActionHoSCol(int index) {
case F_UPSPEED : case F_UPSPEED :
return actionHOSColUpSpeed; return actionHOSColUpSpeed;
break; break;
case F_LEECH : case F_SWARM :
return actionHOSColLeechers; return actionHOSColSwarm;
break;
case F_PEERS :
return actionHOSColPeers;
break;
case F_UPLOAD :
return actionHOSColUpload;
break; break;
case F_RATIO : case F_RATIO :
return actionHOSColRatio; return actionHOSColRatio;
@@ -542,6 +601,7 @@ void FinishedTorrents::toggleFinishedListSortOrder(int index) {
case F_SIZE: case F_SIZE:
case F_UPSPEED: case F_UPSPEED:
case F_RATIO: case F_RATIO:
case F_UPLOAD:
sortFinishedListFloat(index, sortOrder); sortFinishedListFloat(index, sortOrder);
break; break;
default: default:
@@ -566,6 +626,8 @@ void FinishedTorrents::sortFinishedList(int index, Qt::SortOrder sortOrder){
switch(index) { switch(index) {
case F_SIZE: case F_SIZE:
case F_UPSPEED: case F_UPSPEED:
case F_UPLOAD:
case F_RATIO:
sortFinishedListFloat(index, sortOrder); sortFinishedListFloat(index, sortOrder);
break; break;
default: default:

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */
@@ -70,7 +79,9 @@ class FinishedTorrents : public QWidget, public Ui::seeding {
void hideOrShowColumnName(); void hideOrShowColumnName();
void hideOrShowColumnSize(); void hideOrShowColumnSize();
void hideOrShowColumnUpSpeed(); void hideOrShowColumnUpSpeed();
void hideOrShowColumnLeechers(); void hideOrShowColumnSwarm();
void hideOrShowColumnPeers();
void hideOrShowColumnUpload();
void hideOrShowColumnRatio(); void hideOrShowColumnRatio();
void forceRecheck(); void forceRecheck();

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */
#include <QFileDialog> #include <QFileDialog>
@@ -90,14 +99,14 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
qDebug("Info: System tray unavailable"); qDebug("Info: System tray unavailable");
} }
// Setting icons // Setting icons
this->setWindowIcon(QIcon(QString::fromUtf8(":/Icons/qbittorrent32.png"))); this->setWindowIcon(QIcon(QString::fromUtf8(":/Icons/skin/qbittorrent32.png")));
actionOpen->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/open.png"))); actionOpen->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/open.png")));
actionExit->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/exit.png"))); actionExit->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/exit.png")));
actionDownload_from_URL->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/url.png"))); actionDownload_from_URL->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/url.png")));
actionOptions->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/settings.png"))); actionOptions->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/settings.png")));
actionAbout->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/info.png"))); actionAbout->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/info.png")));
actionWebsite->setIcon(QIcon(QString::fromUtf8(":/Icons/qbittorrent32.png"))); actionWebsite->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/qbittorrent32.png")));
actionBugReport->setIcon(QIcon(QString::fromUtf8(":/Icons/newmsg.png"))); actionBugReport->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/bug.png")));
actionStart->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/play.png"))); actionStart->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/play.png")));
actionPause->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/pause.png"))); actionPause->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/pause.png")));
actionDelete->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/delete.png"))); actionDelete->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/delete.png")));
@@ -123,7 +132,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
options = new options_imp(this); options = new options_imp(this);
connect(options, SIGNAL(status_changed(bool)), this, SLOT(OptionsSaved(bool))); connect(options, SIGNAL(status_changed(bool)), this, SLOT(OptionsSaved(bool)));
BTSession = new bittorrent(); BTSession = new bittorrent();
connect(BTSession, SIGNAL(fullDiskError(QTorrentHandle&)), this, SLOT(fullDiskError(QTorrentHandle&))); connect(BTSession, SIGNAL(fullDiskError(QTorrentHandle&, QString)), this, SLOT(fullDiskError(QTorrentHandle&, QString)));
connect(BTSession, SIGNAL(finishedTorrent(QTorrentHandle&)), this, SLOT(finishedTorrent(QTorrentHandle&))); connect(BTSession, SIGNAL(finishedTorrent(QTorrentHandle&)), this, SLOT(finishedTorrent(QTorrentHandle&)));
connect(BTSession, SIGNAL(addedTorrent(QTorrentHandle&)), this, SLOT(addedTorrent(QTorrentHandle&))); connect(BTSession, SIGNAL(addedTorrent(QTorrentHandle&)), this, SLOT(addedTorrent(QTorrentHandle&)));
connect(BTSession, SIGNAL(pausedTorrent(QTorrentHandle&)), this, SLOT(pausedTorrent(QTorrentHandle&))); connect(BTSession, SIGNAL(pausedTorrent(QTorrentHandle&)), this, SLOT(pausedTorrent(QTorrentHandle&)));
@@ -240,6 +249,9 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
if(!settings.value(QString::fromUtf8("Preferences/General/StartMinimized"), false).toBool()) { if(!settings.value(QString::fromUtf8("Preferences/General/StartMinimized"), false).toBool()) {
show(); show();
} }
scrapeTimer = new QTimer(this);
connect(scrapeTimer, SIGNAL(timeout()), this, SLOT(scrapeTrackers()));
scrapeTimer->start(20000);
qDebug("GUI Built"); qDebug("GUI Built");
} }
@@ -251,6 +263,8 @@ GUI::~GUI() {
BTSession->saveDHTEntry(); BTSession->saveDHTEntry();
BTSession->saveSessionState(); BTSession->saveSessionState();
BTSession->saveFastResumeData(); BTSession->saveFastResumeData();
scrapeTimer->stop();
delete scrapeTimer;
delete dlSpeedLbl; delete dlSpeedLbl;
delete upSpeedLbl; delete upSpeedLbl;
delete ratioLbl; delete ratioLbl;
@@ -310,6 +324,16 @@ void GUI::displayRSSTab(bool enable) {
} }
} }
void GUI::scrapeTrackers() {
std::vector<torrent_handle> torrents = BTSession->getTorrents();
std::vector<torrent_handle>::iterator torrentIT;
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
QTorrentHandle h = QTorrentHandle(*torrentIT);
if(!h.is_valid()) continue;
h.scrape_tracker();
}
}
void GUI::updateRatio() { void GUI::updateRatio() {
// Update ratio info // Update ratio info
float ratio = 1.; float ratio = 1.;
@@ -409,15 +433,15 @@ void GUI::checkedTorrent(QTorrentHandle& h) const {
} }
// Notification when disk is full // Notification when disk is full
void GUI::fullDiskError(QTorrentHandle& h) const { void GUI::fullDiskError(QTorrentHandle& h, QString msg) const {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
bool useNotificationBalloons = settings.value(QString::fromUtf8("Preferences/General/NotificationBaloons"), true).toBool(); bool useNotificationBalloons = settings.value(QString::fromUtf8("Preferences/General/NotificationBaloons"), true).toBool();
if(systrayIntegration && useNotificationBalloons) { if(systrayIntegration && useNotificationBalloons) {
myTrayIcon->showMessage(tr("I/O Error", "i.e: Input/Output Error"), tr("An error occured when trying to read or write %1. The disk is probably full, download has been paused", "e.g: An error occured when trying to read or write xxx.avi. The disk is probably full, download has been paused").arg(h.name()), QSystemTrayIcon::Critical, TIME_TRAY_BALLOON); myTrayIcon->showMessage(tr("I/O Error", "i.e: Input/Output Error"), tr("An I/O error occured for torrent %1.\n Reason: %2", "e.g: An error occured for torrent xxx.avi.\n Reason: disk is full.").arg(h.name()).arg(msg), QSystemTrayIcon::Critical, TIME_TRAY_BALLOON);
} }
// Download will be paused by libtorrent. Updating GUI information accordingly // Download will be paused by libtorrent. Updating GUI information accordingly
QString hash = h.hash(); QString hash = h.hash();
qDebug("Full disk error, pausing torrent %s", hash.toUtf8().data()); qDebug("Full disk error, pausing torrent %s", hash.toLocal8Bit().data());
if(h.is_seed()) { if(h.is_seed()) {
// In finished list // In finished list
qDebug("Automatically paused torrent was in finished list"); qDebug("Automatically paused torrent was in finished list");
@@ -661,7 +685,8 @@ void GUI::closeEvent(QCloseEvent *e) {
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()) {
hide(); hide();
e->ignore(); //e->ignore();
e->accept();
return; return;
} }
if(settings.value(QString::fromUtf8("Preferences/General/ExitConfirm"), true).toBool() && downloadingTorrentTab->getNbTorrentsInList()) { if(settings.value(QString::fromUtf8("Preferences/General/ExitConfirm"), true).toBool() && downloadingTorrentTab->getNbTorrentsInList()) {
@@ -720,8 +745,7 @@ void GUI::dropEvent(QDropEvent *event) {
if(event->mimeData()->hasUrls()) { if(event->mimeData()->hasUrls()) {
QList<QUrl> urls = event->mimeData()->urls(); QList<QUrl> urls = event->mimeData()->urls();
foreach(const QUrl &url, urls) { foreach(const QUrl &url, urls) {
QString tmp = url.toString(); QString tmp = url.toString().trimmed();
tmp.trimmed();
if(!tmp.isEmpty()) if(!tmp.isEmpty())
files << url.toString(); files << url.toString();
} }
@@ -733,7 +757,7 @@ void GUI::dropEvent(QDropEvent *event) {
bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool(); bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
foreach(QString file, files) { foreach(QString file, files) {
file = file.trimmed().replace(QString::fromUtf8("file://"), QString::fromUtf8(""), Qt::CaseInsensitive); file = file.trimmed().replace(QString::fromUtf8("file://"), QString::fromUtf8(""), Qt::CaseInsensitive);
qDebug("Dropped file %s on download list", file.toUtf8().data()); qDebug("Dropped file %s on download list", file.toLocal8Bit().data());
if(file.startsWith(QString::fromUtf8("http://"), Qt::CaseInsensitive) || file.startsWith(QString::fromUtf8("ftp://"), Qt::CaseInsensitive) || file.startsWith(QString::fromUtf8("https://"), Qt::CaseInsensitive)) { if(file.startsWith(QString::fromUtf8("http://"), Qt::CaseInsensitive) || file.startsWith(QString::fromUtf8("ftp://"), Qt::CaseInsensitive) || file.startsWith(QString::fromUtf8("https://"), Qt::CaseInsensitive)) {
BTSession->downloadFromUrl(file); BTSession->downloadFromUrl(file);
continue; continue;
@@ -750,7 +774,7 @@ void GUI::dropEvent(QDropEvent *event) {
// Decode if we accept drag 'n drop or not // Decode if we accept drag 'n drop or not
void GUI::dragEnterEvent(QDragEnterEvent *event) { void GUI::dragEnterEvent(QDragEnterEvent *event) {
foreach(const QString &mime, event->mimeData()->formats()){ foreach(const QString &mime, event->mimeData()->formats()){
qDebug("mimeData: %s", mime.toUtf8().data()); qDebug("mimeData: %s", mime.toLocal8Bit().data());
} }
if (event->mimeData()->hasFormat(QString::fromUtf8("text/plain")) || event->mimeData()->hasFormat(QString::fromUtf8("text/uri-list"))) { if (event->mimeData()->hasFormat(QString::fromUtf8("text/plain")) || event->mimeData()->hasFormat(QString::fromUtf8("text/uri-list"))) {
event->acceptProposedAction(); event->acceptProposedAction();
@@ -945,6 +969,11 @@ void GUI::configureSession(bool deleteOptions) {
// Downloads // Downloads
// * Save path // * Save path
BTSession->setDefaultSavePath(options->getSavePath()); BTSession->setDefaultSavePath(options->getSavePath());
if(options->isTempPathEnabled()) {
BTSession->setDefaultTempPath(options->getTempPath());
} else {
BTSession->setDefaultTempPath(QString::null);
}
BTSession->preAllocateAllFiles(options->preAllocateAllFiles()); BTSession->preAllocateAllFiles(options->preAllocateAllFiles());
BTSession->startTorrentsInPause(options->addTorrentsInPause()); BTSession->startTorrentsInPause(options->addTorrentsInPause());
// * Scan dir // * Scan dir
@@ -960,7 +989,7 @@ void GUI::configureSession(bool deleteOptions) {
BTSession->setListeningPortsRange(options->getPorts()); BTSession->setListeningPortsRange(options->getPorts());
unsigned short new_listenPort = BTSession->getListenPort(); unsigned short new_listenPort = BTSession->getListenPort();
if(new_listenPort != old_listenPort) { if(new_listenPort != old_listenPort) {
BTSession->addConsoleMessage(tr("qBittorrent is bind to port: %1", "e.g: qBittorrent is bind to port: 1666").arg( misc::toQString(new_listenPort))); BTSession->addConsoleMessage(tr("qBittorrent is bound to port: TCP/%1", "e.g: qBittorrent is bound to port: 6881").arg( misc::toQString(new_listenPort)));
} }
// * Global download limit // * Global download limit
QPair<int, int> limits = options->getGlobalBandwidthLimits(); QPair<int, int> limits = options->getGlobalBandwidthLimits();
@@ -1049,9 +1078,12 @@ void GUI::configureSession(bool deleteOptions) {
// * DHT // * DHT
if(options->isDHTEnabled()) { if(options->isDHTEnabled()) {
// Set DHT Port // Set DHT Port
BTSession->setDHTPort(new_listenPort); BTSession->setDHTPort(options->getDHTPort());
if(BTSession->enableDHT(true)) { if(BTSession->enableDHT(true)) {
BTSession->addConsoleMessage(tr("DHT support [ON], port: %1").arg(new_listenPort), QString::fromUtf8("blue")); int dht_port = new_listenPort;
if(options->getDHTPort())
dht_port = options->getDHTPort();
BTSession->addConsoleMessage(tr("DHT support [ON], port: UDP/%1").arg(dht_port), QString::fromUtf8("blue"));
} else { } else {
BTSession->addConsoleMessage(tr("DHT support [OFF]"), QString::fromUtf8("red")); BTSession->addConsoleMessage(tr("DHT support [OFF]"), QString::fromUtf8("red"));
} }
@@ -1161,11 +1193,11 @@ void GUI::configureSession(bool deleteOptions) {
// We need this for urllib in search engine plugins // We need this for urllib in search engine plugins
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
char proxystr[512]; char proxystr[512];
snprintf(proxystr, 512, "http_proxy=%s", proxy_str.toUtf8().data()); snprintf(proxystr, 512, "http_proxy=%s", proxy_str.toLocal8Bit().data());
putenv(proxystr); putenv(proxystr);
#else #else
qDebug("HTTP: proxy string: %s", proxy_str.toUtf8().data()); qDebug("HTTP: proxy string: %s", proxy_str.toLocal8Bit().data());
setenv("http_proxy", proxy_str.toUtf8().data(), 1); setenv("http_proxy", proxy_str.toLocal8Bit().data(), 1);
#endif #endif
} else { } else {
qDebug("Disabling search proxy"); qDebug("Disabling search proxy");
@@ -1492,10 +1524,10 @@ void GUI::createSystrayDelayed() {
void GUI::createTrayIcon() { void GUI::createTrayIcon() {
// Tray icon // Tray icon
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
myTrayIcon = new QSystemTrayIcon(QIcon(QString::fromUtf8(":/Icons/qbittorrent16.png")), this); myTrayIcon = new QSystemTrayIcon(QIcon(QString::fromUtf8(":/Icons/skin/qbittorrent16.png")), this);
#endif #endif
#ifndef Q_WS_WIN #ifndef Q_WS_WIN
myTrayIcon = new QSystemTrayIcon(QIcon(QString::fromUtf8(":/Icons/qbittorrent22.png")), this); myTrayIcon = new QSystemTrayIcon(QIcon(QString::fromUtf8(":/Icons/skin/qbittorrent22.png")), this);
#endif #endif
// Tray icon Menu // Tray icon Menu
myTrayIconMenu = new QMenu(this); myTrayIconMenu = new QMenu(this);

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */
@@ -61,6 +70,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
// Bittorrent // Bittorrent
bittorrent *BTSession; bittorrent *BTSession;
QTimer *checkConnect; QTimer *checkConnect;
QTimer *scrapeTimer;
QList<QPair<QTorrentHandle,QString> > unauthenticated_trackers; QList<QPair<QTorrentHandle,QString> > unauthenticated_trackers;
// GUI related // GUI related
QTabWidget *tabs; QTabWidget *tabs;
@@ -130,7 +140,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
void createTrayIcon(); void createTrayIcon();
void updateUnfinishedTorrentNumber(unsigned int nb); void updateUnfinishedTorrentNumber(unsigned int nb);
void updateFinishedTorrentNumber(unsigned int nb); void updateFinishedTorrentNumber(unsigned int nb);
void fullDiskError(QTorrentHandle& h) const; void fullDiskError(QTorrentHandle& h, QString msg) const;
void handleDownloadFromUrlFailure(QString, QString) const; void handleDownloadFromUrlFailure(QString, QString) const;
void createSystrayDelayed(); void createSystrayDelayed();
// Keyboard shortcuts // Keyboard shortcuts
@@ -168,6 +178,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
bool initWebUi(QString username, QString password, int port); bool initWebUi(QString username, QString password, int port);
void on_actionIncreasePriority_triggered(); void on_actionIncreasePriority_triggered();
void on_actionDecreasePriority_triggered(); void on_actionDecreasePriority_triggered();
void scrapeTrackers();
// Options slots // Options slots
void on_actionOptions_triggered(); void on_actionOptions_triggered();
void OptionsSaved(bool deleteOptions); void OptionsSaved(bool deleteOptions);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 821 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 998 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 846 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 532 B

BIN
src/Icons/oxygen/browse.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 796 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
src/Icons/oxygen/bug.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 860 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 892 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 937 B

View File

Before

Width:  |  Height:  |  Size: 575 B

After

Width:  |  Height:  |  Size: 575 B

View File

Before

Width:  |  Height:  |  Size: 750 B

After

Width:  |  Height:  |  Size: 750 B

View File

Before

Width:  |  Height:  |  Size: 704 B

After

Width:  |  Height:  |  Size: 704 B

BIN
src/Icons/oxygen/filter.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 885 B

View File

Before

Width:  |  Height:  |  Size: 449 B

After

Width:  |  Height:  |  Size: 449 B

BIN
src/Icons/oxygen/gear.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
src/Icons/oxygen/log.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 B

BIN
src/Icons/oxygen/proxy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 739 B

After

Width:  |  Height:  |  Size: 739 B

View File

Before

Width:  |  Height:  |  Size: 856 B

After

Width:  |  Height:  |  Size: 856 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 813 B

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 765 B

After

Width:  |  Height:  |  Size: 765 B

BIN
src/Icons/oxygen/webui.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -1,6 +1,6 @@
[Desktop Entry] [Desktop Entry]
Categories=Qt;Network;P2P Categories=Qt;Network;P2P
Comment=V1.3.1 Comment=V1.4.0
Exec=qbittorrent %f Exec=qbittorrent %f
GenericName=Bittorrent client GenericName=Bittorrent client
GenericName[bg]=Торент клиент GenericName[bg]=Торент клиент

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 965 B

After

Width:  |  Height:  |  Size: 965 B

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 888 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -1,7 +1,8 @@
<ui version="4.0" > <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class> <class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow" > <widget class="QMainWindow" name="MainWindow">
<property name="geometry" > <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
@@ -9,264 +10,266 @@
<height>563</height> <height>563</height>
</rect> </rect>
</property> </property>
<property name="contextMenuPolicy" > <property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum> <enum>Qt::CustomContextMenu</enum>
</property> </property>
<property name="windowTitle" > <property name="windowTitle">
<string/> <string/>
</property> </property>
<widget class="QWidget" name="centralwidget" > <widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" /> <layout class="QVBoxLayout"/>
</widget> </widget>
<widget class="QMenuBar" name="menubar" > <widget class="QMenuBar" name="menubar">
<property name="geometry" > <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>914</width> <width>914</width>
<height>26</height> <height>23</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menu_Edit" > <widget class="QMenu" name="menu_Edit">
<property name="title" > <property name="title">
<string>&amp;Edit</string> <string>&amp;Edit</string>
</property> </property>
<addaction name="actionStart_All" /> <addaction name="actionStart_All"/>
<addaction name="actionPause_All" /> <addaction name="actionPause_All"/>
<addaction name="separator" /> <addaction name="separator"/>
<addaction name="actionStart" /> <addaction name="actionStart"/>
<addaction name="actionPause" /> <addaction name="actionPause"/>
<addaction name="separator" /> <addaction name="separator"/>
<addaction name="actionTorrent_Properties" /> <addaction name="actionTorrent_Properties"/>
<addaction name="separator" /> <addaction name="separator"/>
<addaction name="actionDelete" /> <addaction name="actionDelete"/>
<addaction name="actionDelete_Permanently" /> <addaction name="actionDelete_Permanently"/>
<addaction name="actionDecreasePriority" /> <addaction name="actionDecreasePriority"/>
<addaction name="actionIncreasePriority" /> <addaction name="actionIncreasePriority"/>
</widget> </widget>
<widget class="QMenu" name="menu_Help" > <widget class="QMenu" name="menu_Help">
<property name="title" > <property name="title">
<string>&amp;Help</string> <string>&amp;Help</string>
</property> </property>
<addaction name="actionBugReport" /> <addaction name="actionBugReport"/>
<addaction name="actionWebsite" /> <addaction name="actionWebsite"/>
<addaction name="actionDocumentation" /> <addaction name="actionDocumentation"/>
<addaction name="actionAbout" /> <addaction name="actionAbout"/>
</widget> </widget>
<widget class="QMenu" name="menu_Options" > <widget class="QMenu" name="menu_Options">
<property name="title" > <property name="title">
<string>Options</string> <string>Options</string>
</property> </property>
<addaction name="actionOptions" /> <addaction name="actionOptions"/>
<addaction name="actionShow_console" /> <addaction name="actionShow_console"/>
</widget> </widget>
<widget class="QMenu" name="menu_File" > <widget class="QMenu" name="menu_File">
<property name="title" > <property name="title">
<string>&amp;File</string> <string>&amp;File</string>
</property> </property>
<addaction name="actionOpen" /> <addaction name="actionOpen"/>
<addaction name="actionDownload_from_URL" /> <addaction name="actionDownload_from_URL"/>
<addaction name="actionCreate_torrent" /> <addaction name="actionCreate_torrent"/>
<addaction name="actionExit" /> <addaction name="actionExit"/>
</widget> </widget>
<addaction name="menu_File" /> <addaction name="menu_File"/>
<addaction name="menu_Edit" /> <addaction name="menu_Edit"/>
<addaction name="menu_Options" /> <addaction name="menu_Options"/>
<addaction name="menu_Help" /> <addaction name="menu_Help"/>
</widget> </widget>
<widget class="QToolBar" name="toolBar" > <widget class="QToolBar" name="toolBar">
<property name="enabled" > <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="contextMenuPolicy" > <property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum> <enum>Qt::NoContextMenu</enum>
</property> </property>
<property name="movable" > <property name="movable">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="orientation" > <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="iconSize" > <property name="iconSize">
<size> <size>
<width>32</width> <width>32</width>
<height>32</height> <height>32</height>
</size> </size>
</property> </property>
<property name="floatable" > <property name="floatable">
<bool>false</bool> <bool>false</bool>
</property> </property>
<attribute name="toolBarArea" > <attribute name="toolBarArea">
<enum>TopToolBarArea</enum> <enum>TopToolBarArea</enum>
</attribute> </attribute>
<attribute name="toolBarBreak" > <attribute name="toolBarBreak">
<bool>false</bool> <bool>false</bool>
</attribute> </attribute>
<addaction name="actionOpen" /> <addaction name="actionOpen"/>
<addaction name="actionDownload_from_URL" /> <addaction name="actionDownload_from_URL"/>
<addaction name="separator" /> <addaction name="separator"/>
<addaction name="actionDelete" /> <addaction name="actionDelete"/>
<addaction name="actionDelete_Permanently" /> <addaction name="actionDelete_Permanently"/>
<addaction name="separator" /> <addaction name="separator"/>
<addaction name="actionTorrent_Properties" /> <addaction name="actionTorrent_Properties"/>
<addaction name="separator" /> <addaction name="separator"/>
<addaction name="actionStart" /> <addaction name="actionStart"/>
<addaction name="actionPause" /> <addaction name="actionPause"/>
<addaction name="separator" /> <addaction name="separator"/>
<addaction name="actionStart_All" /> <addaction name="actionStart_All"/>
<addaction name="actionPause_All" /> <addaction name="actionPause_All"/>
<addaction name="separator" /> <addaction name="separator"/>
<addaction name="actionOptions" /> <addaction name="actionOptions"/>
<addaction name="actionDecreasePriority" /> <addaction name="actionDecreasePriority"/>
<addaction name="actionIncreasePriority" /> <addaction name="actionIncreasePriority"/>
<addaction name="separator" /> <addaction name="separator"/>
<addaction name="actionExit" /> <addaction name="actionExit"/>
<addaction name="separator" />
</widget> </widget>
<widget class="QStatusBar" name="statusBar" /> <widget class="QStatusBar" name="statusBar"/>
<action name="actionOpen" > <action name="actionOpen">
<property name="text" > <property name="text">
<string>Open</string> <string>Open</string>
</property> </property>
</action> </action>
<action name="actionExit" > <action name="actionExit">
<property name="text" > <property name="text">
<string>Exit</string> <string>Exit</string>
</property> </property>
</action> </action>
<action name="actionOptions" > <action name="actionOptions">
<property name="text" > <property name="text">
<string>Preferences</string> <string>Preferences</string>
</property> </property>
</action> </action>
<action name="actionAbout" > <action name="actionAbout">
<property name="text" > <property name="text">
<string>About</string> <string>About</string>
</property> </property>
</action> </action>
<action name="actionStart" > <action name="actionStart">
<property name="text" > <property name="text">
<string>Start</string> <string>Start</string>
</property> </property>
</action> </action>
<action name="actionPause" > <action name="actionPause">
<property name="text" > <property name="text">
<string>Pause</string> <string>Pause</string>
</property> </property>
</action> </action>
<action name="actionDelete" > <action name="actionDelete">
<property name="text" > <property name="text">
<string>Delete</string> <string>Delete</string>
</property> </property>
</action> </action>
<action name="actionPause_All" > <action name="actionPause_All">
<property name="text" > <property name="text">
<string>Pause All</string> <string>Pause All</string>
</property> </property>
</action> </action>
<action name="actionStart_All" > <action name="actionStart_All">
<property name="text" > <property name="text">
<string>Start All</string> <string>Start All</string>
</property> </property>
</action> </action>
<action name="actionWebsite" > <action name="actionWebsite">
<property name="text" > <property name="text">
<string>Visit website</string> <string>Visit website</string>
</property> </property>
</action> </action>
<action name="actionDelete_Permanently" > <action name="actionDelete_Permanently">
<property name="text" > <property name="text">
<string>Delete Permanently</string> <string>Delete Permanently</string>
</property> </property>
</action> </action>
<action name="actionTorrent_Properties" > <action name="actionTorrent_Properties">
<property name="text" > <property name="text">
<string>Torrent Properties</string> <string>Torrent Properties</string>
</property> </property>
</action> </action>
<action name="actionDownload_from_URL" > <action name="actionDownload_from_URL">
<property name="text" > <property name="text">
<string>Download from URL</string> <string>Download from URL</string>
</property> </property>
</action> </action>
<action name="actionCreate_torrent" > <action name="actionCreate_torrent">
<property name="text" > <property name="text">
<string>Create torrent</string> <string>Create torrent</string>
</property> </property>
</action> </action>
<action name="actionPreview_file" > <action name="actionPreview_file">
<property name="text" > <property name="text">
<string>Preview file</string> <string>Preview file</string>
</property> </property>
</action> </action>
<action name="actionClearLog" > <action name="actionClearLog">
<property name="text" > <property name="text">
<string>Clear log</string> <string>Clear log</string>
</property> </property>
</action> </action>
<action name="actionBugReport" > <action name="actionBugReport">
<property name="text" > <property name="text">
<string>Report a bug</string> <string>Report a bug</string>
</property> </property>
</action> </action>
<action name="actionSet_upload_limit" > <action name="actionSet_upload_limit">
<property name="text" > <property name="text">
<string>Set upload limit</string> <string>Set upload limit</string>
</property> </property>
</action> </action>
<action name="actionSet_download_limit" > <action name="actionSet_download_limit">
<property name="text" > <property name="text">
<string>Set download limit</string> <string>Set download limit</string>
</property> </property>
</action> </action>
<action name="actionDocumentation" > <action name="actionDocumentation">
<property name="text" > <property name="text">
<string>Documentation</string> <string>Documentation</string>
</property> </property>
</action> </action>
<action name="actionSet_global_download_limit" > <action name="actionSet_global_download_limit">
<property name="text" > <property name="text">
<string>Set global download limit</string> <string>Set global download limit</string>
</property> </property>
</action> </action>
<action name="actionSet_global_upload_limit" > <action name="actionSet_global_upload_limit">
<property name="text" > <property name="text">
<string>Set global upload limit</string> <string>Set global upload limit</string>
</property> </property>
</action> </action>
<action name="actionDecreasePriority" > <action name="actionDecreasePriority">
<property name="icon" > <property name="icon">
<iconset resource="icons.qrc" >:/Icons/skin/decrease.png</iconset> <iconset resource="icons.qrc">
<normaloff>:/Icons/skin/decrease.png</normaloff>:/Icons/skin/decrease.png</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>Decrease priority</string> <string>Decrease priority</string>
</property> </property>
<property name="visible" > <property name="visible">
<bool>false</bool> <bool>false</bool>
</property> </property>
</action> </action>
<action name="actionIncreasePriority" > <action name="actionIncreasePriority">
<property name="icon" > <property name="icon">
<iconset resource="icons.qrc" >:/Icons/skin/increase.png</iconset> <iconset resource="icons.qrc">
<normaloff>:/Icons/skin/increase.png</normaloff>:/Icons/skin/increase.png</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>Increase priority</string> <string>Increase priority</string>
</property> </property>
<property name="visible" > <property name="visible">
<bool>false</bool> <bool>false</bool>
</property> </property>
</action> </action>
<action name="actionShow_console" > <action name="actionShow_console">
<property name="icon" > <property name="icon">
<iconset resource="icons.qrc" >:/Icons/log.png</iconset> <iconset resource="icons.qrc">
<normaloff>:/Icons/oxygen/log.png</normaloff>:/Icons/oxygen/log.png</iconset>
</property> </property>
<property name="text" > <property name="text">
<string>Console</string> <string>Console</string>
</property> </property>
</action> </action>
</widget> </widget>
<resources> <resources>
<include location="icons.qrc" /> <include location="icons.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */
@@ -47,13 +56,14 @@ SearchTab::SearchTab(SearchEngine *parent) : QWidget()
setLayout(box); setLayout(box);
// Set Search results list model // Set Search results list model
SearchListModel = new QStandardItemModel(0,5); SearchListModel = new QStandardItemModel(0,6);
SearchListModel->setHeaderData(SEARCH_NAME, Qt::Horizontal, tr("Name", "i.e: file name")); SearchListModel->setHeaderData(SEARCH_NAME, Qt::Horizontal, tr("Name", "i.e: file name"));
SearchListModel->setHeaderData(SEARCH_SIZE, Qt::Horizontal, tr("Size", "i.e: file size")); SearchListModel->setHeaderData(SEARCH_SIZE, Qt::Horizontal, tr("Size", "i.e: file size"));
SearchListModel->setHeaderData(SEARCH_SEEDERS, Qt::Horizontal, tr("Seeders", "i.e: Number of full sources")); SearchListModel->setHeaderData(SEARCH_SEEDERS, Qt::Horizontal, tr("Seeders", "i.e: Number of full sources"));
SearchListModel->setHeaderData(SEARCH_LEECHERS, Qt::Horizontal, tr("Leechers", "i.e: Number of partial sources")); SearchListModel->setHeaderData(SEARCH_LEECHERS, Qt::Horizontal, tr("Leechers", "i.e: Number of partial sources"));
SearchListModel->setHeaderData(SEARCH_ENGINE, Qt::Horizontal, tr("Search engine")); SearchListModel->setHeaderData(SEARCH_ENGINE, Qt::Horizontal, tr("Search engine"));
resultsBrowser->setModel(SearchListModel); resultsBrowser->setModel(SearchListModel);
resultsBrowser->hideColumn(URL_COLUMN); // Hide url column
SearchDelegate = new SearchListDelegate(); SearchDelegate = new SearchListDelegate();
resultsBrowser->setItemDelegate(SearchDelegate); resultsBrowser->setItemDelegate(SearchDelegate);
// Make search list header clickable for sorting // Make search list header clickable for sorting
@@ -65,19 +75,36 @@ SearchTab::SearchTab(SearchEngine *parent) : QWidget()
connect(resultsBrowser->header(), SIGNAL(sectionPressed(int)), this, SLOT(sortSearchList(int))); connect(resultsBrowser->header(), SIGNAL(sectionPressed(int)), this, SLOT(sortSearchList(int)));
// Load last columns width for search results list // Load last columns width for search results list
if(!loadColWidthSearchList()){ if(!loadColWidthResultsList()){
resultsBrowser->header()->resizeSection(0, 275); resultsBrowser->header()->resizeSection(0, 275);
} }
} }
SearchTab::~SearchTab() SearchTab::~SearchTab() {
{
saveColWidthSearchList();
delete resultsBrowser; delete resultsBrowser;
delete SearchListModel; delete SearchListModel;
delete SearchDelegate; delete SearchDelegate;
} }
QHeaderView* SearchTab::header() const {
return resultsBrowser->header();
}
bool SearchTab::loadColWidthResultsList() {
QSettings settings("qBittorrent", "qBittorrent");
QString line = settings.value("SearchResultsColsWidth", QString()).toString();
if(line.isEmpty())
return false;
QStringList width_list = line.split(' ');
if(width_list.size() < SearchListModel->columnCount())
return false;
unsigned int listSize = width_list.size();
for(unsigned int i=0; i<listSize; ++i){
resultsBrowser->header()->resizeSection(i, width_list.at(i).toInt());
}
return true;
}
QLabel* SearchTab::getCurrentLabel() QLabel* SearchTab::getCurrentLabel()
{ {
return results_lbl; return results_lbl;
@@ -128,7 +155,7 @@ void SearchTab::sortSearchListInt(int index, Qt::SortOrder sortOrder){
for(int row=0; row<lines.size(); ++row){ for(int row=0; row<lines.size(); ++row){
SearchListModel->insertRow(SearchListModel->rowCount()); SearchListModel->insertRow(SearchListModel->rowCount());
int sourceRow = lines[row].first; int sourceRow = lines[row].first;
for(int col=0; col<5; ++col){ for(int col=0; col<6; ++col){
SearchListModel->setData(SearchListModel->index(nbRows_old+row, col), SearchListModel->data(SearchListModel->index(sourceRow, col))); SearchListModel->setData(SearchListModel->index(nbRows_old+row, col), SearchListModel->data(SearchListModel->index(sourceRow, col)));
SearchListModel->setData(SearchListModel->index(nbRows_old+row, col), SearchListModel->data(SearchListModel->index(sourceRow, col), Qt::ForegroundRole), Qt::ForegroundRole); SearchListModel->setData(SearchListModel->index(nbRows_old+row, col), SearchListModel->data(SearchListModel->index(sourceRow, col), Qt::ForegroundRole), Qt::ForegroundRole);
} }
@@ -148,7 +175,7 @@ void SearchTab::sortSearchListString(int index, Qt::SortOrder sortOrder){
for(int row=0; row<nbRows_old; ++row){ for(int row=0; row<nbRows_old; ++row){
SearchListModel->insertRow(SearchListModel->rowCount()); SearchListModel->insertRow(SearchListModel->rowCount());
int sourceRow = lines[row].first; int sourceRow = lines[row].first;
for(int col=0; col<5; ++col){ for(int col=0; col<6; ++col){
SearchListModel->setData(SearchListModel->index(nbRows_old+row, col), SearchListModel->data(SearchListModel->index(sourceRow, col))); SearchListModel->setData(SearchListModel->index(nbRows_old+row, col), SearchListModel->data(SearchListModel->index(sourceRow, col)));
SearchListModel->setData(SearchListModel->index(nbRows_old+row, col), SearchListModel->data(SearchListModel->index(sourceRow, col), Qt::ForegroundRole), Qt::ForegroundRole); SearchListModel->setData(SearchListModel->index(nbRows_old+row, col), SearchListModel->data(SearchListModel->index(sourceRow, col), Qt::ForegroundRole), Qt::ForegroundRole);
} }
@@ -157,33 +184,3 @@ void SearchTab::sortSearchListString(int index, Qt::SortOrder sortOrder){
SearchListModel->removeRows(0, nbRows_old); SearchListModel->removeRows(0, nbRows_old);
} }
// Save columns width in a file to remember them
// (download list)
void SearchTab::saveColWidthSearchList() const{
qDebug("Saving columns width in search list");
QSettings settings("qBittorrent", "qBittorrent");
QStringList width_list;
for(int i=0; i<SearchListModel->columnCount(); ++i){
width_list << misc::toQString(resultsBrowser->columnWidth(i));
}
settings.setValue("SearchListColsWidth", width_list.join(" "));
qDebug("Search list columns width saved");
}
// Load columns width in a file that were saved previously
// (search list)
bool SearchTab::loadColWidthSearchList(){
qDebug("Loading columns width for search list");
QSettings settings("qBittorrent", "qBittorrent");
QString line = settings.value("SearchListColsWidth", QString()).toString();
if(line.isEmpty())
return false;
QStringList width_list = line.split(' ');
if(width_list.size() != SearchListModel->columnCount())
return false;
for(int i=0; i<width_list.size(); ++i){
resultsBrowser->header()->resizeSection(i, width_list.at(i).toInt());
}
qDebug("Search list columns width loaded");
return true;
}

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */
@@ -24,9 +33,13 @@
#include "ui_search.h" #include "ui_search.h"
#define ENGINE_URL_COLUMN 4
#define URL_COLUMN 5
class SearchListDelegate; class SearchListDelegate;
class SearchEngine; class SearchEngine;
class QTreeView; class QTreeView;
class QHeaderView;
class QStandardItemModel; class QStandardItemModel;
class SearchTab : public QWidget, public Ui::search_engine class SearchTab : public QWidget, public Ui::search_engine
@@ -42,16 +55,17 @@ class SearchTab : public QWidget, public Ui::search_engine
public: public:
SearchTab(SearchEngine *parent); SearchTab(SearchEngine *parent);
~SearchTab(); ~SearchTab();
bool loadColWidthSearchList(); bool loadColWidthResultsList();
QLabel * getCurrentLabel(); QLabel * getCurrentLabel();
QStandardItemModel * getCurrentSearchListModel(); QStandardItemModel * getCurrentSearchListModel();
QTreeView * getCurrentTreeView(); QTreeView * getCurrentTreeView();
void setRowColor(int row, QString color); void setRowColor(int row, QString color);
QHeaderView* header() const;
protected slots: protected slots:
void sortSearchList(int index); void sortSearchList(int index);
void sortSearchListInt(int index, Qt::SortOrder sortOrder); void sortSearchListInt(int index, Qt::SortOrder sortOrder);
void sortSearchListString(int index, Qt::SortOrder sortOrder); void sortSearchListString(int index, Qt::SortOrder sortOrder);
void saveColWidthSearchList() const;
}; };

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */

View File

@@ -1,8 +1,9 @@
<ui version="4.0" > <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author>Christophe Dumez</author> <author>Christophe Dumez</author>
<class>AboutDlg</class> <class>AboutDlg</class>
<widget class="QDialog" name="AboutDlg" > <widget class="QDialog" name="AboutDlg">
<property name="geometry" > <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
@@ -10,65 +11,65 @@
<height>320</height> <height>320</height>
</rect> </rect>
</property> </property>
<property name="minimumSize" > <property name="minimumSize">
<size> <size>
<width>504</width> <width>504</width>
<height>320</height> <height>320</height>
</size> </size>
</property> </property>
<property name="maximumSize" > <property name="maximumSize">
<size> <size>
<width>504</width> <width>504</width>
<height>320</height> <height>320</height>
</size> </size>
</property> </property>
<property name="windowTitle" > <property name="windowTitle">
<string>About qBittorrent</string> <string>About qBittorrent</string>
</property> </property>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout">
<item> <item>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout">
<item> <item>
<widget class="QLabel" name="logo" > <widget class="QLabel" name="logo">
<property name="minimumSize" > <property name="minimumSize">
<size> <size>
<width>22</width> <width>22</width>
<height>22</height> <height>22</height>
</size> </size>
</property> </property>
<property name="maximumSize" > <property name="maximumSize">
<size> <size>
<width>22</width> <width>22</width>
<height>22</height> <height>22</height>
</size> </size>
</property> </property>
<property name="text" > <property name="text">
<string/> <string/>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="lb_name" > <widget class="QLabel" name="lb_name">
<property name="sizePolicy" > <property name="sizePolicy">
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" > <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text" > <property name="text">
<string>&lt;h3>&lt;b>qBittorrent&lt;/b>&lt;/h3></string> <string>&lt;h3&gt;&lt;b&gt;qBittorrent&lt;/b&gt;&lt;/h3&gt;</string>
</property> </property>
<property name="textFormat" > <property name="textFormat">
<enum>Qt::RichText</enum> <enum>Qt::RichText</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<spacer> <spacer>
<property name="orientation" > <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" > <property name="sizeHint" stdset="0">
<size> <size>
<width>40</width> <width>40</width>
<height>20</height> <height>20</height>
@@ -79,79 +80,90 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QTabWidget" name="tw_tabs" > <widget class="QTabWidget" name="tw_tabs">
<property name="currentIndex" > <property name="currentIndex">
<number>0</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="tab2" > <widget class="QWidget" name="tab2">
<attribute name="title" > <attribute name="title">
<string>About</string> <string>About</string>
</attribute> </attribute>
<widget class="QLabel" name="mascot_lbl" > <widget class="QLabel" name="mascot_lbl">
<property name="geometry" > <property name="geometry">
<rect> <rect>
<x>380</x> <x>380</x>
<y>50</y> <y>70</y>
<width>94</width> <width>94</width>
<height>162</height> <height>162</height>
</rect> </rect>
</property> </property>
<property name="text" > <property name="text">
<string/> <string/>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="lb_about" > <widget class="QLabel" name="lb_about">
<property name="geometry" > <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>40</y> <y>30</y>
<width>481</width> <width>481</width>
<height>102</height> <height>102</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy" > <property name="sizePolicy">
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" > <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text" > <property name="text">
<string>A bittorrent client using Qt4 and libtorrent, programmed in C++.&lt;br> <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;br> &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
Copyright © 2006 by Christophe Dumez&lt;br> p, li { white-space: pre-wrap; }
&lt;br> &lt;u>Home Page:&lt;/u> &lt;i>http://www.qbittorrent.org&lt;/i>&lt;br></string> &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Sans'; font-size:8pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;A Bittorrent client programmed in C++, based on Qt4 toolkit &lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;and libtorrent-rasterbar. &lt;br /&gt;&lt;br /&gt;Copyright ©2006-2009 Christophe Dumez&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot; text-decoration: underline;&quot;&gt;Home Page:&lt;/span&gt; &lt;a href=&quot;http://www.qbittorrent.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0057ae;&quot;&gt;http://www.qbittorrent.org&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="textFormat" > <property name="textFormat">
<enum>Qt::RichText</enum> <enum>Qt::RichText</enum>
</property> </property>
<property name="alignment" > <property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget> </widget>
</widget> </widget>
<widget class="QWidget" name="tab3" > <widget class="QWidget" name="tab3">
<attribute name="title" > <attribute name="title">
<string>Author</string> <string>Author</string>
</attribute> </attribute>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout">
<property name="spacing" > <property name="spacing">
<number>6</number> <number>6</number>
</property> </property>
<item> <item>
<widget class="QFrame" name="te_authors" > <widget class="QFrame" name="te_authors">
<layout class="QHBoxLayout" > <layout class="QHBoxLayout">
<property name="spacing" > <property name="spacing">
<number>6</number> <number>6</number>
</property> </property>
<item> <item>
<spacer> <spacer>
<property name="orientation" > <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeType" > <property name="sizeType">
<enum>QSizePolicy::Preferred</enum> <enum>QSizePolicy::Preferred</enum>
</property> </property>
<property name="sizeHint" > <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>20</height> <height>20</height>
@@ -160,13 +172,13 @@ Copyright © 2006 by Christophe Dumez&lt;br>
</spacer> </spacer>
</item> </item>
<item> <item>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout">
<property name="spacing" > <property name="spacing">
<number>6</number> <number>6</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="label_3" > <widget class="QLabel" name="label_3">
<property name="font" > <property name="font">
<font> <font>
<family>Sans Serif</family> <family>Sans Serif</family>
<pointsize>9</pointsize> <pointsize>9</pointsize>
@@ -177,14 +189,14 @@ Copyright © 2006 by Christophe Dumez&lt;br>
<strikeout>false</strikeout> <strikeout>false</strikeout>
</font> </font>
</property> </property>
<property name="text" > <property name="text">
<string>Name:</string> <string>Name:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_4" > <widget class="QLabel" name="label_4">
<property name="font" > <property name="font">
<font> <font>
<family>Sans Serif</family> <family>Sans Serif</family>
<pointsize>9</pointsize> <pointsize>9</pointsize>
@@ -195,14 +207,14 @@ Copyright © 2006 by Christophe Dumez&lt;br>
<strikeout>false</strikeout> <strikeout>false</strikeout>
</font> </font>
</property> </property>
<property name="text" > <property name="text">
<string>Country:</string> <string>Country:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="lbl_birthday" > <widget class="QLabel" name="lbl_birthday">
<property name="font" > <property name="font">
<font> <font>
<family>Sans Serif</family> <family>Sans Serif</family>
<pointsize>9</pointsize> <pointsize>9</pointsize>
@@ -213,14 +225,14 @@ Copyright © 2006 by Christophe Dumez&lt;br>
<strikeout>false</strikeout> <strikeout>false</strikeout>
</font> </font>
</property> </property>
<property name="text" > <property name="text">
<string>Birthday:</string> <string>Birthday:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="lbl_occupation" > <widget class="QLabel" name="lbl_occupation">
<property name="font" > <property name="font">
<font> <font>
<family>Sans Serif</family> <family>Sans Serif</family>
<pointsize>9</pointsize> <pointsize>9</pointsize>
@@ -231,14 +243,14 @@ Copyright © 2006 by Christophe Dumez&lt;br>
<strikeout>false</strikeout> <strikeout>false</strikeout>
</font> </font>
</property> </property>
<property name="text" > <property name="text">
<string>Occupation:</string> <string>Occupation:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_5" > <widget class="QLabel" name="label_5">
<property name="font" > <property name="font">
<font> <font>
<family>Sans Serif</family> <family>Sans Serif</family>
<pointsize>9</pointsize> <pointsize>9</pointsize>
@@ -249,14 +261,14 @@ Copyright © 2006 by Christophe Dumez&lt;br>
<strikeout>false</strikeout> <strikeout>false</strikeout>
</font> </font>
</property> </property>
<property name="text" > <property name="text">
<string>E-mail:</string> <string>E-mail:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_8" > <widget class="QLabel" name="label_8">
<property name="font" > <property name="font">
<font> <font>
<family>Sans Serif</family> <family>Sans Serif</family>
<pointsize>9</pointsize> <pointsize>9</pointsize>
@@ -267,7 +279,7 @@ Copyright © 2006 by Christophe Dumez&lt;br>
<strikeout>false</strikeout> <strikeout>false</strikeout>
</font> </font>
</property> </property>
<property name="text" > <property name="text">
<string>Home page:</string> <string>Home page:</string>
</property> </property>
</widget> </widget>
@@ -276,13 +288,13 @@ Copyright © 2006 by Christophe Dumez&lt;br>
</item> </item>
<item> <item>
<spacer> <spacer>
<property name="orientation" > <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeType" > <property name="sizeType">
<enum>QSizePolicy::Preferred</enum> <enum>QSizePolicy::Preferred</enum>
</property> </property>
<property name="sizeHint" > <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>20</height> <height>20</height>
@@ -291,48 +303,48 @@ Copyright © 2006 by Christophe Dumez&lt;br>
</spacer> </spacer>
</item> </item>
<item> <item>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout">
<property name="spacing" > <property name="spacing">
<number>6</number> <number>6</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="label_2" > <widget class="QLabel" name="label_2">
<property name="text" > <property name="text">
<string>Christophe Dumez</string> <string>Christophe Dumez</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_7" > <widget class="QLabel" name="label_7">
<property name="text" > <property name="text">
<string>France</string> <string>France</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_11" > <widget class="QLabel" name="label_11">
<property name="text" > <property name="text">
<string>03/05/1985</string> <string>03/05/1985</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_10" > <widget class="QLabel" name="label_10">
<property name="text" > <property name="text">
<string>Student in computer science</string> <string>Student in computer science</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_6" > <widget class="QLabel" name="label_6">
<property name="text" > <property name="text">
<string>chris@qbittorrent.org</string> <string>chris@qbittorrent.org</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_9" > <widget class="QLabel" name="label_9">
<property name="text" > <property name="text">
<string>http://www.dchris.eu</string> <string>http://www.dchris.eu</string>
</property> </property>
</widget> </widget>
@@ -341,10 +353,10 @@ Copyright © 2006 by Christophe Dumez&lt;br>
</item> </item>
<item> <item>
<spacer> <spacer>
<property name="orientation" > <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" > <property name="sizeHint" stdset="0">
<size> <size>
<width>40</width> <width>40</width>
<height>20</height> <height>20</height>
@@ -357,46 +369,46 @@ Copyright © 2006 by Christophe Dumez&lt;br>
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tab4" > <widget class="QWidget" name="tab4">
<attribute name="title" > <attribute name="title">
<string>Thanks to</string> <string>Thanks to</string>
</attribute> </attribute>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout">
<property name="spacing" > <property name="spacing">
<number>6</number> <number>6</number>
</property> </property>
<item> <item>
<widget class="QTextBrowser" name="te_thanks" /> <widget class="QTextBrowser" name="te_thanks"/>
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tab5" > <widget class="QWidget" name="tab5">
<attribute name="title" > <attribute name="title">
<string>Translation</string> <string>Translation</string>
</attribute> </attribute>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout">
<property name="spacing" > <property name="spacing">
<number>6</number> <number>6</number>
</property> </property>
<item> <item>
<widget class="QTextBrowser" name="te_translation" > <widget class="QTextBrowser" name="te_translation">
<property name="lineWrapMode" > <property name="lineWrapMode">
<enum>QTextEdit::NoWrap</enum> <enum>QTextEdit::NoWrap</enum>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tab1" > <widget class="QWidget" name="tab1">
<attribute name="title" > <attribute name="title">
<string>License</string> <string>License</string>
</attribute> </attribute>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout">
<property name="spacing" > <property name="spacing">
<number>6</number> <number>6</number>
</property> </property>
<item> <item>
<widget class="QTextBrowser" name="te_license" /> <widget class="QTextBrowser" name="te_license"/>
</item> </item>
</layout> </layout>
</widget> </widget>
@@ -404,7 +416,7 @@ Copyright © 2006 by Christophe Dumez&lt;br>
</item> </item>
</layout> </layout>
</widget> </widget>
<layoutdefault spacing="6" margin="11" /> <layoutdefault spacing="6" margin="11"/>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */
@@ -37,8 +46,8 @@ class about : public QDialog, private Ui::AboutDlg{
setupUi(this); setupUi(this);
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
// Set icons // Set icons
logo->setPixmap(QPixmap(QString::fromUtf8(":/Icons/qbittorrent22.png"))); logo->setPixmap(QPixmap(QString::fromUtf8(":/Icons/skin/qbittorrent22.png")));
mascot_lbl->setPixmap(QPixmap(QString::fromUtf8(":/Icons/mascot.png"))); mascot_lbl->setPixmap(QPixmap(QString::fromUtf8(":/Icons/skin/mascot.png")));
//Title //Title
lb_name->setText(QString::fromUtf8("<b><h1>")+tr("qBittorrent")+QString::fromUtf8(" "VERSION"</h1></b>")); lb_name->setText(QString::fromUtf8("<b><h1>")+tr("qBittorrent")+QString::fromUtf8(" "VERSION"</h1></b>"));
// Thanks // Thanks
@@ -82,7 +91,19 @@ class about : public QDialog, private Ui::AboutDlg{
te_translation->scrollToAnchor(QString::fromUtf8("top")); te_translation->scrollToAnchor(QString::fromUtf8("top"));
// License // License
te_license->append(QString::fromUtf8("<a name='top'></a>")); te_license->append(QString::fromUtf8("<a name='top'></a>"));
te_license->append(QString::fromUtf8("<center><b>GNU GENERAL PUBLIC LICENSE</b></center><br>\ te_license->append(QString::fromUtf8("qBittorrent is licensed under the GNU General Public License version 2 with the\
addition of the following special exception:\
<br><br>\
<i>In addition, as a special exception, the copyright holders give permission to\
link this program with the OpenSSL project\'s \"OpenSSL\" library (or with\
modified versions of it that use the same license as the \"OpenSSL\" library),\
and distribute the linked executables. You must obey the GNU General Public\
License in all respects for all of the code used other than \"OpenSSL\". If you\
modify file(s), you may extend this exception to your version of the file(s),\
but you are not obligated to do so. If you do not wish to do so, delete this\
exception statement from your version.</i>\
<br><br>\
<center><b>GNU GENERAL PUBLIC LICENSE</b></center><br>\
<center>Version 2, June 1991</center><br>\ <center>Version 2, June 1991</center><br>\
Copyright (C) 1989, 1991 Free Software Foundation, Inc.<br>\ Copyright (C) 1989, 1991 Free Software Foundation, Inc.<br>\
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA<br>\ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA<br>\

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */
@@ -42,6 +51,8 @@ class torrent_file {
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){ 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); qDebug("created a file with index %d", index);
rel_path = QDir::cleanPath(path); rel_path = QDir::cleanPath(path);
Q_ASSERT(progress >= 0.);
Q_ASSERT(progress <= 1.);
if(parent) { if(parent) {
parent->updateProgress(); parent->updateProgress();
parent->updatePriority(priority); parent->updatePriority(priority);
@@ -66,8 +77,8 @@ class torrent_file {
progress = 0.; progress = 0.;
return; return;
} }
float wanted = 0.; double wanted = 0.;
float done = 0.; double done = 0.;
foreach(const torrent_file *child, children) { foreach(const torrent_file *child, children) {
wanted += child->getSize(); wanted += child->getSize();
done += child->getSize()*child->getProgress(); done += child->getSize()*child->getProgress();
@@ -141,7 +152,7 @@ class torrent_file {
bool removeFromFS(QString saveDir) const { bool removeFromFS(QString saveDir) const {
QString full_path = saveDir + QDir::separator() + rel_path; QString full_path = saveDir + QDir::separator() + rel_path;
if(!QFile::exists(full_path)) { if(!QFile::exists(full_path)) {
qDebug("%s does not exist, no need to remove it", full_path.toUtf8().data()); qDebug("%s does not exist, no need to remove it", full_path.toLocal8Bit().data());
return true; return true;
} }
bool success = true; bool success = true;
@@ -151,11 +162,11 @@ class torrent_file {
success = s && success; success = s && success;
} }
if(is_dir) { if(is_dir) {
qDebug("trying to remove directory: %s", full_path.toUtf8().data()); qDebug("trying to remove directory: %s", full_path.toLocal8Bit().data());
QDir dir(full_path); QDir dir(full_path);
dir.rmdir(full_path); dir.rmdir(full_path);
} else { } else {
qDebug("trying to remove file: %s", full_path.toUtf8().data()); qDebug("trying to remove file: %s", full_path.toLocal8Bit().data());
bool s = QFile::remove(full_path); bool s = QFile::remove(full_path);
success = s && success; success = s && success;
} }
@@ -196,13 +207,13 @@ class arborescence {
} else { } else {
// XXX: Will crash if there is no file in torrent // XXX: Will crash if there is no file in torrent
qDebug("one file in the torrent, setting it as root with index 0"); qDebug("one file in the torrent, setting it as root with index 0");
root = new torrent_file(0, misc::toQString(t.name()), false, fi->size, 0, ((float)fp[0])/t.file_at(0).size, prioritiesTab[0]); root = new torrent_file(0, misc::toQString(t.name()), false, fi->size, 0, ((double)fp[0])/t.file_at(0).size, prioritiesTab[0]);
return; return;
} }
int i = 0; int i = 0;
while(fi != t.end_files()) { while(fi != t.end_files()) {
QString path = QDir::cleanPath(misc::toQString(fi->path.string())); QString path = QDir::cleanPath(misc::toQString(fi->path.string()));
addFile(path, fi->size, i, ((float)fp[i])/t.file_at(i).size, prioritiesTab[i]); addFile(path, fi->size, i, ((double)fp[i])/t.file_at(i).size, prioritiesTab[i]);
fi++; fi++;
++i; ++i;
} }

View File

@@ -16,11 +16,20 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */
#include <QDir> #include <QDir>
#include <QTime> #include <QDateTime>
#include <QString> #include <QString>
#include <QTimer> #include <QTimer>
#include <QFileSystemWatcher> #include <QFileSystemWatcher>
@@ -43,16 +52,17 @@
#include <boost/filesystem/exception.hpp> #include <boost/filesystem/exception.hpp>
#define MAX_TRACKER_ERRORS 2 #define MAX_TRACKER_ERRORS 2
#define MAX_RATIO 100.
// Main constructor // Main constructor
bittorrent::bittorrent() : DHTEnabled(false), preAllocateAll(false), addInPause(false), maxConnecsPerTorrent(500), maxUploadsPerTorrent(4), max_ratio(-1), UPnPEnabled(false), NATPMPEnabled(false), LSDEnabled(false), queueingEnabled(false) { bittorrent::bittorrent() : DHTEnabled(false), preAllocateAll(false), addInPause(false), maxConnecsPerTorrent(500), maxUploadsPerTorrent(4), ratio_limit(-1), UPnPEnabled(false), NATPMPEnabled(false), LSDEnabled(false), queueingEnabled(false) {
// To avoid some exceptions // To avoid some exceptions
fs::path::default_name_check(fs::no_check); fs::path::default_name_check(fs::no_check);
// Creating bittorrent session // Creating bittorrent session
// Check if we should spoof azureus // Check if we should spoof azureus
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
if(settings.value(QString::fromUtf8("AzureusSpoof"), false).toBool()) { if(settings.value(QString::fromUtf8("AzureusSpoof"), false).toBool()) {
s = new session(fingerprint("AZ", 3, 0, 5, 2), 0); s = new session(fingerprint("UT", 1, 8, 3, 0), 0);
} else { } else {
s = new session(fingerprint("qB", VERSION_MAJOR, VERSION_MINOR, VERSION_BUGFIX, 0), 0); s = new session(fingerprint("qB", VERSION_MAJOR, VERSION_MINOR, VERSION_BUGFIX, 0), 0);
} }
@@ -115,7 +125,7 @@ void bittorrent::preAllocateAllFiles(bool b) {
} }
void bittorrent::deleteBigRatios() { void bittorrent::deleteBigRatios() {
if(max_ratio == -1) return; if(ratio_limit == -1) return;
std::vector<torrent_handle> torrents = getTorrents(); std::vector<torrent_handle> torrents = getTorrents();
std::vector<torrent_handle>::iterator torrentIT; std::vector<torrent_handle>::iterator torrentIT;
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) { for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
@@ -123,7 +133,8 @@ void bittorrent::deleteBigRatios() {
if(!h.is_valid()) continue; if(!h.is_valid()) continue;
if(h.is_seed()) { if(h.is_seed()) {
QString hash = h.hash(); QString hash = h.hash();
if(getRealRatio(hash) > max_ratio) { float ratio = getRealRatio(hash);
if(ratio <= MAX_RATIO && ratio > ratio_limit) {
QString fileName = h.name(); QString fileName = h.name();
addConsoleMessage(tr("%1 reached the maximum ratio you set.").arg(fileName)); addConsoleMessage(tr("%1 reached the maximum ratio you set.").arg(fileName));
deleteTorrent(hash); deleteTorrent(hash);
@@ -249,7 +260,7 @@ unsigned int bittorrent::getUnfinishedPausedTorrentsNb() const {
// Delete a torrent from the session, given its hash // Delete a torrent from the session, given its hash
// permanent = true means that the torrent will be removed from the hard-drive too // permanent = true means that the torrent will be removed from the hard-drive too
void bittorrent::deleteTorrent(QString hash, bool permanent) { void bittorrent::deleteTorrent(QString hash, bool permanent) {
qDebug("Deleting torrent with hash: %s", hash.toUtf8().data()); qDebug("Deleting torrent with hash: %s", hash.toLocal8Bit().data());
QTorrentHandle h = getTorrentHandle(hash); QTorrentHandle h = getTorrentHandle(hash);
if(!h.is_valid()) { if(!h.is_valid()) {
qDebug("/!\\ Error: Invalid handle"); qDebug("/!\\ Error: Invalid handle");
@@ -333,7 +344,7 @@ void bittorrent::loadWebSeeds(QString hash) {
QStringList seeds_to_delete; QStringList seeds_to_delete;
QStringList existing_seeds = h.url_seeds(); QStringList existing_seeds = h.url_seeds();
foreach(const QString &existing_seed, existing_seeds) { foreach(const QString &existing_seed, existing_seeds) {
if(!url_seeds.contains(existing_seed.toUtf8())) { if(!url_seeds.contains(existing_seed.toLocal8Bit())) {
seeds_to_delete << existing_seed; seeds_to_delete << existing_seed;
} }
} }
@@ -361,7 +372,7 @@ QTorrentHandle bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
// create it if it is not // create it if it is not
if(! torrentBackup.exists()) { if(! torrentBackup.exists()) {
if(! torrentBackup.mkpath(torrentBackup.path())) { if(! torrentBackup.mkpath(torrentBackup.path())) {
std::cerr << "Couldn't create the directory: '" << torrentBackup.path().toUtf8().data() << "'\n"; std::cerr << "Couldn't create the directory: '" << torrentBackup.path().toLocal8Bit().data() << "'\n";
exit(1); exit(1);
} }
} }
@@ -371,11 +382,11 @@ QTorrentHandle bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
return h; return h;
} }
Q_ASSERT(!file.startsWith("http://", Qt::CaseInsensitive) && !file.startsWith("https://", Qt::CaseInsensitive) && !file.startsWith("ftp://", Qt::CaseInsensitive)); Q_ASSERT(!file.startsWith("http://", Qt::CaseInsensitive) && !file.startsWith("https://", Qt::CaseInsensitive) && !file.startsWith("ftp://", Qt::CaseInsensitive));
qDebug("Adding %s to download list", file.toUtf8().data()); qDebug("Adding %s to download list", file.toLocal8Bit().data());
boost::intrusive_ptr<torrent_info> t; boost::intrusive_ptr<torrent_info> t;
try { try {
// Getting torrent file informations // Getting torrent file informations
t = new torrent_info(file.toUtf8().data()); t = new torrent_info(file.toLocal8Bit().data());
} catch(std::exception&) { } catch(std::exception&) {
if(!from_url.isNull()) { if(!from_url.isNull()) {
addConsoleMessage(tr("Unable to decode torrent file: '%1'", "e.g: Unable to decode torrent file: '/home/y/xxx.torrent'").arg(from_url), QString::fromUtf8("red")); addConsoleMessage(tr("Unable to decode torrent file: '%1'", "e.g: Unable to decode torrent file: '/home/y/xxx.torrent'").arg(from_url), QString::fromUtf8("red"));
@@ -399,7 +410,7 @@ QTorrentHandle bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
QFileInfo fi(file); QFileInfo fi(file);
QString old_hash = fi.baseName(); QString old_hash = fi.baseName();
if(old_hash != hash){ if(old_hash != hash){
qDebug("* ERROR: Strange, hash changed from %s to %s", old_hash.toUtf8().data(), hash.toUtf8().data()); qDebug("* ERROR: Strange, hash changed from %s to %s", old_hash.toLocal8Bit().data(), hash.toLocal8Bit().data());
} }
} }
// Check if torrent is already in download list // Check if torrent is already in download list
@@ -425,8 +436,8 @@ QTorrentHandle bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
add_torrent_params p; add_torrent_params p;
//Getting fast resume data if existing //Getting fast resume data if existing
std::vector<char> buf; std::vector<char> buf;
qDebug("Trying to load fastresume data: %s", (torrentBackup.path()+QDir::separator()+hash+QString(".fastresume")).toUtf8().data()); qDebug("Trying to load fastresume data: %s", (torrentBackup.path()+QDir::separator()+hash+QString(".fastresume")).toLocal8Bit().data());
if (load_file((torrentBackup.path()+QDir::separator()+hash+QString(".fastresume")).toUtf8().data(), buf) == 0) { if (load_file((torrentBackup.path()+QDir::separator()+hash+QString(".fastresume")).toLocal8Bit().data(), buf) == 0) {
fastResume = true; fastResume = true;
p.resume_data = &buf; p.resume_data = &buf;
qDebug("Successfuly loaded"); qDebug("Successfuly loaded");
@@ -436,10 +447,14 @@ QTorrentHandle bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
QFile savepath_file(misc::qBittorrentPath()+QString::fromUtf8("BT_backup")+QDir::separator()+hash+QString::fromUtf8(".savepath")); QFile savepath_file(misc::qBittorrentPath()+QString::fromUtf8("BT_backup")+QDir::separator()+hash+QString::fromUtf8(".savepath"));
if(!savepath_file.exists()) { if(!savepath_file.exists()) {
savepath_file.open(QIODevice::WriteOnly | QIODevice::Text); savepath_file.open(QIODevice::WriteOnly | QIODevice::Text);
savepath_file.write(savePath.toUtf8()); savepath_file.write(savePath.toLocal8Bit());
savepath_file.close(); savepath_file.close();
} }
p.save_path = savePath.toUtf8().data(); if(defaultTempPath.isEmpty() || QFile::exists(misc::qBittorrentPath()+QString::fromUtf8("BT_backup")+QDir::separator()+hash+QString::fromUtf8(".finished"))) {
p.save_path = savePath.toLocal8Bit().data();
} else {
p.save_path = defaultTempPath.toLocal8Bit().data();
}
p.ti = t; p.ti = t;
// Preallocate all? // Preallocate all?
if(preAllocateAll) if(preAllocateAll)
@@ -633,7 +648,7 @@ void bittorrent::enableLSD(bool b) {
} }
void bittorrent::loadSessionState() { void bittorrent::loadSessionState() {
boost::filesystem::ifstream ses_state_file((misc::qBittorrentPath()+QString::fromUtf8("ses_state")).toUtf8().data() boost::filesystem::ifstream ses_state_file((misc::qBittorrentPath()+QString::fromUtf8("ses_state")).toLocal8Bit().data()
, std::ios_base::binary); , std::ios_base::binary);
ses_state_file.unsetf(std::ios_base::skipws); ses_state_file.unsetf(std::ios_base::skipws);
s->load_state(bdecode( s->load_state(bdecode(
@@ -644,7 +659,7 @@ void bittorrent::loadSessionState() {
void bittorrent::saveSessionState() { void bittorrent::saveSessionState() {
qDebug("Saving session state to disk..."); qDebug("Saving session state to disk...");
entry session_state = s->state(); entry session_state = s->state();
boost::filesystem::ofstream out((misc::qBittorrentPath()+QString::fromUtf8("ses_state")).toUtf8().data() boost::filesystem::ofstream out((misc::qBittorrentPath()+QString::fromUtf8("ses_state")).toLocal8Bit().data()
, std::ios_base::binary); , std::ios_base::binary);
out.unsetf(std::ios_base::skipws); out.unsetf(std::ios_base::skipws);
bencode(std::ostream_iterator<char>(out), session_state); bencode(std::ostream_iterator<char>(out), session_state);
@@ -657,7 +672,7 @@ bool bittorrent::enableDHT(bool b) {
entry dht_state; entry dht_state;
QString dht_state_path = misc::qBittorrentPath()+QString::fromUtf8("dht_state"); QString dht_state_path = misc::qBittorrentPath()+QString::fromUtf8("dht_state");
if(QFile::exists(dht_state_path)) { if(QFile::exists(dht_state_path)) {
boost::filesystem::ifstream dht_state_file(dht_state_path.toUtf8().data(), std::ios_base::binary); boost::filesystem::ifstream dht_state_file(dht_state_path.toLocal8Bit().data(), std::ios_base::binary);
dht_state_file.unsetf(std::ios_base::skipws); dht_state_file.unsetf(std::ios_base::skipws);
try{ try{
dht_state = bdecode(std::istream_iterator<char>(dht_state_file), std::istream_iterator<char>()); dht_state = bdecode(std::istream_iterator<char>(dht_state_file), std::istream_iterator<char>());
@@ -686,13 +701,13 @@ bool bittorrent::enableDHT(bool b) {
} }
void bittorrent::saveTorrentSpeedLimits(QString hash) { void bittorrent::saveTorrentSpeedLimits(QString hash) {
qDebug("Saving speedLimits file for %s", hash.toUtf8().data()); qDebug("Saving speedLimits file for %s", hash.toLocal8Bit().data());
QTorrentHandle h = getTorrentHandle(hash); QTorrentHandle h = getTorrentHandle(hash);
int download_limit = h.download_limit(); int download_limit = h.download_limit();
int upload_limit = h.upload_limit(); int upload_limit = h.upload_limit();
QFile speeds_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".speedLimits"); QFile speeds_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".speedLimits");
if(!speeds_file.open(QIODevice::WriteOnly | QIODevice::Text)) { if(!speeds_file.open(QIODevice::WriteOnly | QIODevice::Text)) {
qDebug("* Error: Couldn't open speed limits file for torrent: %s", hash.toUtf8().data()); qDebug("* Error: Couldn't open speed limits file for torrent: %s", hash.toLocal8Bit().data());
return; return;
} }
speeds_file.write(misc::toQByteArray(download_limit)+QByteArray(" ")+misc::toQByteArray(upload_limit)); speeds_file.write(misc::toQByteArray(download_limit)+QByteArray(" ")+misc::toQByteArray(upload_limit));
@@ -700,7 +715,7 @@ void bittorrent::saveTorrentSpeedLimits(QString hash) {
} }
void bittorrent::loadTorrentSpeedLimits(QString hash) { void bittorrent::loadTorrentSpeedLimits(QString hash) {
// qDebug("Loading speedLimits file for %s", hash.toUtf8().data()); // qDebug("Loading speedLimits file for %s", hash.toLocal8Bit().data());
QTorrentHandle h = getTorrentHandle(hash); QTorrentHandle h = getTorrentHandle(hash);
QFile speeds_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".speedLimits"); QFile speeds_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".speedLimits");
if(!speeds_file.open(QIODevice::ReadOnly | QIODevice::Text)) { if(!speeds_file.open(QIODevice::ReadOnly | QIODevice::Text)) {
@@ -733,7 +748,7 @@ void bittorrent::loadFilesPriorities(QTorrentHandle &h) {
} }
// Read saved file // Read saved file
if(!pieces_file.open(QIODevice::ReadOnly | QIODevice::Text)) { if(!pieces_file.open(QIODevice::ReadOnly | QIODevice::Text)) {
qDebug("* Error: Couldn't open priorities file: %s", hash.toUtf8().data()); qDebug("* Error: Couldn't open priorities file: %s", hash.toLocal8Bit().data());
return; return;
} }
QByteArray pieces_priorities = pieces_file.readAll(); QByteArray pieces_priorities = pieces_file.readAll();
@@ -760,7 +775,9 @@ float bittorrent::getRealRatio(QString hash) const{
Q_ASSERT(h.all_time_download() >= 0); Q_ASSERT(h.all_time_download() >= 0);
Q_ASSERT(h.all_time_upload() >= 0); Q_ASSERT(h.all_time_upload() >= 0);
if(h.all_time_download() == 0) { if(h.all_time_download() == 0) {
return 101; if(h.all_time_upload() == 0)
return 0;
return 101;
} }
float ratio = (float)h.all_time_upload()/(float)h.all_time_download(); float ratio = (float)h.all_time_upload()/(float)h.all_time_download();
Q_ASSERT(ratio >= 0.); Q_ASSERT(ratio >= 0.);
@@ -818,7 +835,7 @@ void bittorrent::saveFastResumeData() {
// Remove old fastresume file if it exists // Remove old fastresume file if it exists
QFile::remove(torrentBackup.path()+QDir::separator()+ h.hash() + ".fastresume"); QFile::remove(torrentBackup.path()+QDir::separator()+ h.hash() + ".fastresume");
QString file = h.hash()+".fastresume"; QString file = h.hash()+".fastresume";
boost::filesystem::ofstream out(fs::path(torrentBackup.path().toUtf8().data()) / file.toUtf8().data(), std::ios_base::binary); boost::filesystem::ofstream out(fs::path(torrentBackup.path().toLocal8Bit().data()) / file.toLocal8Bit().data(), std::ios_base::binary);
out.unsetf(std::ios_base::skipws); out.unsetf(std::ios_base::skipws);
bencode(std::ostream_iterator<char>(out), *rd->resume_data); bencode(std::ostream_iterator<char>(out), *rd->resume_data);
// Remove torrent from session // Remove torrent from session
@@ -839,7 +856,7 @@ void bittorrent::addConsoleMessage(QString msg, QColor color) {
if(consoleMessages.size() > 100) { if(consoleMessages.size() > 100) {
consoleMessages.removeFirst(); consoleMessages.removeFirst();
} }
consoleMessages.append(QString::fromUtf8("<font color='grey'>")+ QTime::currentTime().toString(QString::fromUtf8("hh:mm:ss")) + QString::fromUtf8("</font> - <font color='") + color.name() +QString::fromUtf8("'><i>") + msg + QString::fromUtf8("</i></font>")); consoleMessages.append(QString::fromUtf8("<font color='grey'>")+ QDateTime::currentDateTime().toString(QString::fromUtf8("dd/MM/yyyy hh:mm:ss")) + QString::fromUtf8("</font> - <font color='") + color.name() +QString::fromUtf8("'><i>") + msg + QString::fromUtf8("</i></font>"));
} }
void bittorrent::addPeerBanMessage(QString ip, bool from_ipfilter) { void bittorrent::addPeerBanMessage(QString ip, bool from_ipfilter) {
@@ -847,9 +864,9 @@ void bittorrent::addPeerBanMessage(QString ip, bool from_ipfilter) {
peerBanMessages.removeFirst(); peerBanMessages.removeFirst();
} }
if(from_ipfilter) if(from_ipfilter)
peerBanMessages.append(QString::fromUtf8("<font color='grey'>")+ QTime::currentTime().toString(QString::fromUtf8("hh:mm:ss")) + QString::fromUtf8("</font> - ")+tr("<font color='red'>%1</font> <i>was blocked due to your IP filter</i>", "x.y.z.w was blocked").arg(ip)); peerBanMessages.append(QString::fromUtf8("<font color='grey'>")+ QDateTime::currentDateTime().toString(QString::fromUtf8("dd/MM/yyyy hh:mm:ss")) + QString::fromUtf8("</font> - ")+tr("<font color='red'>%1</font> <i>was blocked due to your IP filter</i>", "x.y.z.w was blocked").arg(ip));
else else
peerBanMessages.append(QString::fromUtf8("<font color='grey'>")+ QTime::currentTime().toString(QString::fromUtf8("hh:mm:ss")) + QString::fromUtf8("</font> - ")+tr("<font color='red'>%1</font> <i>was banned due to corrupt pieces</i>", "x.y.z.w was banned").arg(ip)); peerBanMessages.append(QString::fromUtf8("<font color='grey'>")+ QDateTime::currentDateTime().toString(QString::fromUtf8("dd/MM/yyyy hh:mm:ss")) + QString::fromUtf8("</font> - ")+tr("<font color='red'>%1</font> <i>was banned due to corrupt pieces</i>", "x.y.z.w was banned").arg(ip));
} }
bool bittorrent::isFilePreviewPossible(QString hash) const{ bool bittorrent::isFilePreviewPossible(QString hash) const{
@@ -873,7 +890,7 @@ bool bittorrent::isFilePreviewPossible(QString hash) const{
// and add them to download list // and add them to download list
void bittorrent::scanDirectory(QString scan_dir) { void bittorrent::scanDirectory(QString scan_dir) {
FSMutex->lock(); FSMutex->lock();
qDebug("Scanning directory: %s", scan_dir.toUtf8().data()); qDebug("Scanning directory: %s", scan_dir.toLocal8Bit().data());
QDir dir(scan_dir); QDir dir(scan_dir);
QStringList filters; QStringList filters;
filters << "*.torrent"; filters << "*.torrent";
@@ -882,10 +899,10 @@ void bittorrent::scanDirectory(QString scan_dir) {
QString fullPath = dir.path()+QDir::separator()+file; QString fullPath = dir.path()+QDir::separator()+file;
QFile torrent(fullPath); QFile torrent(fullPath);
if(torrent.size() != 0) { if(torrent.size() != 0) {
qDebug("Adding for scan_dir: %s", fullPath.toUtf8().data()); qDebug("Adding for scan_dir: %s", fullPath.toLocal8Bit().data());
addTorrent(fullPath, true); addTorrent(fullPath, true);
} else { } else {
qDebug("Ignoring empty file: %s", fullPath.toUtf8().data()); qDebug("Ignoring empty file: %s", fullPath.toLocal8Bit().data());
} }
} }
FSMutex->unlock(); FSMutex->unlock();
@@ -895,6 +912,32 @@ void bittorrent::setDefaultSavePath(QString savepath) {
defaultSavePath = savepath; defaultSavePath = savepath;
} }
void bittorrent::setDefaultTempPath(QString temppath) {
if(defaultTempPath == temppath)
return;
if(temppath.isEmpty()) {
// Disabling temp dir
// Moving all torrents to their destination folder
std::vector<torrent_handle> torrents = getTorrents();
std::vector<torrent_handle>::iterator torrentIT;
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
QTorrentHandle h = QTorrentHandle(*torrentIT);
if(!h.is_valid()) continue;
h.move_storage(getSavePath(h.hash()));
}
} else {
std::vector<torrent_handle> torrents = getTorrents();
std::vector<torrent_handle>::iterator torrentIT;
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
QTorrentHandle h = QTorrentHandle(*torrentIT);
if(!h.is_valid()) continue;
if(!h.is_seed())
h.move_storage(temppath);
}
}
defaultTempPath = temppath;
}
// Enable directory scanning // Enable directory scanning
void bittorrent::enableDirectoryScanning(QString scan_dir) { void bittorrent::enableDirectoryScanning(QString scan_dir) {
if(!scan_dir.isEmpty()) { if(!scan_dir.isEmpty()) {
@@ -972,19 +1015,19 @@ void bittorrent::setGlobalRatio(float ratio) {
// be automatically deleted // be automatically deleted
void bittorrent::setDeleteRatio(float ratio) { void bittorrent::setDeleteRatio(float ratio) {
if(ratio != -1 && ratio < 1.) ratio = 1.; if(ratio != -1 && ratio < 1.) ratio = 1.;
if(max_ratio == -1 && ratio != -1) { if(ratio_limit == -1 && ratio != -1) {
Q_ASSERT(!BigRatioTimer); Q_ASSERT(!BigRatioTimer);
BigRatioTimer = new QTimer(this); BigRatioTimer = new QTimer(this);
connect(BigRatioTimer, SIGNAL(timeout()), this, SLOT(deleteBigRatios())); connect(BigRatioTimer, SIGNAL(timeout()), this, SLOT(deleteBigRatios()));
BigRatioTimer->start(5000); BigRatioTimer->start(5000);
} else { } else {
if(max_ratio != -1 && ratio == -1) { if(ratio_limit != -1 && ratio == -1) {
delete BigRatioTimer; delete BigRatioTimer;
} }
} }
if(max_ratio != ratio) { if(ratio_limit != ratio) {
max_ratio = ratio; ratio_limit = ratio;
qDebug("* Set deleteRatio to %.1f", max_ratio); qDebug("* Set deleteRatio to %.1f", ratio_limit);
deleteBigRatios(); deleteBigRatios();
} }
} }
@@ -1014,7 +1057,7 @@ bool bittorrent::loadTrackerFile(QString hash) {
} }
void bittorrent::saveTrackerFile(QString hash) { void bittorrent::saveTrackerFile(QString hash) {
qDebug("Saving tracker file for %s", hash.toUtf8().data()); qDebug("Saving tracker file for %s", hash.toLocal8Bit().data());
QDir torrentBackup(misc::qBittorrentPath() + "BT_backup"); QDir torrentBackup(misc::qBittorrentPath() + "BT_backup");
QFile tracker_file(torrentBackup.path()+QDir::separator()+ hash + ".trackers"); QFile tracker_file(torrentBackup.path()+QDir::separator()+ hash + ".trackers");
if(tracker_file.exists()) { if(tracker_file.exists()) {
@@ -1029,9 +1072,9 @@ void bittorrent::saveTrackerFile(QString hash) {
tracker_file.close(); tracker_file.close();
} }
// Set DHT port (>= 1000) // Set DHT port (>= 1000 or 0 if same as BT)
void bittorrent::setDHTPort(int dht_port) { void bittorrent::setDHTPort(int dht_port) {
if(dht_port >= 1000) { if(dht_port == 0 or dht_port >= 1000) {
struct dht_settings DHTSettings; struct dht_settings DHTSettings;
DHTSettings.service_port = dht_port; DHTSettings.service_port = dht_port;
s->set_dht_settings(DHTSettings); s->set_dht_settings(DHTSettings);
@@ -1110,8 +1153,17 @@ void bittorrent::readAlerts() {
QFile finished_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".finished"); QFile finished_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".finished");
finished_file.open(QIODevice::WriteOnly | QIODevice::Text); finished_file.open(QIODevice::WriteOnly | QIODevice::Text);
finished_file.close(); finished_file.close();
// Move to download directory if necessary
if(!defaultTempPath.isEmpty()) {
// Check if directory is different
QDir current_dir(h.save_path());
QDir save_dir(getSavePath(h.hash()));
if(current_dir != save_dir) {
h.move_storage(save_dir.path());
}
}
h.save_resume_data(); h.save_resume_data();
qDebug("Received finished alert for %s", h.name().toUtf8().data()); qDebug("Received finished alert for %s", h.name().toLocal8Bit().data());
} }
} }
else if (save_resume_data_alert* p = dynamic_cast<save_resume_data_alert*>(a.get())) { else if (save_resume_data_alert* p = dynamic_cast<save_resume_data_alert*>(a.get())) {
@@ -1121,10 +1173,10 @@ void bittorrent::readAlerts() {
// Delete old fastresume file if necessary // Delete old fastresume file if necessary
if(QFile::exists(file)) if(QFile::exists(file))
QFile::remove(file); QFile::remove(file);
qDebug("Saving fastresume data in %s", file.toUtf8().data()); qDebug("Saving fastresume data in %s", file.toLocal8Bit().data());
if (p->resume_data) if (p->resume_data)
{ {
boost::filesystem::ofstream out(fs::path(torrentBackup.path().toUtf8().data()) / file.toUtf8().data(), std::ios_base::binary); boost::filesystem::ofstream out(fs::path(torrentBackup.path().toLocal8Bit().data()) / file.toLocal8Bit().data(), std::ios_base::binary);
out.unsetf(std::ios_base::skipws); out.unsetf(std::ios_base::skipws);
bencode(std::ostream_iterator<char>(out), *p->resume_data); bencode(std::ostream_iterator<char>(out), *p->resume_data);
} }
@@ -1132,9 +1184,9 @@ void bittorrent::readAlerts() {
else if (file_error_alert* p = dynamic_cast<file_error_alert*>(a.get())) { else if (file_error_alert* p = dynamic_cast<file_error_alert*>(a.get())) {
QTorrentHandle h(p->handle); QTorrentHandle h(p->handle);
h.auto_managed(false); h.auto_managed(false);
qDebug("File Error: %s", p->message().c_str()); std::cerr << "File Error: " << p->message().c_str() << std::endl;
if(h.is_valid()) if(h.is_valid())
emit fullDiskError(h); emit fullDiskError(h, misc::toQString(p->message()));
} }
else if (dynamic_cast<listen_failed_alert*>(a.get())) { else if (dynamic_cast<listen_failed_alert*>(a.get())) {
// Level: fatal // Level: fatal
@@ -1161,7 +1213,7 @@ void bittorrent::readAlerts() {
else if (tracker_reply_alert* p = dynamic_cast<tracker_reply_alert*>(a.get())) { else if (tracker_reply_alert* p = dynamic_cast<tracker_reply_alert*>(a.get())) {
QTorrentHandle h(p->handle); QTorrentHandle h(p->handle);
if(h.is_valid()){ if(h.is_valid()){
qDebug("Received a tracker reply from %s", (const char*)h.current_tracker().toUtf8()); qDebug("Received a tracker reply from %s", (const char*)h.current_tracker().toLocal8Bit());
QString hash = h.hash(); QString hash = h.hash();
QHash<QString, QString> errors = trackersErrors.value(hash, QHash<QString, QString>()); QHash<QString, QString> errors = trackersErrors.value(hash, QHash<QString, QString>());
// p->url requires at least libtorrent v0.13.1 // p->url requires at least libtorrent v0.13.1
@@ -1189,7 +1241,7 @@ void bittorrent::readAlerts() {
else if (fastresume_rejected_alert* p = dynamic_cast<fastresume_rejected_alert*>(a.get())) { else if (fastresume_rejected_alert* p = dynamic_cast<fastresume_rejected_alert*>(a.get())) {
QTorrentHandle h(p->handle); QTorrentHandle h(p->handle);
if(h.is_valid()){ if(h.is_valid()){
qDebug("/!\\ Fast resume failed for %s, reason: %s", h.name().toUtf8().data(), p->message().c_str()); qDebug("/!\\ Fast resume failed for %s, reason: %s", h.name().toLocal8Bit().data(), p->message().c_str());
addConsoleMessage(tr("Fast resume data was rejected for torrent %1, checking again...").arg(h.name()), QString::fromUtf8("red")); addConsoleMessage(tr("Fast resume data was rejected for torrent %1, checking again...").arg(h.name()), QString::fromUtf8("red"));
//emit fastResumeDataRejected(h.name()); //emit fastResumeDataRejected(h.name());
} }
@@ -1202,7 +1254,16 @@ void bittorrent::readAlerts() {
QTorrentHandle h(p->handle); QTorrentHandle h(p->handle);
if(h.is_valid()){ if(h.is_valid()){
QString hash = h.hash(); QString hash = h.hash();
qDebug("%s have just finished checking", hash.toUtf8().data()); qDebug("%s have just finished checking", hash.toLocal8Bit().data());
// Move to temp directory if necessary
if(!h.is_seed() && !defaultTempPath.isEmpty()) {
// Check if directory is different
QDir current_dir(h.save_path());
QDir save_dir(getSavePath(h.hash()));
if(current_dir == save_dir) {
h.move_storage(defaultTempPath);
}
}
emit torrentFinishedChecking(h); emit torrentFinishedChecking(h);
} }
} }
@@ -1241,7 +1302,7 @@ QString bittorrent::getSavePath(QString hash) {
QDir saveDir(savePath); QDir saveDir(savePath);
if(!saveDir.exists()) { if(!saveDir.exists()) {
if(!saveDir.mkpath(saveDir.path())) { if(!saveDir.mkpath(saveDir.path())) {
std::cerr << "Couldn't create the save directory: " << saveDir.path().toUtf8().data() << "\n"; std::cerr << "Couldn't create the save directory: " << saveDir.path().toLocal8Bit().data() << "\n";
// XXX: handle this better // XXX: handle this better
return QDir::homePath(); return QDir::homePath();
} }
@@ -1307,7 +1368,7 @@ void bittorrent::saveDHTEntry() {
if(DHTEnabled) { if(DHTEnabled) {
try{ try{
entry dht_state = s->dht_state(); entry dht_state = s->dht_state();
boost::filesystem::ofstream out((misc::qBittorrentPath()+QString::fromUtf8("dht_state")).toUtf8().data(), std::ios_base::binary); boost::filesystem::ofstream out((misc::qBittorrentPath()+QString::fromUtf8("dht_state")).toLocal8Bit().data(), std::ios_base::binary);
out.unsetf(std::ios_base::skipws); out.unsetf(std::ios_base::skipws);
bencode(std::ostream_iterator<char>(out), dht_state); bencode(std::ostream_iterator<char>(out), dht_state);
qDebug("DHT entry saved"); qDebug("DHT entry saved");

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */
#ifndef __BITTORRENT_H__ #ifndef __BITTORRENT_H__
@@ -51,6 +60,7 @@ class bittorrent : public QObject {
bool DHTEnabled; bool DHTEnabled;
QPointer<downloadThread> downloader; QPointer<downloadThread> downloader;
QString defaultSavePath; QString defaultSavePath;
QString defaultTempPath;
QHash<QString, QHash<QString, QString> > trackersErrors; QHash<QString, QHash<QString, QString> > trackersErrors;
QStringList consoleMessages; QStringList consoleMessages;
QStringList peerBanMessages; QStringList peerBanMessages;
@@ -58,7 +68,7 @@ class bittorrent : public QObject {
bool addInPause; bool addInPause;
int maxConnecsPerTorrent; int maxConnecsPerTorrent;
int maxUploadsPerTorrent; int maxUploadsPerTorrent;
float max_ratio; float ratio_limit;
bool UPnPEnabled; bool UPnPEnabled;
bool NATPMPEnabled; bool NATPMPEnabled;
bool LSDEnabled; bool LSDEnabled;
@@ -142,6 +152,7 @@ class bittorrent : public QObject {
void setSessionSettings(session_settings sessionSettings); void setSessionSettings(session_settings sessionSettings);
void startTorrentsInPause(bool b); void startTorrentsInPause(bool b);
void setDefaultSavePath(QString savepath); void setDefaultSavePath(QString savepath);
void setDefaultTempPath(QString temppath);
void applyEncryptionSettings(pe_settings se); void applyEncryptionSettings(pe_settings se);
void loadFilesPriorities(QTorrentHandle& h); void loadFilesPriorities(QTorrentHandle& h);
void setDownloadLimit(QString hash, long val); void setDownloadLimit(QString hash, long val);
@@ -152,11 +163,11 @@ class bittorrent : public QObject {
bool enableDHT(bool b); bool enableDHT(bool b);
void addConsoleMessage(QString msg, QColor color=QApplication::palette().color(QPalette::WindowText)); void addConsoleMessage(QString msg, QColor color=QApplication::palette().color(QPalette::WindowText));
void addPeerBanMessage(QString msg, bool from_ipfilter); void addPeerBanMessage(QString msg, bool from_ipfilter);
void processDownloadedFile(QString, QString);
protected slots: protected slots:
void scanDirectory(QString); void scanDirectory(QString);
void readAlerts(); void readAlerts();
void processDownloadedFile(QString, QString);
bool loadTrackerFile(QString hash); bool loadTrackerFile(QString hash);
void saveTrackerFile(QString hash); void saveTrackerFile(QString hash);
void deleteBigRatios(); void deleteBigRatios();
@@ -167,7 +178,7 @@ class bittorrent : public QObject {
void pausedTorrent(QTorrentHandle& h); void pausedTorrent(QTorrentHandle& h);
void resumedTorrent(QTorrentHandle& h); void resumedTorrent(QTorrentHandle& h);
void finishedTorrent(QTorrentHandle& h); void finishedTorrent(QTorrentHandle& h);
void fullDiskError(QTorrentHandle& h); void fullDiskError(QTorrentHandle& h, QString msg);
void trackerError(QString hash, QString time, QString msg); void trackerError(QString hash, QString time, QString msg);
void trackerAuthenticationRequired(QTorrentHandle& h); void trackerAuthenticationRequired(QTorrentHandle& h);
void newDownloadedTorrent(QString path, QString url); void newDownloadedTorrent(QString path, QString url);

View File

@@ -13,7 +13,7 @@
<string>qBittorrent console</string> <string>qBittorrent console</string>
</property> </property>
<property name="windowIcon" > <property name="windowIcon" >
<iconset resource="icons.qrc" >:/Icons/log.png</iconset> <iconset resource="icons.qrc" >:/Icons/oxygen/log.png</iconset>
</property> </property>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<item> <item>
@@ -26,7 +26,7 @@
<string>General</string> <string>General</string>
</attribute> </attribute>
<attribute name="icon" > <attribute name="icon" >
<iconset resource="icons.qrc" >:/Icons/log.png</iconset> <iconset resource="icons.qrc" >:/Icons/oxygen/log.png</iconset>
</attribute> </attribute>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<item> <item>

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */
@@ -175,7 +184,6 @@ void createtorrent::on_createButton_clicked(){
void createtorrent::handleCreationFailure(QString msg) { void createtorrent::handleCreationFailure(QString msg) {
QMessageBox::information(0, tr("Torrent creation"), tr("Torrent creation was unsuccessful, reason: %1").arg(msg)); QMessageBox::information(0, tr("Torrent creation"), tr("Torrent creation was unsuccessful, reason: %1").arg(msg));
hide();
} }
void createtorrent::handleCreationSuccess(QString path, const char* branch_path) { void createtorrent::handleCreationSuccess(QString path, const char* branch_path) {
@@ -183,7 +191,7 @@ void createtorrent::handleCreationSuccess(QString path, const char* branch_path)
// Create save path file // Create save path file
boost::intrusive_ptr<torrent_info> t; boost::intrusive_ptr<torrent_info> t;
try { try {
t = new torrent_info(path.toUtf8().data()); t = new torrent_info(path.toLocal8Bit().data());
} catch(std::exception&) { } catch(std::exception&) {
QMessageBox::critical(0, tr("Torrent creation"), tr("Created torrent file is invalid. It won't be added to download list.")); QMessageBox::critical(0, tr("Torrent creation"), tr("Created torrent file is invalid. It won't be added to download list."));
return; return;
@@ -196,7 +204,7 @@ void createtorrent::handleCreationSuccess(QString path, const char* branch_path)
emit torrent_to_seed(path); emit torrent_to_seed(path);
} }
QMessageBox::information(0, tr("Torrent creation"), tr("Torrent was created successfully:")+" "+path); QMessageBox::information(0, tr("Torrent creation"), tr("Torrent was created successfully:")+" "+path);
hide(); close();
} }
void createtorrent::updateProgressBar(int progress) { void createtorrent::updateProgressBar(int progress) {
@@ -219,8 +227,12 @@ void torrentCreatorThread::create(QString _input_path, QString _save_path, QStri
start(); start();
} }
void sendProgressUpdateSignal(int i, int num, QDialog *parent){ void sendProgressUpdateSignal(int i, int num, torrentCreatorThread *parent){
((createtorrent*)parent)->updateProgressBar((int)(i*100./(float)num)); parent->sendProgressSignal((int)(i*100./(float)num));
}
void torrentCreatorThread::sendProgressSignal(int progress) {
emit updateProgress(progress);
} }
void torrentCreatorThread::run() { void torrentCreatorThread::run() {
@@ -229,7 +241,7 @@ void torrentCreatorThread::run() {
try { try {
file_storage fs; file_storage fs;
file_pool fp; file_pool fp;
path full_path = complete(path(input_path.toUtf8().data())); path full_path = complete(path(input_path.toLocal8Bit().data()));
// Adding files to the torrent // Adding files to the torrent
add_files(fs, full_path, file_filter); add_files(fs, full_path, file_filter);
if(abort) return; if(abort) return;
@@ -238,25 +250,23 @@ void torrentCreatorThread::run() {
// Add url seeds // Add url seeds
QString seed; QString seed;
foreach(seed, url_seeds){ foreach(seed, url_seeds){
t.add_url_seed(seed.toUtf8().data()); t.add_url_seed(seed.toLocal8Bit().data());
} }
for(int i=0; i<trackers.size(); ++i){ for(int i=0; i<trackers.size(); ++i){
t.add_tracker(trackers.at(i).toUtf8().data()); t.add_tracker(trackers.at(i).toLocal8Bit().data());
} }
if(abort) return; if(abort) return;
// calculate the hash for all pieces // calculate the hash for all pieces
set_piece_hashes(t, full_path.branch_path(), boost::bind<void>(&sendProgressUpdateSignal, _1, t.num_pieces(), parent)); set_piece_hashes(t, full_path.branch_path(), boost::bind<void>(&sendProgressUpdateSignal, _1, t.num_pieces(), this));
// Set qBittorrent as creator and add user comment to // Set qBittorrent as creator and add user comment to
// torrent_info structure // torrent_info structure
t.set_creator(creator_str); t.set_creator(creator_str);
t.set_comment((const char*)comment.toUtf8()); t.set_comment((const char*)comment.toLocal8Bit());
// Is private ? // Is private ?
if(is_private){ t.set_priv(is_private);
t.set_priv(true);
}
if(abort) return; if(abort) return;
// create the torrent and print it to out // create the torrent and print it to out
ofstream out(complete(path((const char*)save_path.toUtf8())), std::ios_base::binary); ofstream out(complete(path((const char*)save_path.toLocal8Bit())), std::ios_base::binary);
bencode(std::ostream_iterator<char>(out), t.generate()); bencode(std::ostream_iterator<char>(out), t.generate());
emit updateProgress(100); emit updateProgress(100);
emit creationSuccess(save_path, full_path.branch_path().string().c_str()); emit creationSuccess(save_path, full_path.branch_path().string().c_str());

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */
@@ -48,6 +57,7 @@ class torrentCreatorThread : public QThread {
wait(); wait();
} }
void create(QString _input_path, QString _save_path, QStringList _trackers, QStringList _url_seeds, QString _comment, bool _is_private, int _piece_size); void create(QString _input_path, QString _save_path, QStringList _trackers, QStringList _url_seeds, QString _comment, bool _is_private, int _piece_size);
void sendProgressSignal(int progress);
protected: protected:
void run(); void run();
@@ -55,6 +65,8 @@ class torrentCreatorThread : public QThread {
signals: signals:
void creationFailure(QString msg); void creationFailure(QString msg);
void creationSuccess(QString path, const char* branch_path); void creationSuccess(QString path, const char* branch_path);
signals:
void updateProgress(int progress); void updateProgress(int progress);
}; };

View File

@@ -92,7 +92,7 @@
<action name="actionOpen_destination_folder" > <action name="actionOpen_destination_folder" >
<property name="icon" > <property name="icon" >
<iconset resource="icons.qrc" > <iconset resource="icons.qrc" >
<normaloff>:/Icons/folder.png</normaloff>:/Icons/folder.png</iconset> <normaloff>:/Icons/oxygen/folder.png</normaloff>:/Icons/oxygen/folder.png</iconset>
</property> </property>
<property name="text" > <property name="text" >
<string>Open destination folder</string> <string>Open destination folder</string>
@@ -173,7 +173,7 @@
<action name="actionForce_recheck" > <action name="actionForce_recheck" >
<property name="icon" > <property name="icon" >
<iconset resource="icons.qrc" > <iconset resource="icons.qrc" >
<normaloff>:/Icons/gear.png</normaloff>:/Icons/gear.png</iconset> <normaloff>:/Icons/oxygen/gear.png</normaloff>:/Icons/oxygen/gear.png</iconset>
</property> </property>
<property name="text" > <property name="text" >
<string>Force recheck</string> <string>Force recheck</string>

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */
@@ -75,7 +84,7 @@ void subDownloadThread::run(){
filePath = tmpfile->fileName(); filePath = tmpfile->fileName();
} }
delete tmpfile; delete tmpfile;
FILE *f = fopen(filePath.toUtf8().data(), "wb"); FILE *f = fopen(filePath.toLocal8Bit().data(), "wb");
if(!f) { if(!f) {
std::cerr << "couldn't open destination file" << "\n"; std::cerr << "couldn't open destination file" << "\n";
return; return;
@@ -84,7 +93,7 @@ void subDownloadThread::run(){
CURLcode res = (CURLcode)-1; CURLcode res = (CURLcode)-1;
curl = curl_easy_init(); curl = curl_easy_init();
if(curl) { if(curl) {
std::string c_url = url.toUtf8().data(); std::string c_url = url.toLocal8Bit().data();
curl_easy_setopt(curl, CURLOPT_URL, c_url.c_str()); curl_easy_setopt(curl, CURLOPT_URL, c_url.c_str());
// SSL support // SSL support
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
@@ -96,8 +105,8 @@ void subDownloadThread::run(){
// Proxy enabled // Proxy enabled
QString IP = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/IP"), "0.0.0.0").toString(); QString IP = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/IP"), "0.0.0.0").toString();
QString port = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/Port"), 8080).toString(); QString port = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/Port"), 8080).toString();
qDebug("Using proxy: %s", (IP+QString(":")+port).toUtf8().data()); qDebug("Using proxy: %s", (IP+QString(":")+port).toLocal8Bit().data());
curl_easy_setopt(curl, CURLOPT_PROXYPORT, (IP+QString(":")+port).toUtf8().data()); curl_easy_setopt(curl, CURLOPT_PROXYPORT, (IP+QString(":")+port).toLocal8Bit().data());
// Default proxy type is HTTP, we must change if it is SOCKS5 // Default proxy type is HTTP, we must change if it is SOCKS5
if(intValue%2==0) { if(intValue%2==0) {
qDebug("Proxy is SOCKS5, not HTTP"); qDebug("Proxy is SOCKS5, not HTTP");
@@ -108,7 +117,7 @@ void subDownloadThread::run(){
qDebug("Proxy requires authentication, authenticating"); qDebug("Proxy requires authentication, authenticating");
QString username = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/Username"), QString()).toString(); QString username = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/Username"), QString()).toString();
QString password = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/Password"), QString()).toString(); QString password = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/Password"), QString()).toString();
curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, (username+QString(":")+password).toUtf8().data()); curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, (username+QString(":")+password).toLocal8Bit().data());
} }
} }
// We have to define CURLOPT_WRITEFUNCTION or it will crash on windows // We have to define CURLOPT_WRITEFUNCTION or it will crash on windows
@@ -122,7 +131,7 @@ void subDownloadThread::run(){
curl_easy_setopt(curl, CURLOPT_AUTOREFERER, 1); curl_easy_setopt(curl, CURLOPT_AUTOREFERER, 1);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(curl, CURLOPT_MAXREDIRS, -1); curl_easy_setopt(curl, CURLOPT_MAXREDIRS, -1);
qDebug("Downloading %s", url.toUtf8().data()); qDebug("Downloading %s", url.toLocal8Bit().data());
if(!abort) if(!abort)
res = curl_easy_perform(curl); res = curl_easy_perform(curl);
/* always cleanup */ /* always cleanup */

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */
#include "downloadingTorrents.h" #include "downloadingTorrents.h"
@@ -44,8 +53,8 @@ DownloadingTorrents::DownloadingTorrents(QObject *parent, bittorrent *BTSession)
actionSet_download_limit->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/downloading.png"))); actionSet_download_limit->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/downloading.png")));
actionDelete_Permanently->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/delete_perm.png"))); actionDelete_Permanently->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/delete_perm.png")));
actionTorrent_Properties->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/properties.png"))); actionTorrent_Properties->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/properties.png")));
// tabBottom->setTabIcon(0, QIcon(QString::fromUtf8(":/Icons/log.png"))); // tabBottom->setTabIcon(0, QIcon(QString::fromUtf8(":/Icons/oxygen/log.png")));
// tabBottom->setTabIcon(1, QIcon(QString::fromUtf8(":/Icons/filter.png"))); // tabBottom->setTabIcon(1, QIcon(QString::fromUtf8(":/Icons/oxygen/filter.png")));
// Set Download list model // Set Download list model
DLListModel = new QStandardItemModel(0,10); DLListModel = new QStandardItemModel(0,10);
@@ -59,6 +68,8 @@ DownloadingTorrents::DownloadingTorrents(QObject *parent, bittorrent *BTSession)
DLListModel->setHeaderData(ETA, Qt::Horizontal, tr("ETA", "i.e: Estimated Time of Arrival / Time left")); DLListModel->setHeaderData(ETA, Qt::Horizontal, tr("ETA", "i.e: Estimated Time of Arrival / Time left"));
DLListModel->setHeaderData(PRIORITY, Qt::Horizontal, tr("Priority")); DLListModel->setHeaderData(PRIORITY, Qt::Horizontal, tr("Priority"));
downloadList->setModel(DLListModel); downloadList->setModel(DLListModel);
downloadList->setRootIsDecorated(false);
downloadList->setAllColumnsShowFocus(true);
DLDelegate = new DLListDelegate(downloadList); DLDelegate = new DLListDelegate(downloadList);
downloadList->setItemDelegate(DLDelegate); downloadList->setItemDelegate(DLDelegate);
// Hide priority column // Hide priority column
@@ -227,7 +238,7 @@ void DownloadingTorrents::forceRecheck() {
} }
} }
void DownloadingTorrents::displayDLListMenu(const QPoint& pos) { void DownloadingTorrents::displayDLListMenu(const QPoint&) {
QMenu myDLLlistMenu(this); QMenu myDLLlistMenu(this);
// 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();
@@ -276,8 +287,7 @@ void DownloadingTorrents::displayDLListMenu(const QPoint& pos) {
myDLLlistMenu.addSeparator(); myDLLlistMenu.addSeparator();
myDLLlistMenu.addAction(actionBuy_it); myDLLlistMenu.addAction(actionBuy_it);
// Call menu // Call menu
// XXX: why mapToGlobal() is not enough? myDLLlistMenu.exec(QCursor::pos());
myDLLlistMenu.exec(mapToGlobal(pos)+QPoint(10,35));
} }
@@ -317,12 +327,12 @@ void DownloadingTorrents::hideOrShowColumn(int index) {
if(nbVisibleColumns <= 1) return; if(nbVisibleColumns <= 1) return;
// User can hide the column, do it. // User can hide the column, do it.
downloadList->setColumnHidden(index, true); downloadList->setColumnHidden(index, true);
getActionHoSCol(index)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_cancel.png"))); getActionHoSCol(index)->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/button_cancel.png")));
--nbVisibleColumns; --nbVisibleColumns;
} else { } else {
// User want to display the column // User want to display the column
downloadList->setColumnHidden(index, false); downloadList->setColumnHidden(index, false);
getActionHoSCol(index)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_ok.png"))); getActionHoSCol(index)->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/button_ok.png")));
++nbVisibleColumns; ++nbVisibleColumns;
} }
//resize all others non-hidden columns //resize all others non-hidden columns
@@ -336,9 +346,9 @@ void DownloadingTorrents::hideOrShowColumn(int index) {
void DownloadingTorrents::hidePriorityColumn(bool hide) { void DownloadingTorrents::hidePriorityColumn(bool hide) {
downloadList->setColumnHidden(PRIORITY, hide); downloadList->setColumnHidden(PRIORITY, hide);
if(hide) if(hide)
getActionHoSCol(PRIORITY)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_cancel.png"))); getActionHoSCol(PRIORITY)->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/button_cancel.png")));
else else
getActionHoSCol(PRIORITY)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_ok.png"))); getActionHoSCol(PRIORITY)->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/button_ok.png")));
} }
// save the hidden columns in settings // save the hidden columns in settings
@@ -376,9 +386,9 @@ bool DownloadingTorrents::loadHiddenColumns() {
for(int i=0; i<DLListModel->columnCount()-1; i++) { for(int i=0; i<DLListModel->columnCount()-1; i++) {
if(loaded && ishidden_list.at(i) == "0") { if(loaded && ishidden_list.at(i) == "0") {
downloadList->setColumnHidden(i, true); downloadList->setColumnHidden(i, true);
getActionHoSCol(i)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_cancel.png"))); getActionHoSCol(i)->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/button_cancel.png")));
} else { } else {
getActionHoSCol(i)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_ok.png"))); getActionHoSCol(i)->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/button_ok.png")));
} }
} }
return loaded; return loaded;
@@ -488,7 +498,7 @@ bool DownloadingTorrents::updateTorrent(QTorrentHandle h) {
DLListModel->setData(DLListModel->index(row, PRIORITY), QVariant((int)BTSession->getDlTorrentPriority(hash))); DLListModel->setData(DLListModel->index(row, PRIORITY), QVariant((int)BTSession->getDlTorrentPriority(hash)));
if(h.is_queued()) { if(h.is_queued()) {
if(h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking) { if(h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking) {
DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/time.png"))), Qt::DecorationRole); DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/oxygen/time.png"))), Qt::DecorationRole);
if(!downloadList->isColumnHidden(PROGRESS)) { if(!downloadList->isColumnHidden(PROGRESS)) {
DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)h.progress())); DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)h.progress()));
} }
@@ -515,7 +525,7 @@ bool DownloadingTorrents::updateTorrent(QTorrentHandle h) {
switch(h.state()) { switch(h.state()) {
case torrent_status::checking_files: case torrent_status::checking_files:
case torrent_status::queued_for_checking: case torrent_status::queued_for_checking:
DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/time.png"))), Qt::DecorationRole); DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/oxygen/time.png"))), Qt::DecorationRole);
setRowColor(row, QString::fromUtf8("grey")); setRowColor(row, QString::fromUtf8("grey"));
break; break;
case torrent_status::downloading: case torrent_status::downloading:
@@ -546,7 +556,13 @@ bool DownloadingTorrents::updateTorrent(QTorrentHandle h) {
} }
} }
if(!downloadList->isColumnHidden(SEEDSLEECH)) { if(!downloadList->isColumnHidden(SEEDSLEECH)) {
DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant(misc::toQString(h.num_seeds(), true)+QString::fromUtf8("/")+misc::toQString(h.num_peers() - h.num_seeds(), true))); QString tmp = misc::toQString(h.num_seeds(), true);
if(h.num_complete() >= 0)
tmp.append(QString("(")+misc::toQString(h.num_complete())+QString(")"));
tmp.append(QString("/")+misc::toQString(h.num_peers() - h.num_seeds(), true));
if(h.num_incomplete() >= 0)
tmp.append(QString("(")+misc::toQString(h.num_incomplete())+QString(")"));
DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant(tmp));
} }
if(!downloadList->isColumnHidden(RATIO)) { if(!downloadList->isColumnHidden(RATIO)) {
DLListModel->setData(DLListModel->index(row, RATIO), QVariant(misc::toQString(BTSession->getRealRatio(hash)))); DLListModel->setData(DLListModel->index(row, RATIO), QVariant(misc::toQString(BTSession->getRealRatio(hash))));
@@ -558,7 +574,7 @@ bool DownloadingTorrents::updateTorrent(QTorrentHandle h) {
void DownloadingTorrents::addTorrent(QString hash) { void DownloadingTorrents::addTorrent(QString hash) {
QTorrentHandle h = BTSession->getTorrentHandle(hash); QTorrentHandle h = BTSession->getTorrentHandle(hash);
int row = getRowFromHash(hash); int row = getRowFromHash(hash);
qDebug("DL: addTorrent(): %s, row: %d", (const char*)hash.toUtf8(), row); qDebug("DL: addTorrent(): %s, row: %d", (const char*)hash.toLocal8Bit(), row);
if(row != -1) return; if(row != -1) return;
row = DLListModel->rowCount(); row = DLListModel->rowCount();
// Adding torrent to download list // Adding torrent to download list
@@ -569,6 +585,7 @@ void DownloadingTorrents::addTorrent(QString hash) {
DLListModel->setData(DLListModel->index(row, UPSPEED), QVariant((double)0.)); DLListModel->setData(DLListModel->index(row, UPSPEED), QVariant((double)0.));
DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant(QString::fromUtf8("0/0"))); DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant(QString::fromUtf8("0/0")));
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, RATIO), QVariant((double)0.));
DLListModel->setData(DLListModel->index(row, ETA), QVariant((qlonglong)-1)); DLListModel->setData(DLListModel->index(row, ETA), QVariant((qlonglong)-1));
if(BTSession->isQueueingEnabled()) if(BTSession->isQueueingEnabled())
DLListModel->setData(DLListModel->index(row, PRIORITY), QVariant((int)BTSession->getDlTorrentPriority(hash))); DLListModel->setData(DLListModel->index(row, PRIORITY), QVariant((int)BTSession->getDlTorrentPriority(hash)));
@@ -708,7 +725,7 @@ void DownloadingTorrents::saveColWidthDLList() const{
width_list = line.split(' '); width_list = line.split(' ');
} }
for(short i=0; i<nbColumns; ++i){ for(short i=0; i<nbColumns; ++i){
if(downloadList->columnWidth(i)<1 && width_list.size() == DLListModel->columnCount()-1 && width_list.at(i).toInt()>=1) { if(downloadList->columnWidth(i)<1 && width_list.size() == nbColumns && width_list.at(i).toInt()>=1) {
// load the former width // load the former width
new_width_list << width_list.at(i); new_width_list << width_list.at(i);
} else if(downloadList->columnWidth(i)>=1) { } else if(downloadList->columnWidth(i)>=1) {
@@ -721,6 +738,11 @@ void DownloadingTorrents::saveColWidthDLList() const{
} }
} }
settings.setValue(QString::fromUtf8("DownloadListColsWidth"), new_width_list.join(QString::fromUtf8(" "))); settings.setValue(QString::fromUtf8("DownloadListColsWidth"), new_width_list.join(QString::fromUtf8(" ")));
QVariantList visualIndexes;
for(int i=0; i<nbColumns; ++i) {
visualIndexes.append(downloadList->header()->visualIndex(i));
}
settings.setValue(QString::fromUtf8("DownloadListVisualIndexes"), visualIndexes);
qDebug("Download list columns width saved"); qDebug("Download list columns width saved");
} }
@@ -741,6 +763,23 @@ bool DownloadingTorrents::loadColWidthDLList() {
for(unsigned int i=0; i<listSize; ++i) { for(unsigned int i=0; i<listSize; ++i) {
downloadList->header()->resizeSection(i, width_list.at(i).toInt()); downloadList->header()->resizeSection(i, width_list.at(i).toInt());
} }
QVariantList visualIndexes = settings.value(QString::fromUtf8("DownloadListVisualIndexes"), QVariantList()).toList();
if(visualIndexes.size() != DLListModel->columnCount()-1) {
qDebug("Corrupted values for download list columns sizes");
return false;
}
bool change = false;
do {
change = false;
for(int i=0;i<visualIndexes.size(); ++i) {
int new_visual_index = visualIndexes.at(downloadList->header()->logicalIndex(i)).toInt();
if(i != new_visual_index) {
qDebug("Moving column from %d to %d", downloadList->header()->logicalIndex(i), new_visual_index);
downloadList->header()->moveSection(i, new_visual_index);
change = true;
}
}
}while(change);
qDebug("Download list columns width loaded"); qDebug("Download list columns width loaded");
return true; return true;
} }

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */

View File

@@ -16,12 +16,22 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */
#include "engineSelectDlg.h" #include "engineSelectDlg.h"
#include "downloadThread.h" #include "downloadThread.h"
#include "misc.h" #include "misc.h"
#include "ico.h"
#include "pluginSource.h" #include "pluginSource.h"
#include <QProcess> #include <QProcess>
#include <QHeaderView> #include <QHeaderView>
@@ -47,8 +57,8 @@ engineSelectDlg::engineSelectDlg(QWidget *parent) : QDialog(parent) {
pluginsTree->header()->resizeSection(0, 170); pluginsTree->header()->resizeSection(0, 170);
pluginsTree->header()->resizeSection(1, 220); pluginsTree->header()->resizeSection(1, 220);
pluginsTree->hideColumn(ENGINE_ID); pluginsTree->hideColumn(ENGINE_ID);
actionEnable->setIcon(QIcon(QString::fromUtf8(":/Icons/button_ok.png"))); actionEnable->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/button_ok.png")));
actionDisable->setIcon(QIcon(QString::fromUtf8(":/Icons/button_cancel.png"))); actionDisable->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/button_cancel.png")));
actionUninstall->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/remove.png"))); actionUninstall->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/remove.png")));
connect(actionEnable, SIGNAL(triggered()), this, SLOT(enableSelection())); connect(actionEnable, SIGNAL(triggered()), this, SLOT(enableSelection()));
connect(actionDisable, SIGNAL(triggered()), this, SLOT(disableSelection())); connect(actionDisable, SIGNAL(triggered()), this, SLOT(disableSelection()));
@@ -75,7 +85,7 @@ void engineSelectDlg::dropEvent(QDropEvent *event) {
QStringList files=event->mimeData()->text().split(QString::fromUtf8("\n")); QStringList files=event->mimeData()->text().split(QString::fromUtf8("\n"));
QString file; QString file;
foreach(file, files) { foreach(file, files) {
qDebug("dropped %s", file.toUtf8().data()); qDebug("dropped %s", file.toLocal8Bit().data());
file = file.replace("file://", ""); file = file.replace("file://", "");
if(file.startsWith("http://", Qt::CaseInsensitive) || file.startsWith("https://", Qt::CaseInsensitive) || file.startsWith("ftp://", Qt::CaseInsensitive)) { if(file.startsWith("http://", Qt::CaseInsensitive) || file.startsWith("https://", Qt::CaseInsensitive) || file.startsWith("ftp://", Qt::CaseInsensitive)) {
downloader->downloadUrl(file); downloader->downloadUrl(file);
@@ -98,7 +108,7 @@ void engineSelectDlg::dropEvent(QDropEvent *event) {
void engineSelectDlg::dragEnterEvent(QDragEnterEvent *event) { void engineSelectDlg::dragEnterEvent(QDragEnterEvent *event) {
QString mime; QString mime;
foreach(mime, event->mimeData()->formats()){ foreach(mime, event->mimeData()->formats()){
qDebug("mimeData: %s", mime.toUtf8().data()); qDebug("mimeData: %s", mime.toLocal8Bit().data());
} }
if (event->mimeData()->hasFormat(QString::fromUtf8("text/plain")) || event->mimeData()->hasFormat(QString::fromUtf8("text/uri-list"))) { if (event->mimeData()->hasFormat(QString::fromUtf8("text/plain")) || event->mimeData()->hasFormat(QString::fromUtf8("text/uri-list"))) {
event->acceptProposedAction(); event->acceptProposedAction();
@@ -113,7 +123,7 @@ void engineSelectDlg::saveSettings() {
foreach(engine, installed_engines.keys()) { foreach(engine, installed_engines.keys()) {
known_engines << engine; known_engines << engine;
known_enginesEnabled << QVariant(installed_engines.value(engine, true)); known_enginesEnabled << QVariant(installed_engines.value(engine, true));
qDebug("Engine %s has state: %d", engine.toUtf8().data(), installed_engines.value(engine, true)); qDebug("Engine %s has state: %d", engine.toLocal8Bit().data(), installed_engines.value(engine, true));
} }
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
settings.setValue(QString::fromUtf8("SearchEngines/knownEngines"), known_engines); settings.setValue(QString::fromUtf8("SearchEngines/knownEngines"), known_engines);
@@ -122,7 +132,7 @@ void engineSelectDlg::saveSettings() {
void engineSelectDlg::on_updateButton_clicked() { void engineSelectDlg::on_updateButton_clicked() {
// Download version file from primary server // Download version file from primary server
downloader->downloadUrl("http://www.dchris.eu/search_engine/versions.txt"); downloader->downloadUrl("http://www.dchris.eu/search_engine2/versions.txt");
} }
void engineSelectDlg::toggleEngineState(QTreeWidgetItem *item, int) { void engineSelectDlg::toggleEngineState(QTreeWidgetItem *item, int) {
@@ -254,7 +264,7 @@ bool engineSelectDlg::checkInstalled(QString plugin_name) const {
result = result.replace("\r", ""); 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.toLocal8Bit());
} }
void engineSelectDlg::loadSupportedSearchEngines(bool first) { void engineSelectDlg::loadSupportedSearchEngines(bool first) {
@@ -323,8 +333,13 @@ void engineSelectDlg::loadSupportedSearchEngines(bool first) {
// Good, we already have the icon // Good, we already have the icon
item->setData(ENGINE_NAME, Qt::DecorationRole, QVariant(QIcon(iconPath))); item->setData(ENGINE_NAME, Qt::DecorationRole, QVariant(QIcon(iconPath)));
} else { } else {
// Icon is missing, we must download it iconPath = misc::qBittorrentPath()+"search_engine"+QDir::separator()+"engines"+QDir::separator()+id+".ico";
downloader->downloadUrl(line.at(1)+"/favicon.ico"); if(QFile::exists(iconPath)) { // ICO support
item->setData(ENGINE_NAME, Qt::DecorationRole, QVariant(QIcon(iconPath)));
} else {
// Icon is missing, we must download it
downloader->downloadUrl(line.at(1)+"/favicon.ico");
}
} }
if(installed_engines.value(id, true)) if(installed_engines.value(id, true))
setRowColor(i, "green"); setRowColor(i, "green");
@@ -364,7 +379,7 @@ bool engineSelectDlg::isUpdateNeeded(QString plugin_name, float new_version) con
void engineSelectDlg::installZipPlugin(QString path) { void engineSelectDlg::installZipPlugin(QString path) {
QStringList plugins; QStringList plugins;
QStringList favicons; QStringList favicons;
ZZIP_DIR* dir = zzip_dir_open(path.toUtf8().data(), 0); ZZIP_DIR* dir = zzip_dir_open(path.toLocal8Bit().data(), 0);
if(!dir) { if(!dir) {
QMessageBox::warning(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("Search engine plugin archive could not be read.")); QMessageBox::warning(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("Search engine plugin archive could not be read."));
return; return;
@@ -397,8 +412,8 @@ void engineSelectDlg::installZipPlugin(QString path) {
foreach(plugin, plugins) { foreach(plugin, plugins) {
QString plugin_name = plugin.split(QDir::separator()).last(); QString plugin_name = plugin.split(QDir::separator()).last();
plugin_name.chop(3); // Remove .py extension plugin_name.chop(3); // Remove .py extension
qDebug("Detected plugin %s in archive", plugin_name.toUtf8().data()); qDebug("Detected plugin %s in archive", plugin_name.toLocal8Bit().data());
ZZIP_FILE* fp = zzip_file_open(dir, plugin.toUtf8().data(), 0); ZZIP_FILE* fp = zzip_file_open(dir, plugin.toLocal8Bit().data(), 0);
if(fp) { if(fp) {
QTemporaryFile *tmpfile = new QTemporaryFile(); QTemporaryFile *tmpfile = new QTemporaryFile();
QString tmpPath; QString tmpPath;
@@ -415,7 +430,7 @@ void engineSelectDlg::installZipPlugin(QString path) {
tmpfile->close(); tmpfile->close();
} else { } else {
qDebug("Could not open tmp file"); qDebug("Could not open tmp file");
QMessageBox::warning(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("%1 search engine plugin could not be installed.", "%1 is the name of the search engine").arg(plugin_name.toUtf8().data())); QMessageBox::warning(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("%1 search engine plugin could not be installed.", "%1 is the name of the search engine").arg(plugin_name.toLocal8Bit().data()));
delete tmpfile; delete tmpfile;
continue; continue;
} }
@@ -426,12 +441,12 @@ void engineSelectDlg::installZipPlugin(QString path) {
qDebug("Deleted tmpfile"); qDebug("Deleted tmpfile");
} else { } else {
qDebug("Cannot read file in archive"); qDebug("Cannot read file in archive");
QMessageBox::warning(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("%1 search engine plugin could not be installed.", "%1 is the name of the search engine").arg(plugin_name.toUtf8().data())); QMessageBox::warning(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("%1 search engine plugin could not be installed.", "%1 is the name of the search engine").arg(plugin_name.toLocal8Bit().data()));
} }
} }
QString favicon; QString favicon;
foreach(favicon, favicons) { foreach(favicon, favicons) {
qDebug("Detected favicon %s in archive", favicon.toUtf8().data()); qDebug("Detected favicon %s in archive", favicon.toLocal8Bit().data());
// Ok we have a favicon here // Ok we have a favicon here
QString plugin_name = favicon.split(QDir::separator()).last(); QString plugin_name = favicon.split(QDir::separator()).last();
plugin_name.chop(4); // Remove .png extension plugin_name.chop(4); // Remove .png extension
@@ -439,8 +454,10 @@ void engineSelectDlg::installZipPlugin(QString path) {
continue; continue;
// Check if we already have a favicon for this plugin // Check if we already have a favicon for this plugin
QString iconPath = misc::qBittorrentPath()+"search_engine"+QDir::separator()+"engines"+QDir::separator()+plugin_name+".png"; QString iconPath = misc::qBittorrentPath()+"search_engine"+QDir::separator()+"engines"+QDir::separator()+plugin_name+".png";
if(QFile::exists(iconPath)) continue; if(QFile::exists(iconPath)) {
ZZIP_FILE* fp = zzip_file_open(dir, favicon.toUtf8().data(), 0); QFile::remove(iconPath);
}
ZZIP_FILE* fp = zzip_file_open(dir, favicon.toLocal8Bit().data(), 0);
if(fp) { if(fp) {
QFile dest_icon(iconPath); QFile dest_icon(iconPath);
// Write icon // Write icon
@@ -465,12 +482,12 @@ void engineSelectDlg::installZipPlugin(QString path) {
#endif #endif
void engineSelectDlg::installPlugin(QString path, QString plugin_name) { void engineSelectDlg::installPlugin(QString path, QString plugin_name) {
qDebug("Asked to install plugin at %s", path.toUtf8().data()); qDebug("Asked to install plugin at %s", path.toLocal8Bit().data());
float new_version = misc::getPluginVersion(path); float new_version = misc::getPluginVersion(path);
qDebug("Version to be installed: %.2f", new_version); qDebug("Version to be installed: %.2f", new_version);
if(!isUpdateNeeded(plugin_name, new_version)) { if(!isUpdateNeeded(plugin_name, new_version)) {
qDebug("Apparently update it not needed, we have a more recent version"); qDebug("Apparently update it not needed, we have a more recent version");
QMessageBox::information(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("A more recent version of %1 search engine plugin is already installed.", "%1 is the name of the search engine").arg(plugin_name.toUtf8().data())); QMessageBox::information(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("A more recent version of %1 search engine plugin is already installed.", "%1 is the name of the search engine").arg(plugin_name.toLocal8Bit().data()));
return; return;
} }
// Process with install // Process with install
@@ -492,12 +509,12 @@ void engineSelectDlg::installPlugin(QString path, QString plugin_name) {
// restore backup // restore backup
QFile::copy(dest_path+".bak", dest_path); QFile::copy(dest_path+".bak", dest_path);
QFile::remove(dest_path+".bak"); QFile::remove(dest_path+".bak");
QMessageBox::warning(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("%1 search engine plugin could not be updated, keeping old version.", "%1 is the name of the search engine").arg(plugin_name.toUtf8().data())); QMessageBox::warning(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("%1 search engine plugin could not be updated, keeping old version.", "%1 is the name of the search engine").arg(plugin_name.toLocal8Bit().data()));
return; return;
} else { } else {
// Remove broken file // Remove broken file
QFile::remove(dest_path); QFile::remove(dest_path);
QMessageBox::warning(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("%1 search engine plugin could not be installed.", "%1 is the name of the search engine").arg(plugin_name.toUtf8().data())); QMessageBox::warning(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("%1 search engine plugin could not be installed.", "%1 is the name of the search engine").arg(plugin_name.toLocal8Bit().data()));
return; return;
} }
} }
@@ -508,10 +525,10 @@ void engineSelectDlg::installPlugin(QString path, QString plugin_name) {
// Refresh plugin list // Refresh plugin list
loadSupportedSearchEngines(); loadSupportedSearchEngines();
if(update) { if(update) {
QMessageBox::information(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("%1 search engine plugin was successfully updated.", "%1 is the name of the search engine").arg(plugin_name.toUtf8().data())); QMessageBox::information(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("%1 search engine plugin was successfully updated.", "%1 is the name of the search engine").arg(plugin_name.toLocal8Bit().data()));
return; return;
} else { } else {
QMessageBox::information(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("%1 search engine plugin was successfully installed.", "%1 is the name of the search engine").arg(plugin_name.toUtf8().data())); QMessageBox::information(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("%1 search engine plugin was successfully installed.", "%1 is the name of the search engine").arg(plugin_name.toLocal8Bit().data()));
return; return;
} }
} }
@@ -578,17 +595,17 @@ bool engineSelectDlg::parseVersionsFile(QString versions_file, QString updateSer
plugin_name.chop(1); // remove trailing ':' plugin_name.chop(1); // remove trailing ':'
bool ok; bool ok;
float version = list.last().toFloat(&ok); float version = list.last().toFloat(&ok);
qDebug("read line %s: %.2f", plugin_name.toUtf8().data(), version); qDebug("read line %s: %.2f", plugin_name.toLocal8Bit().data(), version);
if(!ok) continue; if(!ok) continue;
file_correct = true; file_correct = true;
if(isUpdateNeeded(plugin_name, version)) { if(isUpdateNeeded(plugin_name, version)) {
qDebug("Plugin: %s is outdated", plugin_name.toUtf8().data()); qDebug("Plugin: %s is outdated", plugin_name.toLocal8Bit().data());
// Downloading update // Downloading update
downloader->downloadUrl(updateServer+plugin_name+".pyqBT"); // Actually this is really a .py downloader->downloadUrl(updateServer+plugin_name+".pyqBT"); // Actually this is really a .py
downloader->downloadUrl(updateServer+plugin_name+".png"); downloader->downloadUrl(updateServer+plugin_name+".png");
updated = true; updated = true;
}else { }else {
qDebug("Plugin: %s is up to date", plugin_name.toUtf8().data()); qDebug("Plugin: %s is up to date", plugin_name.toLocal8Bit().data());
} }
} }
// Close file // Close file
@@ -602,7 +619,7 @@ bool engineSelectDlg::parseVersionsFile(QString versions_file, QString updateSer
} }
void engineSelectDlg::processDownloadedFile(QString url, QString filePath) { void engineSelectDlg::processDownloadedFile(QString url, QString filePath) {
qDebug("engineSelectDlg received %s", url.toUtf8().data()); qDebug("engineSelectDlg received %s", url.toLocal8Bit().data());
if(url.endsWith("favicon.ico", Qt::CaseInsensitive)){ if(url.endsWith("favicon.ico", Qt::CaseInsensitive)){
// Icon downloaded // Icon downloaded
QImage fileIcon; QImage fileIcon;
@@ -611,7 +628,13 @@ void engineSelectDlg::processDownloadedFile(QString url, QString filePath) {
QTreeWidgetItem *item; QTreeWidgetItem *item;
foreach(item, items){ foreach(item, items){
QString id = item->text(ENGINE_ID); QString id = item->text(ENGINE_ID);
QString iconPath = misc::qBittorrentPath()+"search_engine"+QDir::separator()+"engines"+QDir::separator()+id+".png"; QString iconPath;
QFile icon(filePath);
icon.open(QIODevice::ReadOnly);
if(ICOHandler::canRead(&icon))
iconPath = misc::qBittorrentPath()+"search_engine"+QDir::separator()+"engines"+QDir::separator()+id+".ico";
else
iconPath = misc::qBittorrentPath()+"search_engine"+QDir::separator()+"engines"+QDir::separator()+id+".png";
QFile::copy(filePath, iconPath); QFile::copy(filePath, iconPath);
item->setData(ENGINE_NAME, Qt::DecorationRole, QVariant(QIcon(iconPath))); item->setData(ENGINE_NAME, Qt::DecorationRole, QVariant(QIcon(iconPath)));
} }
@@ -620,16 +643,16 @@ void engineSelectDlg::processDownloadedFile(QString url, QString filePath) {
QFile::remove(filePath); QFile::remove(filePath);
return; return;
} }
if(url == "http://www.dchris.eu/search_engine/versions.txt") { if(url == "http://www.dchris.eu/search_engine2/versions.txt") {
if(!parseVersionsFile(filePath, "http://www.dchris.eu/search_engine/")) { if(!parseVersionsFile(filePath, "http://www.dchris.eu/search_engine2/")) {
qDebug("Primary update server failed, try secondary"); qDebug("Primary update server failed, try secondary");
downloader->downloadUrl("http://hydr0g3n.free.fr/search_engine/versions.txt"); downloader->downloadUrl("http://hydr0g3n.free.fr/search_engine2/versions.txt");
} }
QFile::remove(filePath); QFile::remove(filePath);
return; return;
} }
if(url == "http://hydr0g3n.free.fr/search_engine/versions.txt") { if(url == "http://hydr0g3n.free.fr/search_engine2/versions.txt") {
if(!parseVersionsFile(filePath, "http://hydr0g3n.free.fr/search_engine/")) { if(!parseVersionsFile(filePath, "http://hydr0g3n.free.fr/search_engine2/")) {
QMessageBox::warning(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("Sorry, update server is temporarily unavailable.")); QMessageBox::warning(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("Sorry, update server is temporarily unavailable."));
} }
QFile::remove(filePath); QFile::remove(filePath);
@@ -654,16 +677,16 @@ void engineSelectDlg::processDownloadedFile(QString url, QString filePath) {
void engineSelectDlg::handleDownloadFailure(QString url, QString reason) { void engineSelectDlg::handleDownloadFailure(QString url, QString reason) {
if(url.endsWith("favicon.ico", Qt::CaseInsensitive)){ if(url.endsWith("favicon.ico", Qt::CaseInsensitive)){
qDebug("Could not download favicon: %s, reason: %s", url.toUtf8().data(), reason.toUtf8().data()); qDebug("Could not download favicon: %s, reason: %s", url.toLocal8Bit().data(), reason.toLocal8Bit().data());
return; return;
} }
if(url == "http://www.dchris.eu/search_engine/versions.txt") { if(url == "http://www.dchris.eu/search_engine2/versions.txt") {
// Primary update server failed, try secondary // Primary update server failed, try secondary
qDebug("Primary update server failed, try secondary"); qDebug("Primary update server failed, try secondary");
downloader->downloadUrl("http://hydr0g3n.free.fr/search_engine/versions.txt"); downloader->downloadUrl("http://hydr0g3n.free.fr/search_engine2/versions.txt");
return; return;
} }
if(url == "http://hydr0g3n.free.fr/search_engine/versions.txt") { if(url == "http://hydr0g3n.free.fr/search_engine2/versions.txt") {
QMessageBox::warning(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("Sorry, update server is temporarily unavailable.")); QMessageBox::warning(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("Sorry, update server is temporarily unavailable."));
return; return;
} }
@@ -672,13 +695,13 @@ void engineSelectDlg::handleDownloadFailure(QString url, QString reason) {
QString plugin_name = url.split('/').last(); QString plugin_name = url.split('/').last();
plugin_name.replace(".pyqBT", "", Qt::CaseInsensitive); plugin_name.replace(".pyqBT", "", Qt::CaseInsensitive);
plugin_name.replace(".py", "", Qt::CaseInsensitive); plugin_name.replace(".py", "", Qt::CaseInsensitive);
QMessageBox::warning(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("Sorry, %1 search plugin install failed.", "%1 is the name of the search engine").arg(plugin_name.toUtf8().data())); QMessageBox::warning(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("Sorry, %1 search plugin install failed.", "%1 is the name of the search engine").arg(plugin_name.toLocal8Bit().data()));
} }
#ifdef HAVE_ZZIP #ifdef HAVE_ZZIP
if(url.endsWith(".zip", Qt::CaseInsensitive)) { if(url.endsWith(".zip", Qt::CaseInsensitive)) {
QString plugin_name = url.split('/').last(); QString plugin_name = url.split('/').last();
plugin_name.replace(".zip", "", Qt::CaseInsensitive); plugin_name.replace(".zip", "", Qt::CaseInsensitive);
QMessageBox::warning(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("Sorry, %1 search plugin install failed.", "%1 is the name of the search engine").arg(plugin_name.toUtf8().data())); QMessageBox::warning(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("Sorry, %1 search plugin install failed.", "%1 is the name of the search engine").arg(plugin_name.toLocal8Bit().data()));
} }
#endif #endif
} }

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */

View File

@@ -1,21 +1,31 @@
/* /*
* Copyright (C) 2007 by Ishan Arora & Christophe Dumez * Bittorrent Client using Qt4 and libtorrent.
* <ishan@qbittorrent.org>, <chris@qbittorrent.org> * Copyright (C) 2006 Ishan Arora and Christophe Dumez
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or
* it under the terms of the GNU General Public License as published by * modify it under the terms of the GNU General Public License
* the Free Software Foundation; either version 2 of the License, or * as published by the Free Software Foundation; either version 2
* (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the * along with this program; if not, write to the Free Software
* Free Software Foundation, Inc., * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org
*/ */

View File

@@ -1,21 +1,31 @@
/* /*
* Copyright (C) 2007 by Ishan Arora & Christophe Dumez * Bittorrent Client using Qt4 and libtorrent.
* <ishan@qbittorrent.org>, <chris@qbittorrent.org> * Copyright (C) 2006 Ishan Arora and Christophe Dumez
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or
* it under the terms of the GNU General Public License as published by * modify it under the terms of the GNU General Public License
* the Free Software Foundation; either version 2 of the License, or * as published by the Free Software Foundation; either version 2
* (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the * along with this program; if not, write to the Free Software
* Free Software Foundation, Inc., * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org
*/ */

View File

@@ -16,6 +16,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */
@@ -182,17 +191,21 @@ class FilterParserThread : public QThread {
if(IPv4) { if(IPv4) {
//IPv4 addresses //IPv4 addresses
IP = strStartIP.split('.'); IP = strStartIP.split('.');
address_v4 start((IP.at(0).toInt() << 24) + (IP.at(1).toInt() << 16) + (IP.at(2).toInt() << 8) + IP.at(3).toInt()); if(IP.size() != 4)
throw exception();
address_v4 start((IP.at(0).toUInt() << 24) + (IP.at(1).toUInt() << 16) + (IP.at(2).toUInt() << 8) + IP.at(3).toUInt());
IP = strEndIP.split('.'); IP = strEndIP.split('.');
address_v4 last((IP.at(0).toInt() << 24) + (IP.at(1).toInt() << 16) + (IP.at(2).toInt() << 8) + IP.at(3).toInt()); if(IP.size() != 4)
throw exception();
address_v4 last((IP.at(0).toUInt() << 24) + (IP.at(1).toUInt() << 16) + (IP.at(2).toUInt() << 8) + IP.at(3).toUInt());
// Apply to bittorrent session // Apply to bittorrent session
filter.add_rule(start, last, ip_filter::blocked); filter.add_rule(start, last, ip_filter::blocked);
} else { } else {
// IPv6, ex : 1fff:0000:0a88:85a3:0000:0000:ac1f:8001 // IPv6, ex : 1fff:0000:0a88:85a3:0000:0000:ac1f:8001
IP = strStartIP.split(':'); IP = strStartIP.split(':');
address_v6 start = address_v6::from_string(strStartIP.remove(':', 0).toUtf8().data()); address_v6 start = address_v6::from_string(strStartIP.remove(':', 0).toLocal8Bit().data());
IP = strEndIP.split(':'); IP = strEndIP.split(':');
address_v6 last = address_v6::from_string(strEndIP.remove(':', 0).toUtf8().data()); address_v6 last = address_v6::from_string(strEndIP.remove(':', 0).toLocal8Bit().data());
// Apply to bittorrent session // Apply to bittorrent session
filter.add_rule(start, last, ip_filter::blocked); filter.add_rule(start, last, ip_filter::blocked);
} }
@@ -241,9 +254,9 @@ class FilterParserThread : public QThread {
if(strStartIP.contains(is_ipv4) && strEndIP.contains(is_ipv4)) { if(strStartIP.contains(is_ipv4) && strEndIP.contains(is_ipv4)) {
// IPv4 // IPv4
IP = strStartIP.split('.'); IP = strStartIP.split('.');
address_v4 start((IP.at(0).toInt() << 24) + (IP.at(1).toInt() << 16) + (IP.at(2).toInt() << 8) + IP.at(3).toInt()); address_v4 start((IP.at(0).toUInt() << 24) + (IP.at(1).toUInt() << 16) + (IP.at(2).toUInt() << 8) + IP.at(3).toUInt());
IP = strEndIP.split('.'); IP = strEndIP.split('.');
address_v4 last((IP.at(0).toInt() << 24) + (IP.at(1).toInt() << 16) + (IP.at(2).toInt() << 8) + IP.at(3).toInt()); address_v4 last((IP.at(0).toUInt() << 24) + (IP.at(1).toUInt() << 16) + (IP.at(2).toUInt() << 8) + IP.at(3).toUInt());
// Apply to bittorrent session // Apply to bittorrent session
filter.add_rule(start, last, ip_filter::blocked); filter.add_rule(start, last, ip_filter::blocked);
} else { } else {

View File

@@ -1,21 +1,31 @@
/* /*
* Copyright (C) 2007 by Ishan Arora * Bittorrent Client using Qt4 and libtorrent.
* ishanarora@gmail.com * Copyright (C) 2006 Ishan Arora and Christophe Dumez
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or
* it under the terms of the GNU General Public License as published by * modify it under the terms of the GNU General Public License
* the Free Software Foundation; either version 2 of the License, or * as published by the Free Software Foundation; either version 2
* (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the * along with this program; if not, write to the Free Software
* Free Software Foundation, Inc., * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org
*/ */
@@ -46,12 +56,12 @@ HttpConnection::~HttpConnection()
} }
void HttpConnection::processDownloadedFile(QString url, QString file_path) { void HttpConnection::processDownloadedFile(QString url, QString file_path) {
qDebug("URL %s successfully downloaded !", (const char*)url.toUtf8()); qDebug("URL %s successfully downloaded !", (const char*)url.toLocal8Bit());
emit torrentReadyToBeDownloaded(file_path, false, url, false); emit torrentReadyToBeDownloaded(file_path, false, url, false);
} }
void HttpConnection::handleDownloadFailure(QString url, QString reason) { void HttpConnection::handleDownloadFailure(QString url, QString reason) {
std::cerr << "Could not download " << (const char*)url.toUtf8() << ", reason: " << (const char*)reason.toUtf8() << "\n"; std::cerr << "Could not download " << (const char*)url.toLocal8Bit() << ", reason: " << (const char*)reason.toLocal8Bit() << "\n";
} }
void HttpConnection::read() void HttpConnection::read()
@@ -93,7 +103,7 @@ void HttpConnection::respond()
{ {
//qDebug("Respond called"); //qDebug("Respond called");
QStringList auth = parser.value("Authorization").split(" ", QString::SkipEmptyParts); QStringList auth = parser.value("Authorization").split(" ", QString::SkipEmptyParts);
if (auth.size() != 2 || QString::compare(auth[0], "Basic", Qt::CaseInsensitive) != 0 || !parent->isAuthorized(auth[1].toUtf8())) if (auth.size() != 2 || QString::compare(auth[0], "Basic", Qt::CaseInsensitive) != 0 || !parent->isAuthorized(auth[1].toLocal8Bit()))
{ {
generator.setStatusLine(401, "Unauthorized"); generator.setStatusLine(401, "Unauthorized");
generator.setValue("WWW-Authenticate", "Basic realm=\"you know what\""); generator.setValue("WWW-Authenticate", "Basic realm=\"you know what\"");
@@ -177,7 +187,7 @@ void HttpConnection::respondCommand(QString command)
foreach(QString url, list){ foreach(QString url, list){
url = url.trimmed(); url = url.trimmed();
if(!url.isEmpty()){ if(!url.isEmpty()){
qDebug("Downloading url: %s", (const char*)url.toUtf8()); qDebug("Downloading url: %s", (const char*)url.toLocal8Bit());
emit UrlReadyToBeDownloaded(url); emit UrlReadyToBeDownloaded(url);
} }
} }

View File

@@ -1,21 +1,31 @@
/* /*
* Copyright (C) 2007 by Ishan Arora * Bittorrent Client using Qt4 and libtorrent.
* ishanarora@gmail.com * Copyright (C) 2006 Ishan Arora and Christophe Dumez
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or
* it under the terms of the GNU General Public License as published by * modify it under the terms of the GNU General Public License
* the Free Software Foundation; either version 2 of the License, or * as published by the Free Software Foundation; either version 2
* (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the * along with this program; if not, write to the Free Software
* Free Software Foundation, Inc., * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org
*/ */

View File

@@ -1,21 +1,31 @@
/* /*
* Copyright (C) 2007 by Ishan Arora * Bittorrent Client using Qt4 and libtorrent.
* ishanarora@gmail.com * Copyright (C) 2006 Ishan Arora and Christophe Dumez
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or
* it under the terms of the GNU General Public License as published by * modify it under the terms of the GNU General Public License
* the Free Software Foundation; either version 2 of the License, or * as published by the Free Software Foundation; either version 2
* (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the * along with this program; if not, write to the Free Software
* Free Software Foundation, Inc., * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org
*/ */

View File

@@ -1,21 +1,31 @@
/* /*
* Copyright (C) 2007 by Ishan Arora * Bittorrent Client using Qt4 and libtorrent.
* ishanarora@gmail.com * Copyright (C) 2006 Ishan Arora and Christophe Dumez
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or
* it under the terms of the GNU General Public License as published by * modify it under the terms of the GNU General Public License
* the Free Software Foundation; either version 2 of the License, or * as published by the Free Software Foundation; either version 2
* (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the * along with this program; if not, write to the Free Software
* Free Software Foundation, Inc., * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org
*/ */

View File

@@ -1,21 +1,31 @@
/* /*
* Copyright (C) 2007 by Ishan Arora * Bittorrent Client using Qt4 and libtorrent.
* ishanarora@gmail.com * Copyright (C) 2006 Ishan Arora and Christophe Dumez
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or
* it under the terms of the GNU General Public License as published by * modify it under the terms of the GNU General Public License
* the Free Software Foundation; either version 2 of the License, or * as published by the Free Software Foundation; either version 2
* (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the * along with this program; if not, write to the Free Software
* Free Software Foundation, Inc., * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org
*/ */
@@ -29,7 +39,7 @@ void HttpResponseGenerator::setMessage(const QByteArray message)
void HttpResponseGenerator::setMessage(const QString message) void HttpResponseGenerator::setMessage(const QString message)
{ {
setMessage(message.QString::toUtf8()); setMessage(message.QString::toLocal8Bit());
} }
void HttpResponseGenerator::stripMessage() void HttpResponseGenerator::stripMessage()
@@ -39,7 +49,7 @@ void HttpResponseGenerator::stripMessage()
QByteArray HttpResponseGenerator::toByteArray() const QByteArray HttpResponseGenerator::toByteArray() const
{ {
return QHttpResponseHeader::toString().toUtf8() + message; return QHttpResponseHeader::toString().toLocal8Bit() + message;
} }
void HttpResponseGenerator::setContentTypeByExt(const QString ext) void HttpResponseGenerator::setContentTypeByExt(const QString ext)

View File

@@ -1,21 +1,31 @@
/* /*
* Copyright (C) 2007 by Ishan Arora * Bittorrent Client using Qt4 and libtorrent.
* ishanarora@gmail.com * Copyright (C) 2006 Ishan Arora and Christophe Dumez
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or
* it under the terms of the GNU General Public License as published by * modify it under the terms of the GNU General Public License
* the Free Software Foundation; either version 2 of the License, or * as published by the Free Software Foundation; either version 2
* (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the * along with this program; if not, write to the Free Software
* Free Software Foundation, Inc., * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org
*/ */

View File

@@ -1,21 +1,31 @@
/* /*
* Copyright (C) 2007 by Ishan Arora * Bittorrent Client using Qt4 and libtorrent.
* ishanarora@gmail.com * Copyright (C) 2006 Ishan Arora and Christophe Dumez
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or
* it under the terms of the GNU General Public License as published by * modify it under the terms of the GNU General Public License
* the Free Software Foundation; either version 2 of the License, or * as published by the Free Software Foundation; either version 2
* (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the * along with this program; if not, write to the Free Software
* Free Software Foundation, Inc., * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org
*/ */
@@ -86,7 +96,7 @@ void HttpServer::onTimer() {
void HttpServer::setAuthorization(QString username, QString password) void HttpServer::setAuthorization(QString username, QString password)
{ {
QString cat = username + ":" + password; QString cat = username + ":" + password;
base64 = QByteArray(cat.toUtf8()).toBase64(); base64 = QByteArray(cat.toLocal8Bit()).toBase64();
} }
bool HttpServer::isAuthorized(QByteArray auth) const bool HttpServer::isAuthorized(QByteArray auth) const

Some files were not shown because too many files have changed in this diff Show More