Compare commits
58 Commits
release-2.
...
release-2.
Author | SHA1 | Date | |
---|---|---|---|
![]() |
89c9a646ad | ||
![]() |
1ee45151a1 | ||
![]() |
772f05c5d4 | ||
![]() |
de9e215404 | ||
![]() |
eeabf85e3b | ||
![]() |
6b99c84fe3 | ||
![]() |
7d42969505 | ||
![]() |
90351c4a57 | ||
![]() |
492b9dc88f | ||
![]() |
c9a8c1d053 | ||
![]() |
c8fdf8dc10 | ||
![]() |
119f83fbf0 | ||
![]() |
e8db20a558 | ||
![]() |
508a811a8a | ||
![]() |
296267ec20 | ||
![]() |
39d4af1d6e | ||
![]() |
2e8f50b709 | ||
![]() |
fdccf9cc1c | ||
![]() |
31819e148f | ||
![]() |
5371fb15f8 | ||
![]() |
f845acb207 | ||
![]() |
f42eec5ad9 | ||
![]() |
ec1a06d7c8 | ||
![]() |
e9b6a726e3 | ||
![]() |
a3f54fc3b9 | ||
![]() |
10f58b4eed | ||
![]() |
52fef5ac38 | ||
![]() |
4d0cdea1c9 | ||
![]() |
86ca755dfe | ||
![]() |
659664509a | ||
![]() |
412f947db5 | ||
![]() |
ad47565b93 | ||
![]() |
89175ea827 | ||
![]() |
8dc34463e3 | ||
![]() |
cab38857d1 | ||
![]() |
14db21c241 | ||
![]() |
975ab9ad64 | ||
![]() |
b810278452 | ||
![]() |
86ac0a430e | ||
![]() |
78a0f34645 | ||
![]() |
3ae09658c9 | ||
![]() |
7d9caad31e | ||
![]() |
c9c627dec2 | ||
![]() |
5b104cdd9b | ||
![]() |
8f667dce5c | ||
![]() |
89412e5050 | ||
![]() |
63c121ecc7 | ||
![]() |
33b60779d6 | ||
![]() |
26b2367833 | ||
![]() |
9b40a036a7 | ||
![]() |
d4cc0e9e4a | ||
![]() |
ca802a6233 | ||
![]() |
35394c4966 | ||
![]() |
077dd11af6 | ||
![]() |
a5c9c8d670 | ||
![]() |
1ef0bcbc06 | ||
![]() |
e15eab9b6a | ||
![]() |
8f1c56babd |
7
AUTHORS
@@ -6,7 +6,6 @@ Contributors:
|
||||
* Ishan Arora <ishan@qbittorrent.org>
|
||||
* Arnaud Demaizière <arnaud@qbittorrent.org>
|
||||
* Grigis Gaëtan <cipher16@gmail.com>
|
||||
* Christian Kandeler <zambesi@users.sourceforge.net>
|
||||
|
||||
Code from other projects:
|
||||
* files src/ico.cpp src/ico.h
|
||||
@@ -60,13 +59,11 @@ Images Authors:
|
||||
Translations authors:
|
||||
* files: src/lang/*.ts
|
||||
copyright:
|
||||
- Arabic: SDERAWI (abz8868@msn.com) and sn51234 (nesseyan@gmail.com)
|
||||
- Brazilian: Nick Marinho (nickmarinho@gmail.com)
|
||||
- Bulgarian: Tsvetan & Boyko Bankoff (emerge_life@users.sourceforge.net)
|
||||
- Bulgarian: Tsvetan & Boiko Bankov (emerge_life@users.sourceforge.net)
|
||||
- Catalan: Francisco Luque Contreras (frannoe@ya.com)
|
||||
- Chinese (Simplified): Guo Yue (yue.guo0418@gmail.com)
|
||||
- Chinese (Traditional): Yi-Shun Wang (dnextstep@gmail.com)
|
||||
- Croatian: Oliver Mucafir (oliver.untwist@gmail.com)
|
||||
- Czech: Jirka Vilim (web@tets.cz)
|
||||
- Danish: Mathias Nielsen (comoneo@gmail.com)
|
||||
- Dutch: Joost Schipper (heavyjoost@users.sourceforge.net)
|
||||
@@ -89,5 +86,5 @@ Translations authors:
|
||||
- Spanish: Francisco Luque Contreras (frannoe@ya.com)
|
||||
- Swedish: Daniel Nylander (po@danielnylander.se)
|
||||
- Turkish: Hasan Yilmaz (iletisim@hedefturkce.com)
|
||||
- Ukrainian: Andrey Shpachenko (masterfix@users.sourceforge.net) and Oleh Prypin (blaxpirit@gmail.com)
|
||||
- Ukrainian: Andrey Shpachenko (masterfix@users.sourceforge.net)
|
||||
license: GPLv2
|
||||
|
135
Changelog
@@ -1,102 +1,45 @@
|
||||
* Mon May 24 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.2.8
|
||||
- BUGFIX: ETA for finished torrent is now 0 instead of Infinite (closes #583704)
|
||||
- BUGFIX: Fix sorting of ETA column when having infinite values (closes #583347)
|
||||
- BUGFIX: Torrent queue position now starts at 1 (closes #581130)
|
||||
- BUGFIX: Fix unicode issue in start seeding after torrent creation code
|
||||
- BUGFIX: Fix torrent error state clearance on resuming
|
||||
- BUGFIX: Fix possible checkbox update in Web UI
|
||||
- COSMETIC: Fix torrent properties layout
|
||||
* Mon Feb 8 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.1.4
|
||||
- BUGFIX: Fix file prioritizing in a torrent
|
||||
- BUGFIX: Make sure seeding torrents display a progress of 100%
|
||||
- BUGFIX: Usage display was improved and localized (--help)
|
||||
- BUGFIX: Fix possible crash when deleting a torrent
|
||||
- BUGFIX: Fix possible crash when changing torrents label
|
||||
|
||||
* Wed May 12 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.2.7
|
||||
- BUGFIX: Fix unicode problem in torrent moving code
|
||||
- BUGFIX: Fix possible initialization problem in Web UI
|
||||
- BUGFIX: Fix torrent moving after completion feature
|
||||
- BUGFIX: Improved empty folder removing code
|
||||
- BUGFIX: Use guid or news url as RSS items identifier (instead of title)
|
||||
- BUGFIX: Fix possible crash in RSS item selection code
|
||||
- BUGFIX: Added support for url encoded ampersands in RSS
|
||||
- COSMETIC: Sort torrent labels in popup menu
|
||||
- I18N: Added Croatian translation
|
||||
* Sun Jan 31 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.1.3
|
||||
- BUGFIX: Fix "Append .!qB extension to complete files" (libtorrent v0.15)
|
||||
- BUGFIX: Make sure bandwidth limiting dialogs are centered on screen
|
||||
- BUGFIX: Added support for HTTP redirection
|
||||
- BUGFIX: Fix compilation error when geoip database is embedded
|
||||
- BUGFIX: Fix crash when double-clicking on a torrent that has no metadata to open its save path
|
||||
- BUGFIX: Fix Scan directory preferences in Web UI
|
||||
- BUGFIX: Clear torrent error state when resuming it
|
||||
|
||||
* Sun Apr 18 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.2.6
|
||||
- BUGFIX: Announce to all trackers at once
|
||||
- BUGFIX: Added support for single-thread boost
|
||||
- BUGFIX: Remove old folder when moving a torrent
|
||||
- BUGFIX: Improved reliability of torrent moving
|
||||
- BUGFIX: Stop rechecking torrents when they are moved
|
||||
- BUGFIX: Status filters height stays correct when the visual style changes
|
||||
- I18N: Added Arabic translation
|
||||
* Sun Jan 24 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.1.2
|
||||
- FEATURE: Added back file prioritizing in a torrent
|
||||
- BUGFIX: Fix issue causing torrents not to be displayed in the list
|
||||
- BUGFIX: Make sure invalid torrent are removed from the transfer list
|
||||
- BUGFIX: Fix overwrite check when renaming a folder in a torrent
|
||||
- BUGFIX: Force a recheck after renaming files to avoid overwriting
|
||||
- BUGFIX: Improve "Open destination folder" behavior
|
||||
- BUGFIX: Fix race condition in RSS that could cause a crash on startup
|
||||
- BUGFIX: Improved user friendlyness of size units
|
||||
- BUGFIX: Optimized transfer list repainting
|
||||
- COSMETIC: Improved transfer speed display in peers list
|
||||
|
||||
* Wed Apr 07 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.2.5
|
||||
- BUGFIX: Fix crash when adding a new torrent label
|
||||
- BUGFIX: Fix HTTPS protocol support in torrent/rss downloader
|
||||
- BUGFIX: Fix default width of file name column in torrent content
|
||||
- BUGFIX: Fix torrent addition dialog buttons height
|
||||
- BUGFIX: Fix deprecation warnings with libtorrent v0.15
|
||||
- BUGFIX: Fix "Download from URL" title size in Web UI
|
||||
- BUGFIX: Fix transparency of speed limits icons
|
||||
- BUGFIX: Dropped dependency on Qt gif library
|
||||
- BUGFIX: Improved libboost detection by configure file
|
||||
- BUGFIX: Bring back compatibility with boost v1.34
|
||||
- COSMETIC: Added icons to menu actions in Web UI
|
||||
|
||||
* Tue Apr 06 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.2.4
|
||||
- BUGFIX: Fix possible crash when adding a torrent
|
||||
- BUGFIX: Fix failure to remember some torrents on startup
|
||||
- BUGFIX: Fix torrent addition window layout (torrent content not expanding)
|
||||
- BUGFIX: Fix about dialog in Web UI
|
||||
- BUGFIX: Correctly clear trackers error messages once they work
|
||||
- BUGFIX: Display correct share ratio for paused torrents
|
||||
- COSMETIC: Improved alternative speed limits icons
|
||||
|
||||
* Sun Apr 04 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.2.3
|
||||
- BUGFIX: Fix possible crash when deleting a torrent just after pausing it
|
||||
- BUGFIX: Enable Apply button when alternative rate limits are changed
|
||||
- BUGFIX: Source compatibility with Windows (Thanks Ishan Arora)
|
||||
- BUGFIX: Source compatibility with eCS (OS/2) (Thanks Silvan Scherrer)
|
||||
- BUGFIX: Cleaner binutils gold linker support
|
||||
- BUGFIX: Clean fix for progress display with cleanlooks style
|
||||
|
||||
* Mon Mar 22 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.2.2
|
||||
- FEATURE: DHT port can be set from Web UI
|
||||
- BUGFIX: Fix possible crash with folder scanning
|
||||
- BUGFIX: Fix Mac compilation
|
||||
- BUGFIX: Save fast resume data every 3 minutes (for robustness)
|
||||
- I18N: Updated Polish translation (thanks Szymon Świerkosz)
|
||||
|
||||
* Sat Mar 20 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.2.1
|
||||
- FEATURE: Display pieces that are being downloaded
|
||||
- FEATURE: Added back folder watching in Web UI
|
||||
- FEATURE: Added back file prioritizing in Web UI
|
||||
- BUGFIX: Fix compilation with Qt 4.4
|
||||
- BUGFIX: Fix Web UI compatibility with Safari
|
||||
- BUGFIX: Fix progress display with cleanlook style
|
||||
- BUGFIX: Fix file filtering in complex torrents
|
||||
- BUGFIX: Ask for user confirmation for recursive torrent download
|
||||
- BUGFIX: Fix "add file" dialog in torrent creation tool
|
||||
- BUGFIX: Fix "Ctrl+A" in Web UI
|
||||
|
||||
* Sun Mar 14 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.2.0
|
||||
- FEATURE: User can set alternative speed limits for fast toggling
|
||||
- FEATURE: Bandwidth scheduler (automatically use alternative speed limits for a given period)
|
||||
- FEATURE: Added "Added/Completed On" columns to transfer list
|
||||
- FEATURE: Added "Upload/Download limit" columns to transfer list
|
||||
- FEATURE: Torrent files can be exported to a given directory
|
||||
- FEATURE: Outgoing ports range can be customized (for QoS)
|
||||
- FEATURE: User can choose to apply transfer limits on LAN too
|
||||
- FEATURE: User can choose to include the protocol overhead in transfer limits
|
||||
- FEATURE: Torrents can be automatically rechecked on completion
|
||||
- FEATURE: If 2 torrents have the same hash, add new trackers/URL seeds to the existing torrent
|
||||
- FEATURE: Trackers can be added from Web UI
|
||||
- FEATURE: Global transfer information are displayed in the new Web UI status bar
|
||||
- FEATURE: Allow to change the priority of several files at once
|
||||
- FEATURE: Support for multiple scan folders (Patch by Christian Kandeler)
|
||||
- BUGFIX: Only one log window can be opened at a time
|
||||
- BUGFIX: Optimized RSS module memory usage
|
||||
- BUGFIX: Consider HTTP downloads >1MB as invalid .torrent files and abort
|
||||
- BUGFIX: Fix Web UI authentication with some browsers
|
||||
- BUGFIX: Set Web UI ban period to 1 hour
|
||||
- COSMETIC: Improved style management
|
||||
* Wed Jan 20 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.1.1
|
||||
- BUGFIX: Fix compilation with Qt4.4
|
||||
- BUGFIX: Save torrent metadata so that it does not have to be re-downloaded on restart (Magnet links)
|
||||
- BUGFIX: Fix folder renaming in a torrent (would rename children under certain conditions)
|
||||
- BUGFIX: Nox version no longer requires libQtXml
|
||||
- BUGFIX: Configure file now checks for pkg-config executable which is required
|
||||
- BUGFIX: Torrents added from magnet links were not remembered on restart
|
||||
- BUGFIX: "Add in pause" setting can be ignored from torrent addition dialog
|
||||
- BUGFIX: Fix renaming of files with unicode characters in their name
|
||||
- BUGFIX: Fix typo in legal notice (startup)
|
||||
- BUGFIX: Can listen on ports < 1024 (must be root)
|
||||
- BUGFIX: Paused torrents can now be rechecked
|
||||
- BUGFIX: Fix "open torrent destination" feature when path contains spaces
|
||||
- I18N: Updated translations (Hungarian, Chinese, Russian)
|
||||
|
||||
* Mon Jan 18 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.1.0
|
||||
- FEATURE: Graphical User Interface can be disabled at compilation time (headless running)
|
||||
|
6
INSTALL
@@ -14,13 +14,11 @@ qBittorrent - A BitTorrent client in C++ / Qt4
|
||||
|
||||
- pkg-config executable
|
||||
|
||||
- libtorrent-rasterbar by Arvid Norberg (>= 0.14.4 REQUIRED, compatible with v0.15.x)
|
||||
- libtorrent-rasterbar by Arvid Norberg (>= 0.14.4 REQUIRED, >= v0.15.0 ADVISED)
|
||||
-> http://www.libtorrent.net
|
||||
Be careful: another library (the one used by rTorrent) uses a similar name.
|
||||
|
||||
- libboost 1.34.x (libboost-filesystem, libboost-thread, libboost-date-time) + libasio
|
||||
or
|
||||
- libboost >= 1.35.x (libboost-system, libboost-filesystem, libboost-thread, libboost-date-time)
|
||||
- libboost: libboost-filesystem, libboost-date-time, libboost-thread, libboost-serialization
|
||||
|
||||
- python >= 2.3 (needed by search engine)
|
||||
* Run time only dependency
|
||||
|
62
README.os2
@@ -1,62 +0,0 @@
|
||||
qBittorrent - A BitTorrent client in Qt4
|
||||
------------------------------------------
|
||||
|
||||
This is the eComStation (OS/2) qBittorrent part of the readme. See also README for more general information.
|
||||
|
||||
|
||||
Building qBittorrent
|
||||
********************
|
||||
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
- gcc based build env (recommended gcc v4.4.2 or greater)
|
||||
|
||||
- Qt4 for eCS (OS/2) dev package (see http://svn.netlabs.org/qt4 for more information)
|
||||
|
||||
- libtorrent-rasterbar for eCS (OS/2) port (see http://svn.netlabs.org/ports for more information)
|
||||
|
||||
- boost for eCS (OS/2) port (see http://svn.netlabs.org/ports for more information)
|
||||
|
||||
|
||||
How to build
|
||||
============
|
||||
|
||||
First you need to create the conf.pri file in the same dir as this readme.os2 is.
|
||||
the conf.pri file has the following content:
|
||||
|
||||
##### conf.pri content beginn #####
|
||||
PREFIX = .
|
||||
BINDIR = ./bin
|
||||
INCDIR = ./include
|
||||
LIBDIR = ./lib
|
||||
DATADIR = ./share
|
||||
|
||||
CONFIG += staticlib
|
||||
INCLUDEPATH += x:/trees/libtorrent/trunk/include
|
||||
LIBS += -Lx:/trees/libtorrent/trunk/src/.libs \
|
||||
-Lx:/trees/boost/trunk/stage/lib \
|
||||
-Lx:/trees/openssl \
|
||||
-Lx:/extras/lib
|
||||
##### conf.pri content end #####
|
||||
|
||||
Of course all the above path references have to be adjusted to your build env.
|
||||
|
||||
It should now be easy to build qBittorrent:
|
||||
|
||||
Simply type:
|
||||
$ qmake
|
||||
|
||||
Followed by:
|
||||
$ make
|
||||
|
||||
If all works fine you should get a working qbittorrent executable.
|
||||
|
||||
If you have any question regarding the eCS (OS/2) port of qBittorrent you can meet me (_diver) on IRC:
|
||||
#netlabs on irc.freenode.net
|
||||
|
||||
------------------------------------------
|
||||
Silvan Scherrer <silvan.scherrer@aroa.ch>
|
||||
|
||||
|
95
configure
vendored
@@ -21,7 +21,6 @@ Dependency options:
|
||||
--disable-gui Disable qBittorrent Graphical user
|
||||
interface for headless running
|
||||
--with-libboost-inc=[path] Path to libboost include files
|
||||
--with-libboost-lib=[path] Path to libboost library files
|
||||
--disable-libnotify Disable use of libnotify
|
||||
--disable-geoip-database Disable use of geoip-database
|
||||
--with-geoip-database-embedded Geoip Database will be embedded in
|
||||
@@ -153,11 +152,6 @@ while [ $# -gt 0 ]; do
|
||||
shift
|
||||
;;
|
||||
|
||||
--with-libboost-lib=*)
|
||||
QC_WITH_LIBBOOST_LIB=$optarg
|
||||
shift
|
||||
;;
|
||||
|
||||
--disable-libnotify)
|
||||
QC_DISABLE_libnotify="Y"
|
||||
shift
|
||||
@@ -196,7 +190,6 @@ echo DATADIR=$DATADIR
|
||||
echo EX_QTDIR=$EX_QTDIR
|
||||
echo QC_DISABLE_GUI=$QC_DISABLE_GUI
|
||||
echo QC_WITH_LIBBOOST_INC=$QC_WITH_LIBBOOST_INC
|
||||
echo QC_WITH_LIBBOOST_LIB=$QC_WITH_LIBBOOST_LIB
|
||||
echo QC_DISABLE_libnotify=$QC_DISABLE_libnotify
|
||||
echo QC_DISABLE_geoip_database=$QC_DISABLE_geoip_database
|
||||
echo QC_WITH_GEOIP_DATABASE_EMBEDDED=$QC_WITH_GEOIP_DATABASE_EMBEDDED
|
||||
@@ -319,7 +312,11 @@ public:
|
||||
if(!conf->getenv("QC_DISABLE_GUI").isEmpty()) {
|
||||
conf->addDefine("DISABLE_GUI");
|
||||
}
|
||||
if(QT_VERSION >= 0x040500) {
|
||||
conf->addDefine("QT_4_5");
|
||||
}
|
||||
return(QT_VERSION >= 0x040400);
|
||||
|
||||
}
|
||||
};
|
||||
#line 1 "pkg-config.qcm"
|
||||
@@ -362,23 +359,12 @@ public:
|
||||
return false;
|
||||
for(int n = 0; n < incs.count(); ++n)
|
||||
conf->addIncludePath(incs[n]);
|
||||
//if(!libs.isEmpty())
|
||||
// conf->addLib(libs);
|
||||
if(conf->findPkgConfig("libtorrent-rasterbar", mode, adv_ver, &version, &incs, &libs, &other)) {
|
||||
//printf("\nWarning: libtorrent-rasterbar v%s was detected. Some feature will be disabled because they require v%s.\n", version.toLocal8Bit().data(), adv_ver.toUtf8().data());
|
||||
//else
|
||||
if(!libs.isEmpty())
|
||||
conf->addLib(libs);
|
||||
if(!conf->findPkgConfig("libtorrent-rasterbar", mode, adv_ver, &version, &incs, &libs, &other))
|
||||
printf("\nWarning: libtorrent-rasterbar v%s was detected. Some feature will be disabled because they require v%s.\n", version.toLocal8Bit().data(), adv_ver.toUtf8().data());
|
||||
else
|
||||
conf->addDefine("LIBTORRENT_0_15");
|
||||
}
|
||||
// Get linking parameters
|
||||
//QStringList params;
|
||||
//QByteArray staticlibs;
|
||||
//params << "--static" << "--libs" << "libtorrent-rasterbar";
|
||||
//conf->doCommand("pkg-config", params, &staticlibs);
|
||||
//conf->addLib(staticlibs.trimmed());
|
||||
//libcrypto
|
||||
if(conf->getenv("QC_DISABLE_GUI").isEmpty()) {
|
||||
conf->addLib("-lcrypto");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -387,39 +373,14 @@ public:
|
||||
-----BEGIN QCMOD-----
|
||||
name: libboost
|
||||
arg: with-libboost-inc=[path], Path to libboost include files
|
||||
arg: with-libboost-lib=[path], Path to libboost library files
|
||||
-----END QCMOD-----
|
||||
*/
|
||||
#include <boost/version.hpp>
|
||||
class qc_libboost : public ConfObj
|
||||
{
|
||||
public:
|
||||
qc_libboost(Conf *c) : ConfObj(c) {}
|
||||
QString name() const { return "libboost"; }
|
||||
QString shortname() const { return "libboost"; }
|
||||
QString findBoostLib(QString path, QString lib) const {
|
||||
QString name;
|
||||
QDir libDir(path);
|
||||
QStringList filters;
|
||||
filters << "libboost_"+lib+"*-mt*.so";
|
||||
QStringList result = libDir.entryList(filters, QDir::Files);
|
||||
if(!result.empty()) {
|
||||
name = result.first().mid(3);
|
||||
// Remove .so
|
||||
name.chop(3);
|
||||
} else {
|
||||
// Fall back to non -mt boost lib
|
||||
filters.clear();
|
||||
filters << "libboost_"+lib+"*.so";
|
||||
result = libDir.entryList(filters, QDir::Files);
|
||||
if(!result.empty()) {
|
||||
name = result.first().mid(3);
|
||||
// Remove .so
|
||||
name.chop(3);
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
bool exec(){
|
||||
QString s;
|
||||
s = conf->getenv("QC_WITH_LIBBOOST_INC");
|
||||
@@ -461,43 +422,6 @@ public:
|
||||
}
|
||||
}
|
||||
conf->addIncludePath(s);
|
||||
// Find library
|
||||
s = conf->getenv("QC_WITH_LIBBOOST_LIB");
|
||||
QStringList required_libs;
|
||||
#if BOOST_VERSION >= 103500
|
||||
required_libs << "system";
|
||||
#endif
|
||||
if(conf->getenv("QC_DISABLE_GUI").isEmpty()) {
|
||||
// Not required by nox
|
||||
required_libs << "filesystem" << "thread";
|
||||
}
|
||||
QStringList libDirs;
|
||||
libDirs << "/usr/lib/" << "/usr/lib64/" << "/usr/local/lib/" << "/usr/local/lib64/";
|
||||
foreach(const QString& lib, required_libs) {
|
||||
if(!s.isEmpty()) {
|
||||
QString detected_name = findBoostLib(s, lib);
|
||||
if(detected_name.isEmpty()) {
|
||||
printf("Could not find boost %s library!\n", qPrintable(lib));
|
||||
return false;
|
||||
} else {
|
||||
conf->addLib("-l"+detected_name);
|
||||
}
|
||||
} else {
|
||||
bool found = false;
|
||||
foreach(const QString& libDir, libDirs) {
|
||||
QString detected_name = findBoostLib(libDir, lib);
|
||||
if(!detected_name.isEmpty()) {
|
||||
conf->addLib("-l"+detected_name);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found) {
|
||||
printf("Could not find boost %s library!\n", qPrintable(lib));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -1557,7 +1481,6 @@ export DATADIR
|
||||
export EX_QTDIR
|
||||
export QC_DISABLE_GUI
|
||||
export QC_WITH_LIBBOOST_INC
|
||||
export QC_WITH_LIBBOOST_LIB
|
||||
export QC_DISABLE_libnotify
|
||||
export QC_DISABLE_geoip_database
|
||||
export QC_WITH_GEOIP_DATABASE_EMBEDDED
|
||||
|
@@ -2,39 +2,14 @@
|
||||
-----BEGIN QCMOD-----
|
||||
name: libboost
|
||||
arg: with-libboost-inc=[path], Path to libboost include files
|
||||
arg: with-libboost-lib=[path], Path to libboost library files
|
||||
-----END QCMOD-----
|
||||
*/
|
||||
#include <boost/version.hpp>
|
||||
class qc_libboost : public ConfObj
|
||||
{
|
||||
public:
|
||||
qc_libboost(Conf *c) : ConfObj(c) {}
|
||||
QString name() const { return "libboost"; }
|
||||
QString shortname() const { return "libboost"; }
|
||||
QString findBoostLib(QString path, QString lib) const {
|
||||
QString name;
|
||||
QDir libDir(path);
|
||||
QStringList filters;
|
||||
filters << "libboost_"+lib+"*-mt*.so";
|
||||
QStringList result = libDir.entryList(filters, QDir::Files);
|
||||
if(!result.empty()) {
|
||||
name = result.first().mid(3);
|
||||
// Remove .so
|
||||
name.chop(3);
|
||||
} else {
|
||||
// Fall back to non -mt boost lib
|
||||
filters.clear();
|
||||
filters << "libboost_"+lib+"*.so";
|
||||
result = libDir.entryList(filters, QDir::Files);
|
||||
if(!result.empty()) {
|
||||
name = result.first().mid(3);
|
||||
// Remove .so
|
||||
name.chop(3);
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
bool exec(){
|
||||
QString s;
|
||||
s = conf->getenv("QC_WITH_LIBBOOST_INC");
|
||||
@@ -76,43 +51,6 @@ public:
|
||||
}
|
||||
}
|
||||
conf->addIncludePath(s);
|
||||
// Find library
|
||||
s = conf->getenv("QC_WITH_LIBBOOST_LIB");
|
||||
QStringList required_libs;
|
||||
#if BOOST_VERSION >= 103500
|
||||
required_libs << "system";
|
||||
#endif
|
||||
if(conf->getenv("QC_DISABLE_GUI").isEmpty()) {
|
||||
// Not required by nox
|
||||
required_libs << "filesystem" << "thread";
|
||||
}
|
||||
QStringList libDirs;
|
||||
libDirs << "/usr/lib/" << "/usr/lib64/" << "/usr/local/lib/" << "/usr/local/lib64/";
|
||||
foreach(const QString& lib, required_libs) {
|
||||
if(!s.isEmpty()) {
|
||||
QString detected_name = findBoostLib(s, lib);
|
||||
if(detected_name.isEmpty()) {
|
||||
printf("Could not find boost %s library!\n", qPrintable(lib));
|
||||
return false;
|
||||
} else {
|
||||
conf->addLib("-l"+detected_name);
|
||||
}
|
||||
} else {
|
||||
bool found = false;
|
||||
foreach(const QString& libDir, libDirs) {
|
||||
QString detected_name = findBoostLib(libDir, lib);
|
||||
if(!detected_name.isEmpty()) {
|
||||
conf->addLib("-l"+detected_name);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found) {
|
||||
printf("Could not find boost %s library!\n", qPrintable(lib));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
@@ -20,23 +20,12 @@ public:
|
||||
return false;
|
||||
for(int n = 0; n < incs.count(); ++n)
|
||||
conf->addIncludePath(incs[n]);
|
||||
//if(!libs.isEmpty())
|
||||
// conf->addLib(libs);
|
||||
if(conf->findPkgConfig("libtorrent-rasterbar", mode, adv_ver, &version, &incs, &libs, &other)) {
|
||||
//printf("\nWarning: libtorrent-rasterbar v%s was detected. Some feature will be disabled because they require v%s.\n", version.toLocal8Bit().data(), adv_ver.toUtf8().data());
|
||||
//else
|
||||
if(!libs.isEmpty())
|
||||
conf->addLib(libs);
|
||||
if(!conf->findPkgConfig("libtorrent-rasterbar", mode, adv_ver, &version, &incs, &libs, &other))
|
||||
printf("\nWarning: libtorrent-rasterbar v%s was detected. Some feature will be disabled because they require v%s.\n", version.toLocal8Bit().data(), adv_ver.toUtf8().data());
|
||||
else
|
||||
conf->addDefine("LIBTORRENT_0_15");
|
||||
}
|
||||
// Get linking parameters
|
||||
//QStringList params;
|
||||
//QByteArray staticlibs;
|
||||
//params << "--static" << "--libs" << "libtorrent-rasterbar";
|
||||
//conf->doCommand("pkg-config", params, &staticlibs);
|
||||
//conf->addLib(staticlibs.trimmed());
|
||||
//libcrypto
|
||||
if(conf->getenv("QC_DISABLE_GUI").isEmpty()) {
|
||||
conf->addLib("-lcrypto");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
@@ -15,6 +15,10 @@ public:
|
||||
if(!conf->getenv("QC_DISABLE_GUI").isEmpty()) {
|
||||
conf->addDefine("DISABLE_GUI");
|
||||
}
|
||||
if(QT_VERSION >= 0x040500) {
|
||||
conf->addDefine("QT_4_5");
|
||||
}
|
||||
return(QT_VERSION >= 0x040400);
|
||||
|
||||
}
|
||||
};
|
||||
|
159
src/GUI.cpp
105
src/GUI.h
@@ -55,28 +55,43 @@ class TransferListFiltersWidget;
|
||||
class QSplitter;
|
||||
class PropertiesWidget;
|
||||
class StatusBar;
|
||||
class consoleDlg;
|
||||
class about;
|
||||
class createtorrent;
|
||||
class downloadFromURL;
|
||||
|
||||
class GUI : public QMainWindow, private Ui::MainWindow{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// Construct / Destruct
|
||||
GUI(QWidget *parent=0, QStringList torrentCmdLine=QStringList());
|
||||
~GUI();
|
||||
// Methods
|
||||
int getCurrentTabIndex() const;
|
||||
TransferListWidget* getTransferList() const { return transferList; }
|
||||
|
||||
public slots:
|
||||
void trackerAuthenticationRequired(QTorrentHandle& h);
|
||||
void setTabText(int index, QString text) const;
|
||||
void showNotificationBaloon(QString title, QString msg) const;
|
||||
void downloadFromURLList(const QStringList& urls);
|
||||
void updateAltSpeedsBtn(bool alternative);
|
||||
private:
|
||||
// Bittorrent
|
||||
Bittorrent *BTSession;
|
||||
QList<QPair<QTorrentHandle,QString> > unauthenticated_trackers; // Still needed?
|
||||
// GUI related
|
||||
QTimer *guiUpdater;
|
||||
QTabWidget *tabs;
|
||||
StatusBar *status_bar;
|
||||
QPointer<options_imp> options;
|
||||
QPointer<QSystemTrayIcon> systrayIcon;
|
||||
QPointer<QTimer> systrayCreator;
|
||||
QMenu *myTrayIconMenu;
|
||||
TransferListWidget *transferList;
|
||||
TransferListFiltersWidget *transferListFilters;
|
||||
PropertiesWidget *properties;
|
||||
bool displaySpeedInTitle;
|
||||
bool force_exit;
|
||||
// Keyboard shortcuts
|
||||
QShortcut *switchSearchShortcut;
|
||||
QShortcut *switchSearchShortcut2;
|
||||
QShortcut *switchTransferShortcut;
|
||||
QShortcut *switchRSSShortcut;
|
||||
// Widgets
|
||||
QAction *prioSeparator;
|
||||
QAction *prioSeparator2;
|
||||
QSplitter *hSplitter;
|
||||
QSplitter *vSplitter;
|
||||
// Search
|
||||
SearchEngine *searchEngine;
|
||||
// RSS
|
||||
QPointer<RSSImp> rssWidget;
|
||||
// Misc
|
||||
QLocalServer *localServer;
|
||||
|
||||
protected slots:
|
||||
// GUI related slots
|
||||
@@ -113,59 +128,35 @@ protected slots:
|
||||
void loadPreferences(bool configure_session=true);
|
||||
void processParams(const QStringList& params);
|
||||
void addTorrent(QString path);
|
||||
void addUnauthenticatedTracker(const QPair<QTorrentHandle,QString> &tracker);
|
||||
void addUnauthenticatedTracker(QPair<QTorrentHandle,QString> tracker);
|
||||
void processDownloadedFiles(QString path, QString url);
|
||||
void finishedTorrent(QTorrentHandle& h) const;
|
||||
void askRecursiveTorrentDownloadConfirmation(QTorrentHandle &h);
|
||||
// Options slots
|
||||
void on_actionOptions_triggered();
|
||||
void optionsSaved();
|
||||
// HTTP slots
|
||||
void on_actionDownload_from_URL_triggered();
|
||||
|
||||
|
||||
public slots:
|
||||
void trackerAuthenticationRequired(QTorrentHandle& h);
|
||||
void setTabText(int index, QString text) const;
|
||||
void showNotificationBaloon(QString title, QString msg) const;
|
||||
void downloadFromURLList(const QStringList& urls);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *);
|
||||
void showEvent(QShowEvent *);
|
||||
bool event(QEvent * event);
|
||||
void displayRSSTab(bool enable);
|
||||
|
||||
private:
|
||||
// Bittorrent
|
||||
Bittorrent *BTSession;
|
||||
QList<QPair<QTorrentHandle,QString> > unauthenticated_trackers; // Still needed?
|
||||
// GUI related
|
||||
QTimer *guiUpdater;
|
||||
QTabWidget *tabs;
|
||||
StatusBar *status_bar;
|
||||
QPointer<options_imp> options;
|
||||
QPointer<consoleDlg> console;
|
||||
QPointer<about> aboutDlg;
|
||||
QPointer<createtorrent> createTorrentDlg;
|
||||
QPointer<downloadFromURL> downloadFromURLDialog;
|
||||
QPointer<QSystemTrayIcon> systrayIcon;
|
||||
QPointer<QTimer> systrayCreator;
|
||||
QMenu *myTrayIconMenu;
|
||||
TransferListWidget *transferList;
|
||||
TransferListFiltersWidget *transferListFilters;
|
||||
PropertiesWidget *properties;
|
||||
bool displaySpeedInTitle;
|
||||
bool force_exit;
|
||||
// Keyboard shortcuts
|
||||
QShortcut *switchSearchShortcut;
|
||||
QShortcut *switchSearchShortcut2;
|
||||
QShortcut *switchTransferShortcut;
|
||||
QShortcut *switchRSSShortcut;
|
||||
// Widgets
|
||||
QAction *prioSeparator;
|
||||
QAction *prioSeparator2;
|
||||
QSplitter *hSplitter;
|
||||
QSplitter *vSplitter;
|
||||
// Search
|
||||
SearchEngine *searchEngine;
|
||||
// RSS
|
||||
QPointer<RSSImp> rssWidget;
|
||||
// Misc
|
||||
QLocalServer *localServer;
|
||||
public:
|
||||
// Construct / Destruct
|
||||
GUI(QWidget *parent=0, QStringList torrentCmdLine=QStringList());
|
||||
~GUI();
|
||||
// Methods
|
||||
int getCurrentTabIndex() const;
|
||||
TransferListWidget* getTransferList() const { return transferList; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Before Width: | Height: | Size: 546 B |
Before Width: | Height: | Size: 7.0 KiB |
Before Width: | Height: | Size: 1.8 KiB |
@@ -1,9 +1,8 @@
|
||||
[Desktop Entry]
|
||||
Categories=Qt;Network;P2P;
|
||||
Comment=V2.2.8
|
||||
Comment=V2.1.4
|
||||
Exec=qbittorrent %f
|
||||
GenericName=Bittorrent client
|
||||
GenericName[ar]=العميل Bittorrent
|
||||
GenericName[bg]=Торент клиент
|
||||
GenericName[cs]=Bittorrent klient
|
||||
GenericName[de]=Bittorren Client
|
||||
@@ -11,7 +10,6 @@ GenericName[el]=Bittorrent πελάτης
|
||||
GenericName[es]=Cliente Bittorrent
|
||||
GenericName[fi]=Bittorrent-ohjelma
|
||||
GenericName[fr]=Client Bittorrent
|
||||
GenericName[hr]=Bittorrent klijent
|
||||
GenericName[hu]=Bittorrent kliens
|
||||
GenericName[it]=Client Bittorrent
|
||||
GenericName[ja]=Bittorrent クライアント
|
||||
|
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.3 KiB |
@@ -62,13 +62,11 @@ class about : public QDialog, private Ui::AboutDlg{
|
||||
te_translation->append(QString::fromUtf8("<a name='top'></a>"));
|
||||
te_translation->append(tr("I would like to thank the following people who volunteered to translate qBittorrent:")+QString::fromUtf8("<br>"));
|
||||
te_translation->append(QString::fromUtf8(
|
||||
"<i><u>Arabic:</u> SDERAWI (abz8868@msn.com) and sn51234 (nesseyan@gmail.com)<br>\
|
||||
- <u>Brazilian:</u> Nick Marinho (nickmarinho@gmail.com)<br>\
|
||||
- <u>Bulgarian:</u> Tsvetan & Boyko Bankoff (emerge_life@users.sourceforge.net)<br>\
|
||||
"<i>- <u>Brazilian:</u> Nick Marinho (nickmarinho@gmail.com)<br>\
|
||||
- <u>Bulgarian:</u> Tsvetan & Boiko Bankov (emerge_life@users.sourceforge.net)<br>\
|
||||
- <u>Catalan:</u> Francisco Luque Contreras (frannoe@ya.com)<br>\
|
||||
- <u>Chinese (Simplified):</u> Guo Yue (yue.guo0418@gmail.com)<br>\
|
||||
- <u>Chinese (Traditional):</u> Yi-Shun Wang (dnextstep@gmail.com)<br>\
|
||||
- <u>Croatian:</u> Oliver Mucafir (oliver.untwist@gmail.com)<br>\
|
||||
- <u>Czech:</u> Jirka Vilim (web@tets.cz)<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>\
|
||||
@@ -89,14 +87,11 @@ class about : public QDialog, private Ui::AboutDlg{
|
||||
- <u>Spanish:</u> Francisco Luque Contreras (frannoe@ya.com)<br>\
|
||||
- <u>Swedish:</u> Daniel Nylander (po@danielnylander.se)<br>\
|
||||
- <u>Turkish:</u> Hasan YILMAZ (iletisim@hedefturkce.com) and Erdem Bingöl (erdem84@gmail.com)<br>\
|
||||
- <u>Ukrainian:</u> Andrey Shpachenko (masterfix@users.sourceforge.net) and Oleh Prypin (blaxpirit@gmail.com)<br><br>"));
|
||||
- <u>Ukrainian:</u> Andrey Shpachenko (masterfix@users.sourceforge.net)<br><br>"));
|
||||
te_translation->append(tr("Please contact me if you would like to translate qBittorrent into your own language."));
|
||||
te_translation->scrollToAnchor(QString::fromUtf8("top"));
|
||||
// License
|
||||
te_license->append(QString::fromUtf8("<a name='top'></a>"));
|
||||
#ifdef Q_WS_WIN
|
||||
te_license->append(QString::fromUtf8("qBittorrent is licensed under the GNU General Public License version 2."));
|
||||
#else
|
||||
te_license->append(QString::fromUtf8("qBittorrent is licensed under the GNU General Public License version 2 with the\
|
||||
addition of the following special exception:\
|
||||
<br><br>\
|
||||
@@ -443,7 +438,6 @@ exception statement from your version.</i>\
|
||||
consider it more useful to permit linking proprietary applications with the<br>\
|
||||
library. If this is what you want to do, use the GNU Library General<br>\
|
||||
Public License instead of this License.<br>"));
|
||||
#endif
|
||||
te_license->scrollToAnchor(QString::fromUtf8("top"));
|
||||
show();
|
||||
}
|
||||
|
@@ -1,146 +0,0 @@
|
||||
#ifndef ADVANCEDSETTINGS_H
|
||||
#define ADVANCEDSETTINGS_H
|
||||
|
||||
#include <QTableWidget>
|
||||
#include <QHeaderView>
|
||||
#include <QSpinBox>
|
||||
#include <QCheckBox>
|
||||
#include "preferences.h"
|
||||
|
||||
enum AdvSettingsCols {PROPERTY, VALUE};
|
||||
enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_LIMIT_LAN, COUNT_OVERHEAD, RECHECK_COMPLETED, LIST_REFRESH, RESOLVE_COUNTRIES, RESOLVE_HOSTS };
|
||||
#define ROW_COUNT 9
|
||||
|
||||
class AdvancedSettings: public QTableWidget {
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
QSpinBox *spin_cache, *outgoing_ports_min, *outgoing_ports_max, *spin_list_refresh;
|
||||
QCheckBox *cb_ignore_limits_lan, *cb_count_overhead, *cb_recheck_completed, *cb_resolve_countries, *cb_resolve_hosts;
|
||||
|
||||
public:
|
||||
AdvancedSettings(QWidget *parent=0): QTableWidget(parent) {
|
||||
// Set visual appearance
|
||||
setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
setAlternatingRowColors(true);
|
||||
setColumnCount(2);
|
||||
QStringList header;
|
||||
header << tr("Property") << tr("Value");
|
||||
setHorizontalHeaderLabels(header);
|
||||
setColumnWidth(0, width()/2);
|
||||
horizontalHeader()->setStretchLastSection(true);
|
||||
verticalHeader()->setVisible(false);
|
||||
setRowCount(ROW_COUNT);
|
||||
// Load settings
|
||||
loadAdvancedSettings();
|
||||
}
|
||||
|
||||
~AdvancedSettings() {
|
||||
delete spin_cache;
|
||||
delete outgoing_ports_min;
|
||||
delete outgoing_ports_max;
|
||||
delete cb_ignore_limits_lan;
|
||||
delete cb_count_overhead;
|
||||
delete cb_recheck_completed;
|
||||
delete spin_list_refresh;
|
||||
delete cb_resolve_countries;
|
||||
delete cb_resolve_hosts;
|
||||
}
|
||||
|
||||
public slots:
|
||||
void saveAdvancedSettings() {
|
||||
// Disk write cache
|
||||
Preferences::setDiskCacheSize(spin_cache->value());
|
||||
// Outgoing ports
|
||||
Preferences::setOutgoingPortsMin(outgoing_ports_min->value());
|
||||
Preferences::setOutgoingPortsMax(outgoing_ports_max->value());
|
||||
// Ignore limits on LAN
|
||||
Preferences::ignoreLimitsOnLAN(cb_ignore_limits_lan->isChecked());
|
||||
// Include protocol overhead in transfer limits
|
||||
Preferences::includeOverheadInLimits(cb_count_overhead->isChecked());
|
||||
// Recheck torrents on completion
|
||||
Preferences::recheckTorrentsOnCompletion(cb_recheck_completed->isChecked());
|
||||
// Transfer list refresh interval
|
||||
Preferences::setRefreshInterval(spin_list_refresh->value());
|
||||
// Peer resolution
|
||||
Preferences::resolvePeerCountries(cb_resolve_countries->isChecked());
|
||||
Preferences::resolvePeerHostNames(cb_resolve_hosts->isChecked());
|
||||
}
|
||||
|
||||
protected slots:
|
||||
void loadAdvancedSettings() {
|
||||
// Disk write cache
|
||||
setItem(DISK_CACHE, PROPERTY, new QTableWidgetItem(tr("Disk write cache size")));
|
||||
spin_cache = new QSpinBox();
|
||||
connect(spin_cache, SIGNAL(valueChanged(int)), this, SLOT(emitSettingsChanged()));
|
||||
spin_cache->setMinimum(1);
|
||||
spin_cache->setMaximum(200);
|
||||
spin_cache->setValue(Preferences::diskCacheSize());
|
||||
spin_cache->setSuffix(tr(" MiB"));
|
||||
setCellWidget(DISK_CACHE, VALUE, spin_cache);
|
||||
// Outgoing port Min
|
||||
setItem(OUTGOING_PORT_MIN, PROPERTY, new QTableWidgetItem(tr("Outgoing ports (Min) [0: Disabled]")));
|
||||
outgoing_ports_min = new QSpinBox();
|
||||
connect(outgoing_ports_min, SIGNAL(valueChanged(int)), this, SLOT(emitSettingsChanged()));
|
||||
outgoing_ports_min->setMinimum(0);
|
||||
outgoing_ports_min->setMaximum(65535);
|
||||
outgoing_ports_min->setValue(Preferences::outgoingPortsMin());
|
||||
setCellWidget(OUTGOING_PORT_MIN, VALUE, outgoing_ports_min);
|
||||
// Outgoing port Min
|
||||
setItem(OUTGOING_PORT_MAX, PROPERTY, new QTableWidgetItem(tr("Outgoing ports (Max) [0: Disabled]")));
|
||||
outgoing_ports_max = new QSpinBox();
|
||||
connect(outgoing_ports_max, SIGNAL(valueChanged(int)), this, SLOT(emitSettingsChanged()));
|
||||
outgoing_ports_max->setMinimum(0);
|
||||
outgoing_ports_max->setMaximum(65535);
|
||||
outgoing_ports_max->setValue(Preferences::outgoingPortsMax());
|
||||
setCellWidget(OUTGOING_PORT_MAX, VALUE, outgoing_ports_max);
|
||||
// Ignore transfer limits on local network
|
||||
setItem(IGNORE_LIMIT_LAN, PROPERTY, new QTableWidgetItem(tr("Ignore transfer limits on local network")));
|
||||
cb_ignore_limits_lan = new QCheckBox();
|
||||
connect(cb_ignore_limits_lan, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged()));
|
||||
cb_ignore_limits_lan->setChecked(Preferences::ignoreLimitsOnLAN());
|
||||
setCellWidget(IGNORE_LIMIT_LAN, VALUE, cb_ignore_limits_lan);
|
||||
// Consider protocol overhead in transfer limits
|
||||
setItem(COUNT_OVERHEAD, PROPERTY, new QTableWidgetItem(tr("Include TCP/IP overhead in transfer limits")));
|
||||
cb_count_overhead = new QCheckBox();
|
||||
connect(cb_count_overhead, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged()));
|
||||
cb_count_overhead->setChecked(Preferences::includeOverheadInLimits());
|
||||
setCellWidget(COUNT_OVERHEAD, VALUE, cb_count_overhead);
|
||||
// Recheck completed torrents
|
||||
setItem(RECHECK_COMPLETED, PROPERTY, new QTableWidgetItem(tr("Recheck torrents on completion")));
|
||||
cb_recheck_completed = new QCheckBox();
|
||||
connect(cb_recheck_completed, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged()));
|
||||
cb_recheck_completed->setChecked(Preferences::recheckTorrentsOnCompletion());
|
||||
setCellWidget(RECHECK_COMPLETED, VALUE, cb_recheck_completed);
|
||||
// Transfer list refresh interval
|
||||
setItem(LIST_REFRESH, PROPERTY, new QTableWidgetItem(tr("Transfer list refresh interval")));
|
||||
spin_list_refresh = new QSpinBox();
|
||||
connect(spin_list_refresh, SIGNAL(valueChanged(int)), this, SLOT(emitSettingsChanged()));
|
||||
spin_list_refresh->setMinimum(30);
|
||||
spin_list_refresh->setMaximum(99999);
|
||||
spin_list_refresh->setValue(Preferences::getRefreshInterval());
|
||||
spin_list_refresh->setSuffix(tr(" ms", " milliseconds"));
|
||||
setCellWidget(LIST_REFRESH, VALUE, spin_list_refresh);
|
||||
// Resolve Peer countries
|
||||
setItem(RESOLVE_COUNTRIES, PROPERTY, new QTableWidgetItem(tr("Resolve peer countries (GeoIP)")));
|
||||
cb_resolve_countries = new QCheckBox();
|
||||
connect(cb_resolve_countries, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged()));
|
||||
cb_resolve_countries->setChecked(Preferences::resolvePeerCountries());
|
||||
setCellWidget(RESOLVE_COUNTRIES, VALUE, cb_resolve_countries);
|
||||
// Resolve peer hosts
|
||||
setItem(RESOLVE_HOSTS, PROPERTY, new QTableWidgetItem(tr("Resolve peer host names")));
|
||||
cb_resolve_hosts = new QCheckBox();
|
||||
connect(cb_resolve_hosts, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged()));
|
||||
cb_resolve_hosts->setChecked(Preferences::resolvePeerHostNames());
|
||||
setCellWidget(RESOLVE_HOSTS, VALUE, cb_resolve_hosts);
|
||||
}
|
||||
|
||||
void emitSettingsChanged() {
|
||||
emit settingsChanged();
|
||||
}
|
||||
|
||||
signals:
|
||||
void settingsChanged();
|
||||
};
|
||||
|
||||
#endif // ADVANCEDSETTINGS_H
|
@@ -1,111 +0,0 @@
|
||||
#ifndef BANDWIDTHSCHEDULER_H
|
||||
#define BANDWIDTHSCHEDULER_H
|
||||
|
||||
#include <QTimer>
|
||||
#include <QTime>
|
||||
#include <QDateTime>
|
||||
#include "preferences.h"
|
||||
#include <iostream>
|
||||
|
||||
class BandwidthScheduler: public QTimer {
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
bool in_alternative_mode;
|
||||
|
||||
public:
|
||||
BandwidthScheduler(QObject *parent): QTimer(parent), in_alternative_mode(false) {
|
||||
Q_ASSERT(Preferences::isSchedulerEnabled());
|
||||
// Signal shot, we call start() again manually
|
||||
setSingleShot(true);
|
||||
// Connect Signals/Slots
|
||||
connect(this, SIGNAL(timeout()), this, SLOT(switchMode()));
|
||||
}
|
||||
|
||||
public slots:
|
||||
void start() {
|
||||
Q_ASSERT(Preferences::isSchedulerEnabled());
|
||||
|
||||
QTime startAltSpeeds = Preferences::getSchedulerStartTime();
|
||||
QTime endAltSpeeds = Preferences::getSchedulerEndTime();
|
||||
if(startAltSpeeds == endAltSpeeds) {
|
||||
std::cerr << "Error: bandwidth scheduler have the same start time and end time." << std::endl;
|
||||
std::cerr << "The bandwidth scheduler will be disabled" << std::endl;
|
||||
stop();
|
||||
emit switchToAlternativeMode(false);
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine what the closest QTime is
|
||||
QTime now = QTime::currentTime();
|
||||
uint time_to_start = secsTo(now, startAltSpeeds);
|
||||
uint time_to_end = secsTo(now, endAltSpeeds);
|
||||
if(time_to_end < time_to_start) {
|
||||
// We should be in alternative mode
|
||||
in_alternative_mode = true;
|
||||
// Start counting
|
||||
QTimer::start(time_to_end*1000);
|
||||
} else {
|
||||
// We should be in normal mode
|
||||
in_alternative_mode = false;
|
||||
// Start counting
|
||||
QTimer::start(time_to_start*1000);
|
||||
}
|
||||
// Send signal to notify BTSession
|
||||
emit switchToAlternativeMode(in_alternative_mode);
|
||||
}
|
||||
|
||||
void switchMode() {
|
||||
// Get the day this mode was started (either today or yesterday)
|
||||
QDate current_date = QDateTime::currentDateTime().toLocalTime().date();
|
||||
int day = current_date.dayOfWeek();
|
||||
if(in_alternative_mode) {
|
||||
// It is possible that starttime was yesterday
|
||||
if(QTime::currentTime().secsTo(Preferences::getSchedulerStartTime()) > 0) {
|
||||
current_date.addDays(-1); // Go to yesterday
|
||||
day = current_date.day();
|
||||
}
|
||||
}
|
||||
// Check if the day is in scheduler days
|
||||
// Notify BTSession only if necessary
|
||||
switch(Preferences::getSchedulerDays()) {
|
||||
case EVERY_DAY:
|
||||
emit switchToAlternativeMode(!in_alternative_mode);
|
||||
break;
|
||||
case WEEK_ENDS:
|
||||
if(day == Qt::Saturday || day == Qt::Sunday)
|
||||
emit switchToAlternativeMode(!in_alternative_mode);
|
||||
break;
|
||||
case WEEK_DAYS:
|
||||
if(day != Qt::Saturday && day != Qt::Sunday)
|
||||
emit switchToAlternativeMode(!in_alternative_mode);
|
||||
break;
|
||||
default:
|
||||
// Convert our enum index to Qt enum index
|
||||
int scheduler_day = ((int)Preferences::getSchedulerDays()) - 2;
|
||||
if(day == scheduler_day)
|
||||
emit switchToAlternativeMode(!in_alternative_mode);
|
||||
break;
|
||||
}
|
||||
// Call start again
|
||||
start();
|
||||
}
|
||||
|
||||
signals:
|
||||
void switchToAlternativeMode(bool alternative);
|
||||
|
||||
private:
|
||||
// Qt function can return negative values and we
|
||||
// don't want that
|
||||
uint secsTo(QTime now, QTime t) {
|
||||
int diff = now.secsTo(t);
|
||||
if(diff < 0) {
|
||||
// 86400 seconds in a day
|
||||
diff += 86400;
|
||||
}
|
||||
Q_ASSERT(diff >= 0);
|
||||
return diff;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // BANDWIDTHSCHEDULER_H
|
1014
src/bittorrent.cpp
136
src/bittorrent.h
@@ -41,7 +41,6 @@
|
||||
#include <QPalette>
|
||||
#endif
|
||||
#include <QPointer>
|
||||
#include <QTimer>
|
||||
|
||||
#include <libtorrent/session.hpp>
|
||||
#include <libtorrent/ip_filter.hpp>
|
||||
@@ -53,10 +52,9 @@ using namespace libtorrent;
|
||||
|
||||
class downloadThread;
|
||||
class QTimer;
|
||||
class FileSystemWatcher;
|
||||
class FilterParserThread;
|
||||
class HttpServer;
|
||||
class BandwidthScheduler;
|
||||
class ScanFoldersModel;
|
||||
|
||||
class TrackerInfos {
|
||||
public:
|
||||
@@ -90,6 +88,60 @@ public:
|
||||
class Bittorrent : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
// Bittorrent
|
||||
session *s;
|
||||
QPointer<QTimer> timerAlerts;
|
||||
QMap<QUrl, QString> savepath_fromurl;
|
||||
QHash<QString, QHash<QString, TrackerInfos> > trackersInfos;
|
||||
QStringList torrentsToPausedAfterChecking;
|
||||
// Ratio
|
||||
QPointer<QTimer> BigRatioTimer;
|
||||
// HTTP
|
||||
QPointer<downloadThread> downloader;
|
||||
// File System
|
||||
QPointer<FileSystemWatcher> FSWatcher;
|
||||
// Console / Log
|
||||
QStringList consoleMessages;
|
||||
QStringList peerBanMessages;
|
||||
// Settings
|
||||
bool preAllocateAll;
|
||||
bool addInPause;
|
||||
float ratio_limit;
|
||||
bool UPnPEnabled;
|
||||
bool NATPMPEnabled;
|
||||
bool LSDEnabled;
|
||||
bool DHTEnabled;
|
||||
int current_dht_port;
|
||||
bool PeXEnabled;
|
||||
bool queueingEnabled;
|
||||
bool appendLabelToSavePath;
|
||||
#ifdef LIBTORRENT_0_15
|
||||
bool appendqBExtension;
|
||||
#endif
|
||||
QString defaultSavePath;
|
||||
QString defaultTempPath;
|
||||
// GeoIP
|
||||
#ifndef DISABLE_GUI
|
||||
bool resolve_countries;
|
||||
bool geoipDBLoaded;
|
||||
#endif
|
||||
// ETA Computation
|
||||
QPointer<QTimer> timerETA;
|
||||
QHash<QString, QList<int> > ETA_samples;
|
||||
// IP filtering
|
||||
QPointer<FilterParserThread> filterParser;
|
||||
QString filterPath;
|
||||
// Web UI
|
||||
QPointer<HttpServer> httpServer;
|
||||
QList<QUrl> url_skippingDlg;
|
||||
// Fast exit (async)
|
||||
bool exiting;
|
||||
|
||||
protected:
|
||||
QString getSavePath(QString hash);
|
||||
bool initWebUi(QString username, QString password, int port);
|
||||
|
||||
public:
|
||||
// Constructor / Destructor
|
||||
Bittorrent();
|
||||
@@ -116,11 +168,13 @@ public:
|
||||
qlonglong getETA(QString hash);
|
||||
bool useTemporaryFolder() const;
|
||||
QString getDefaultSavePath() const;
|
||||
ScanFoldersModel* getScanFoldersModel() const;
|
||||
|
||||
public slots:
|
||||
QTorrentHandle addTorrent(QString path, bool fromScanDir = false, QString from_url = QString(), bool resumed = false);
|
||||
QTorrentHandle addMagnetUri(QString magnet_uri, bool resumed=false);
|
||||
void importOldTorrents();
|
||||
void applyFormerAttributeFiles(QTorrentHandle h);
|
||||
void importOldTempData(QString torrent_path);
|
||||
void loadSessionState();
|
||||
void saveSessionState();
|
||||
void downloadFromUrl(QString url);
|
||||
@@ -128,18 +182,17 @@ public slots:
|
||||
void startUpTorrents();
|
||||
session_proxy asyncDeletion();
|
||||
void recheckTorrent(QString hash);
|
||||
void useAlternativeSpeedsLimit(bool alternative);
|
||||
/* Needed by Web UI */
|
||||
void pauseAllTorrents();
|
||||
void pauseTorrent(QString hash);
|
||||
void resumeTorrent(QString hash);
|
||||
void resumeAllTorrents();
|
||||
/* End Web UI */
|
||||
#ifndef LIBTORRENT_0_15
|
||||
void saveDHTEntry();
|
||||
#endif
|
||||
void preAllocateAllFiles(bool b);
|
||||
void saveFastResumeData();
|
||||
void enableDirectoryScanning(QString scan_dir);
|
||||
void disableDirectoryScanning();
|
||||
void enableIPFilter(QString filter);
|
||||
void disableIPFilter();
|
||||
void setQueueingEnabled(bool enable);
|
||||
@@ -155,9 +208,9 @@ public slots:
|
||||
void setGlobalRatio(float ratio);
|
||||
void setDeleteRatio(float ratio);
|
||||
void setDHTPort(int dht_port);
|
||||
void setPeerProxySettings(const proxy_settings &proxySettings);
|
||||
void setHTTPProxySettings(const proxy_settings &proxySettings);
|
||||
void setSessionSettings(const session_settings &sessionSettings);
|
||||
void setPeerProxySettings(proxy_settings proxySettings);
|
||||
void setHTTPProxySettings(proxy_settings proxySettings);
|
||||
void setSessionSettings(session_settings sessionSettings);
|
||||
void startTorrentsInPause(bool b);
|
||||
void setDefaultTempPath(QString temppath);
|
||||
void setAppendLabelToSavePath(bool append);
|
||||
@@ -185,19 +238,12 @@ public slots:
|
||||
void downloadFromURLList(const QStringList& urls);
|
||||
void configureSession();
|
||||
void banIP(QString ip);
|
||||
void recursiveTorrentDownload(const QTorrentHandle &h);
|
||||
|
||||
protected:
|
||||
QString getSavePath(QString hash, bool fromScanDir = false, QString filePath = QString());
|
||||
bool initWebUi(QString username, QString password, int port);
|
||||
|
||||
protected slots:
|
||||
void addTorrentsFromScanFolder(QStringList&);
|
||||
void readAlerts();
|
||||
void deleteBigRatios();
|
||||
void takeETASamples();
|
||||
void exportTorrentFiles(QString path);
|
||||
void saveTempFastResumeData();
|
||||
|
||||
signals:
|
||||
void addedTorrent(QTorrentHandle& h);
|
||||
@@ -215,62 +261,6 @@ signals:
|
||||
void metadataReceived(QTorrentHandle &h);
|
||||
void savePathChanged(QTorrentHandle &h);
|
||||
void newConsoleMessage(QString msg);
|
||||
void alternativeSpeedsModeChanged(bool alternative);
|
||||
void recursiveTorrentDownloadPossible(QTorrentHandle &h);
|
||||
|
||||
private:
|
||||
// Bittorrent
|
||||
session *s;
|
||||
QPointer<QTimer> timerAlerts;
|
||||
QPointer<BandwidthScheduler> bd_scheduler;
|
||||
QMap<QUrl, QString> savepath_fromurl;
|
||||
QHash<QString, QHash<QString, TrackerInfos> > trackersInfos;
|
||||
QStringList torrentsToPausedAfterChecking;
|
||||
QTimer resumeDataTimer;
|
||||
// Ratio
|
||||
QPointer<QTimer> BigRatioTimer;
|
||||
// HTTP
|
||||
QPointer<downloadThread> downloader;
|
||||
// File System
|
||||
ScanFoldersModel *m_scanFolders;
|
||||
// Console / Log
|
||||
QStringList consoleMessages;
|
||||
QStringList peerBanMessages;
|
||||
// Settings
|
||||
bool preAllocateAll;
|
||||
bool addInPause;
|
||||
float ratio_limit;
|
||||
bool UPnPEnabled;
|
||||
bool NATPMPEnabled;
|
||||
bool LSDEnabled;
|
||||
bool DHTEnabled;
|
||||
int current_dht_port;
|
||||
bool PeXEnabled;
|
||||
bool queueingEnabled;
|
||||
bool appendLabelToSavePath;
|
||||
bool torrentExport;
|
||||
#ifdef LIBTORRENT_0_15
|
||||
bool appendqBExtension;
|
||||
#endif
|
||||
QString defaultSavePath;
|
||||
QString defaultTempPath;
|
||||
// ETA Computation
|
||||
QPointer<QTimer> timerETA;
|
||||
QHash<QString, QList<int> > ETA_samples;
|
||||
// IP filtering
|
||||
QPointer<FilterParserThread> filterParser;
|
||||
QString filterPath;
|
||||
// Web UI
|
||||
QPointer<HttpServer> httpServer;
|
||||
QList<QUrl> url_skippingDlg;
|
||||
// Fast exit (async)
|
||||
bool exiting;
|
||||
// GeoIP
|
||||
#ifndef DISABLE_GUI
|
||||
bool geoipDBLoaded;
|
||||
bool resolve_countries;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -46,7 +46,6 @@ class consoleDlg : public QDialog, private Ui_ConsoleDlg{
|
||||
consoleDlg(QWidget *parent, Bittorrent* _BTSession) : QDialog(parent) {
|
||||
setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
setModal(true);
|
||||
BTSession = _BTSession;
|
||||
textConsole->setHtml(BTSession->getConsoleMessages().join("<br>"));
|
||||
textBannedPeers->setHtml(BTSession->getPeerBanMessages().join("<br>"));
|
||||
|
@@ -65,7 +65,6 @@ bool file_filter(boost::filesystem::path const& filename)
|
||||
createtorrent::createtorrent(QWidget *parent): QDialog(parent){
|
||||
setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
setModal(true);
|
||||
creatorThread = new torrentCreatorThread(this);
|
||||
connect(creatorThread, SIGNAL(creationSuccess(QString, const char*)), this, SLOT(handleCreationSuccess(QString, const char*)));
|
||||
connect(creatorThread, SIGNAL(creationFailure(QString)), this, SLOT(handleCreationFailure(QString)));
|
||||
@@ -85,7 +84,7 @@ void createtorrent::on_addFolder_button_clicked(){
|
||||
}
|
||||
|
||||
void createtorrent::on_addFile_button_clicked(){
|
||||
QString file = QFileDialog::getOpenFileName(this, tr("Select a file to add to the torrent"), QDir::homePath());
|
||||
QString file = QFileDialog::getOpenFileName(this, tr("Select a file to add to the torrent"), QDir::homePath(), QString(), 0, QFileDialog::ShowDirsOnly);
|
||||
if(!file.isEmpty())
|
||||
textInputPath->setText(file);
|
||||
}
|
||||
@@ -199,7 +198,7 @@ void createtorrent::handleCreationSuccess(QString path, const char* branch_path)
|
||||
return;
|
||||
}
|
||||
QString hash = misc::toQString(t->info_hash());
|
||||
TorrentTempData::setSavePath(hash, QString::fromLocal8Bit(branch_path));
|
||||
TorrentTempData::setSavePath(hash, QString(branch_path));
|
||||
#ifdef LIBTORRENT_0_15
|
||||
// Enable seeding mode (do not recheck the files)
|
||||
TorrentTempData::setSeedingMode(hash, true);
|
||||
|
@@ -53,49 +53,34 @@ public:
|
||||
setFixedHeight(BAR_HEIGHT);
|
||||
}
|
||||
|
||||
void setProgress(const bitfield &pieces, const bitfield &downloading_pieces) {
|
||||
void setProgress(bitfield pieces) {
|
||||
if(pieces.empty()) {
|
||||
// Empty bar
|
||||
QPixmap pix = QPixmap(1, 1);
|
||||
pix.fill();
|
||||
pixmap = pix;
|
||||
} else {
|
||||
const int nb_pieces = pieces.size();
|
||||
int nb_pieces = pieces.size();
|
||||
// Reduce the number of pieces before creating the pixmap
|
||||
// otherwise it can crash when there are too many pieces
|
||||
if(nb_pieces > width()) {
|
||||
const int ratio = floor(nb_pieces/(double)width());
|
||||
std::vector<bool> scaled_pieces;
|
||||
std::vector<bool> scaled_downloading;
|
||||
int ratio = floor(nb_pieces/(double)width());
|
||||
QVector<bool> scaled_pieces;
|
||||
for(int i=0; i<nb_pieces; i+= ratio) {
|
||||
bool have = true;
|
||||
for(int j=i; j<qMin(i+ratio, nb_pieces); ++j) {
|
||||
if(!pieces[i]) { have = false; break; }
|
||||
}
|
||||
scaled_pieces.push_back(have);
|
||||
if(have) {
|
||||
scaled_downloading.push_back(false);
|
||||
} else {
|
||||
bool downloading = false;
|
||||
for(int j=i; j<qMin(i+ratio, nb_pieces); ++j) {
|
||||
if(downloading_pieces[i]) { downloading = true; break; }
|
||||
}
|
||||
scaled_downloading.push_back(downloading);
|
||||
}
|
||||
scaled_pieces << have;
|
||||
}
|
||||
QPixmap pix = QPixmap(scaled_pieces.size(), 1);
|
||||
pix.fill();
|
||||
QPainter painter(&pix);
|
||||
for(uint i=0; i<scaled_pieces.size(); ++i) {
|
||||
if(scaled_pieces[i]) {
|
||||
for(int i=0; i<scaled_pieces.size(); ++i) {
|
||||
if(scaled_pieces[i])
|
||||
painter.setPen(Qt::blue);
|
||||
} else {
|
||||
if(scaled_downloading[i]) {
|
||||
painter.setPen(Qt::yellow);
|
||||
} else {
|
||||
painter.setPen(Qt::white);
|
||||
}
|
||||
}
|
||||
else
|
||||
painter.setPen(Qt::white);
|
||||
painter.drawPoint(i,0);
|
||||
}
|
||||
pixmap = pix;
|
||||
@@ -104,15 +89,10 @@ public:
|
||||
pix.fill();
|
||||
QPainter painter(&pix);
|
||||
for(uint i=0; i<pieces.size(); ++i) {
|
||||
if(pieces[i]) {
|
||||
if(pieces[i])
|
||||
painter.setPen(Qt::blue);
|
||||
} else {
|
||||
if(downloading_pieces[i]) {
|
||||
painter.setPen(Qt::yellow);
|
||||
} else {
|
||||
painter.setPen(Qt::white);
|
||||
}
|
||||
}
|
||||
else
|
||||
painter.setPen(Qt::white);
|
||||
painter.drawPoint(i,0);
|
||||
}
|
||||
pixmap = pix;
|
||||
|
@@ -47,7 +47,6 @@ class downloadFromURL : public QDialog, private Ui::downloadFromURL{
|
||||
setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
icon_lbl->setPixmap(QPixmap(QString::fromUtf8(":/Icons/skin/url.png")));
|
||||
setModal(true);
|
||||
show();
|
||||
// Paste clipboard if there is an URL in it
|
||||
QString clip_txt = qApp->clipboard()->text();
|
||||
|
@@ -42,9 +42,6 @@ enum ProxyType {HTTP=1, SOCKS5=2, HTTP_PW=3, SOCKS5_PW=4, SOCKS4=5};
|
||||
downloadThread::downloadThread(QObject* parent) : QObject(parent) {
|
||||
networkManager = new QNetworkAccessManager(this);
|
||||
connect(networkManager, SIGNAL(finished (QNetworkReply*)), this, SLOT(processDlFinished(QNetworkReply*)));
|
||||
#ifndef QT_NO_OPENSSL
|
||||
connect(networkManager, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)), this, SLOT(ignoreSslErrors(QNetworkReply*,QList<QSslError>)));
|
||||
#endif
|
||||
}
|
||||
|
||||
downloadThread::~downloadThread(){
|
||||
@@ -54,7 +51,7 @@ downloadThread::~downloadThread(){
|
||||
}
|
||||
|
||||
void downloadThread::processDlFinished(QNetworkReply* reply) {
|
||||
QString url = reply->url().toEncoded().data();
|
||||
QString url = reply->url().toString();
|
||||
if(reply->error() != QNetworkReply::NoError) {
|
||||
// Failure
|
||||
emit downloadFailure(url, errorCodeToString(reply->error()));
|
||||
@@ -62,7 +59,7 @@ void downloadThread::processDlFinished(QNetworkReply* reply) {
|
||||
QVariant redirection = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
|
||||
if(redirection.isValid()) {
|
||||
// We should redirect
|
||||
qDebug("Redirecting from %s to %s", qPrintable(url), qPrintable(redirection.toUrl().toString()));
|
||||
qDebug("Redirecting from %s to %s", url.toLocal8Bit().data(), redirection.toUrl().toString().toLocal8Bit().data());
|
||||
redirect_mapping.insert(redirection.toUrl().toString(), url);
|
||||
downloadUrl(redirection.toUrl().toString());
|
||||
return;
|
||||
@@ -77,9 +74,8 @@ void downloadThread::processDlFinished(QNetworkReply* reply) {
|
||||
tmpfile.setAutoRemove(false);
|
||||
if (tmpfile.open()) {
|
||||
filePath = tmpfile.fileName();
|
||||
qDebug("Temporary filename is: %s", qPrintable(filePath));
|
||||
qDebug("Temporary filename is: %s", filePath.toLocal8Bit().data());
|
||||
if(reply->open(QIODevice::ReadOnly)) {
|
||||
// TODO: Support GZIP compression
|
||||
tmpfile.write(reply->readAll());
|
||||
reply->close();
|
||||
tmpfile.close();
|
||||
@@ -98,12 +94,7 @@ void downloadThread::processDlFinished(QNetworkReply* reply) {
|
||||
reply->deleteLater();
|
||||
}
|
||||
|
||||
void downloadThread::downloadTorrentUrl(QString url){
|
||||
QNetworkReply *reply = downloadUrl(url);
|
||||
connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(checkDownloadSize(qint64,qint64)));
|
||||
}
|
||||
|
||||
QNetworkReply* downloadThread::downloadUrl(QString url){
|
||||
void downloadThread::downloadUrl(QString url){
|
||||
// Update proxy settings
|
||||
applyProxySettings();
|
||||
// Process download request
|
||||
@@ -112,27 +103,8 @@ QNetworkReply* downloadThread::downloadUrl(QString url){
|
||||
// Spoof Firefox 3.5 user agent to avoid
|
||||
// Web server banning
|
||||
request.setRawHeader("User-Agent", "Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5");
|
||||
qDebug("Downloading %s...", qPrintable(request.url().toString()));
|
||||
return networkManager->get(request);
|
||||
}
|
||||
|
||||
void downloadThread::checkDownloadSize(qint64 bytesReceived, qint64 bytesTotal) {
|
||||
if(bytesTotal > 0) {
|
||||
QNetworkReply *reply = static_cast<QNetworkReply*>(sender());
|
||||
// Total number of bytes is available
|
||||
if(bytesTotal > 1048576) {
|
||||
// More than 1MB, this is probably not a torrent file, aborting...
|
||||
reply->abort();
|
||||
} else {
|
||||
disconnect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(checkDownloadSize(qint64,qint64)));
|
||||
}
|
||||
} else {
|
||||
if(bytesReceived > 1048576) {
|
||||
// More than 1MB, this is probably not a torrent file, aborting...
|
||||
QNetworkReply *reply = static_cast<QNetworkReply*>(sender());
|
||||
reply->abort();
|
||||
}
|
||||
}
|
||||
qDebug("Downloading %s...", request.url().toString().toLocal8Bit().data());
|
||||
networkManager->get(request);
|
||||
}
|
||||
|
||||
void downloadThread::applyProxySettings() {
|
||||
@@ -144,7 +116,7 @@ void downloadThread::applyProxySettings() {
|
||||
QString IP = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/IP"), "0.0.0.0").toString();
|
||||
proxy.setHostName(IP);
|
||||
QString port = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/Port"), 8080).toString();
|
||||
qDebug("Using proxy: %s", qPrintable(IP));
|
||||
qDebug("Using proxy: %s", (IP+QString(":")+port).toLocal8Bit().data());
|
||||
proxy.setPort(port.toUShort());
|
||||
// Default proxy type is HTTP, we must change if it is SOCKS5
|
||||
if(intValue == SOCKS5 || intValue == SOCKS5_PW) {
|
||||
@@ -216,11 +188,3 @@ QString downloadThread::errorCodeToString(QNetworkReply::NetworkError status) {
|
||||
return tr("Unknown error");
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef QT_NO_OPENSSL
|
||||
void downloadThread::ignoreSslErrors(QNetworkReply* reply,QList<QSslError> errors) {
|
||||
Q_UNUSED(errors)
|
||||
// Ignore all SSL errors
|
||||
reply->ignoreSslErrors();
|
||||
}
|
||||
#endif
|
||||
|
@@ -34,7 +34,6 @@
|
||||
#include <QNetworkReply>
|
||||
#include <QObject>
|
||||
#include <QHash>
|
||||
#include <QSslError>
|
||||
|
||||
class QNetworkAccessManager;
|
||||
|
||||
@@ -52,8 +51,7 @@ signals:
|
||||
public:
|
||||
downloadThread(QObject* parent);
|
||||
~downloadThread();
|
||||
QNetworkReply* downloadUrl(QString url);
|
||||
void downloadTorrentUrl(QString url);
|
||||
void downloadUrl(QString url);
|
||||
//void setProxy(QString IP, int port, QString username, QString password);
|
||||
|
||||
protected:
|
||||
@@ -62,10 +60,6 @@ protected:
|
||||
|
||||
protected slots:
|
||||
void processDlFinished(QNetworkReply* reply);
|
||||
void checkDownloadSize(qint64 bytesReceived, qint64 bytesTotal);
|
||||
#ifndef QT_NO_OPENSSL
|
||||
void ignoreSslErrors(QNetworkReply*,QList<QSslError>);
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
@@ -81,7 +81,7 @@ void engineSelectDlg::dropEvent(QDropEvent *event) {
|
||||
QStringList files=event->mimeData()->text().split(QString::fromUtf8("\n"));
|
||||
QString file;
|
||||
foreach(file, files) {
|
||||
qDebug("dropped %s", qPrintable(file));
|
||||
qDebug("dropped %s", file.toLocal8Bit().data());
|
||||
file = file.replace("file://", "");
|
||||
if(file.startsWith("http://", Qt::CaseInsensitive) || file.startsWith("https://", Qt::CaseInsensitive) || file.startsWith("ftp://", Qt::CaseInsensitive)) {
|
||||
downloader->downloadUrl(file);
|
||||
@@ -99,7 +99,7 @@ void engineSelectDlg::dropEvent(QDropEvent *event) {
|
||||
void engineSelectDlg::dragEnterEvent(QDragEnterEvent *event) {
|
||||
QString mime;
|
||||
foreach(mime, event->mimeData()->formats()){
|
||||
qDebug("mimeData: %s", qPrintable(mime));
|
||||
qDebug("mimeData: %s", mime.toLocal8Bit().data());
|
||||
}
|
||||
if (event->mimeData()->hasFormat(QString::fromUtf8("text/plain")) || event->mimeData()->hasFormat(QString::fromUtf8("text/uri-list"))) {
|
||||
event->acceptProposedAction();
|
||||
@@ -251,12 +251,12 @@ bool engineSelectDlg::isUpdateNeeded(QString plugin_name, float new_version) con
|
||||
}
|
||||
|
||||
void engineSelectDlg::installPlugin(QString path, QString plugin_name) {
|
||||
qDebug("Asked to install plugin at %s", qPrintable(path));
|
||||
qDebug("Asked to install plugin at %s", path.toLocal8Bit().data());
|
||||
float new_version = SearchEngine::getPluginVersion(path);
|
||||
qDebug("Version to be installed: %.2f", new_version);
|
||||
if(!isUpdateNeeded(plugin_name, new_version)) {
|
||||
qDebug("Apparently update is 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));
|
||||
QMessageBox::information(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("A more recent version of %1 search engine plugin is already installed.", "%1 is the name of the search engine").arg(plugin_name.toLocal8Bit().data()));
|
||||
return;
|
||||
}
|
||||
// Process with install
|
||||
@@ -280,12 +280,12 @@ void engineSelectDlg::installPlugin(QString path, QString plugin_name) {
|
||||
// restore backup
|
||||
QFile::copy(dest_path+".bak", dest_path);
|
||||
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));
|
||||
QMessageBox::warning(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("%1 search engine plugin could not be updated, keeping old version.", "%1 is the name of the search engine").arg(plugin_name.toLocal8Bit().data()));
|
||||
return;
|
||||
} else {
|
||||
// Remove broken file
|
||||
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));
|
||||
QMessageBox::warning(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("%1 search engine plugin could not be installed.", "%1 is the name of the search engine").arg(plugin_name.toLocal8Bit().data()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -294,10 +294,10 @@ void engineSelectDlg::installPlugin(QString path, QString plugin_name) {
|
||||
QFile::remove(dest_path+".bak");
|
||||
}
|
||||
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));
|
||||
QMessageBox::information(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("%1 search engine plugin was successfully updated.", "%1 is the name of the search engine").arg(plugin_name.toLocal8Bit().data()));
|
||||
return;
|
||||
} 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));
|
||||
QMessageBox::information(this, tr("Search plugin install")+" -- "+tr("qBittorrent"), tr("%1 search engine plugin was successfully installed.", "%1 is the name of the search engine").arg(plugin_name.toLocal8Bit().data()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -390,17 +390,17 @@ bool engineSelectDlg::parseVersionsFile(QString versions_file) {
|
||||
plugin_name.chop(1); // remove trailing ':'
|
||||
bool ok;
|
||||
float version = list.last().toFloat(&ok);
|
||||
qDebug("read line %s: %.2f", qPrintable(plugin_name), version);
|
||||
qDebug("read line %s: %.2f", plugin_name.toLocal8Bit().data(), version);
|
||||
if(!ok) continue;
|
||||
file_correct = true;
|
||||
if(isUpdateNeeded(plugin_name, version)) {
|
||||
qDebug("Plugin: %s is outdated", qPrintable(plugin_name));
|
||||
qDebug("Plugin: %s is outdated", plugin_name.toLocal8Bit().data());
|
||||
// Downloading update
|
||||
downloader->downloadUrl(UPDATE_URL+plugin_name+".py");
|
||||
//downloader->downloadUrl(UPDATE_URL+plugin_name+".png");
|
||||
updated = true;
|
||||
}else {
|
||||
qDebug("Plugin: %s is up to date", qPrintable(plugin_name));
|
||||
qDebug("Plugin: %s is up to date", plugin_name.toLocal8Bit().data());
|
||||
}
|
||||
}
|
||||
// Close file
|
||||
@@ -414,7 +414,7 @@ bool engineSelectDlg::parseVersionsFile(QString versions_file) {
|
||||
}
|
||||
|
||||
void engineSelectDlg::processDownloadedFile(QString url, QString filePath) {
|
||||
qDebug("engineSelectDlg received %s", qPrintable(url));
|
||||
qDebug("engineSelectDlg received %s", url.toLocal8Bit().data());
|
||||
if(url.endsWith("favicon.ico", Qt::CaseInsensitive)){
|
||||
// Icon downloaded
|
||||
QImage fileIcon;
|
||||
@@ -456,7 +456,7 @@ void engineSelectDlg::processDownloadedFile(QString url, QString filePath) {
|
||||
|
||||
void engineSelectDlg::handleDownloadFailure(QString url, QString reason) {
|
||||
if(url.endsWith("favicon.ico", Qt::CaseInsensitive)){
|
||||
qDebug("Could not download favicon: %s, reason: %s", qPrintable(url), qPrintable(reason));
|
||||
qDebug("Could not download favicon: %s, reason: %s", url.toLocal8Bit().data(), reason.toLocal8Bit().data());
|
||||
return;
|
||||
}
|
||||
if(url.endsWith("versions.txt")) {
|
||||
@@ -467,6 +467,6 @@ void engineSelectDlg::handleDownloadFailure(QString url, QString reason) {
|
||||
// a plugin update download has been failed
|
||||
QString plugin_name = url.split('/').last();
|
||||
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));
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
@@ -31,7 +31,6 @@
|
||||
|
||||
#include "eventmanager.h"
|
||||
#include "bittorrent.h"
|
||||
#include "scannedfoldersmodel.h"
|
||||
#include "misc.h"
|
||||
#include "preferences.h"
|
||||
//#include "proplistdelegate.h"
|
||||
@@ -130,31 +129,8 @@ void EventManager::setGlobalPreferences(QVariantMap m) const {
|
||||
Preferences::setTempPathEnabled(m["temp_path_enabled"].toBool());
|
||||
if(m.contains("temp_path"))
|
||||
Preferences::setTempPath(m["temp_path"].toString());
|
||||
if(m.contains("scan_dirs") && m.contains("download_in_scan_dirs")) {
|
||||
QVariantList download_at_path = m["download_in_scan_dirs"].toList();
|
||||
QStringList old_folders = Preferences::getScanDirs();
|
||||
QStringList new_folders = m["scan_dirs"].toStringList();
|
||||
if(download_at_path.size() == new_folders.size()) {
|
||||
Preferences::setScanDirs(new_folders);
|
||||
Preferences::setDownloadInScanDirs(download_at_path);
|
||||
foreach(const QString &old_folder, old_folders) {
|
||||
// Update deleted folders
|
||||
if(!new_folders.contains(old_folder)) {
|
||||
BTSession->getScanFoldersModel()->removePath(old_folder);
|
||||
}
|
||||
}
|
||||
int i = 0;
|
||||
foreach(const QString &new_folder, new_folders) {
|
||||
// Update new folders
|
||||
if(!old_folders.contains(new_folder)) {
|
||||
BTSession->getScanFoldersModel()->addPath(new_folder, download_at_path.at(i).toBool());
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(m.contains("export_dir"))
|
||||
Preferences::setExportDir(m["export_dir"].toString());
|
||||
if(m.contains("scan_dir"))
|
||||
Preferences::setScanDir(m["scan_dir"].toString());
|
||||
if(m.contains("preallocate_all"))
|
||||
Preferences::preAllocateAllFiles(m["preallocate_all"].toBool());
|
||||
if(m.contains("queueing_enabled"))
|
||||
@@ -189,10 +165,6 @@ void EventManager::setGlobalPreferences(QVariantMap m) const {
|
||||
// Bittorrent
|
||||
if(m.contains("dht"))
|
||||
Preferences::setDHTEnabled(m["dht"].toBool());
|
||||
if(m.contains("dhtSameAsBT"))
|
||||
Preferences::setDHTPortSameAsBT(m["dhtSameAsBT"].toBool());
|
||||
if(m.contains("dht_port"))
|
||||
Preferences::setDHTPort(m["dht_port"].toInt());
|
||||
if(m.contains("pex"))
|
||||
Preferences::setPeXEnabled(m["pex"].toBool());
|
||||
qDebug("Pex support: %d", (int)m["pex"].toBool());
|
||||
@@ -255,10 +227,8 @@ QVariantMap EventManager::getGlobalPreferences() const {
|
||||
data["save_path"] = Preferences::getSavePath();
|
||||
data["temp_path_enabled"] = Preferences::isTempPathEnabled();
|
||||
data["temp_path"] = Preferences::getTempPath();
|
||||
data["scan_dirs"] = Preferences::getScanDirs();
|
||||
data["download_in_scan_dirs"] = Preferences::getDownloadInScanDirs();
|
||||
data["export_dir_enabled"] = Preferences::isTorrentExportEnabled();
|
||||
data["export_dir"] = Preferences::getExportDir();
|
||||
data["scan_dir_enabled"] = Preferences::isDirScanEnabled();
|
||||
data["scan_dir"] = Preferences::getScanDir();
|
||||
data["preallocate_all"] = Preferences::preAllocateAllFiles();
|
||||
data["queueing_enabled"] = Preferences::isQueueingSystemEnabled();
|
||||
data["max_active_downloads"] = Preferences::getMaxActiveDownloads();
|
||||
@@ -278,8 +248,6 @@ QVariantMap EventManager::getGlobalPreferences() const {
|
||||
data["max_uploads_per_torrent"] = Preferences::getMaxUploadsPerTorrent();
|
||||
// Bittorrent
|
||||
data["dht"] = Preferences::isDHTEnabled();
|
||||
data["dhtSameAsBT"] = Preferences::isDHTPortSameAsBT();
|
||||
data["dht_port"] = Preferences::getDHTPort();
|
||||
data["pex"] = Preferences::isPeXEnabled();
|
||||
data["lsd"] = Preferences::isLSDEnabled();
|
||||
data["encryption"] = Preferences::getEncryptionSetting();
|
||||
@@ -314,30 +282,28 @@ QVariantMap EventManager::getPropGeneralInfo(QString hash) const {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
if(h.is_valid() && h.has_metadata()) {
|
||||
// Save path
|
||||
QString p = TorrentPersistentData::getSavePath(hash);
|
||||
if(p.isEmpty()) p = h.save_path();
|
||||
data["save_path"] = p;
|
||||
data["save_path"] = TorrentPersistentData::getSavePath(hash);
|
||||
// Creation date
|
||||
data["creation_date"] = h.creation_date();
|
||||
// Comment
|
||||
data["comment"] = h.comment();
|
||||
data["total_wasted"] = QVariant(misc::friendlyUnit(h.total_failed_bytes()+h.total_redundant_bytes()));
|
||||
data["total_uploaded"] = QVariant(misc::friendlyUnit(h.all_time_upload()) + " ("+misc::friendlyUnit(h.total_payload_upload())+" "+tr("this session")+")");
|
||||
data["total_downloaded"] = QVariant(misc::friendlyUnit(h.all_time_download()) + " ("+misc::friendlyUnit(h.total_payload_download())+" "+tr("this session")+")");
|
||||
data["total_wasted"] = misc::friendlyUnit(h.total_failed_bytes()+h.total_redundant_bytes());
|
||||
data["total_uploaded"] = misc::friendlyUnit(h.all_time_upload()) + " ("+misc::friendlyUnit(h.total_payload_upload())+" "+tr("this session")+")";
|
||||
data["total_downloaded"] = misc::friendlyUnit(h.all_time_download()) + " ("+misc::friendlyUnit(h.total_payload_download())+" "+tr("this session")+")";
|
||||
if(h.upload_limit() <= 0)
|
||||
data["up_limit"] = QString::fromUtf8("∞");
|
||||
else
|
||||
data["up_limit"] = QVariant(misc::friendlyUnit(h.upload_limit())+tr("/s", "/second (i.e. per second)"));
|
||||
data["up_limit"] = misc::friendlyUnit(h.upload_limit())+tr("/s", "/second (i.e. per second)");
|
||||
if(h.download_limit() <= 0)
|
||||
data["dl_limit"] = QString::fromUtf8("∞");
|
||||
else
|
||||
data["dl_limit"] = QVariant(misc::friendlyUnit(h.download_limit())+tr("/s", "/second (i.e. per second)"));
|
||||
data["dl_limit"] = misc::friendlyUnit(h.download_limit())+tr("/s", "/second (i.e. per second)");
|
||||
QString elapsed_txt = misc::userFriendlyDuration(h.active_time());
|
||||
if(h.is_seed()) {
|
||||
elapsed_txt += " ("+tr("Seeded for %1", "e.g. Seeded for 3m10s").arg(misc::userFriendlyDuration(h.seeding_time()))+")";
|
||||
}
|
||||
data["time_elapsed"] = elapsed_txt;
|
||||
data["nb_connections"] = QVariant(QString::number(h.num_connections())+" ("+tr("%1 max", "e.g. 10 max").arg(QString::number(h.connections_limit()))+")");
|
||||
data["nb_connections"] = QString::number(h.num_connections())+" ("+tr("%1 max", "e.g. 10 max").arg(QString::number(h.connections_limit()))+")";
|
||||
// Update ratio info
|
||||
double ratio = BTSession->getRealRatio(h.hash());
|
||||
if(ratio > 100.)
|
||||
|
@@ -28,16 +28,15 @@ public:
|
||||
setColumnCount(1);
|
||||
QTreeWidgetItem *___qtreewidgetitem = headerItem();
|
||||
___qtreewidgetitem->setText(0, QApplication::translate("RSS", "RSS feeds", 0, QApplication::UnicodeUTF8));
|
||||
connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(updateCurrentFeed(QTreeWidgetItem*)));
|
||||
unread_item = new QTreeWidgetItem(this);
|
||||
unread_item->setText(0, tr("Unread") + QString::fromUtf8(" (") + QString::number(rssmanager->getNbUnRead(), 10)+ QString(")"));
|
||||
unread_item->setData(0,Qt::DecorationRole, QVariant(QIcon(":/Icons/oxygen/mail-folder-inbox.png")));
|
||||
itemAdded(unread_item, rssmanager);
|
||||
connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(updateCurrentFeed(QTreeWidgetItem*)));
|
||||
setCurrentItem(unread_item);
|
||||
}
|
||||
|
||||
~FeedList() {
|
||||
disconnect(this, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(updateCurrentFeed(QTreeWidgetItem*)));
|
||||
delete unread_item;
|
||||
}
|
||||
|
||||
@@ -122,19 +121,19 @@ public:
|
||||
}
|
||||
|
||||
RssFile* getRSSItem(QTreeWidgetItem *item) const {
|
||||
return mapping.value(item, 0);
|
||||
return mapping[item];
|
||||
}
|
||||
|
||||
RssFile::FileType getItemType(QTreeWidgetItem *item) const {
|
||||
return mapping.value(item)->getType();
|
||||
return mapping[item]->getType();
|
||||
}
|
||||
|
||||
QString getItemID(QTreeWidgetItem *item) const {
|
||||
return mapping.value(item)->getID();
|
||||
return mapping[item]->getID();
|
||||
}
|
||||
|
||||
QTreeWidgetItem* getTreeItemFromUrl(QString url) const{
|
||||
return feeds_items.value(url, 0);
|
||||
return feeds_items[url];
|
||||
}
|
||||
|
||||
RssStream* getRSSItemFromUrl(QString url) const {
|
||||
|
@@ -46,7 +46,7 @@
|
||||
#include "bittorrent.h"
|
||||
#include "ui_feeddownloader.h"
|
||||
|
||||
#if QT_VERSION >= 0x040500
|
||||
#ifdef QT_4_5
|
||||
#include <QHash>
|
||||
#else
|
||||
#include <QMap>
|
||||
@@ -64,9 +64,11 @@ public:
|
||||
|
||||
bool matches(QString s) {
|
||||
QStringList match_tokens = getMatchingTokens();
|
||||
//qDebug("Checking matching tokens: \"%s\"", getMatchingTokens_str().toLocal8Bit().data());
|
||||
foreach(const QString& token, match_tokens) {
|
||||
if(token.isEmpty() || token == "")
|
||||
continue;
|
||||
//qDebug("Token: %s", token.toLocal8Bit().data());
|
||||
QRegExp reg(token, Qt::CaseInsensitive, QRegExp::Wildcard);
|
||||
//reg.setMinimal(false);
|
||||
if(reg.indexIn(s) < 0) return false;
|
||||
@@ -224,7 +226,7 @@ public:
|
||||
void save() {
|
||||
QSettings qBTRSS("qBittorrent", "qBittorrent-rss");
|
||||
QHash<QString, QVariant> all_feeds_filters = qBTRSS.value("feed_filters", QHash<QString, QVariant>()).toHash();
|
||||
qDebug("Saving filters for feed: %s (%d filters)", qPrintable(feed_url), (*this).size());
|
||||
qDebug("Saving filters for feed: %s (%d filters)", feed_url.toLocal8Bit().data(), (*this).size());
|
||||
all_feeds_filters[feed_url] = *this;
|
||||
qBTRSS.setValue("feed_filters", all_feeds_filters);
|
||||
}
|
||||
@@ -259,6 +261,7 @@ public:
|
||||
// Restore saved info
|
||||
enableDl_cb->setChecked(filters.isDownloadingEnabled());
|
||||
fillFiltersList();
|
||||
filtersList->sortItems(Qt::AscendingOrder);
|
||||
if(filters.size() > 0) {
|
||||
// Select first filter
|
||||
filtersList->setCurrentItem(filtersList->item(0));
|
||||
@@ -385,6 +388,7 @@ protected slots:
|
||||
if(selected_filter == current_name)
|
||||
selected_filter = new_name;
|
||||
item->setText(new_name);
|
||||
filtersList->sortItems(Qt::AscendingOrder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -438,6 +442,7 @@ protected slots:
|
||||
}
|
||||
}while(!validated);
|
||||
QListWidgetItem *it = new QListWidgetItem(filter_name, filtersList);
|
||||
filtersList->sortItems(Qt::AscendingOrder);
|
||||
filtersList->setCurrentItem(it);
|
||||
//showFilterSettings(it);
|
||||
}
|
||||
|