Compare commits
1 Commits
release-1.
...
release-1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b0d473a53 |
5
AUTHORS
@@ -17,11 +17,6 @@ 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
@@ -1,17 +1,3 @@
|
|||||||
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
|
||||||
|
|
||||||
|
|||||||
65
Changelog
@@ -1,68 +1,3 @@
|
|||||||
* Sun Aug 21 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.4.1
|
|
||||||
- BUGFIX: Fix problems when changing save path (if using temporary download folder)
|
|
||||||
- BUGFIX: Display real save path instead of the temporary one in torrent properties
|
|
||||||
- BUGFIX: Catching invalid_handle exception to avoid rare crashes
|
|
||||||
- BUGFIX: Fixed popup menu position in RSS feeds list
|
|
||||||
- BUGFIX: Don't save RSS feed state if it could not be updated
|
|
||||||
|
|
||||||
* 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
|
|
||||||
- BUGFIX: Torrents paused due to an I/O error were displayed as queued
|
|
||||||
- BUGFIX: qBittorrent now prints backtrace in terminal when segfaulting
|
|
||||||
- BUGFIX: Fixed files progress display in torrent properties
|
|
||||||
- BUGFIX: Improved torrent ratio calculation
|
|
||||||
- BUGFIX: Fixed possible crash when parsing filter file
|
|
||||||
- BUGFIX: Made some code optimization
|
|
||||||
- BUGFIX: Fixed download/upload speed decrease problems
|
|
||||||
- I18N: Updated Finnish, Bulgarian and Greek translations
|
|
||||||
|
|
||||||
* Fri Jan 9 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.3.0
|
* Fri Jan 9 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.3.0
|
||||||
- FEATURE: Based on libtorrent-rasterbar v0.14.2
|
- FEATURE: Based on libtorrent-rasterbar v0.14.2
|
||||||
- FEATURE: Improved ratio calculation system
|
- FEATURE: Improved ratio calculation system
|
||||||
|
|||||||
16
TODO
@@ -1,2 +1,18 @@
|
|||||||
See https://blueprints.launchpad.net/qbittorrent/
|
See https://blueprints.launchpad.net/qbittorrent/
|
||||||
|
|
||||||
|
// translations done in v1.3.0
|
||||||
|
- Romanian
|
||||||
|
- Russian
|
||||||
|
- Hungarian
|
||||||
|
- German
|
||||||
|
- Chinese (traditional)
|
||||||
|
- Chinese (simplified)
|
||||||
|
- Italian
|
||||||
|
- Swedish
|
||||||
|
- Turkish
|
||||||
|
- French
|
||||||
|
- Slovak
|
||||||
|
- Czech
|
||||||
|
- Korean
|
||||||
|
- Portuguese
|
||||||
|
- Brazilian
|
||||||
|
|||||||
95
configure
vendored
@@ -18,6 +18,11 @@ Main options:
|
|||||||
--help This help text.
|
--help This help text.
|
||||||
|
|
||||||
Dependency options:
|
Dependency options:
|
||||||
|
--with-libtorrent-inc=[path] Path to libtorrent-rasterbar include
|
||||||
|
files
|
||||||
|
--with-libtorrent-lib=[path] Path to libtorrent-rasterbar library
|
||||||
|
files
|
||||||
|
--with-libtorrent-static-lib=[path] Path to libtorrent-rasterbar .a file
|
||||||
--with-libboost-inc=[path] Path to libboost include files
|
--with-libboost-inc=[path] Path to libboost include files
|
||||||
--with-libcurl-inc=[path] Path to libcurl include files
|
--with-libcurl-inc=[path] Path to libcurl include files
|
||||||
--with-libcurl-lib=[path] Path to libcurl library files
|
--with-libcurl-lib=[path] Path to libcurl library files
|
||||||
@@ -140,6 +145,21 @@ 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
|
||||||
@@ -191,6 +211,9 @@ 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
|
||||||
@@ -323,29 +346,70 @@ 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.0 (>= 0.14.4 advised)"; }
|
QString name() const { return "libtorrent-rasterbar >= 0.14"; }
|
||||||
QString shortname() const { return "libtorrent-rasterbar"; }
|
QString shortname() const { return "libtorrent-rasterbar"; }
|
||||||
bool exec(){
|
bool exec(){
|
||||||
QStringList incs;
|
QString s;
|
||||||
QString req_ver = "0.14.0";
|
s = conf->getenv("QC_WITH_LIBTORRENT_INC");
|
||||||
QString adv_ver = "0.14.4";
|
if(!s.isEmpty()) {
|
||||||
QString version, libs, other;
|
if(!conf->checkHeader(s, "libtorrent/magnet_uri.hpp")) {
|
||||||
VersionMode mode = VersionMin;
|
|
||||||
if(!conf->findPkgConfig("libtorrent-rasterbar", mode, req_ver, &version, &incs, &libs, &other))
|
|
||||||
return false;
|
return false;
|
||||||
for(int n = 0; n < incs.count(); ++n)
|
}
|
||||||
conf->addIncludePath(incs[n]);
|
}else{
|
||||||
if(!libs.isEmpty())
|
QStringList sl;
|
||||||
conf->addLib(libs);
|
sl << "/usr/include";
|
||||||
if(!conf->findPkgConfig("libtorrent-rasterbar", mode, adv_ver, &version, &incs, &libs, &other))
|
sl << "/usr/local/include";
|
||||||
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());
|
bool found = false;
|
||||||
|
foreach(s, sl){
|
||||||
|
if(conf->checkHeader(s, "libtorrent/magnet_uri.hpp")){
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1503,6 +1567,9 @@ 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
|
||||||
|
|||||||
65
qcm/libcommoncpp2.qcm
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
-----BEGIN QCMOD-----
|
||||||
|
name: libcommoncpp2
|
||||||
|
arg: with-libcommoncpp2-inc=[path], Path to libcommoncpp2 include files
|
||||||
|
arg: with-libcommoncpp2-lib=[path], Path to libcommoncpp2 library files
|
||||||
|
-----END QCMOD-----
|
||||||
|
*/
|
||||||
|
class qc_libcommoncpp2 : public ConfObj
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
qc_libcommoncpp2(Conf *c) : ConfObj(c) {}
|
||||||
|
QString name() const { return "GNU Common C++ library (libcommoncpp2)"; }
|
||||||
|
QString shortname() const { return "libcommoncpp2"; }
|
||||||
|
bool exec(){
|
||||||
|
QString s;
|
||||||
|
s = conf->getenv("QC_WITH_LIBCOMMONCPP2_INC");
|
||||||
|
if(!s.isEmpty()) {
|
||||||
|
if(!conf->checkHeader(s, "cc++/url.h")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
QStringList sl;
|
||||||
|
sl << "/usr/include";
|
||||||
|
sl << "/usr/local/include";
|
||||||
|
bool found = false;
|
||||||
|
foreach(s, sl){
|
||||||
|
if(conf->checkHeader(s, "cc++/url.h")){
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!found) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
conf->addIncludePath(s);
|
||||||
|
|
||||||
|
s = conf->getenv("QC_WITH_LIBCOMMONCPP2_LIB");
|
||||||
|
if(!s.isEmpty()) {
|
||||||
|
if(!QFile::exists(s+QString("/libccext2.so")))
|
||||||
|
return false;
|
||||||
|
if(!QFile::exists(s+QString("/libccgnu2.so")))
|
||||||
|
return false;
|
||||||
|
conf->addLib(QString("-L") + s);
|
||||||
|
}else{
|
||||||
|
QStringList sl;
|
||||||
|
sl << "/usr/lib/";
|
||||||
|
sl << "/usr/lib64/";
|
||||||
|
sl << "/usr/local/lib/";
|
||||||
|
sl << "/usr/local/lib64/";
|
||||||
|
bool found = false;
|
||||||
|
foreach(s, sl){
|
||||||
|
if(QFile::exists(s+QString("libccext2.so"))){
|
||||||
|
if(QFile::exists(s+QString("libccgnu2.so"))){
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!found) return false;
|
||||||
|
conf->addLib(QString("-L") + s);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -64,11 +64,14 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
conf->addLib(QString("-L") + s);
|
conf->addLib(QString("-L") + s);
|
||||||
QString out = "";
|
QProcess magickConfig;
|
||||||
QStringList params;
|
QStringList params;
|
||||||
params << "--libs";
|
params << "--libs";
|
||||||
qconf->doCommand("Magick++-config", params, &out);
|
magickConfig.start("Magick++-config", params, QIODevice::ReadOnly);
|
||||||
out = out.replace("\n", "");
|
magickConfig.waitForStarted();
|
||||||
|
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;
|
||||||
|
|||||||
@@ -1,29 +1,70 @@
|
|||||||
/*
|
/*
|
||||||
-----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.0 (>= 0.14.4 advised)"; }
|
QString name() const { return "libtorrent-rasterbar >= 0.14"; }
|
||||||
QString shortname() const { return "libtorrent-rasterbar"; }
|
QString shortname() const { return "libtorrent-rasterbar"; }
|
||||||
bool exec(){
|
bool exec(){
|
||||||
QStringList incs;
|
QString s;
|
||||||
QString req_ver = "0.14.0";
|
s = conf->getenv("QC_WITH_LIBTORRENT_INC");
|
||||||
QString adv_ver = "0.14.4";
|
if(!s.isEmpty()) {
|
||||||
QString version, libs, other;
|
if(!conf->checkHeader(s, "libtorrent/magnet_uri.hpp")) {
|
||||||
VersionMode mode = VersionMin;
|
|
||||||
if(!conf->findPkgConfig("libtorrent-rasterbar", mode, req_ver, &version, &incs, &libs, &other))
|
|
||||||
return false;
|
return false;
|
||||||
for(int n = 0; n < incs.count(); ++n)
|
}
|
||||||
conf->addIncludePath(incs[n]);
|
}else{
|
||||||
if(!libs.isEmpty())
|
QStringList sl;
|
||||||
conf->addLib(libs);
|
sl << "/usr/include";
|
||||||
if(!conf->findPkgConfig("libtorrent-rasterbar", mode, adv_ver, &version, &incs, &libs, &other))
|
sl << "/usr/local/include";
|
||||||
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());
|
bool found = false;
|
||||||
|
foreach(s, sl){
|
||||||
|
if(conf->checkHeader(s, "libtorrent/magnet_uri.hpp")){
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,15 +16,6 @@
|
|||||||
* 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -81,9 +72,6 @@ class DLListDelegate: public QItemDelegate {
|
|||||||
case RATIO:{
|
case RATIO:{
|
||||||
QItemDelegate::drawBackground(painter, opt, index);
|
QItemDelegate::drawBackground(painter, opt, index);
|
||||||
double ratio = index.data().toDouble();
|
double ratio = index.data().toDouble();
|
||||||
if(ratio > 100.)
|
|
||||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::fromUtf8("∞"));
|
|
||||||
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)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,15 +16,6 @@
|
|||||||
* 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -44,13 +35,9 @@
|
|||||||
#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_SWARM 3
|
#define F_LEECH 3
|
||||||
#define F_PEERS 4
|
#define F_RATIO 4
|
||||||
#define F_UPLOAD 5
|
#define F_HASH 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
|
||||||
@@ -64,7 +51,6 @@ 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;
|
||||||
@@ -77,9 +63,6 @@ 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 > MAX_RATIO)
|
|
||||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::fromUtf8("∞"));
|
|
||||||
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)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,15 +16,6 @@
|
|||||||
* 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"
|
||||||
@@ -46,17 +37,13 @@ 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,8);
|
finishedListModel = new QStandardItemModel(0,6);
|
||||||
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_SWARM, Qt::Horizontal, tr("Seeds / Leechers"));
|
finishedListModel->setHeaderData(F_LEECH, Qt::Horizontal, tr("Leechers", "i.e: full/partial sources"));
|
||||||
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);
|
||||||
@@ -92,9 +79,7 @@ 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(actionHOSColSwarm, SIGNAL(triggered()), this, SLOT(hideOrShowColumnSwarm()));
|
connect(actionHOSColLeechers, SIGNAL(triggered()), this, SLOT(hideOrShowColumnLeechers()));
|
||||||
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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,9 +106,7 @@ 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_SWARM), QVariant("-1/-1"));
|
finishedListModel->setData(finishedListModel->index(row, F_LEECH), QVariant("0"));
|
||||||
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()) {
|
||||||
@@ -150,8 +133,9 @@ void FinishedTorrents::setRowColor(int row, QString color){
|
|||||||
|
|
||||||
QStringList FinishedTorrents::getSelectedTorrents(bool only_one) const{
|
QStringList FinishedTorrents::getSelectedTorrents(bool only_one) const{
|
||||||
QStringList res;
|
QStringList res;
|
||||||
|
QModelIndex index;
|
||||||
QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes();
|
QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes();
|
||||||
foreach(const QModelIndex &index, selectedIndexes) {
|
foreach(index, selectedIndexes) {
|
||||||
if(index.column() == F_NAME) {
|
if(index.column() == F_NAME) {
|
||||||
// Get the file hash
|
// Get the file hash
|
||||||
QString hash = finishedListModel->data(finishedListModel->index(index.row(), F_HASH)).toString();
|
QString hash = finishedListModel->data(finishedListModel->index(index.row(), F_HASH)).toString();
|
||||||
@@ -182,23 +166,6 @@ 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;
|
||||||
}
|
}
|
||||||
@@ -233,7 +200,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() == nbColumns && width_list.at(i).toInt()>=1) {
|
if(finishedList->columnWidth(i)<1 && width_list.size() == finishedListModel->columnCount()-1 && 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) {
|
||||||
@@ -246,18 +213,14 @@ 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");
|
||||||
}
|
}
|
||||||
|
|
||||||
void FinishedTorrents::on_actionSet_upload_limit_triggered(){
|
void FinishedTorrents::on_actionSet_upload_limit_triggered(){
|
||||||
QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes();
|
QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes();
|
||||||
|
QModelIndex index;
|
||||||
QStringList hashes;
|
QStringList hashes;
|
||||||
foreach(const QModelIndex &index, selectedIndexes){
|
foreach(index, selectedIndexes){
|
||||||
if(index.column() == F_NAME){
|
if(index.column() == F_NAME){
|
||||||
// Get the file hash
|
// Get the file hash
|
||||||
hashes << finishedListModel->data(finishedListModel->index(index.row(), F_HASH)).toString();
|
hashes << finishedListModel->data(finishedListModel->index(index.row(), F_HASH)).toString();
|
||||||
@@ -267,7 +230,6 @@ void FinishedTorrents::on_actionSet_upload_limit_triggered(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FinishedTorrents::updateTorrent(QTorrentHandle h) {
|
void FinishedTorrents::updateTorrent(QTorrentHandle h) {
|
||||||
if(!h.is_valid()) return;
|
|
||||||
QString hash = h.hash();
|
QString hash = h.hash();
|
||||||
int row = getRowFromHash(hash);
|
int row = getRowFromHash(hash);
|
||||||
if(row == -1){
|
if(row == -1){
|
||||||
@@ -276,25 +238,22 @@ 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/oxygen/time.png"))), Qt::DecorationRole);
|
finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/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_PEERS), "0");
|
finishedListModel->setData(finishedListModel->index(row, F_LEECH), "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/oxygen/time.png"))), Qt::DecorationRole);
|
finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/time.png"))), Qt::DecorationRole);
|
||||||
setRowColor(row, QString::fromUtf8("grey"));
|
setRowColor(row, QString::fromUtf8("grey"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -303,11 +262,8 @@ 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_PEERS)) {
|
if(!finishedList->isColumnHidden(F_LEECH)) {
|
||||||
finishedListModel->setData(finishedListModel->index(row, F_PEERS), misc::toQString(h.num_peers() - h.num_seeds(), true));
|
finishedListModel->setData(finishedListModel->index(row, F_LEECH), 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))));
|
||||||
@@ -331,7 +287,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_PEERS), QVariant(QString::fromUtf8("0")));
|
finishedListModel->setData(finishedListModel->index(row, F_LEECH), QVariant(QString::fromUtf8("0")));
|
||||||
setRowColor(row, QString::fromUtf8("red"));
|
setRowColor(row, QString::fromUtf8("red"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,7 +330,8 @@ void FinishedTorrents::updateFileSize(QString hash){
|
|||||||
// display properties of selected items
|
// display properties of selected items
|
||||||
void FinishedTorrents::propertiesSelection(){
|
void FinishedTorrents::propertiesSelection(){
|
||||||
QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes();
|
QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes();
|
||||||
foreach(const QModelIndex &index, selectedIndexes){
|
QModelIndex index;
|
||||||
|
foreach(index, selectedIndexes){
|
||||||
if(index.column() == F_NAME){
|
if(index.column() == F_NAME){
|
||||||
showProperties(index);
|
showProperties(index);
|
||||||
}
|
}
|
||||||
@@ -383,22 +340,23 @@ void FinishedTorrents::propertiesSelection(){
|
|||||||
|
|
||||||
void FinishedTorrents::forceRecheck(){
|
void FinishedTorrents::forceRecheck(){
|
||||||
QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes();
|
QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes();
|
||||||
foreach(const QModelIndex &index, selectedIndexes){
|
QModelIndex index;
|
||||||
|
foreach(index, selectedIndexes){
|
||||||
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&){
|
void FinishedTorrents::displayFinishedListMenu(const QPoint& pos){
|
||||||
QMenu myFinishedListMenu(this);
|
QMenu myFinishedListMenu(this);
|
||||||
|
QModelIndex index;
|
||||||
// Enable/disable pause/start action given the DL state
|
// Enable/disable pause/start action given the DL state
|
||||||
QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes();
|
QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes();
|
||||||
bool has_pause = false, has_start = false, has_preview = false;
|
bool has_pause = false, has_start = false, has_preview = false;
|
||||||
foreach(const QModelIndex &index, selectedIndexes) {
|
foreach(index, selectedIndexes) {
|
||||||
if(index.column() == F_NAME) {
|
if(index.column() == F_NAME) {
|
||||||
// Get the file name
|
// Get the file name
|
||||||
QString hash = finishedListModel->data(finishedListModel->index(index.row(), F_HASH)).toString();
|
QString hash = finishedListModel->data(finishedListModel->index(index.row(), F_HASH)).toString();
|
||||||
@@ -437,7 +395,8 @@ void FinishedTorrents::displayFinishedListMenu(const QPoint&){
|
|||||||
myFinishedListMenu.addAction(actionBuy_it);
|
myFinishedListMenu.addAction(actionBuy_it);
|
||||||
|
|
||||||
// Call menu
|
// Call menu
|
||||||
myFinishedListMenu.exec(QCursor::pos());
|
// XXX: why mapToGlobal() is not enough?
|
||||||
|
myFinishedListMenu.exec(mapToGlobal(pos)+QPoint(10,58));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -472,12 +431,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/oxygen/button_cancel.png")));
|
getActionHoSCol(index)->setIcon(QIcon(QString::fromUtf8(":/Icons/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/oxygen/button_ok.png")));
|
getActionHoSCol(index)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_ok.png")));
|
||||||
++nbVisibleColumns;
|
++nbVisibleColumns;
|
||||||
}
|
}
|
||||||
//resize all others non-hidden columns
|
//resize all others non-hidden columns
|
||||||
@@ -500,16 +459,8 @@ void FinishedTorrents::hideOrShowColumnUpSpeed() {
|
|||||||
hideOrShowColumn(F_UPSPEED);
|
hideOrShowColumn(F_UPSPEED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FinishedTorrents::hideOrShowColumnSwarm() {
|
void FinishedTorrents::hideOrShowColumnLeechers() {
|
||||||
hideOrShowColumn(F_SWARM);
|
hideOrShowColumn(F_LEECH);
|
||||||
}
|
|
||||||
|
|
||||||
void FinishedTorrents::hideOrShowColumnPeers() {
|
|
||||||
hideOrShowColumn(F_PEERS);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FinishedTorrents::hideOrShowColumnUpload() {
|
|
||||||
hideOrShowColumn(F_UPLOAD);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FinishedTorrents::hideOrShowColumnRatio() {
|
void FinishedTorrents::hideOrShowColumnRatio() {
|
||||||
@@ -535,9 +486,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/oxygen/button_cancel.png")));
|
getActionHoSCol(i)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_cancel.png")));
|
||||||
} else {
|
} else {
|
||||||
getActionHoSCol(i)->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/button_ok.png")));
|
getActionHoSCol(i)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_ok.png")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return loaded;
|
return loaded;
|
||||||
@@ -571,14 +522,8 @@ QAction* FinishedTorrents::getActionHoSCol(int index) {
|
|||||||
case F_UPSPEED :
|
case F_UPSPEED :
|
||||||
return actionHOSColUpSpeed;
|
return actionHOSColUpSpeed;
|
||||||
break;
|
break;
|
||||||
case F_SWARM :
|
case F_LEECH :
|
||||||
return actionHOSColSwarm;
|
return actionHOSColLeechers;
|
||||||
break;
|
|
||||||
case F_PEERS :
|
|
||||||
return actionHOSColPeers;
|
|
||||||
break;
|
|
||||||
case F_UPLOAD :
|
|
||||||
return actionHOSColUpload;
|
|
||||||
break;
|
break;
|
||||||
case F_RATIO :
|
case F_RATIO :
|
||||||
return actionHOSColRatio;
|
return actionHOSColRatio;
|
||||||
@@ -602,7 +547,6 @@ 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:
|
||||||
@@ -627,8 +571,6 @@ 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:
|
||||||
|
|||||||
@@ -16,15 +16,6 @@
|
|||||||
* 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -79,9 +70,7 @@ class FinishedTorrents : public QWidget, public Ui::seeding {
|
|||||||
void hideOrShowColumnName();
|
void hideOrShowColumnName();
|
||||||
void hideOrShowColumnSize();
|
void hideOrShowColumnSize();
|
||||||
void hideOrShowColumnUpSpeed();
|
void hideOrShowColumnUpSpeed();
|
||||||
void hideOrShowColumnSwarm();
|
void hideOrShowColumnLeechers();
|
||||||
void hideOrShowColumnPeers();
|
|
||||||
void hideOrShowColumnUpload();
|
|
||||||
void hideOrShowColumnRatio();
|
void hideOrShowColumnRatio();
|
||||||
void forceRecheck();
|
void forceRecheck();
|
||||||
|
|
||||||
|
|||||||
112
src/GUI.cpp
@@ -16,15 +16,6 @@
|
|||||||
* 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>
|
||||||
@@ -99,14 +90,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/skin/qbittorrent32.png")));
|
this->setWindowIcon(QIcon(QString::fromUtf8(":/Icons/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/skin/qbittorrent32.png")));
|
actionWebsite->setIcon(QIcon(QString::fromUtf8(":/Icons/qbittorrent32.png")));
|
||||||
actionBugReport->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/bug.png")));
|
actionBugReport->setIcon(QIcon(QString::fromUtf8(":/Icons/newmsg.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")));
|
||||||
@@ -132,7 +123,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&, QString)), this, SLOT(fullDiskError(QTorrentHandle&, QString)));
|
connect(BTSession, SIGNAL(fullDiskError(QTorrentHandle&)), this, SLOT(fullDiskError(QTorrentHandle&)));
|
||||||
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&)));
|
||||||
@@ -249,9 +240,6 @@ 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");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,8 +251,6 @@ 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;
|
||||||
@@ -324,16 +310,6 @@ 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.;
|
||||||
@@ -433,15 +409,15 @@ void GUI::checkedTorrent(QTorrentHandle& h) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Notification when disk is full
|
// Notification when disk is full
|
||||||
void GUI::fullDiskError(QTorrentHandle& h, QString msg) const {
|
void GUI::fullDiskError(QTorrentHandle& h) 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 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);
|
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);
|
||||||
}
|
}
|
||||||
// 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.toLocal8Bit().data());
|
qDebug("Full disk error, pausing torrent %s", hash.toUtf8().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");
|
||||||
@@ -579,8 +555,9 @@ void GUI::openDestinationFolder() const {
|
|||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
QString hash;
|
||||||
QStringList pathsList;
|
QStringList pathsList;
|
||||||
foreach(const QString &hash, hashes) {
|
foreach(hash, hashes) {
|
||||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||||
QString savePath = h.save_path();
|
QString savePath = h.save_path();
|
||||||
if(!pathsList.contains(savePath)) {
|
if(!pathsList.contains(savePath)) {
|
||||||
@@ -602,8 +579,9 @@ void GUI::goBuyPage() const {
|
|||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
QString hash;
|
||||||
QStringList pathsList;
|
QStringList pathsList;
|
||||||
foreach(const QString &hash, hashes) {
|
foreach(hash, hashes) {
|
||||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||||
QDesktopServices::openUrl("http://match.sharemonkey.com/?info_hash="+hash+"&n="+h.name()+"&cid=33");
|
QDesktopServices::openUrl("http://match.sharemonkey.com/?info_hash="+hash+"&n="+h.name()+"&cid=33");
|
||||||
}
|
}
|
||||||
@@ -685,8 +663,7 @@ 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()) {
|
||||||
@@ -744,8 +721,10 @@ void GUI::dropEvent(QDropEvent *event) {
|
|||||||
QStringList files;
|
QStringList files;
|
||||||
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) {
|
QUrl url;
|
||||||
QString tmp = url.toString().trimmed();
|
foreach(url, urls) {
|
||||||
|
QString tmp = url.toString();
|
||||||
|
tmp.trimmed();
|
||||||
if(!tmp.isEmpty())
|
if(!tmp.isEmpty())
|
||||||
files << url.toString();
|
files << url.toString();
|
||||||
}
|
}
|
||||||
@@ -753,11 +732,12 @@ void GUI::dropEvent(QDropEvent *event) {
|
|||||||
files = event->mimeData()->text().split(QString::fromUtf8("\n"));
|
files = event->mimeData()->text().split(QString::fromUtf8("\n"));
|
||||||
}
|
}
|
||||||
// Add file to download list
|
// Add file to download list
|
||||||
|
QString file;
|
||||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
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(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.toLocal8Bit().data());
|
qDebug("Dropped file %s on download list", file.toUtf8().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;
|
||||||
@@ -773,8 +753,9 @@ 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()){
|
QString mime;
|
||||||
qDebug("mimeData: %s", mime.toLocal8Bit().data());
|
foreach(mime, event->mimeData()->formats()){
|
||||||
|
qDebug("mimeData: %s", mime.toUtf8().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();
|
||||||
@@ -847,7 +828,8 @@ void GUI::on_actionDelete_Permanently_triggered() {
|
|||||||
}
|
}
|
||||||
if(ret) return;
|
if(ret) return;
|
||||||
//User clicked YES
|
//User clicked YES
|
||||||
foreach(const QString &hash, hashes) {
|
QString hash;
|
||||||
|
foreach(hash, hashes) {
|
||||||
// Get the file name
|
// Get the file name
|
||||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||||
QString fileName = h.name();
|
QString fileName = h.name();
|
||||||
@@ -899,7 +881,8 @@ void GUI::on_actionDelete_triggered() {
|
|||||||
}
|
}
|
||||||
if(ret) return;
|
if(ret) return;
|
||||||
//User clicked YES
|
//User clicked YES
|
||||||
foreach(const QString &hash, hashes) {
|
QString hash;
|
||||||
|
foreach(hash, hashes) {
|
||||||
// Get the file name
|
// Get the file name
|
||||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||||
QString fileName = h.name();
|
QString fileName = h.name();
|
||||||
@@ -913,9 +896,10 @@ void GUI::on_actionDelete_triggered() {
|
|||||||
// the right addTorrent function, considering
|
// the right addTorrent function, considering
|
||||||
// the parameter type.
|
// the parameter type.
|
||||||
void GUI::processParams(const QStringList& params) {
|
void GUI::processParams(const QStringList& params) {
|
||||||
|
QString param;
|
||||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
|
bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
|
||||||
foreach(QString param, params) {
|
foreach(param, params) {
|
||||||
param = param.trimmed();
|
param = param.trimmed();
|
||||||
if(param.startsWith(QString::fromUtf8("http://"), Qt::CaseInsensitive) || param.startsWith(QString::fromUtf8("ftp://"), Qt::CaseInsensitive) || param.startsWith(QString::fromUtf8("https://"), Qt::CaseInsensitive)) {
|
if(param.startsWith(QString::fromUtf8("http://"), Qt::CaseInsensitive) || param.startsWith(QString::fromUtf8("ftp://"), Qt::CaseInsensitive) || param.startsWith(QString::fromUtf8("https://"), Qt::CaseInsensitive)) {
|
||||||
BTSession->downloadFromUrl(param);
|
BTSession->downloadFromUrl(param);
|
||||||
@@ -955,12 +939,14 @@ void GUI::configureSession(bool deleteOptions) {
|
|||||||
setWindowTitle(tr("qBittorrent %1", "e.g: qBittorrent v0.x").arg(QString::fromUtf8(VERSION)));
|
setWindowTitle(tr("qBittorrent %1", "e.g: qBittorrent v0.x").arg(QString::fromUtf8(VERSION)));
|
||||||
}
|
}
|
||||||
displaySpeedInTitle = new_displaySpeedInTitle;
|
displaySpeedInTitle = new_displaySpeedInTitle;
|
||||||
|
if(options->isToolbarDisplayed() != toolBar->isVisible()) {
|
||||||
if(options->isToolbarDisplayed()) {
|
if(options->isToolbarDisplayed()) {
|
||||||
toolBar->setVisible(true);
|
toolBar->setVisible(true);
|
||||||
toolBar->layout()->setSpacing(7);
|
toolBar->layout()->setSpacing(7);
|
||||||
} else {
|
} else {
|
||||||
toolBar->setVisible(false);
|
toolBar->setVisible(false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
unsigned int new_refreshInterval = options->getRefreshInterval();
|
unsigned int new_refreshInterval = options->getRefreshInterval();
|
||||||
if(refreshInterval != new_refreshInterval) {
|
if(refreshInterval != new_refreshInterval) {
|
||||||
refreshInterval = new_refreshInterval;
|
refreshInterval = new_refreshInterval;
|
||||||
@@ -969,11 +955,6 @@ 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
|
||||||
@@ -989,7 +970,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 bound to port: TCP/%1", "e.g: qBittorrent is bound to port: 6881").arg( misc::toQString(new_listenPort)));
|
BTSession->addConsoleMessage(tr("qBittorrent is bind to port: %1", "e.g: qBittorrent is bind to port: 1666").arg( misc::toQString(new_listenPort)));
|
||||||
}
|
}
|
||||||
// * Global download limit
|
// * Global download limit
|
||||||
QPair<int, int> limits = options->getGlobalBandwidthLimits();
|
QPair<int, int> limits = options->getGlobalBandwidthLimits();
|
||||||
@@ -1033,8 +1014,6 @@ void GUI::configureSession(bool deleteOptions) {
|
|||||||
}
|
}
|
||||||
sessionSettings.upnp_ignore_nonrouters = true;
|
sessionSettings.upnp_ignore_nonrouters = true;
|
||||||
sessionSettings.use_dht_as_fallback = false;
|
sessionSettings.use_dht_as_fallback = false;
|
||||||
// To keep same behavior as in qbittorrent v1.2.0
|
|
||||||
sessionSettings.rate_limit_ip_overhead = false;
|
|
||||||
// Queueing System
|
// Queueing System
|
||||||
if(options->isQueueingSystemEnabled()) {
|
if(options->isQueueingSystemEnabled()) {
|
||||||
if(!BTSession->isQueueingEnabled()) {
|
if(!BTSession->isQueueingEnabled()) {
|
||||||
@@ -1078,12 +1057,9 @@ void GUI::configureSession(bool deleteOptions) {
|
|||||||
// * DHT
|
// * DHT
|
||||||
if(options->isDHTEnabled()) {
|
if(options->isDHTEnabled()) {
|
||||||
// Set DHT Port
|
// Set DHT Port
|
||||||
BTSession->setDHTPort(options->getDHTPort());
|
BTSession->setDHTPort(new_listenPort);
|
||||||
if(BTSession->enableDHT(true)) {
|
if(BTSession->enableDHT(true)) {
|
||||||
int dht_port = new_listenPort;
|
BTSession->addConsoleMessage(tr("DHT support [ON], port: %1").arg(new_listenPort), QString::fromUtf8("blue"));
|
||||||
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"));
|
||||||
}
|
}
|
||||||
@@ -1193,11 +1169,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.toLocal8Bit().data());
|
snprintf(proxystr, 512, "http_proxy=%s", proxy_str.toUtf8().data());
|
||||||
putenv(proxystr);
|
putenv(proxystr);
|
||||||
#else
|
#else
|
||||||
qDebug("HTTP: proxy string: %s", proxy_str.toLocal8Bit().data());
|
qDebug("HTTP: proxy string: %s", proxy_str.toUtf8().data());
|
||||||
setenv("http_proxy", proxy_str.toLocal8Bit().data(), 1);
|
setenv("http_proxy", proxy_str.toUtf8().data(), 1);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
qDebug("Disabling search proxy");
|
qDebug("Disabling search proxy");
|
||||||
@@ -1306,7 +1282,7 @@ void GUI::on_actionIncreasePriority_triggered() {
|
|||||||
if(tabs->currentIndex() != 0)
|
if(tabs->currentIndex() != 0)
|
||||||
return;
|
return;
|
||||||
QStringList hashes = downloadingTorrentTab->getSelectedTorrents();
|
QStringList hashes = downloadingTorrentTab->getSelectedTorrents();
|
||||||
foreach(const QString &hash, hashes) {
|
foreach(QString hash, hashes) {
|
||||||
BTSession->increaseDlTorrentPriority(hash);
|
BTSession->increaseDlTorrentPriority(hash);
|
||||||
}
|
}
|
||||||
updateLists();
|
updateLists();
|
||||||
@@ -1315,7 +1291,7 @@ void GUI::on_actionIncreasePriority_triggered() {
|
|||||||
void GUI::on_actionDecreasePriority_triggered() {
|
void GUI::on_actionDecreasePriority_triggered() {
|
||||||
Q_ASSERT(tabs->currentIndex() == 0);
|
Q_ASSERT(tabs->currentIndex() == 0);
|
||||||
QStringList hashes = downloadingTorrentTab->getSelectedTorrents();
|
QStringList hashes = downloadingTorrentTab->getSelectedTorrents();
|
||||||
foreach(const QString &hash, hashes) {
|
foreach(QString hash, hashes) {
|
||||||
BTSession->decreaseDlTorrentPriority(hash);
|
BTSession->decreaseDlTorrentPriority(hash);
|
||||||
}
|
}
|
||||||
updateLists();
|
updateLists();
|
||||||
@@ -1333,7 +1309,8 @@ void GUI::on_actionPause_triggered() {
|
|||||||
} else {
|
} else {
|
||||||
hashes = finishedTorrentTab->getSelectedTorrents();
|
hashes = finishedTorrentTab->getSelectedTorrents();
|
||||||
}
|
}
|
||||||
foreach(const QString &hash, hashes) {
|
QString hash;
|
||||||
|
foreach(hash, hashes) {
|
||||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||||
if(!h.is_paused()){
|
if(!h.is_paused()){
|
||||||
h.pause();
|
h.pause();
|
||||||
@@ -1377,7 +1354,8 @@ void GUI::on_actionStart_triggered() {
|
|||||||
} else {
|
} else {
|
||||||
hashes = finishedTorrentTab->getSelectedTorrents();
|
hashes = finishedTorrentTab->getSelectedTorrents();
|
||||||
}
|
}
|
||||||
foreach(const QString &hash, hashes) {
|
QString hash;
|
||||||
|
foreach(hash, hashes) {
|
||||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||||
if(h.is_paused()){
|
if(h.is_paused()){
|
||||||
h.resume();
|
h.resume();
|
||||||
@@ -1420,7 +1398,6 @@ void GUI::updateLists(bool force) {
|
|||||||
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
|
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
|
||||||
QTorrentHandle h = QTorrentHandle(*torrentIT);
|
QTorrentHandle h = QTorrentHandle(*torrentIT);
|
||||||
if(!h.is_valid()) continue;
|
if(!h.is_valid()) continue;
|
||||||
try {
|
|
||||||
if(h.is_seed()) {
|
if(h.is_seed()) {
|
||||||
// Update in finished list
|
// Update in finished list
|
||||||
finishedTorrentTab->updateTorrent(h);
|
finishedTorrentTab->updateTorrent(h);
|
||||||
@@ -1432,7 +1409,6 @@ void GUI::updateLists(bool force) {
|
|||||||
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+h.hash()+".finished");
|
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+h.hash()+".finished");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(invalid_handle) {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(displaySpeedInTitle) {
|
if(displaySpeedInTitle) {
|
||||||
@@ -1526,10 +1502,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/skin/qbittorrent16.png")), this);
|
myTrayIcon = new QSystemTrayIcon(QIcon(QString::fromUtf8(":/Icons/qbittorrent16.png")), this);
|
||||||
#endif
|
#endif
|
||||||
#ifndef Q_WS_WIN
|
#ifndef Q_WS_WIN
|
||||||
myTrayIcon = new QSystemTrayIcon(QIcon(QString::fromUtf8(":/Icons/skin/qbittorrent22.png")), this);
|
myTrayIcon = new QSystemTrayIcon(QIcon(QString::fromUtf8(":/Icons/qbittorrent22.png")), this);
|
||||||
#endif
|
#endif
|
||||||
// Tray icon Menu
|
// Tray icon Menu
|
||||||
myTrayIconMenu = new QMenu(this);
|
myTrayIconMenu = new QMenu(this);
|
||||||
|
|||||||
13
src/GUI.h
@@ -16,15 +16,6 @@
|
|||||||
* 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 +61,6 @@ 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;
|
||||||
@@ -140,7 +130,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, QString msg) const;
|
void fullDiskError(QTorrentHandle& h) const;
|
||||||
void handleDownloadFromUrlFailure(QString, QString) const;
|
void handleDownloadFromUrlFailure(QString, QString) const;
|
||||||
void createSystrayDelayed();
|
void createSystrayDelayed();
|
||||||
// Keyboard shortcuts
|
// Keyboard shortcuts
|
||||||
@@ -178,7 +168,6 @@ 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);
|
||||||
|
|||||||
BIN
src/Icons/bt_settings.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
src/Icons/button_cancel.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
src/Icons/button_ok.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
src/Icons/configure.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
src/Icons/connection.png
Normal file
|
After Width: | Height: | Size: 820 B |
BIN
src/Icons/description.png
Normal file
|
After Width: | Height: | Size: 821 B |
BIN
src/Icons/download.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 575 B After Width: | Height: | Size: 575 B |
|
Before Width: | Height: | Size: 750 B After Width: | Height: | Size: 750 B |
|
Before Width: | Height: | Size: 704 B After Width: | Height: | Size: 704 B |
BIN
src/Icons/filter.png
Normal file
|
After Width: | Height: | Size: 998 B |
|
Before Width: | Height: | Size: 449 B After Width: | Height: | Size: 449 B |
BIN
src/Icons/gear.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
src/Icons/home.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
src/Icons/log.png
Normal file
|
After Width: | Height: | Size: 846 B |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
BIN
src/Icons/newmsg.png
Normal file
|
After Width: | Height: | Size: 532 B |
|
Before Width: | Height: | Size: 796 B |
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 733 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 860 B |
|
Before Width: | Height: | Size: 892 B |
|
Before Width: | Height: | Size: 937 B |
|
Before Width: | Height: | Size: 885 B |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 541 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 813 B |
|
Before Width: | Height: | Size: 1.5 KiB |
BIN
src/Icons/password.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
src/Icons/proxy.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
@@ -1,6 +1,6 @@
|
|||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Categories=Qt;Network;P2P
|
Categories=Qt;Network;P2P
|
||||||
Comment=V1.4.1
|
Comment=V1.3.0
|
||||||
Exec=qbittorrent %f
|
Exec=qbittorrent %f
|
||||||
GenericName=Bittorrent client
|
GenericName=Bittorrent client
|
||||||
GenericName[bg]=Торент клиент
|
GenericName[bg]=Торент клиент
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 965 B After Width: | Height: | Size: 965 B |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 76 KiB |
BIN
src/Icons/star.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
src/Icons/style.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 739 B After Width: | Height: | Size: 739 B |
BIN
src/Icons/systemtray.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 856 B After Width: | Height: | Size: 856 B |
BIN
src/Icons/unavailable.png
Normal file
|
After Width: | Height: | Size: 888 B |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 765 B After Width: | Height: | Size: 765 B |
BIN
src/Icons/wizard.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
@@ -1,4 +1,3 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0" >
|
<ui version="4.0" >
|
||||||
<class>MainWindow</class>
|
<class>MainWindow</class>
|
||||||
<widget class="QMainWindow" name="MainWindow" >
|
<widget class="QMainWindow" name="MainWindow" >
|
||||||
@@ -25,7 +24,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>914</width>
|
<width>914</width>
|
||||||
<height>23</height>
|
<height>26</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menu_Edit" >
|
<widget class="QMenu" name="menu_Edit" >
|
||||||
@@ -122,6 +121,7 @@
|
|||||||
<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" >
|
||||||
@@ -236,8 +236,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionDecreasePriority" >
|
<action name="actionDecreasePriority" >
|
||||||
<property name="icon" >
|
<property name="icon" >
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="icons.qrc" >:/Icons/skin/decrease.png</iconset>
|
||||||
<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>
|
||||||
@@ -248,8 +247,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionIncreasePriority" >
|
<action name="actionIncreasePriority" >
|
||||||
<property name="icon" >
|
<property name="icon" >
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="icons.qrc" >:/Icons/skin/increase.png</iconset>
|
||||||
<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>
|
||||||
@@ -260,8 +258,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionShow_console" >
|
<action name="actionShow_console" >
|
||||||
<property name="icon" >
|
<property name="icon" >
|
||||||
<iconset resource="icons.qrc">
|
<iconset resource="icons.qrc" >:/Icons/log.png</iconset>
|
||||||
<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>
|
||||||
|
|||||||
@@ -16,15 +16,6 @@
|
|||||||
* 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -16,15 +16,6 @@
|
|||||||
* 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -16,15 +16,6 @@
|
|||||||
* 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -16,15 +16,6 @@
|
|||||||
* 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -56,14 +47,13 @@ SearchTab::SearchTab(SearchEngine *parent) : QWidget()
|
|||||||
|
|
||||||
setLayout(box);
|
setLayout(box);
|
||||||
// Set Search results list model
|
// Set Search results list model
|
||||||
SearchListModel = new QStandardItemModel(0,6);
|
SearchListModel = new QStandardItemModel(0,5);
|
||||||
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
|
||||||
@@ -75,36 +65,19 @@ 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(!loadColWidthResultsList()){
|
if(!loadColWidthSearchList()){
|
||||||
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;
|
||||||
@@ -155,7 +128,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<6; ++col){
|
for(int col=0; col<5; ++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);
|
||||||
}
|
}
|
||||||
@@ -175,7 +148,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<6; ++col){
|
for(int col=0; col<5; ++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);
|
||||||
}
|
}
|
||||||
@@ -184,3 +157,33 @@ 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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -16,15 +16,6 @@
|
|||||||
* 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -33,13 +24,9 @@
|
|||||||
|
|
||||||
#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
|
||||||
@@ -55,17 +42,16 @@ class SearchTab : public QWidget, public Ui::search_engine
|
|||||||
public:
|
public:
|
||||||
SearchTab(SearchEngine *parent);
|
SearchTab(SearchEngine *parent);
|
||||||
~SearchTab();
|
~SearchTab();
|
||||||
bool loadColWidthResultsList();
|
bool loadColWidthSearchList();
|
||||||
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;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -16,15 +16,6 @@
|
|||||||
* 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
38
src/about.ui
@@ -1,4 +1,3 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0" >
|
<ui version="4.0" >
|
||||||
<author>Christophe Dumez</author>
|
<author>Christophe Dumez</author>
|
||||||
<class>AboutDlg</class>
|
<class>AboutDlg</class>
|
||||||
@@ -51,13 +50,13 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="lb_name" >
|
<widget class="QLabel" name="lb_name" >
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy" >
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string><h3><b>qBittorrent</b></h3></string>
|
<string><h3><b>qBittorrent</b></h3></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="textFormat" >
|
<property name="textFormat" >
|
||||||
<enum>Qt::RichText</enum>
|
<enum>Qt::RichText</enum>
|
||||||
@@ -69,7 +68,7 @@
|
|||||||
<property name="orientation" >
|
<property name="orientation" >
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" >
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
@@ -92,7 +91,7 @@
|
|||||||
<property name="geometry" >
|
<property name="geometry" >
|
||||||
<rect>
|
<rect>
|
||||||
<x>380</x>
|
<x>380</x>
|
||||||
<y>70</y>
|
<y>50</y>
|
||||||
<width>94</width>
|
<width>94</width>
|
||||||
<height>162</height>
|
<height>162</height>
|
||||||
</rect>
|
</rect>
|
||||||
@@ -105,40 +104,29 @@
|
|||||||
<property name="geometry" >
|
<property name="geometry" >
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>30</y>
|
<y>40</y>
|
||||||
<width>481</width>
|
<width>481</width>
|
||||||
<height>102</height>
|
<height>102</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy" >
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
<string>A bittorrent client using Qt4 and libtorrent, programmed in C++.<br>
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
<br>
|
||||||
p, li { white-space: pre-wrap; }
|
Copyright © 2006 by Christophe Dumez<br>
|
||||||
</style></head><body style=" font-family:'DejaVu Sans'; font-size:8pt; font-weight:400; font-style:normal;">
|
<br> <u>Home Page:</u> <i>http://www.qbittorrent.org</i><br></string>
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">A Bittorrent client programmed in C++, based on Qt4 toolkit </p>
|
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">and libtorrent-rasterbar. <br /><br />Copyright ©2006-2009 Christophe Dumez<br /><br /><span style=" text-decoration: underline;">Home Page:</span> <a href="http://www.qbittorrent.org"><span style=" text-decoration: underline; color:#0057ae;">http://www.qbittorrent.org</span></a><br /></p></body></html></string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="textFormat" >
|
<property name="textFormat" >
|
||||||
<enum>Qt::RichText</enum>
|
<enum>Qt::RichText</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="scaledContents">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="alignment" >
|
<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" >
|
||||||
@@ -163,7 +151,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<property name="sizeType" >
|
<property name="sizeType" >
|
||||||
<enum>QSizePolicy::Preferred</enum>
|
<enum>QSizePolicy::Preferred</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" >
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>20</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
@@ -294,7 +282,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<property name="sizeType" >
|
<property name="sizeType" >
|
||||||
<enum>QSizePolicy::Preferred</enum>
|
<enum>QSizePolicy::Preferred</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" >
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>20</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
@@ -356,7 +344,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<property name="orientation" >
|
<property name="orientation" >
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" >
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
|
|||||||
@@ -16,15 +16,6 @@
|
|||||||
* 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -46,8 +37,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/skin/qbittorrent22.png")));
|
logo->setPixmap(QPixmap(QString::fromUtf8(":/Icons/qbittorrent22.png")));
|
||||||
mascot_lbl->setPixmap(QPixmap(QString::fromUtf8(":/Icons/skin/mascot.png")));
|
mascot_lbl->setPixmap(QPixmap(QString::fromUtf8(":/Icons/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
|
||||||
@@ -70,7 +61,7 @@ class about : public QDialog, private Ui::AboutDlg{
|
|||||||
- <u>Czech:</u> Jirka Vilim (web@tets.cz)<br>\
|
- <u>Czech:</u> Jirka Vilim (web@tets.cz)<br>\
|
||||||
- <u>Danish:</u> Mathias Nielsen (comoneo@gmail.com)<br>\
|
- <u>Danish:</u> Mathias Nielsen (comoneo@gmail.com)<br>\
|
||||||
- <u>Dutch:</u> Joost Schipper (heavyjoost@users.sourceforge.net) and Peter Koeleman (peter@peerweb.nl)<br>\
|
- <u>Dutch:</u> Joost Schipper (heavyjoost@users.sourceforge.net) and Peter Koeleman (peter@peerweb.nl)<br>\
|
||||||
- <u>Finnish:</u> Niklas Laxström (nikerabbit@users.sourceforge.net) and Pekka Niemi (pekka.niemi@iki.fi)<br>\
|
- <u>Finnish:</u> Niklas Laxström (nikerabbit@users.sourceforge.net)<br>\
|
||||||
- <u>German:</u> Niels Hoffmann (zentralmaschine@users.sourceforge.net)<br>\
|
- <u>German:</u> Niels Hoffmann (zentralmaschine@users.sourceforge.net)<br>\
|
||||||
- <u>Greek:</u> Tsvetan Bankov (emerge_life@users.sourceforge.net)<br>\
|
- <u>Greek:</u> Tsvetan Bankov (emerge_life@users.sourceforge.net)<br>\
|
||||||
- <u>Hungarian:</u> Majoros Péter (majoros.peterj@gmail.com)<br>\
|
- <u>Hungarian:</u> Majoros Péter (majoros.peterj@gmail.com)<br>\
|
||||||
@@ -91,19 +82,7 @@ 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("qBittorrent is licensed under the GNU General Public License version 2 with the\
|
te_license->append(QString::fromUtf8("<center><b>GNU GENERAL PUBLIC LICENSE</b></center><br>\
|
||||||
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>\
|
||||||
|
|||||||
@@ -16,15 +16,6 @@
|
|||||||
* 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -16,15 +16,6 @@
|
|||||||
* 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -41,7 +32,7 @@ class torrent_file {
|
|||||||
torrent_file *parent;
|
torrent_file *parent;
|
||||||
bool is_dir;
|
bool is_dir;
|
||||||
QString rel_path;
|
QString rel_path;
|
||||||
QList<const torrent_file*> children;
|
QList<torrent_file*> children;
|
||||||
size_type size;
|
size_type size;
|
||||||
float progress;
|
float progress;
|
||||||
int priority;
|
int priority;
|
||||||
@@ -51,8 +42,6 @@ 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);
|
||||||
@@ -77,9 +66,10 @@ class torrent_file {
|
|||||||
progress = 0.;
|
progress = 0.;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
double wanted = 0.;
|
float wanted = 0.;
|
||||||
double done = 0.;
|
float done = 0.;
|
||||||
foreach(const torrent_file *child, children) {
|
torrent_file *child;
|
||||||
|
foreach(child, children) {
|
||||||
wanted += child->getSize();
|
wanted += child->getSize();
|
||||||
done += child->getSize()*child->getProgress();
|
done += child->getSize()*child->getProgress();
|
||||||
}
|
}
|
||||||
@@ -90,7 +80,8 @@ class torrent_file {
|
|||||||
|
|
||||||
void updatePriority(int prio) {
|
void updatePriority(int prio) {
|
||||||
Q_ASSERT(is_dir);
|
Q_ASSERT(is_dir);
|
||||||
foreach(const torrent_file *child, children) {
|
torrent_file *child;
|
||||||
|
foreach(child, children) {
|
||||||
if(child->getPriority() != prio) return;
|
if(child->getPriority() != prio) return;
|
||||||
}
|
}
|
||||||
priority = prio;
|
priority = prio;
|
||||||
@@ -120,13 +111,14 @@ class torrent_file {
|
|||||||
return (!children.isEmpty());
|
return (!children.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<const torrent_file*> getChildren() const {
|
QList<torrent_file*> getChildren() const {
|
||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
const torrent_file* getChild(QString fileName) const {
|
torrent_file* getChild(QString fileName) const {
|
||||||
Q_ASSERT(is_dir);
|
Q_ASSERT(is_dir);
|
||||||
foreach(const torrent_file *f, children) {
|
torrent_file* f;
|
||||||
|
foreach(f, children) {
|
||||||
if(f->name() == fileName) return f;
|
if(f->name() == fileName) return f;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -149,24 +141,25 @@ class torrent_file {
|
|||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool removeFromFS(QString saveDir) const {
|
bool removeFromFS(QString saveDir) {
|
||||||
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.toLocal8Bit().data());
|
qDebug("%s does not exist, no need to remove it", full_path.toUtf8().data());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
torrent_file *f;
|
||||||
qDebug("We have %d children", children.size());
|
qDebug("We have %d children", children.size());
|
||||||
foreach(const torrent_file *f, children) {
|
foreach(f, children) {
|
||||||
bool s = f->removeFromFS(saveDir);
|
bool s = f->removeFromFS(saveDir);
|
||||||
success = s && success;
|
success = s && success;
|
||||||
}
|
}
|
||||||
if(is_dir) {
|
if(is_dir) {
|
||||||
qDebug("trying to remove directory: %s", full_path.toLocal8Bit().data());
|
qDebug("trying to remove directory: %s", full_path.toUtf8().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.toLocal8Bit().data());
|
qDebug("trying to remove file: %s", full_path.toUtf8().data());
|
||||||
bool s = QFile::remove(full_path);
|
bool s = QFile::remove(full_path);
|
||||||
success = s && success;
|
success = s && success;
|
||||||
}
|
}
|
||||||
@@ -207,13 +200,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, ((double)fp[0])/t.file_at(0).size, prioritiesTab[0]);
|
root = new torrent_file(0, misc::toQString(t.name()), false, fi->size, 0, 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, ((double)fp[i])/t.file_at(i).size, prioritiesTab[i]);
|
addFile(path, fi->size, i, fp[i]/t.file_at(i).size, prioritiesTab[i]);
|
||||||
fi++;
|
fi++;
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
@@ -246,13 +239,14 @@ class arborescence {
|
|||||||
if(relative_path.at(0) ==QDir::separator())
|
if(relative_path.at(0) ==QDir::separator())
|
||||||
relative_path.remove(0, 1);
|
relative_path.remove(0, 1);
|
||||||
QStringList fileNames = relative_path.split(QDir::separator());
|
QStringList fileNames = relative_path.split(QDir::separator());
|
||||||
|
QString fileName;
|
||||||
torrent_file *dad = root;
|
torrent_file *dad = root;
|
||||||
unsigned int nb_i = 0;
|
unsigned int nb_i = 0;
|
||||||
unsigned int size = fileNames.size();
|
unsigned int size = fileNames.size();
|
||||||
foreach(const QString &fileName, fileNames) {
|
foreach(fileName, fileNames) {
|
||||||
++nb_i;
|
++nb_i;
|
||||||
if(fileName == ".") continue;
|
if(fileName == ".") continue;
|
||||||
const torrent_file* child = dad->getChild(fileName);
|
torrent_file* child = dad->getChild(fileName);
|
||||||
if(!child) {
|
if(!child) {
|
||||||
if(nb_i != size) {
|
if(nb_i != size) {
|
||||||
// Folder
|
// Folder
|
||||||
@@ -262,7 +256,7 @@ class arborescence {
|
|||||||
child = dad->addChild(fileName, false, file_size, index, progress, priority);
|
child = dad->addChild(fileName, false, file_size, index, progress, priority);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dad = (torrent_file*)child;
|
dad = child;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,20 +16,11 @@
|
|||||||
* 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 <QDateTime>
|
#include <QTime>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QFileSystemWatcher>
|
#include <QFileSystemWatcher>
|
||||||
@@ -52,17 +43,16 @@
|
|||||||
#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), ratio_limit(-1), UPnPEnabled(false), NATPMPEnabled(false), LSDEnabled(false), queueingEnabled(false) {
|
bittorrent::bittorrent() : DHTEnabled(false), preAllocateAll(false), addInPause(false), maxConnecsPerTorrent(500), maxUploadsPerTorrent(4), max_ratio(-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("UT", 1, 8, 3, 0), 0);
|
s = new session(fingerprint("AZ", 3, 0, 5, 2), 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);
|
||||||
}
|
}
|
||||||
@@ -125,7 +115,7 @@ void bittorrent::preAllocateAllFiles(bool b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::deleteBigRatios() {
|
void bittorrent::deleteBigRatios() {
|
||||||
if(ratio_limit == -1) return;
|
if(max_ratio == -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++) {
|
||||||
@@ -133,8 +123,7 @@ 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();
|
||||||
float ratio = getRealRatio(hash);
|
if(getRealRatio(hash) > max_ratio) {
|
||||||
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);
|
||||||
@@ -151,10 +140,6 @@ void bittorrent::setDownloadLimit(QString hash, long val) {
|
|||||||
saveTorrentSpeedLimits(hash);
|
saveTorrentSpeedLimits(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bittorrent::useTemporaryFolder() const {
|
|
||||||
return !defaultTempPath.isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool bittorrent::isQueueingEnabled() const {
|
bool bittorrent::isQueueingEnabled() const {
|
||||||
return queueingEnabled;
|
return queueingEnabled;
|
||||||
}
|
}
|
||||||
@@ -264,7 +249,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.toLocal8Bit().data());
|
qDebug("Deleting torrent with hash: %s", hash.toUtf8().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");
|
||||||
@@ -282,7 +267,8 @@ void bittorrent::deleteTorrent(QString hash, bool permanent) {
|
|||||||
QStringList filters;
|
QStringList filters;
|
||||||
filters << hash+".*";
|
filters << hash+".*";
|
||||||
QStringList files = torrentBackup.entryList(filters, QDir::Files, QDir::Unsorted);
|
QStringList files = torrentBackup.entryList(filters, QDir::Files, QDir::Unsorted);
|
||||||
foreach(const QString &file, files) {
|
QString file;
|
||||||
|
foreach(file, files) {
|
||||||
torrentBackup.remove(file);
|
torrentBackup.remove(file);
|
||||||
}
|
}
|
||||||
// Remove tracker errors
|
// Remove tracker errors
|
||||||
@@ -342,21 +328,23 @@ void bittorrent::loadWebSeeds(QString hash) {
|
|||||||
QByteArray urlseeds_lines = urlseeds_file.readAll();
|
QByteArray urlseeds_lines = urlseeds_file.readAll();
|
||||||
urlseeds_file.close();
|
urlseeds_file.close();
|
||||||
QList<QByteArray> url_seeds = urlseeds_lines.split('\n');
|
QList<QByteArray> url_seeds = urlseeds_lines.split('\n');
|
||||||
|
QByteArray url_seed;
|
||||||
QTorrentHandle h = getTorrentHandle(hash);
|
QTorrentHandle h = getTorrentHandle(hash);
|
||||||
// First remove from the torrent the url seeds that were deleted
|
// First remove from the torrent the url seeds that were deleted
|
||||||
// in a previous session
|
// in a previous session
|
||||||
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) {
|
QString existing_seed;
|
||||||
if(!url_seeds.contains(existing_seed.toLocal8Bit())) {
|
foreach(existing_seed, existing_seeds) {
|
||||||
|
if(!url_seeds.contains(existing_seed.toUtf8())) {
|
||||||
seeds_to_delete << existing_seed;
|
seeds_to_delete << existing_seed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach(const QString &existing_seed, seeds_to_delete) {
|
foreach(existing_seed, seeds_to_delete) {
|
||||||
h.remove_url_seed(existing_seed);
|
h.remove_url_seed(existing_seed);
|
||||||
}
|
}
|
||||||
// Add the ones that were added in a previous session
|
// Add the ones that were added in a previous session
|
||||||
foreach(const QByteArray &url_seed, url_seeds) {
|
foreach(url_seed, url_seeds) {
|
||||||
if(!url_seed.isEmpty()) {
|
if(!url_seed.isEmpty()) {
|
||||||
// XXX: Should we check if it is already in the list before adding it
|
// XXX: Should we check if it is already in the list before adding it
|
||||||
// or is libtorrent clever enough to know
|
// or is libtorrent clever enough to know
|
||||||
@@ -376,7 +364,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().toLocal8Bit().data() << "'\n";
|
std::cerr << "Couldn't create the directory: '" << torrentBackup.path().toUtf8().data() << "'\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -386,11 +374,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.toLocal8Bit().data());
|
qDebug("Adding %s to download list", file.toUtf8().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.toLocal8Bit().data());
|
t = new torrent_info(file.toUtf8().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"));
|
||||||
@@ -414,7 +402,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.toLocal8Bit().data(), hash.toLocal8Bit().data());
|
qDebug("* ERROR: Strange, hash changed from %s to %s", old_hash.toUtf8().data(), hash.toUtf8().data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check if torrent is already in download list
|
// Check if torrent is already in download list
|
||||||
@@ -440,8 +428,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")).toLocal8Bit().data());
|
qDebug("Trying to load fastresume data: %s", (torrentBackup.path()+QDir::separator()+hash+QString(".fastresume")).toUtf8().data());
|
||||||
if (load_file((torrentBackup.path()+QDir::separator()+hash+QString(".fastresume")).toLocal8Bit().data(), buf) == 0) {
|
if (load_file((torrentBackup.path()+QDir::separator()+hash+QString(".fastresume")).toUtf8().data(), buf) == 0) {
|
||||||
fastResume = true;
|
fastResume = true;
|
||||||
p.resume_data = &buf;
|
p.resume_data = &buf;
|
||||||
qDebug("Successfuly loaded");
|
qDebug("Successfuly loaded");
|
||||||
@@ -451,14 +439,10 @@ 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.toLocal8Bit());
|
savepath_file.write(savePath.toUtf8());
|
||||||
savepath_file.close();
|
savepath_file.close();
|
||||||
}
|
}
|
||||||
if(defaultTempPath.isEmpty() || QFile::exists(misc::qBittorrentPath()+QString::fromUtf8("BT_backup")+QDir::separator()+hash+QString::fromUtf8(".finished"))) {
|
p.save_path = savePath.toUtf8().data();
|
||||||
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)
|
||||||
@@ -652,7 +636,7 @@ void bittorrent::enableLSD(bool b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::loadSessionState() {
|
void bittorrent::loadSessionState() {
|
||||||
boost::filesystem::ifstream ses_state_file((misc::qBittorrentPath()+QString::fromUtf8("ses_state")).toLocal8Bit().data()
|
boost::filesystem::ifstream ses_state_file((misc::qBittorrentPath()+QString::fromUtf8("ses_state")).toUtf8().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(
|
||||||
@@ -663,7 +647,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")).toLocal8Bit().data()
|
boost::filesystem::ofstream out((misc::qBittorrentPath()+QString::fromUtf8("ses_state")).toUtf8().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);
|
||||||
@@ -676,7 +660,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.toLocal8Bit().data(), std::ios_base::binary);
|
boost::filesystem::ifstream dht_state_file(dht_state_path.toUtf8().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>());
|
||||||
@@ -705,13 +689,13 @@ bool bittorrent::enableDHT(bool b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::saveTorrentSpeedLimits(QString hash) {
|
void bittorrent::saveTorrentSpeedLimits(QString hash) {
|
||||||
qDebug("Saving speedLimits file for %s", hash.toLocal8Bit().data());
|
qDebug("Saving speedLimits file for %s", hash.toUtf8().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.toLocal8Bit().data());
|
qDebug("* Error: Couldn't open speed limits file for torrent: %s", hash.toUtf8().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));
|
||||||
@@ -719,7 +703,7 @@ void bittorrent::saveTorrentSpeedLimits(QString hash) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::loadTorrentSpeedLimits(QString hash) {
|
void bittorrent::loadTorrentSpeedLimits(QString hash) {
|
||||||
// qDebug("Loading speedLimits file for %s", hash.toLocal8Bit().data());
|
// qDebug("Loading speedLimits file for %s", hash.toUtf8().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)) {
|
||||||
@@ -752,7 +736,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.toLocal8Bit().data());
|
qDebug("* Error: Couldn't open priorities file: %s", hash.toUtf8().data());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QByteArray pieces_priorities = pieces_file.readAll();
|
QByteArray pieces_priorities = pieces_file.readAll();
|
||||||
@@ -780,13 +764,13 @@ float bittorrent::getRealRatio(QString hash) const{
|
|||||||
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) {
|
||||||
if(h.all_time_upload() == 0)
|
if(h.all_time_upload() == 0)
|
||||||
return 0;
|
return 1.;
|
||||||
return 101;
|
return 10.;
|
||||||
}
|
}
|
||||||
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.);
|
||||||
if(ratio > 100.)
|
if(ratio > 10.)
|
||||||
ratio = 100.;
|
ratio = 10.;
|
||||||
return ratio;
|
return ratio;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -839,7 +823,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().toLocal8Bit().data()) / file.toLocal8Bit().data(), std::ios_base::binary);
|
boost::filesystem::ofstream out(fs::path(torrentBackup.path().toUtf8().data()) / file.toUtf8().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
|
||||||
@@ -860,7 +844,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'>")+ 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>"));
|
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>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::addPeerBanMessage(QString ip, bool from_ipfilter) {
|
void bittorrent::addPeerBanMessage(QString ip, bool from_ipfilter) {
|
||||||
@@ -868,9 +852,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'>")+ 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));
|
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));
|
||||||
else
|
else
|
||||||
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));
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bittorrent::isFilePreviewPossible(QString hash) const{
|
bool bittorrent::isFilePreviewPossible(QString hash) const{
|
||||||
@@ -894,19 +878,20 @@ 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.toLocal8Bit().data());
|
qDebug("Scanning directory: %s", scan_dir.toUtf8().data());
|
||||||
|
QString file;
|
||||||
QDir dir(scan_dir);
|
QDir dir(scan_dir);
|
||||||
QStringList filters;
|
QStringList filters;
|
||||||
filters << "*.torrent";
|
filters << "*.torrent";
|
||||||
QStringList files = dir.entryList(filters, QDir::Files, QDir::Unsorted);
|
QStringList files = dir.entryList(filters, QDir::Files, QDir::Unsorted);
|
||||||
foreach(const QString &file, files) {
|
foreach(file, files) {
|
||||||
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.toLocal8Bit().data());
|
qDebug("Adding for scan_dir: %s", fullPath.toUtf8().data());
|
||||||
addTorrent(fullPath, true);
|
addTorrent(fullPath, true);
|
||||||
} else {
|
} else {
|
||||||
qDebug("Ignoring empty file: %s", fullPath.toLocal8Bit().data());
|
qDebug("Ignoring empty file: %s", fullPath.toUtf8().data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FSMutex->unlock();
|
FSMutex->unlock();
|
||||||
@@ -916,32 +901,6 @@ 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()) {
|
||||||
@@ -1019,19 +978,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(ratio_limit == -1 && ratio != -1) {
|
if(max_ratio == -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(ratio_limit != -1 && ratio == -1) {
|
if(max_ratio != -1 && ratio == -1) {
|
||||||
delete BigRatioTimer;
|
delete BigRatioTimer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ratio_limit != ratio) {
|
if(max_ratio != ratio) {
|
||||||
ratio_limit = ratio;
|
max_ratio = ratio;
|
||||||
qDebug("* Set deleteRatio to %.1f", ratio_limit);
|
qDebug("* Set deleteRatio to %.1f", max_ratio);
|
||||||
deleteBigRatios();
|
deleteBigRatios();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1043,7 +1002,8 @@ bool bittorrent::loadTrackerFile(QString hash) {
|
|||||||
tracker_file.open(QIODevice::ReadOnly | QIODevice::Text);
|
tracker_file.open(QIODevice::ReadOnly | QIODevice::Text);
|
||||||
QStringList lines = QString::fromUtf8(tracker_file.readAll().data()).split("\n");
|
QStringList lines = QString::fromUtf8(tracker_file.readAll().data()).split("\n");
|
||||||
std::vector<announce_entry> trackers;
|
std::vector<announce_entry> trackers;
|
||||||
foreach(const QString &line, lines) {
|
QString line;
|
||||||
|
foreach(line, lines) {
|
||||||
QStringList parts = line.split("|");
|
QStringList parts = line.split("|");
|
||||||
if(parts.size() != 2) continue;
|
if(parts.size() != 2) continue;
|
||||||
announce_entry t(parts[0].toStdString());
|
announce_entry t(parts[0].toStdString());
|
||||||
@@ -1061,7 +1021,7 @@ bool bittorrent::loadTrackerFile(QString hash) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::saveTrackerFile(QString hash) {
|
void bittorrent::saveTrackerFile(QString hash) {
|
||||||
qDebug("Saving tracker file for %s", hash.toLocal8Bit().data());
|
qDebug("Saving tracker file for %s", hash.toUtf8().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()) {
|
||||||
@@ -1076,9 +1036,9 @@ void bittorrent::saveTrackerFile(QString hash) {
|
|||||||
tracker_file.close();
|
tracker_file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set DHT port (>= 1000 or 0 if same as BT)
|
// Set DHT port (>= 1000)
|
||||||
void bittorrent::setDHTPort(int dht_port) {
|
void bittorrent::setDHTPort(int dht_port) {
|
||||||
if(dht_port == 0 or dht_port >= 1000) {
|
if(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);
|
||||||
@@ -1157,17 +1117,8 @@ 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().toLocal8Bit().data());
|
qDebug("Received finished alert for %s", h.name().toUtf8().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())) {
|
||||||
@@ -1177,20 +1128,19 @@ 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.toLocal8Bit().data());
|
qDebug("Saving fastresume data in %s", file.toUtf8().data());
|
||||||
if (p->resume_data)
|
if (p->resume_data)
|
||||||
{
|
{
|
||||||
boost::filesystem::ofstream out(fs::path(torrentBackup.path().toLocal8Bit().data()) / file.toLocal8Bit().data(), std::ios_base::binary);
|
boost::filesystem::ofstream out(fs::path(torrentBackup.path().toUtf8().data()) / file.toUtf8().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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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);
|
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, misc::toQString(p->message()));
|
emit fullDiskError(h);
|
||||||
}
|
}
|
||||||
else if (dynamic_cast<listen_failed_alert*>(a.get())) {
|
else if (dynamic_cast<listen_failed_alert*>(a.get())) {
|
||||||
// Level: fatal
|
// Level: fatal
|
||||||
@@ -1217,7 +1167,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().toLocal8Bit());
|
qDebug("Received a tracker reply from %s", (const char*)h.current_tracker().toUtf8());
|
||||||
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
|
||||||
@@ -1245,7 +1195,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().toLocal8Bit().data(), p->message().c_str());
|
qDebug("/!\\ Fast resume failed for %s, reason: %s", h.name().toUtf8().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());
|
||||||
}
|
}
|
||||||
@@ -1258,16 +1208,7 @@ 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.toLocal8Bit().data());
|
qDebug("%s have just finished checking", hash.toUtf8().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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1306,7 +1247,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().toLocal8Bit().data() << "\n";
|
std::cerr << "Couldn't create the save directory: " << saveDir.path().toUtf8().data() << "\n";
|
||||||
// XXX: handle this better
|
// XXX: handle this better
|
||||||
return QDir::homePath();
|
return QDir::homePath();
|
||||||
}
|
}
|
||||||
@@ -1344,8 +1285,9 @@ void bittorrent::processDownloadedFile(QString url, QString file_path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::downloadFromURLList(const QStringList& url_list) {
|
void bittorrent::downloadFromURLList(const QStringList& url_list) {
|
||||||
|
QString url;
|
||||||
qDebug("DownloadFromUrlList");
|
qDebug("DownloadFromUrlList");
|
||||||
foreach(const QString url, url_list) {
|
foreach(url, url_list) {
|
||||||
downloadFromUrl(url);
|
downloadFromUrl(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1372,7 +1314,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")).toLocal8Bit().data(), std::ios_base::binary);
|
boost::filesystem::ofstream out((misc::qBittorrentPath()+QString::fromUtf8("dht_state")).toUtf8().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");
|
||||||
@@ -1407,7 +1349,7 @@ void bittorrent::resumeUnfinishedTorrents() {
|
|||||||
fileNames = torrentBackup.entryList(filters, QDir::Files, QDir::Unsorted);
|
fileNames = torrentBackup.entryList(filters, QDir::Files, QDir::Unsorted);
|
||||||
if(isQueueingEnabled()) {
|
if(isQueueingEnabled()) {
|
||||||
QList<QPair<int, QString> > filePaths;
|
QList<QPair<int, QString> > filePaths;
|
||||||
foreach(const QString &fileName, fileNames) {
|
foreach(QString fileName, fileNames) {
|
||||||
QString filePath = torrentBackup.path()+QDir::separator()+fileName;
|
QString filePath = torrentBackup.path()+QDir::separator()+fileName;
|
||||||
int prio = 99999;
|
int prio = 99999;
|
||||||
// Get priority
|
// Get priority
|
||||||
@@ -1432,11 +1374,11 @@ void bittorrent::resumeUnfinishedTorrents() {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QStringList filePaths;
|
QStringList filePaths;
|
||||||
foreach(const QString &fileName, fileNames) {
|
foreach(QString fileName, fileNames) {
|
||||||
filePaths.append(torrentBackup.path()+QDir::separator()+fileName);
|
filePaths.append(torrentBackup.path()+QDir::separator()+fileName);
|
||||||
}
|
}
|
||||||
// Resume downloads
|
// Resume downloads
|
||||||
foreach(const QString &fileName, filePaths) {
|
foreach(QString fileName, filePaths) {
|
||||||
addTorrent(fileName, false, QString(), true);
|
addTorrent(fileName, false, QString(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,15 +16,6 @@
|
|||||||
* 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__
|
||||||
@@ -60,7 +51,6 @@ 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;
|
||||||
@@ -68,7 +58,7 @@ class bittorrent : public QObject {
|
|||||||
bool addInPause;
|
bool addInPause;
|
||||||
int maxConnecsPerTorrent;
|
int maxConnecsPerTorrent;
|
||||||
int maxUploadsPerTorrent;
|
int maxUploadsPerTorrent;
|
||||||
float ratio_limit;
|
float max_ratio;
|
||||||
bool UPnPEnabled;
|
bool UPnPEnabled;
|
||||||
bool NATPMPEnabled;
|
bool NATPMPEnabled;
|
||||||
bool LSDEnabled;
|
bool LSDEnabled;
|
||||||
@@ -77,6 +67,9 @@ class bittorrent : public QObject {
|
|||||||
bool queueingEnabled;
|
bool queueingEnabled;
|
||||||
QStringList url_skippingDlg;
|
QStringList url_skippingDlg;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QString getSavePath(QString hash);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor / Destructor
|
// Constructor / Destructor
|
||||||
bittorrent();
|
bittorrent();
|
||||||
@@ -104,8 +97,6 @@ class bittorrent : public QObject {
|
|||||||
QStringList getConsoleMessages() const;
|
QStringList getConsoleMessages() const;
|
||||||
QStringList getPeerBanMessages() const;
|
QStringList getPeerBanMessages() const;
|
||||||
qlonglong getETA(QString hash) const;
|
qlonglong getETA(QString hash) const;
|
||||||
bool useTemporaryFolder() const;
|
|
||||||
QString getSavePath(QString hash);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
QTorrentHandle addTorrent(QString path, bool fromScanDir = false, QString from_url = QString(), bool resumed = false);
|
QTorrentHandle addTorrent(QString path, bool fromScanDir = false, QString from_url = QString(), bool resumed = false);
|
||||||
@@ -151,7 +142,6 @@ 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);
|
||||||
@@ -162,11 +152,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();
|
||||||
@@ -177,7 +167,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, QString msg);
|
void fullDiskError(QTorrentHandle& h);
|
||||||
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);
|
||||||
|
|||||||
@@ -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/oxygen/log.png</iconset>
|
<iconset resource="icons.qrc" >:/Icons/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/oxygen/log.png</iconset>
|
<iconset resource="icons.qrc" >:/Icons/log.png</iconset>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
<item>
|
<item>
|
||||||
|
|||||||
@@ -16,15 +16,6 @@
|
|||||||
* 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -16,15 +16,6 @@
|
|||||||
* 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -184,6 +175,7 @@ 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) {
|
||||||
@@ -191,7 +183,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.toLocal8Bit().data());
|
t = new torrent_info(path.toUtf8().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;
|
||||||
@@ -204,7 +196,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);
|
||||||
close();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void createtorrent::updateProgressBar(int progress) {
|
void createtorrent::updateProgressBar(int progress) {
|
||||||
@@ -227,12 +219,8 @@ void torrentCreatorThread::create(QString _input_path, QString _save_path, QStri
|
|||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendProgressUpdateSignal(int i, int num, torrentCreatorThread *parent){
|
void sendProgressUpdateSignal(int i, int num, QDialog *parent){
|
||||||
parent->sendProgressSignal((int)(i*100./(float)num));
|
((createtorrent*)parent)->updateProgressBar((int)(i*100./(float)num));
|
||||||
}
|
|
||||||
|
|
||||||
void torrentCreatorThread::sendProgressSignal(int progress) {
|
|
||||||
emit updateProgress(progress);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrentCreatorThread::run() {
|
void torrentCreatorThread::run() {
|
||||||
@@ -241,7 +229,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.toLocal8Bit().data()));
|
path full_path = complete(path(input_path.toUtf8().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;
|
||||||
@@ -250,23 +238,25 @@ 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.toLocal8Bit().data());
|
t.add_url_seed(seed.toUtf8().data());
|
||||||
}
|
}
|
||||||
for(int i=0; i<trackers.size(); ++i){
|
for(int i=0; i<trackers.size(); ++i){
|
||||||
t.add_tracker(trackers.at(i).toLocal8Bit().data());
|
t.add_tracker(trackers.at(i).toUtf8().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(), this));
|
set_piece_hashes(t, full_path.branch_path(), boost::bind<void>(&sendProgressUpdateSignal, _1, t.num_pieces(), parent));
|
||||||
// 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.toLocal8Bit());
|
t.set_comment((const char*)comment.toUtf8());
|
||||||
// Is private ?
|
// Is private ?
|
||||||
t.set_priv(is_private);
|
if(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.toLocal8Bit())), std::ios_base::binary);
|
ofstream out(complete(path((const char*)save_path.toUtf8())), 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());
|
||||||
|
|||||||
@@ -16,15 +16,6 @@
|
|||||||
* 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -57,7 +48,6 @@ 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();
|
||||||
@@ -65,8 +55,6 @@ 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);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -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/oxygen/folder.png</normaloff>:/Icons/oxygen/folder.png</iconset>
|
<normaloff>:/Icons/folder.png</normaloff>:/Icons/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/oxygen/gear.png</normaloff>:/Icons/oxygen/gear.png</iconset>
|
<normaloff>:/Icons/gear.png</normaloff>:/Icons/gear.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Force recheck</string>
|
<string>Force recheck</string>
|
||||||
|
|||||||
@@ -16,15 +16,6 @@
|
|||||||
* 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -16,15 +16,6 @@
|
|||||||
* 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -84,7 +75,7 @@ void subDownloadThread::run(){
|
|||||||
filePath = tmpfile->fileName();
|
filePath = tmpfile->fileName();
|
||||||
}
|
}
|
||||||
delete tmpfile;
|
delete tmpfile;
|
||||||
FILE *f = fopen(filePath.toLocal8Bit().data(), "wb");
|
FILE *f = fopen(filePath.toUtf8().data(), "wb");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
std::cerr << "couldn't open destination file" << "\n";
|
std::cerr << "couldn't open destination file" << "\n";
|
||||||
return;
|
return;
|
||||||
@@ -93,7 +84,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.toLocal8Bit().data();
|
std::string c_url = url.toUtf8().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);
|
||||||
@@ -105,8 +96,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).toLocal8Bit().data());
|
qDebug("Using proxy: %s", (IP+QString(":")+port).toUtf8().data());
|
||||||
curl_easy_setopt(curl, CURLOPT_PROXYPORT, (IP+QString(":")+port).toLocal8Bit().data());
|
curl_easy_setopt(curl, CURLOPT_PROXYPORT, (IP+QString(":")+port).toUtf8().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");
|
||||||
@@ -117,7 +108,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).toLocal8Bit().data());
|
curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, (username+QString(":")+password).toUtf8().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
|
||||||
@@ -131,7 +122,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.toLocal8Bit().data());
|
qDebug("Downloading %s", url.toUtf8().data());
|
||||||
if(!abort)
|
if(!abort)
|
||||||
res = curl_easy_perform(curl);
|
res = curl_easy_perform(curl);
|
||||||
/* always cleanup */
|
/* always cleanup */
|
||||||
|
|||||||
@@ -16,15 +16,6 @@
|
|||||||
* 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -16,15 +16,6 @@
|
|||||||
* 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"
|
||||||
@@ -53,8 +44,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/oxygen/log.png")));
|
// tabBottom->setTabIcon(0, QIcon(QString::fromUtf8(":/Icons/log.png")));
|
||||||
// tabBottom->setTabIcon(1, QIcon(QString::fromUtf8(":/Icons/oxygen/filter.png")));
|
// tabBottom->setTabIcon(1, QIcon(QString::fromUtf8(":/Icons/filter.png")));
|
||||||
|
|
||||||
// Set Download list model
|
// Set Download list model
|
||||||
DLListModel = new QStandardItemModel(0,10);
|
DLListModel = new QStandardItemModel(0,10);
|
||||||
@@ -68,8 +59,6 @@ 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
|
||||||
@@ -193,8 +182,9 @@ void DownloadingTorrents::deleteTorrent(QString hash) {
|
|||||||
|
|
||||||
void DownloadingTorrents::on_actionSet_download_limit_triggered() {
|
void DownloadingTorrents::on_actionSet_download_limit_triggered() {
|
||||||
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
||||||
|
QModelIndex index;
|
||||||
QStringList hashes;
|
QStringList hashes;
|
||||||
foreach(const QModelIndex &index, selectedIndexes) {
|
foreach(index, selectedIndexes) {
|
||||||
if(index.column() == NAME) {
|
if(index.column() == NAME) {
|
||||||
// Get the file hash
|
// Get the file hash
|
||||||
hashes << DLListModel->data(DLListModel->index(index.row(), HASH)).toString();
|
hashes << DLListModel->data(DLListModel->index(index.row(), HASH)).toString();
|
||||||
@@ -206,8 +196,9 @@ void DownloadingTorrents::on_actionSet_download_limit_triggered() {
|
|||||||
|
|
||||||
void DownloadingTorrents::on_actionSet_upload_limit_triggered() {
|
void DownloadingTorrents::on_actionSet_upload_limit_triggered() {
|
||||||
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
||||||
|
QModelIndex index;
|
||||||
QStringList hashes;
|
QStringList hashes;
|
||||||
foreach(const QModelIndex &index, selectedIndexes) {
|
foreach(index, selectedIndexes) {
|
||||||
if(index.column() == NAME) {
|
if(index.column() == NAME) {
|
||||||
// Get the file hash
|
// Get the file hash
|
||||||
hashes << DLListModel->data(DLListModel->index(index.row(), HASH)).toString();
|
hashes << DLListModel->data(DLListModel->index(index.row(), HASH)).toString();
|
||||||
@@ -220,7 +211,8 @@ void DownloadingTorrents::on_actionSet_upload_limit_triggered() {
|
|||||||
// display properties of selected items
|
// display properties of selected items
|
||||||
void DownloadingTorrents::propertiesSelection(){
|
void DownloadingTorrents::propertiesSelection(){
|
||||||
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
||||||
foreach(const QModelIndex &index, selectedIndexes){
|
QModelIndex index;
|
||||||
|
foreach(index, selectedIndexes){
|
||||||
if(index.column() == NAME){
|
if(index.column() == NAME){
|
||||||
showProperties(index);
|
showProperties(index);
|
||||||
}
|
}
|
||||||
@@ -229,7 +221,8 @@ void DownloadingTorrents::propertiesSelection(){
|
|||||||
|
|
||||||
void DownloadingTorrents::forceRecheck() {
|
void DownloadingTorrents::forceRecheck() {
|
||||||
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
||||||
foreach(const QModelIndex &index, selectedIndexes){
|
QModelIndex index;
|
||||||
|
foreach(index, selectedIndexes){
|
||||||
if(index.column() == NAME){
|
if(index.column() == NAME){
|
||||||
QString hash = DLListModel->data(DLListModel->index(index.row(), HASH)).toString();
|
QString hash = DLListModel->data(DLListModel->index(index.row(), HASH)).toString();
|
||||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||||
@@ -238,12 +231,13 @@ void DownloadingTorrents::forceRecheck() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DownloadingTorrents::displayDLListMenu(const QPoint&) {
|
void DownloadingTorrents::displayDLListMenu(const QPoint& pos) {
|
||||||
QMenu myDLLlistMenu(this);
|
QMenu myDLLlistMenu(this);
|
||||||
|
QModelIndex index;
|
||||||
// Enable/disable pause/start action given the DL state
|
// Enable/disable pause/start action given the DL state
|
||||||
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
||||||
bool has_pause = false, has_start = false, has_preview = false;
|
bool has_pause = false, has_start = false, has_preview = false;
|
||||||
foreach(const QModelIndex &index, selectedIndexes) {
|
foreach(index, selectedIndexes) {
|
||||||
if(index.column() == NAME) {
|
if(index.column() == NAME) {
|
||||||
// Get the file name
|
// Get the file name
|
||||||
QString hash = DLListModel->data(DLListModel->index(index.row(), HASH)).toString();
|
QString hash = DLListModel->data(DLListModel->index(index.row(), HASH)).toString();
|
||||||
@@ -287,7 +281,8 @@ void DownloadingTorrents::displayDLListMenu(const QPoint&) {
|
|||||||
myDLLlistMenu.addSeparator();
|
myDLLlistMenu.addSeparator();
|
||||||
myDLLlistMenu.addAction(actionBuy_it);
|
myDLLlistMenu.addAction(actionBuy_it);
|
||||||
// Call menu
|
// Call menu
|
||||||
myDLLlistMenu.exec(QCursor::pos());
|
// XXX: why mapToGlobal() is not enough?
|
||||||
|
myDLLlistMenu.exec(mapToGlobal(pos)+QPoint(10,35));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -327,12 +322,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/oxygen/button_cancel.png")));
|
getActionHoSCol(index)->setIcon(QIcon(QString::fromUtf8(":/Icons/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/oxygen/button_ok.png")));
|
getActionHoSCol(index)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_ok.png")));
|
||||||
++nbVisibleColumns;
|
++nbVisibleColumns;
|
||||||
}
|
}
|
||||||
//resize all others non-hidden columns
|
//resize all others non-hidden columns
|
||||||
@@ -346,9 +341,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/oxygen/button_cancel.png")));
|
getActionHoSCol(PRIORITY)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_cancel.png")));
|
||||||
else
|
else
|
||||||
getActionHoSCol(PRIORITY)->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/button_ok.png")));
|
getActionHoSCol(PRIORITY)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_ok.png")));
|
||||||
}
|
}
|
||||||
|
|
||||||
// save the hidden columns in settings
|
// save the hidden columns in settings
|
||||||
@@ -386,9 +381,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/oxygen/button_cancel.png")));
|
getActionHoSCol(i)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_cancel.png")));
|
||||||
} else {
|
} else {
|
||||||
getActionHoSCol(i)->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/button_ok.png")));
|
getActionHoSCol(i)->setIcon(QIcon(QString::fromUtf8(":/Icons/button_ok.png")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return loaded;
|
return loaded;
|
||||||
@@ -467,8 +462,9 @@ QAction* DownloadingTorrents::getActionHoSCol(int index) {
|
|||||||
|
|
||||||
QStringList DownloadingTorrents::getSelectedTorrents(bool only_one) const{
|
QStringList DownloadingTorrents::getSelectedTorrents(bool only_one) const{
|
||||||
QStringList res;
|
QStringList res;
|
||||||
|
QModelIndex index;
|
||||||
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
||||||
foreach(const QModelIndex &index, selectedIndexes) {
|
foreach(index, selectedIndexes) {
|
||||||
if(index.column() == NAME) {
|
if(index.column() == NAME) {
|
||||||
// Get the file hash
|
// Get the file hash
|
||||||
QString hash = DLListModel->data(DLListModel->index(index.row(), HASH)).toString();
|
QString hash = DLListModel->data(DLListModel->index(index.row(), HASH)).toString();
|
||||||
@@ -482,7 +478,6 @@ QStringList DownloadingTorrents::getSelectedTorrents(bool only_one) const{
|
|||||||
// get information from torrent handles and
|
// get information from torrent handles and
|
||||||
// update download list accordingly
|
// update download list accordingly
|
||||||
bool DownloadingTorrents::updateTorrent(QTorrentHandle h) {
|
bool DownloadingTorrents::updateTorrent(QTorrentHandle h) {
|
||||||
if(!h.is_valid()) return false;
|
|
||||||
bool added = false;
|
bool added = false;
|
||||||
try{
|
try{
|
||||||
QString hash = h.hash();
|
QString hash = h.hash();
|
||||||
@@ -499,7 +494,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/oxygen/time.png"))), Qt::DecorationRole);
|
DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/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()));
|
||||||
}
|
}
|
||||||
@@ -526,7 +521,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/oxygen/time.png"))), Qt::DecorationRole);
|
DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/time.png"))), Qt::DecorationRole);
|
||||||
setRowColor(row, QString::fromUtf8("grey"));
|
setRowColor(row, QString::fromUtf8("grey"));
|
||||||
break;
|
break;
|
||||||
case torrent_status::downloading:
|
case torrent_status::downloading:
|
||||||
@@ -557,13 +552,7 @@ bool DownloadingTorrents::updateTorrent(QTorrentHandle h) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!downloadList->isColumnHidden(SEEDSLEECH)) {
|
if(!downloadList->isColumnHidden(SEEDSLEECH)) {
|
||||||
QString tmp = misc::toQString(h.num_seeds(), true);
|
DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant(misc::toQString(h.num_seeds(), true)+QString::fromUtf8("/")+misc::toQString(h.num_peers() - 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))));
|
||||||
@@ -575,7 +564,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.toLocal8Bit(), row);
|
qDebug("DL: addTorrent(): %s, row: %d", (const char*)hash.toUtf8(), 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
|
||||||
@@ -586,7 +575,6 @@ 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)));
|
||||||
@@ -726,7 +714,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() == nbColumns && width_list.at(i).toInt()>=1) {
|
if(downloadList->columnWidth(i)<1 && width_list.size() == DLListModel->columnCount()-1 && 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) {
|
||||||
@@ -739,11 +727,6 @@ 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");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -764,23 +747,6 @@ 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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,15 +16,6 @@
|
|||||||
* 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -16,22 +16,12 @@
|
|||||||
* 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>
|
||||||
@@ -57,8 +47,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/oxygen/button_ok.png")));
|
actionEnable->setIcon(QIcon(QString::fromUtf8(":/Icons/button_ok.png")));
|
||||||
actionDisable->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/button_cancel.png")));
|
actionDisable->setIcon(QIcon(QString::fromUtf8(":/Icons/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()));
|
||||||
@@ -85,7 +75,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.toLocal8Bit().data());
|
qDebug("dropped %s", file.toUtf8().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);
|
||||||
@@ -108,7 +98,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.toLocal8Bit().data());
|
qDebug("mimeData: %s", mime.toUtf8().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();
|
||||||
@@ -123,7 +113,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.toLocal8Bit().data(), installed_engines.value(engine, true));
|
qDebug("Engine %s has state: %d", engine.toUtf8().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);
|
||||||
@@ -132,7 +122,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_engine2/versions.txt");
|
downloader->downloadUrl("http://www.dchris.eu/search_engine/versions.txt");
|
||||||
}
|
}
|
||||||
|
|
||||||
void engineSelectDlg::toggleEngineState(QTreeWidgetItem *item, int) {
|
void engineSelectDlg::toggleEngineState(QTreeWidgetItem *item, int) {
|
||||||
@@ -264,7 +254,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.toLocal8Bit());
|
return plugins_list.contains(plugin_name.toUtf8());
|
||||||
}
|
}
|
||||||
|
|
||||||
void engineSelectDlg::loadSupportedSearchEngines(bool first) {
|
void engineSelectDlg::loadSupportedSearchEngines(bool first) {
|
||||||
@@ -332,15 +322,10 @@ void engineSelectDlg::loadSupportedSearchEngines(bool first) {
|
|||||||
if(QFile::exists(iconPath)) {
|
if(QFile::exists(iconPath)) {
|
||||||
// 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 {
|
|
||||||
iconPath = misc::qBittorrentPath()+"search_engine"+QDir::separator()+"engines"+QDir::separator()+id+".ico";
|
|
||||||
if(QFile::exists(iconPath)) { // ICO support
|
|
||||||
item->setData(ENGINE_NAME, Qt::DecorationRole, QVariant(QIcon(iconPath)));
|
|
||||||
} else {
|
} else {
|
||||||
// Icon is missing, we must download it
|
// Icon is missing, we must download it
|
||||||
downloader->downloadUrl(line.at(1)+"/favicon.ico");
|
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");
|
||||||
else
|
else
|
||||||
@@ -379,7 +364,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.toLocal8Bit().data(), 0);
|
ZZIP_DIR* dir = zzip_dir_open(path.toUtf8().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;
|
||||||
@@ -412,8 +397,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.toLocal8Bit().data());
|
qDebug("Detected plugin %s in archive", plugin_name.toUtf8().data());
|
||||||
ZZIP_FILE* fp = zzip_file_open(dir, plugin.toLocal8Bit().data(), 0);
|
ZZIP_FILE* fp = zzip_file_open(dir, plugin.toUtf8().data(), 0);
|
||||||
if(fp) {
|
if(fp) {
|
||||||
QTemporaryFile *tmpfile = new QTemporaryFile();
|
QTemporaryFile *tmpfile = new QTemporaryFile();
|
||||||
QString tmpPath;
|
QString tmpPath;
|
||||||
@@ -430,7 +415,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.toLocal8Bit().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.toUtf8().data()));
|
||||||
delete tmpfile;
|
delete tmpfile;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -441,12 +426,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.toLocal8Bit().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.toUtf8().data()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QString favicon;
|
QString favicon;
|
||||||
foreach(favicon, favicons) {
|
foreach(favicon, favicons) {
|
||||||
qDebug("Detected favicon %s in archive", favicon.toLocal8Bit().data());
|
qDebug("Detected favicon %s in archive", favicon.toUtf8().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
|
||||||
@@ -454,10 +439,8 @@ 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)) {
|
if(QFile::exists(iconPath)) continue;
|
||||||
QFile::remove(iconPath);
|
ZZIP_FILE* fp = zzip_file_open(dir, favicon.toUtf8().data(), 0);
|
||||||
}
|
|
||||||
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
|
||||||
@@ -482,12 +465,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.toLocal8Bit().data());
|
qDebug("Asked to install plugin at %s", path.toUtf8().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.toLocal8Bit().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.toUtf8().data()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Process with install
|
// Process with install
|
||||||
@@ -509,12 +492,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.toLocal8Bit().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.toUtf8().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.toLocal8Bit().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.toUtf8().data()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -525,10 +508,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.toLocal8Bit().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.toUtf8().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.toLocal8Bit().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.toUtf8().data()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -595,17 +578,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.toLocal8Bit().data(), version);
|
qDebug("read line %s: %.2f", plugin_name.toUtf8().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.toLocal8Bit().data());
|
qDebug("Plugin: %s is outdated", plugin_name.toUtf8().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.toLocal8Bit().data());
|
qDebug("Plugin: %s is up to date", plugin_name.toUtf8().data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Close file
|
// Close file
|
||||||
@@ -619,7 +602,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.toLocal8Bit().data());
|
qDebug("engineSelectDlg received %s", url.toUtf8().data());
|
||||||
if(url.endsWith("favicon.ico", Qt::CaseInsensitive)){
|
if(url.endsWith("favicon.ico", Qt::CaseInsensitive)){
|
||||||
// Icon downloaded
|
// Icon downloaded
|
||||||
QImage fileIcon;
|
QImage fileIcon;
|
||||||
@@ -628,13 +611,7 @@ 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;
|
QString iconPath = misc::qBittorrentPath()+"search_engine"+QDir::separator()+"engines"+QDir::separator()+id+".png";
|
||||||
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)));
|
||||||
}
|
}
|
||||||
@@ -643,16 +620,16 @@ void engineSelectDlg::processDownloadedFile(QString url, QString filePath) {
|
|||||||
QFile::remove(filePath);
|
QFile::remove(filePath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(url == "http://www.dchris.eu/search_engine2/versions.txt") {
|
if(url == "http://www.dchris.eu/search_engine/versions.txt") {
|
||||||
if(!parseVersionsFile(filePath, "http://www.dchris.eu/search_engine2/")) {
|
if(!parseVersionsFile(filePath, "http://www.dchris.eu/search_engine/")) {
|
||||||
qDebug("Primary update server failed, try secondary");
|
qDebug("Primary update server failed, try secondary");
|
||||||
downloader->downloadUrl("http://hydr0g3n.free.fr/search_engine2/versions.txt");
|
downloader->downloadUrl("http://hydr0g3n.free.fr/search_engine/versions.txt");
|
||||||
}
|
}
|
||||||
QFile::remove(filePath);
|
QFile::remove(filePath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(url == "http://hydr0g3n.free.fr/search_engine2/versions.txt") {
|
if(url == "http://hydr0g3n.free.fr/search_engine/versions.txt") {
|
||||||
if(!parseVersionsFile(filePath, "http://hydr0g3n.free.fr/search_engine2/")) {
|
if(!parseVersionsFile(filePath, "http://hydr0g3n.free.fr/search_engine/")) {
|
||||||
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);
|
||||||
@@ -677,16 +654,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.toLocal8Bit().data(), reason.toLocal8Bit().data());
|
qDebug("Could not download favicon: %s, reason: %s", url.toUtf8().data(), reason.toUtf8().data());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(url == "http://www.dchris.eu/search_engine2/versions.txt") {
|
if(url == "http://www.dchris.eu/search_engine/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_engine2/versions.txt");
|
downloader->downloadUrl("http://hydr0g3n.free.fr/search_engine/versions.txt");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(url == "http://hydr0g3n.free.fr/search_engine2/versions.txt") {
|
if(url == "http://hydr0g3n.free.fr/search_engine/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;
|
||||||
}
|
}
|
||||||
@@ -695,13 +672,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.toLocal8Bit().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.toUtf8().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.toLocal8Bit().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.toUtf8().data()));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,15 +16,6 @@
|
|||||||
* 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Bittorrent Client using Qt4 and libtorrent.
|
* Copyright (C) 2007 by Ishan Arora & Christophe Dumez
|
||||||
* Copyright (C) 2006 Ishan Arora and Christophe Dumez
|
* <ishan@qbittorrent.org>, <chris@qbittorrent.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* modify it under the terms of the GNU General Public License
|
* it under the terms of the GNU General Public License as published by
|
||||||
* as published by the Free Software Foundation; either version 2
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* of the License, or (at your option) any later version.
|
* (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
|
||||||
@@ -13,19 +13,9 @@
|
|||||||
* 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 Free Software
|
* along with this program; if not, write to the
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Free Software Foundation, Inc.,
|
||||||
*
|
* 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
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Bittorrent Client using Qt4 and libtorrent.
|
* Copyright (C) 2007 by Ishan Arora & Christophe Dumez
|
||||||
* Copyright (C) 2006 Ishan Arora and Christophe Dumez
|
* <ishan@qbittorrent.org>, <chris@qbittorrent.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* modify it under the terms of the GNU General Public License
|
* it under the terms of the GNU General Public License as published by
|
||||||
* as published by the Free Software Foundation; either version 2
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* of the License, or (at your option) any later version.
|
* (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
|
||||||
@@ -13,19 +13,9 @@
|
|||||||
* 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 Free Software
|
* along with this program; if not, write to the
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Free Software Foundation, Inc.,
|
||||||
*
|
* 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
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,15 +16,6 @@
|
|||||||
* 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -187,31 +178,23 @@ class FilterParserThread : public QThread {
|
|||||||
}
|
}
|
||||||
// Now Add to the filter
|
// Now Add to the filter
|
||||||
QStringList IP;
|
QStringList IP;
|
||||||
try {
|
|
||||||
if(IPv4) {
|
if(IPv4) {
|
||||||
//IPv4 addresses
|
//IPv4 addresses
|
||||||
IP = strStartIP.split('.');
|
IP = strStartIP.split('.');
|
||||||
if(IP.size() != 4)
|
address_v4 start((IP.at(0).toInt() << 24) + (IP.at(1).toInt() << 16) + (IP.at(2).toInt() << 8) + IP.at(3).toInt());
|
||||||
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('.');
|
||||||
if(IP.size() != 4)
|
address_v4 last((IP.at(0).toInt() << 24) + (IP.at(1).toInt() << 16) + (IP.at(2).toInt() << 8) + IP.at(3).toInt());
|
||||||
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).toLocal8Bit().data());
|
address_v6 start = address_v6::from_string(strStartIP.remove(':', 0).toUtf8().data());
|
||||||
IP = strEndIP.split(':');
|
IP = strEndIP.split(':');
|
||||||
address_v6 last = address_v6::from_string(strEndIP.remove(':', 0).toLocal8Bit().data());
|
address_v6 last = address_v6::from_string(strEndIP.remove(':', 0).toUtf8().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);
|
||||||
}
|
}
|
||||||
}catch(exception){
|
|
||||||
qDebug("Bad line in filter file, avoided crash...");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
@@ -254,9 +237,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).toUInt() << 24) + (IP.at(1).toUInt() << 16) + (IP.at(2).toUInt() << 8) + IP.at(3).toUInt());
|
address_v4 start((IP.at(0).toInt() << 24) + (IP.at(1).toInt() << 16) + (IP.at(2).toInt() << 8) + IP.at(3).toInt());
|
||||||
IP = strEndIP.split('.');
|
IP = strEndIP.split('.');
|
||||||
address_v4 last((IP.at(0).toUInt() << 24) + (IP.at(1).toUInt() << 16) + (IP.at(2).toUInt() << 8) + IP.at(3).toUInt());
|
address_v4 last((IP.at(0).toInt() << 24) + (IP.at(1).toInt() << 16) + (IP.at(2).toInt() << 8) + IP.at(3).toInt());
|
||||||
// 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 {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Bittorrent Client using Qt4 and libtorrent.
|
* Copyright (C) 2007 by Ishan Arora
|
||||||
* Copyright (C) 2006 Ishan Arora and Christophe Dumez
|
* ishanarora@gmail.com
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* modify it under the terms of the GNU General Public License
|
* it under the terms of the GNU General Public License as published by
|
||||||
* as published by the Free Software Foundation; either version 2
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* of the License, or (at your option) any later version.
|
* (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
|
||||||
@@ -13,19 +13,9 @@
|
|||||||
* 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 Free Software
|
* along with this program; if not, write to the
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Free Software Foundation, Inc.,
|
||||||
*
|
* 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
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -56,12 +46,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.toLocal8Bit());
|
qDebug("URL %s successfully downloaded !", (const char*)url.toUtf8());
|
||||||
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.toLocal8Bit() << ", reason: " << (const char*)reason.toLocal8Bit() << "\n";
|
std::cerr << "Could not download " << (const char*)url.toUtf8() << ", reason: " << (const char*)reason.toUtf8() << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void HttpConnection::read()
|
void HttpConnection::read()
|
||||||
@@ -103,7 +93,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].toLocal8Bit()))
|
if (auth.size() != 2 || QString::compare(auth[0], "Basic", Qt::CaseInsensitive) != 0 || !parent->isAuthorized(auth[1].toUtf8()))
|
||||||
{
|
{
|
||||||
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\"");
|
||||||
@@ -187,7 +177,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.toLocal8Bit());
|
qDebug("Downloading url: %s", (const char*)url.toUtf8());
|
||||||
emit UrlReadyToBeDownloaded(url);
|
emit UrlReadyToBeDownloaded(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Bittorrent Client using Qt4 and libtorrent.
|
* Copyright (C) 2007 by Ishan Arora
|
||||||
* Copyright (C) 2006 Ishan Arora and Christophe Dumez
|
* ishanarora@gmail.com
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* modify it under the terms of the GNU General Public License
|
* it under the terms of the GNU General Public License as published by
|
||||||
* as published by the Free Software Foundation; either version 2
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* of the License, or (at your option) any later version.
|
* (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
|
||||||
@@ -13,19 +13,9 @@
|
|||||||
* 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 Free Software
|
* along with this program; if not, write to the
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Free Software Foundation, Inc.,
|
||||||
*
|
* 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
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Bittorrent Client using Qt4 and libtorrent.
|
* Copyright (C) 2007 by Ishan Arora
|
||||||
* Copyright (C) 2006 Ishan Arora and Christophe Dumez
|
* ishanarora@gmail.com
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* modify it under the terms of the GNU General Public License
|
* it under the terms of the GNU General Public License as published by
|
||||||
* as published by the Free Software Foundation; either version 2
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* of the License, or (at your option) any later version.
|
* (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
|
||||||
@@ -13,19 +13,9 @@
|
|||||||
* 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 Free Software
|
* along with this program; if not, write to the
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Free Software Foundation, Inc.,
|
||||||
*
|
* 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
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Bittorrent Client using Qt4 and libtorrent.
|
* Copyright (C) 2007 by Ishan Arora
|
||||||
* Copyright (C) 2006 Ishan Arora and Christophe Dumez
|
* ishanarora@gmail.com
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* modify it under the terms of the GNU General Public License
|
* it under the terms of the GNU General Public License as published by
|
||||||
* as published by the Free Software Foundation; either version 2
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* of the License, or (at your option) any later version.
|
* (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
|
||||||
@@ -13,19 +13,9 @@
|
|||||||
* 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 Free Software
|
* along with this program; if not, write to the
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Free Software Foundation, Inc.,
|
||||||
*
|
* 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
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Bittorrent Client using Qt4 and libtorrent.
|
* Copyright (C) 2007 by Ishan Arora
|
||||||
* Copyright (C) 2006 Ishan Arora and Christophe Dumez
|
* ishanarora@gmail.com
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* modify it under the terms of the GNU General Public License
|
* it under the terms of the GNU General Public License as published by
|
||||||
* as published by the Free Software Foundation; either version 2
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* of the License, or (at your option) any later version.
|
* (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
|
||||||
@@ -13,19 +13,9 @@
|
|||||||
* 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 Free Software
|
* along with this program; if not, write to the
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Free Software Foundation, Inc.,
|
||||||
*
|
* 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
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -39,7 +29,7 @@ void HttpResponseGenerator::setMessage(const QByteArray message)
|
|||||||
|
|
||||||
void HttpResponseGenerator::setMessage(const QString message)
|
void HttpResponseGenerator::setMessage(const QString message)
|
||||||
{
|
{
|
||||||
setMessage(message.QString::toLocal8Bit());
|
setMessage(message.QString::toUtf8());
|
||||||
}
|
}
|
||||||
|
|
||||||
void HttpResponseGenerator::stripMessage()
|
void HttpResponseGenerator::stripMessage()
|
||||||
@@ -49,7 +39,7 @@ void HttpResponseGenerator::stripMessage()
|
|||||||
|
|
||||||
QByteArray HttpResponseGenerator::toByteArray() const
|
QByteArray HttpResponseGenerator::toByteArray() const
|
||||||
{
|
{
|
||||||
return QHttpResponseHeader::toString().toLocal8Bit() + message;
|
return QHttpResponseHeader::toString().toUtf8() + message;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HttpResponseGenerator::setContentTypeByExt(const QString ext)
|
void HttpResponseGenerator::setContentTypeByExt(const QString ext)
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Bittorrent Client using Qt4 and libtorrent.
|
* Copyright (C) 2007 by Ishan Arora
|
||||||
* Copyright (C) 2006 Ishan Arora and Christophe Dumez
|
* ishanarora@gmail.com
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* modify it under the terms of the GNU General Public License
|
* it under the terms of the GNU General Public License as published by
|
||||||
* as published by the Free Software Foundation; either version 2
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* of the License, or (at your option) any later version.
|
* (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
|
||||||
@@ -13,19 +13,9 @@
|
|||||||
* 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 Free Software
|
* along with this program; if not, write to the
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Free Software Foundation, Inc.,
|
||||||
*
|
* 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
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||