You've already forked qBittorrent
mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-10-26 06:12:17 +01:00
Compare commits
121 Commits
release-3.
...
release-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
33147d842c | ||
|
|
11e0b7c9b5 | ||
|
|
e8cd92e245 | ||
|
|
a757953b76 | ||
|
|
a26da65419 | ||
|
|
1d9ef166bd | ||
|
|
81a5201e41 | ||
|
|
9f9354af12 | ||
|
|
ac1ebf4e13 | ||
|
|
b9ccd3e74f | ||
|
|
4177a37d63 | ||
|
|
24a73c05b9 | ||
|
|
960d8d1bc9 | ||
|
|
da69983e64 | ||
|
|
6db7d36e4d | ||
|
|
571963b1bd | ||
|
|
9e50e1ba7e | ||
|
|
82af132d8a | ||
|
|
80dd666107 | ||
|
|
ac50f0cdc2 | ||
|
|
bf685773e6 | ||
|
|
a0ada5c3ba | ||
|
|
220fd4a7b8 | ||
|
|
d5622da576 | ||
|
|
55be2aa9a0 | ||
|
|
96f619b486 | ||
|
|
89a1eb1bca | ||
|
|
de228fe074 | ||
|
|
8846f52ce1 | ||
|
|
545ce42d4e | ||
|
|
faf8b0e3f5 | ||
|
|
70a0b3cff3 | ||
|
|
24ab195d2f | ||
|
|
4bd2641d70 | ||
|
|
7c5779eee0 | ||
|
|
0bbe4426c2 | ||
|
|
595a190508 | ||
|
|
ec30fe2498 | ||
|
|
4d80d6ef5c | ||
|
|
3d53e641c1 | ||
|
|
3deee6d595 | ||
|
|
86f2447f8a | ||
|
|
a69c3098e1 | ||
|
|
88627df7fe | ||
|
|
8e3ba25c8d | ||
|
|
1ecffb777a | ||
|
|
1c4ae8ffbf | ||
|
|
0fad329b7e | ||
|
|
bdaf16123f | ||
|
|
6b56a1f10f | ||
|
|
204b02a480 | ||
|
|
eb7a844099 | ||
|
|
84dbb76331 | ||
|
|
fb21944aae | ||
|
|
14625a565d | ||
|
|
3f875324d8 | ||
|
|
03f2293b2a | ||
|
|
47482586a1 | ||
|
|
96fd1624ce | ||
|
|
8ea2312b4f | ||
|
|
9382de64d6 | ||
|
|
b0e3549780 | ||
|
|
d2abe18497 | ||
|
|
ede004148f | ||
|
|
91bfe3585c | ||
|
|
f99adf8e9a | ||
|
|
ebab7c5760 | ||
|
|
baf5fe45b4 | ||
|
|
54793e4195 | ||
|
|
e8da08906c | ||
|
|
ae7e9cd1df | ||
|
|
7679b852b8 | ||
|
|
eda04b3ef3 | ||
|
|
3ef6e7bf65 | ||
|
|
146cf9a435 | ||
|
|
dff6b057b9 | ||
|
|
3b7448dfc7 | ||
|
|
4e4ac771a9 | ||
|
|
06a376d014 | ||
|
|
b3d2f9b701 | ||
|
|
055a99239b | ||
|
|
e779c9a7db | ||
|
|
b0f7f5ae58 | ||
|
|
512ab58832 | ||
|
|
9ad088682c | ||
|
|
d2fad8249c | ||
|
|
20fb7c3adf | ||
|
|
c4fdfec420 | ||
|
|
a3e03e739c | ||
|
|
9846dc0fff | ||
|
|
1b29b148d8 | ||
|
|
6dab35cb8e | ||
|
|
6b2d922005 | ||
|
|
1d92ae6382 | ||
|
|
62f4d6386a | ||
|
|
e74ef4c6fd | ||
|
|
282ee0e879 | ||
|
|
697d2ccb71 | ||
|
|
71d163d743 | ||
|
|
83685942de | ||
|
|
6f34c81014 | ||
|
|
5e826dffc8 | ||
|
|
b4dc66020c | ||
|
|
cb4741ed89 | ||
|
|
4c3976e5df | ||
|
|
fd7fb115ff | ||
|
|
197d5b3a05 | ||
|
|
624d6aa6a1 | ||
|
|
28d7dc137b | ||
|
|
351d84e2f7 | ||
|
|
774b8f4fd6 | ||
|
|
2fc6470696 | ||
|
|
1038b00553 | ||
|
|
c3b37b4f1f | ||
|
|
41faf341cc | ||
|
|
44e92a7f3d | ||
|
|
599f956269 | ||
|
|
79a9606e86 | ||
|
|
5b576baf67 | ||
|
|
aa3ce90478 | ||
|
|
2c433e35b0 |
2
AUTHORS
2
AUTHORS
@@ -107,5 +107,5 @@ Translations authors:
|
|||||||
- Spanish: Francisco Luque Contreras (frannoe@ya.com)
|
- Spanish: Francisco Luque Contreras (frannoe@ya.com)
|
||||||
- Swedish: Daniel Nylander (po@danielnylander.se)
|
- Swedish: Daniel Nylander (po@danielnylander.se)
|
||||||
- Turkish: Hasan Yilmaz (iletisim@hedefturkce.com)
|
- Turkish: Hasan Yilmaz (iletisim@hedefturkce.com)
|
||||||
- Ukrainian: Oleh Prypin (blaxpirit@gmail.com)
|
- Ukrainian: Andrey Shpachenko (masterfix@users.sourceforge.net) and Oleh Prypin (blaxpirit@gmail.com)
|
||||||
license: GPLv2
|
license: GPLv2
|
||||||
|
|||||||
83
Changelog
83
Changelog
@@ -1,13 +1,78 @@
|
|||||||
* Thu Aug 09 2012 - Christophe Dumez <chris@qbittorrent.org> - v3.0.0
|
* Sun Jun 24 2012 - Christophe Dumez <chris@qbittorrent.org> - v2.9.10
|
||||||
- FEATURE: Brand new torrent addition dialog
|
- BUGFIX: Fix possible crash when showing torrent content (closes #1002586)
|
||||||
- FEATURE: Add the ability to choose the save path when using magnet links (mutoso)
|
- BUGFIX: Add support for RSS feeds using magnet links (closes #1016379)
|
||||||
- FEATURE: Add support for adding multiple local torrents at once (Web UI)
|
- BUGFIX: Remove 100kb limit for torrent file size in Web UI
|
||||||
|
- BUGFIX: Fix ratio limiting bug (closes #835217)
|
||||||
|
- BUGFIX: Do not display .!qB file extensions in Web UI
|
||||||
|
- BUGFIX: Stop using absolute URLs in Web UI ajax requests (closes #1011226)
|
||||||
|
- BUGFIX: Fix torrent association and loading on Mac OS X (closes #1011229)
|
||||||
|
- BUGFIX: Fix unreversible "Minimize to tray" on some window managers (closes #917825)
|
||||||
|
|
||||||
|
* Sun May 20 2012 - Christophe Dumez <chris@qbittorrent.org> - v2.9.9
|
||||||
|
- BUGFIX: More reliable RSS feed parsing (closes #1001777)
|
||||||
|
- BUGFIX: Better support for cookies in RSS
|
||||||
|
- BUGFIX: Make sure show/hide text in tray icon menu is correct
|
||||||
- COSMETIC: Improve style of left panel
|
- COSMETIC: Improve style of left panel
|
||||||
- BUGFIX: Lower panels no longer gets disabled
|
- COSMETIC: Never disable properties panel
|
||||||
- BUGFIX: Major code refactoring and various optimizations.
|
- COSMETIC: Make sure first tab is initially selected in options dialog
|
||||||
- BUGFIX: No longer strip root folder from torrent files
|
- COSMETIC: Fix a few focus issues on Mac OS X
|
||||||
- OTHER: Drop support for libtorrent v0.14.x
|
|
||||||
- OTHER: Drop support for Qt 4.5
|
* Sat May 5 2012 - Christophe Dumez <chris@qbittorrent.org> - v2.9.8
|
||||||
|
- BUGFIX: Various UI style fixes
|
||||||
|
- BUGFIX: Fix compilation with gcc 4.7
|
||||||
|
- BUGFIX: Fix possible compilation error with msvc (Windows)
|
||||||
|
- BUGFIX: Fix compilation on OS/2
|
||||||
|
- I18N: Update Italian translation
|
||||||
|
|
||||||
|
* Sun Mar 18 2012 - Christophe Dumez <chris@qbittorrent.org> - v2.9.7
|
||||||
|
- BUGFIX: Fix important HTTP request parsing bug (Web UI)
|
||||||
|
|
||||||
|
* Sat Mar 17 2012 - Christophe Dumez <chris@qbittorrent.org> - v2.9.6
|
||||||
|
- BUGFIX: Fix download first/last pieces state reporting
|
||||||
|
- BUGFIX: Fix name of progress column in torrent content panel
|
||||||
|
- BUGFIX: Disable system tray icon on Mac OS X
|
||||||
|
- BUGFIX: RSS downloader should not ignore "Do not start automatically" rule (closes #946910)
|
||||||
|
- BUGFIX: Fix DHT port setting in Web UI (Closes #952182)
|
||||||
|
- BUGFIX: Fix possible Web UI authentication problem when using SSL (closes #941343)
|
||||||
|
- BUGFIX: Fix possible issues with folder removal when removing a torrent
|
||||||
|
- I18N: Add Basque translation
|
||||||
|
|
||||||
|
* Sat Feb 18 2012 - Christophe Dumez <chris@qbittorrent.org> - v2.9.5
|
||||||
|
- BUGFIX: Fix crash when disabling then reenabling RSS
|
||||||
|
- BUGFIX: Fix duplicate torrent detection when adding a magnet link
|
||||||
|
- BUGFIX: Fix import of new trackers when adding a torrent with same hash (Closes #747000)
|
||||||
|
- BUGFIX: Fix possible redownload of torrents marked as read (Closes #927495)
|
||||||
|
- BUGFIX: Properly remove RSS feed settings/history upon feed removal
|
||||||
|
|
||||||
|
* Sat Feb 18 2012 - Christophe Dumez <chris@qbittorrent.org> - v2.9.4
|
||||||
|
- BUGFIX: qBittorrent does not handle redirection to relative URLs correctly (Closes #919905)
|
||||||
|
- BUGFIX: Cmd+M minimizes main window on Mac OS X (Closes #928216)
|
||||||
|
- BUGFIX: Cmd+Del removes torrents on Mac OS X (Closes #928852)
|
||||||
|
- BUGFIX: Fix potential bug when moving single file torrents to tmp folder (closes #932861)
|
||||||
|
- BUGFIX: Fix torrent import dialog layout (Closes #930932)
|
||||||
|
- BUGFIX: Prevent log window buffer from filling up (Closes #929673)
|
||||||
|
- I18N: Add Belarusian translation
|
||||||
|
|
||||||
|
* Thu Dec 29 2011 - Christophe Dumez <chris@qbittorrent.org> - v2.9.3
|
||||||
|
- BUGFIX: Fix btdigg plugin (Python3 support + torrent name in magnet links)
|
||||||
|
- BUGFIX: Fix banning of IPv6 peers (Closes #885021)
|
||||||
|
- BUGFIX: Fix torrent addition dialog layout problem (Closes #84650522)
|
||||||
|
- BUGFIX: Do not report any progress for disabled files (Closes #56731485)
|
||||||
|
- BUGFIX: Make torrent sorting case insensitive (Closes #857154)
|
||||||
|
- BUGFIX: Improve Web UI usability of small devices
|
||||||
|
- BUGFIX: Program updater: More reliable version detection / comparison
|
||||||
|
- I18N: Add Georgian translation
|
||||||
|
|
||||||
|
* Sat Oct 29 2011 - Christophe Dumez <chris@qbittorrent.org> - v2.9.2
|
||||||
|
- BUGFIX: Fix mimimum dimensions for torrent addition dialog
|
||||||
|
- BUGFIX: Remove dependency on boost-datetime
|
||||||
|
- BUGFIX: Remove dependency on boost-filesystem (libtorrent v0.16.x)
|
||||||
|
|
||||||
|
* Sun Oct 23 2011 - Christophe Dumez <chris@qbittorrent.org> - v2.9.1
|
||||||
|
- BUGFIX: Add support for speed limits scheduling (Web UI)
|
||||||
|
- BUGFIX: Fix ratio calculation for purely seeded torrents
|
||||||
|
- I18N: Update Russian translation
|
||||||
|
- COSMETIC: Torrent addition dialog layout fixes
|
||||||
|
|
||||||
* Sat Oct 08 2011 - Christophe Dumez <chris@qbittorrent.org> - v2.9.0
|
* Sat Oct 08 2011 - Christophe Dumez <chris@qbittorrent.org> - v2.9.0
|
||||||
- FEATURE: Add file association settings to program preferences (Windows)
|
- FEATURE: Add file association settings to program preferences (Windows)
|
||||||
|
|||||||
6
INSTALL
6
INSTALL
@@ -10,11 +10,11 @@ qBittorrent - A BitTorrent client in C++ / Qt4
|
|||||||
will install and execute qBittorrent hopefully without any problems.
|
will install and execute qBittorrent hopefully without any problems.
|
||||||
|
|
||||||
Dependencies:
|
Dependencies:
|
||||||
- Qt >= 4.6.0 (libqtgui, libqtcore, libqtnetwork, libqtxml, libqtdbus/optional)
|
- Qt >= 4.5.0 (libqtgui, libqtcore, libqtnetwork, libqtxml, libqtdbus/optional)
|
||||||
|
|
||||||
- pkg-config executable
|
- pkg-config executable
|
||||||
|
|
||||||
- libtorrent-rasterbar by Arvid Norberg (>= 0.15.0)
|
- libtorrent-rasterbar by Arvid Norberg (>= 0.14.4 REQUIRED, compatible with v0.15.x/v0.16.x)
|
||||||
-> http://www.libtorrent.net
|
-> http://www.libtorrent.net
|
||||||
Be careful: another library (the one used by rTorrent) uses a similar name.
|
Be careful: another library (the one used by rTorrent) uses a similar name.
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ qBittorrent - A BitTorrent client in C++ / Qt4
|
|||||||
|
|
||||||
- pkg-config executable
|
- pkg-config executable
|
||||||
|
|
||||||
- libtorrent-rasterbar by Arvid Norberg (>= v0.15.0)
|
- libtorrent-rasterbar by Arvid Norberg (>= 0.14.4 REQUIRED, >= v0.15.0 ADVISED)
|
||||||
-> http://www.libtorrent.net
|
-> http://www.libtorrent.net
|
||||||
Be careful: another library (the one used by rTorrent) uses a similar name.
|
Be careful: another library (the one used by rTorrent) uses a similar name.
|
||||||
|
|
||||||
|
|||||||
12
configure
vendored
12
configure
vendored
@@ -325,7 +325,7 @@ cat >$1/modules.cpp <<EOT
|
|||||||
#line 1 "qt4.qcm"
|
#line 1 "qt4.qcm"
|
||||||
/*
|
/*
|
||||||
-----BEGIN QCMOD-----
|
-----BEGIN QCMOD-----
|
||||||
name: Qt >= 4.6
|
name: Qt >= 4.5
|
||||||
arg: enable-debug, Enable debug mode
|
arg: enable-debug, Enable debug mode
|
||||||
arg: disable-gui, Disable qBittorrent Graphical user interface for headless running
|
arg: disable-gui, Disable qBittorrent Graphical user interface for headless running
|
||||||
-----END QCMOD-----
|
-----END QCMOD-----
|
||||||
@@ -334,8 +334,8 @@ class qc_qt4 : public ConfObj
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
qc_qt4(Conf *c) : ConfObj(c) {}
|
qc_qt4(Conf *c) : ConfObj(c) {}
|
||||||
QString name() const { return "Qt >= 4.6"; }
|
QString name() const { return "Qt >= 4.5"; }
|
||||||
QString shortname() const { return "Qt 4.6"; }
|
QString shortname() const { return "Qt 4.5"; }
|
||||||
bool exec()
|
bool exec()
|
||||||
{
|
{
|
||||||
// NOX mode
|
// NOX mode
|
||||||
@@ -356,7 +356,7 @@ public:
|
|||||||
#else
|
#else
|
||||||
conf->addExtra("MANPREFIX = \$\$PREFIX/share");
|
conf->addExtra("MANPREFIX = \$\$PREFIX/share");
|
||||||
#endif
|
#endif
|
||||||
return(QT_VERSION >= 0x040600);
|
return(QT_VERSION >= 0x040500);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#line 1 "qt-dbus.qcm"
|
#line 1 "qt-dbus.qcm"
|
||||||
@@ -419,11 +419,11 @@ 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.15.0"; }
|
QString name() const { return "libtorrent-rasterbar >= 0.14.4"; }
|
||||||
QString shortname() const { return "libtorrent-rasterbar"; }
|
QString shortname() const { return "libtorrent-rasterbar"; }
|
||||||
bool exec(){
|
bool exec(){
|
||||||
QStringList incs;
|
QStringList incs;
|
||||||
QString req_ver = "0.15.0";
|
QString req_ver = "0.14.4";
|
||||||
QString version, libs, other;
|
QString version, libs, other;
|
||||||
VersionMode mode = VersionMin;
|
VersionMode mode = VersionMin;
|
||||||
if(!conf->findPkgConfig("libtorrent-rasterbar", mode, req_ver, &version, &incs, &libs, &other))
|
if(!conf->findPkgConfig("libtorrent-rasterbar", mode, req_ver, &version, &incs, &libs, &other))
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ 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.15.0"; }
|
QString name() const { return "libtorrent-rasterbar >= 0.14.4"; }
|
||||||
QString shortname() const { return "libtorrent-rasterbar"; }
|
QString shortname() const { return "libtorrent-rasterbar"; }
|
||||||
bool exec(){
|
bool exec(){
|
||||||
QStringList incs;
|
QStringList incs;
|
||||||
QString req_ver = "0.15.0";
|
QString req_ver = "0.14.4";
|
||||||
QString version, libs, other;
|
QString version, libs, other;
|
||||||
VersionMode mode = VersionMin;
|
VersionMode mode = VersionMin;
|
||||||
if(!conf->findPkgConfig("libtorrent-rasterbar", mode, req_ver, &version, &incs, &libs, &other))
|
if(!conf->findPkgConfig("libtorrent-rasterbar", mode, req_ver, &version, &incs, &libs, &other))
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
-----BEGIN QCMOD-----
|
-----BEGIN QCMOD-----
|
||||||
name: Qt >= 4.6
|
name: Qt >= 4.5
|
||||||
arg: enable-debug, Enable debug mode
|
arg: enable-debug, Enable debug mode
|
||||||
arg: disable-gui, Disable qBittorrent Graphical user interface for headless running
|
arg: disable-gui, Disable qBittorrent Graphical user interface for headless running
|
||||||
-----END QCMOD-----
|
-----END QCMOD-----
|
||||||
@@ -9,8 +9,8 @@ class qc_qt4 : public ConfObj
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
qc_qt4(Conf *c) : ConfObj(c) {}
|
qc_qt4(Conf *c) : ConfObj(c) {}
|
||||||
QString name() const { return "Qt >= 4.6"; }
|
QString name() const { return "Qt >= 4.5"; }
|
||||||
QString shortname() const { return "Qt 4.6"; }
|
QString shortname() const { return "Qt 4.5"; }
|
||||||
bool exec()
|
bool exec()
|
||||||
{
|
{
|
||||||
// NOX mode
|
// NOX mode
|
||||||
@@ -31,6 +31,6 @@ public:
|
|||||||
#else
|
#else
|
||||||
conf->addExtra("MANPREFIX = $$PREFIX/share");
|
conf->addExtra("MANPREFIX = $$PREFIX/share");
|
||||||
#endif
|
#endif
|
||||||
return(QT_VERSION >= 0x040600);
|
return(QT_VERSION >= 0x040500);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>3.0.0</string>
|
<string>2.9.10</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>qBit</string>
|
<string>qBit</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class about : public QDialog, private Ui::AboutDlg{
|
|||||||
qDebug("Deleting about dlg");
|
qDebug("Deleting about dlg");
|
||||||
}
|
}
|
||||||
|
|
||||||
about(QWidget *parent): QDialog(parent) {
|
about(QWidget *parent): QDialog(parent){
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
// Set icons
|
// Set icons
|
||||||
@@ -95,13 +95,13 @@ class about : public QDialog, private Ui::AboutDlg{
|
|||||||
<li><u>Spanish:</u> Francisco Luque Contreras (frannoe@ya.com)</li>\
|
<li><u>Spanish:</u> Francisco Luque Contreras (frannoe@ya.com)</li>\
|
||||||
<li><u>Swedish:</u> Daniel Nylander (po@danielnylander.se)</li>\
|
<li><u>Swedish:</u> Daniel Nylander (po@danielnylander.se)</li>\
|
||||||
<li><u>Turkish:</u> Hasan YILMAZ (iletisim@hedefturkce.com) and Erdem Bingöl (erdem84@gmail.com)</li>\
|
<li><u>Turkish:</u> Hasan YILMAZ (iletisim@hedefturkce.com) and Erdem Bingöl (erdem84@gmail.com)</li>\
|
||||||
<li><u>Ukrainian:</u> Oleh Prypin (blaxpirit@gmail.com)</li></ul>");
|
<li><u>Ukrainian:</u> Andrey Shpachenko (masterfix@users.sourceforge.net) and Oleh Prypin (blaxpirit@gmail.com)</li></ul>");
|
||||||
trans_txt += "<p>"+tr("Please contact me if you would like to translate qBittorrent into your own language.")+"</p>";
|
trans_txt += "<p>"+tr("Please contact me if you would like to translate qBittorrent into your own language.")+"</p>";
|
||||||
te_translation->setHtml(trans_txt);
|
te_translation->setHtml(trans_txt);
|
||||||
// License
|
// License
|
||||||
te_license->append(QString::fromUtf8("<a name='top'></a>"));
|
te_license->append(QString::fromUtf8("<a name='top'></a>"));
|
||||||
QFile licensefile(":/gpl.html");
|
QFile licensefile(":/gpl.html");
|
||||||
if (licensefile.open(QIODevice::ReadOnly|QIODevice::Text)) {
|
if(licensefile.open(QIODevice::ReadOnly|QIODevice::Text)) {
|
||||||
te_license->setHtml(licensefile.readAll());
|
te_license->setHtml(licensefile.readAll());
|
||||||
licensefile.close();
|
licensefile.close();
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -59,7 +59,7 @@ class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg {
|
|||||||
|
|
||||||
static bool askForDeletionConfirmation(bool *delete_local_files) {
|
static bool askForDeletionConfirmation(bool *delete_local_files) {
|
||||||
DeletionConfirmationDlg dlg;
|
DeletionConfirmationDlg dlg;
|
||||||
if (dlg.exec() == QDialog::Accepted) {
|
if(dlg.exec() == QDialog::Accepted) {
|
||||||
*delete_local_files = dlg.shouldDeleteLocalFiles();
|
*delete_local_files = dlg.shouldDeleteLocalFiles();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ DNSUpdater::DNSUpdater(QObject *parent) :
|
|||||||
m_ipCheckTimer.start();
|
m_ipCheckTimer.start();
|
||||||
|
|
||||||
// Check lastUpdate to avoid flooding
|
// Check lastUpdate to avoid flooding
|
||||||
if (!m_lastIPCheckTime.isValid() ||
|
if(!m_lastIPCheckTime.isValid() ||
|
||||||
m_lastIPCheckTime.secsTo(QDateTime::currentDateTime())*1000 > IP_CHECK_INTERVAL_MS) {
|
m_lastIPCheckTime.secsTo(QDateTime::currentDateTime())*1000 > IP_CHECK_INTERVAL_MS) {
|
||||||
checkPublicIP();
|
checkPublicIP();
|
||||||
}
|
}
|
||||||
@@ -79,19 +79,19 @@ void DNSUpdater::checkPublicIP()
|
|||||||
void DNSUpdater::ipRequestFinished(QNetworkReply *reply)
|
void DNSUpdater::ipRequestFinished(QNetworkReply *reply)
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
if (reply->error()) {
|
if(reply->error()) {
|
||||||
// Error
|
// Error
|
||||||
qWarning() << Q_FUNC_INFO << "Error:" << reply->errorString();
|
qWarning() << Q_FUNC_INFO << "Error:" << reply->errorString();
|
||||||
} else {
|
} else {
|
||||||
// Parse response
|
// Parse response
|
||||||
QRegExp ipregex("Current IP Address:\\s+([^<]+)</body>");
|
QRegExp ipregex("Current IP Address:\\s+([^<]+)</body>");
|
||||||
QString ret = reply->readAll();
|
QString ret = reply->readAll();
|
||||||
if (ipregex.indexIn(ret) >= 0) {
|
if(ipregex.indexIn(ret) >= 0) {
|
||||||
QString ip_str = ipregex.cap(1);
|
QString ip_str = ipregex.cap(1);
|
||||||
qDebug() << Q_FUNC_INFO << "Regular expression captured the following IP:" << ip_str;
|
qDebug() << Q_FUNC_INFO << "Regular expression captured the following IP:" << ip_str;
|
||||||
QHostAddress new_ip(ip_str);
|
QHostAddress new_ip(ip_str);
|
||||||
if (!new_ip.isNull()) {
|
if(!new_ip.isNull()) {
|
||||||
if (m_lastIP != new_ip) {
|
if(m_lastIP != new_ip) {
|
||||||
qDebug() << Q_FUNC_INFO << "The IP address changed, report the change to DynDNS...";
|
qDebug() << Q_FUNC_INFO << "The IP address changed, report the change to DynDNS...";
|
||||||
qDebug() << m_lastIP.toString() << "->" << new_ip.toString();
|
qDebug() << m_lastIP.toString() << "->" << new_ip.toString();
|
||||||
m_lastIP = new_ip;
|
m_lastIP = new_ip;
|
||||||
@@ -157,7 +157,7 @@ QUrl DNSUpdater::getUpdateUrl() const
|
|||||||
|
|
||||||
void DNSUpdater::ipUpdateFinished(QNetworkReply *reply)
|
void DNSUpdater::ipUpdateFinished(QNetworkReply *reply)
|
||||||
{
|
{
|
||||||
if (reply->error()) {
|
if(reply->error()) {
|
||||||
// Error
|
// Error
|
||||||
qWarning() << Q_FUNC_INFO << "Error:" << reply->errorString();
|
qWarning() << Q_FUNC_INFO << "Error:" << reply->errorString();
|
||||||
} else {
|
} else {
|
||||||
@@ -174,11 +174,11 @@ void DNSUpdater::processIPUpdateReply(const QString &reply)
|
|||||||
qDebug() << Q_FUNC_INFO << reply;
|
qDebug() << Q_FUNC_INFO << reply;
|
||||||
QString code = reply.split(" ").first();
|
QString code = reply.split(" ").first();
|
||||||
qDebug() << Q_FUNC_INFO << "Code:" << code;
|
qDebug() << Q_FUNC_INFO << "Code:" << code;
|
||||||
if (code == "good" || code == "nochg") {
|
if(code == "good" || code == "nochg") {
|
||||||
QBtSession::instance()->addConsoleMessage(tr("Your dynamic DNS was successfully updated."), "green");
|
QBtSession::instance()->addConsoleMessage(tr("Your dynamic DNS was successfuly updated."), "green");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (code == "911" || code == "dnserr") {
|
if(code == "911" || code == "dnserr") {
|
||||||
QBtSession::instance()->addConsoleMessage(tr("Dynamic DNS error: The service is temporarily unavailable, it will be retried in 30 minutes."),
|
QBtSession::instance()->addConsoleMessage(tr("Dynamic DNS error: The service is temporarily unavailable, it will be retried in 30 minutes."),
|
||||||
"red");
|
"red");
|
||||||
m_lastIP.clear();
|
m_lastIP.clear();
|
||||||
@@ -188,30 +188,30 @@ void DNSUpdater::processIPUpdateReply(const QString &reply)
|
|||||||
// Everything bellow is an error, stop updating until the user updates something
|
// Everything bellow is an error, stop updating until the user updates something
|
||||||
m_ipCheckTimer.stop();
|
m_ipCheckTimer.stop();
|
||||||
m_lastIP.clear();
|
m_lastIP.clear();
|
||||||
if (code == "nohost") {
|
if(code == "nohost") {
|
||||||
QBtSession::instance()->addConsoleMessage(tr("Dynamic DNS error: hostname supplied does not exist under specified account."),
|
QBtSession::instance()->addConsoleMessage(tr("Dynamic DNS error: hostname supplied does not exist under specified account."),
|
||||||
"red");
|
"red");
|
||||||
m_state = INVALID_CREDS;
|
m_state = INVALID_CREDS;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (code == "badauth") {
|
if(code == "badauth") {
|
||||||
QBtSession::instance()->addConsoleMessage(tr("Dynamic DNS error: Invalid username/password."), "red");
|
QBtSession::instance()->addConsoleMessage(tr("Dynamic DNS error: Invalid username/password."), "red");
|
||||||
m_state = INVALID_CREDS;
|
m_state = INVALID_CREDS;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (code == "badagent") {
|
if(code == "badagent") {
|
||||||
QBtSession::instance()->addConsoleMessage(tr("Dynamic DNS error: qBittorrent was blacklisted by the service, please report a bug at http://bugs.qbittorrent.org."),
|
QBtSession::instance()->addConsoleMessage(tr("Dynamic DNS error: qBittorrent was blacklisted by the service, please report a bug at http://bugs.qbittorrent.org."),
|
||||||
"red");
|
"red");
|
||||||
m_state = FATAL;
|
m_state = FATAL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (code == "!donator") {
|
if(code == "!donator") {
|
||||||
QBtSession::instance()->addConsoleMessage(tr("Dynamic DNS error: %1 was returned by the service, please report a bug at http://bugs.qbittorrent.org.").arg("!donator"),
|
QBtSession::instance()->addConsoleMessage(tr("Dynamic DNS error: %1 was returned by the service, please report a bug at http://bugs.qbittorrent.org.").arg("!donator"),
|
||||||
"red");
|
"red");
|
||||||
m_state = FATAL;
|
m_state = FATAL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (code == "abuse") {
|
if(code == "abuse") {
|
||||||
QBtSession::instance()->addConsoleMessage(tr("Dynamic DNS error: Your username was blocked due to abuse."),
|
QBtSession::instance()->addConsoleMessage(tr("Dynamic DNS error: Your username was blocked due to abuse."),
|
||||||
"red");
|
"red");
|
||||||
m_state = FATAL;
|
m_state = FATAL;
|
||||||
@@ -221,18 +221,18 @@ void DNSUpdater::processIPUpdateReply(const QString &reply)
|
|||||||
|
|
||||||
void DNSUpdater::updateCredentials()
|
void DNSUpdater::updateCredentials()
|
||||||
{
|
{
|
||||||
if (m_state == FATAL) return;
|
if(m_state == FATAL) return;
|
||||||
Preferences pref;
|
Preferences pref;
|
||||||
bool change = false;
|
bool change = false;
|
||||||
// Get DNS service information
|
// Get DNS service information
|
||||||
if (m_service != pref.getDynDNSService()) {
|
if(m_service != pref.getDynDNSService()) {
|
||||||
m_service = pref.getDynDNSService();
|
m_service = pref.getDynDNSService();
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
if (m_domain != pref.getDynDomainName()) {
|
if(m_domain != pref.getDynDomainName()) {
|
||||||
m_domain = pref.getDynDomainName();
|
m_domain = pref.getDynDomainName();
|
||||||
QRegExp domain_regex("^(?:(?!\\d|-)[a-zA-Z0-9\\-]{1,63}\\.)+[a-zA-Z]{2,}$");
|
QRegExp domain_regex("^(?:(?!\\d|-)[a-zA-Z0-9\\-]{1,63}\\.)+[a-zA-Z]{2,}$");
|
||||||
if (domain_regex.indexIn(m_domain) < 0) {
|
if(domain_regex.indexIn(m_domain) < 0) {
|
||||||
QBtSession::instance()->addConsoleMessage(tr("Dynamic DNS error: supplied domain name is invalid."),
|
QBtSession::instance()->addConsoleMessage(tr("Dynamic DNS error: supplied domain name is invalid."),
|
||||||
"red");
|
"red");
|
||||||
m_lastIP.clear();
|
m_lastIP.clear();
|
||||||
@@ -242,9 +242,9 @@ void DNSUpdater::updateCredentials()
|
|||||||
}
|
}
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
if (m_username != pref.getDynDNSUsername()) {
|
if(m_username != pref.getDynDNSUsername()) {
|
||||||
m_username = pref.getDynDNSUsername();
|
m_username = pref.getDynDNSUsername();
|
||||||
if (m_username.length() < 4) {
|
if(m_username.length() < 4) {
|
||||||
QBtSession::instance()->addConsoleMessage(tr("Dynamic DNS error: supplied username is too short."),
|
QBtSession::instance()->addConsoleMessage(tr("Dynamic DNS error: supplied username is too short."),
|
||||||
"red");
|
"red");
|
||||||
m_lastIP.clear();
|
m_lastIP.clear();
|
||||||
@@ -254,9 +254,9 @@ void DNSUpdater::updateCredentials()
|
|||||||
}
|
}
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
if (m_password != pref.getDynDNSPassword()) {
|
if(m_password != pref.getDynDNSPassword()) {
|
||||||
m_password = pref.getDynDNSPassword();
|
m_password = pref.getDynDNSPassword();
|
||||||
if (m_password.length() < 4) {
|
if(m_password.length() < 4) {
|
||||||
QBtSession::instance()->addConsoleMessage(tr("Dynamic DNS error: supplied password is too short."),
|
QBtSession::instance()->addConsoleMessage(tr("Dynamic DNS error: supplied password is too short."),
|
||||||
"red");
|
"red");
|
||||||
m_lastIP.clear();
|
m_lastIP.clear();
|
||||||
@@ -267,7 +267,7 @@ void DNSUpdater::updateCredentials()
|
|||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_state == INVALID_CREDS && change) {
|
if(m_state == INVALID_CREDS && change) {
|
||||||
m_state = OK; // Try again
|
m_state = OK; // Try again
|
||||||
m_ipCheckTimer.start();
|
m_ipCheckTimer.start();
|
||||||
checkPublicIP();
|
checkPublicIP();
|
||||||
|
|||||||
@@ -43,38 +43,38 @@ class downloadFromURL : public QDialog, private Ui::downloadFromURL{
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
downloadFromURL(QWidget *parent): QDialog(parent) {
|
downloadFromURL(QWidget *parent): QDialog(parent){
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
setModal(true);
|
setModal(true);
|
||||||
show();
|
show();
|
||||||
// Paste clipboard if there is an URL in it
|
// Paste clipboard if there is an URL in it
|
||||||
QString clip_txt = qApp->clipboard()->text();
|
QString clip_txt = qApp->clipboard()->text();
|
||||||
if (clip_txt.startsWith("http://", Qt::CaseInsensitive) || clip_txt.startsWith("https://", Qt::CaseInsensitive) || clip_txt.startsWith("ftp://", Qt::CaseInsensitive) || clip_txt.startsWith("magnet:", Qt::CaseInsensitive) || clip_txt.startsWith("bc://bt/", Qt::CaseInsensitive)) {
|
if(clip_txt.startsWith("http://", Qt::CaseInsensitive) || clip_txt.startsWith("https://", Qt::CaseInsensitive) || clip_txt.startsWith("ftp://", Qt::CaseInsensitive) || clip_txt.startsWith("magnet:", Qt::CaseInsensitive) || clip_txt.startsWith("bc://bt/", Qt::CaseInsensitive)) {
|
||||||
textUrls->setText(clip_txt);
|
textUrls->setText(clip_txt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~downloadFromURL() {}
|
~downloadFromURL(){}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void urlsReadyToBeDownloaded(const QStringList& torrent_urls);
|
void urlsReadyToBeDownloaded(const QStringList& torrent_urls);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void on_downloadButton_clicked() {
|
void on_downloadButton_clicked(){
|
||||||
QString urls = textUrls->toPlainText();
|
QString urls = textUrls->toPlainText();
|
||||||
QStringList url_list = urls.split(QString::fromUtf8("\n"));
|
QStringList url_list = urls.split(QString::fromUtf8("\n"));
|
||||||
QString url;
|
QString url;
|
||||||
QStringList url_list_cleaned;
|
QStringList url_list_cleaned;
|
||||||
foreach (url, url_list) {
|
foreach(url, url_list){
|
||||||
url = url.trimmed();
|
url = url.trimmed();
|
||||||
if (!url.isEmpty()) {
|
if(!url.isEmpty()){
|
||||||
if (url_list_cleaned.indexOf(QRegExp(url, Qt::CaseInsensitive, QRegExp::FixedString)) < 0) {
|
if(url_list_cleaned.indexOf(QRegExp(url, Qt::CaseInsensitive, QRegExp::FixedString)) < 0){
|
||||||
url_list_cleaned << url;
|
url_list_cleaned << url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!url_list_cleaned.size()) {
|
if(!url_list_cleaned.size()){
|
||||||
QMessageBox::critical(0, tr("No URL entered"), tr("Please type at least one URL."));
|
QMessageBox::critical(0, tr("No URL entered"), tr("Please type at least one URL."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -83,7 +83,7 @@ class downloadFromURL : public QDialog, private Ui::downloadFromURL{
|
|||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_cancelButton_clicked() {
|
void on_cancelButton_clicked(){
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ void DownloadThread::processDlFinished(QNetworkReply* reply) {
|
|||||||
QString url = reply->url().toString();
|
QString url = reply->url().toString();
|
||||||
qDebug("Download finished: %s", qPrintable(url));
|
qDebug("Download finished: %s", qPrintable(url));
|
||||||
// Check if the request was successful
|
// Check if the request was successful
|
||||||
if (reply->error() != QNetworkReply::NoError) {
|
if(reply->error() != QNetworkReply::NoError) {
|
||||||
// Failure
|
// Failure
|
||||||
qDebug("Download failure (%s), reason: %s", qPrintable(url), qPrintable(errorCodeToString(reply->error())));
|
qDebug("Download failure (%s), reason: %s", qPrintable(url), qPrintable(errorCodeToString(reply->error())));
|
||||||
emit downloadFailure(url, errorCodeToString(reply->error()));
|
emit downloadFailure(url, errorCodeToString(reply->error()));
|
||||||
@@ -63,7 +63,7 @@ void DownloadThread::processDlFinished(QNetworkReply* reply) {
|
|||||||
}
|
}
|
||||||
// Check if the server ask us to redirect somewhere lese
|
// Check if the server ask us to redirect somewhere lese
|
||||||
const QVariant redirection = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
|
const QVariant redirection = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
|
||||||
if (redirection.isValid()) {
|
if(redirection.isValid()) {
|
||||||
// We should redirect
|
// We should redirect
|
||||||
QUrl newUrl = redirection.toUrl();
|
QUrl newUrl = redirection.toUrl();
|
||||||
// Resolve relative urls
|
// Resolve relative urls
|
||||||
@@ -77,7 +77,7 @@ void DownloadThread::processDlFinished(QNetworkReply* reply) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Checking if it was redirected, restoring initial URL
|
// Checking if it was redirected, restoring initial URL
|
||||||
if (m_redirectMapping.contains(url)) {
|
if(m_redirectMapping.contains(url)) {
|
||||||
url = m_redirectMapping.take(url);
|
url = m_redirectMapping.take(url);
|
||||||
}
|
}
|
||||||
// Success
|
// Success
|
||||||
@@ -86,7 +86,7 @@ void DownloadThread::processDlFinished(QNetworkReply* reply) {
|
|||||||
if (tmpfile->open()) {
|
if (tmpfile->open()) {
|
||||||
QString filePath = tmpfile->fileName();
|
QString filePath = tmpfile->fileName();
|
||||||
qDebug("Temporary filename is: %s", qPrintable(filePath));
|
qDebug("Temporary filename is: %s", qPrintable(filePath));
|
||||||
if (reply->isOpen() || reply->open(QIODevice::ReadOnly)) {
|
if(reply->isOpen() || reply->open(QIODevice::ReadOnly)) {
|
||||||
// TODO: Support GZIP compression
|
// TODO: Support GZIP compression
|
||||||
tmpfile->write(reply->readAll());
|
tmpfile->write(reply->readAll());
|
||||||
tmpfile->close();
|
tmpfile->close();
|
||||||
@@ -132,7 +132,7 @@ QNetworkReply* DownloadThread::downloadUrl(const QString &url, const QList<QNetw
|
|||||||
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");
|
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...", request.url().toEncoded().data());
|
qDebug("Downloading %s...", request.url().toEncoded().data());
|
||||||
qDebug("%d cookies for this URL", m_networkManager.cookieJar()->cookiesForUrl(url).size());
|
qDebug("%d cookies for this URL", m_networkManager.cookieJar()->cookiesForUrl(url).size());
|
||||||
for (int i=0; i<m_networkManager.cookieJar()->cookiesForUrl(url).size(); ++i) {
|
for(int i=0; i<m_networkManager.cookieJar()->cookiesForUrl(url).size(); ++i) {
|
||||||
qDebug("%s=%s", m_networkManager.cookieJar()->cookiesForUrl(url).at(i).name().data(), m_networkManager.cookieJar()->cookiesForUrl(url).at(i).value().data());
|
qDebug("%s=%s", m_networkManager.cookieJar()->cookiesForUrl(url).at(i).name().data(), m_networkManager.cookieJar()->cookiesForUrl(url).at(i).value().data());
|
||||||
qDebug("Domain: %s, Path: %s", qPrintable(m_networkManager.cookieJar()->cookiesForUrl(url).at(i).domain()), qPrintable(m_networkManager.cookieJar()->cookiesForUrl(url).at(i).path()));
|
qDebug("Domain: %s, Path: %s", qPrintable(m_networkManager.cookieJar()->cookiesForUrl(url).at(i).domain()), qPrintable(m_networkManager.cookieJar()->cookiesForUrl(url).at(i).path()));
|
||||||
}
|
}
|
||||||
@@ -141,10 +141,10 @@ QNetworkReply* DownloadThread::downloadUrl(const QString &url, const QList<QNetw
|
|||||||
|
|
||||||
void DownloadThread::checkDownloadSize(qint64 bytesReceived, qint64 bytesTotal) {
|
void DownloadThread::checkDownloadSize(qint64 bytesReceived, qint64 bytesTotal) {
|
||||||
QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
|
QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
|
||||||
if (!reply) return;
|
if(!reply) return;
|
||||||
if (bytesTotal > 0) {
|
if(bytesTotal > 0) {
|
||||||
// Total number of bytes is available
|
// Total number of bytes is available
|
||||||
if (bytesTotal > 1048576) {
|
if(bytesTotal > 1048576) {
|
||||||
// More than 1MB, this is probably not a torrent file, aborting...
|
// More than 1MB, this is probably not a torrent file, aborting...
|
||||||
reply->abort();
|
reply->abort();
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
@@ -152,7 +152,7 @@ void DownloadThread::checkDownloadSize(qint64 bytesReceived, qint64 bytesTotal)
|
|||||||
disconnect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(checkDownloadSize(qint64,qint64)));
|
disconnect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(checkDownloadSize(qint64,qint64)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (bytesReceived > 1048576) {
|
if(bytesReceived > 1048576) {
|
||||||
// More than 1MB, this is probably not a torrent file, aborting...
|
// More than 1MB, this is probably not a torrent file, aborting...
|
||||||
reply->abort();
|
reply->abort();
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
@@ -163,13 +163,13 @@ void DownloadThread::checkDownloadSize(qint64 bytesReceived, qint64 bytesTotal)
|
|||||||
void DownloadThread::applyProxySettings() {
|
void DownloadThread::applyProxySettings() {
|
||||||
QNetworkProxy proxy;
|
QNetworkProxy proxy;
|
||||||
const Preferences pref;
|
const Preferences pref;
|
||||||
if (pref.isProxyEnabled()) {
|
if(pref.isProxyEnabled()) {
|
||||||
// Proxy enabled
|
// Proxy enabled
|
||||||
proxy.setHostName(pref.getProxyIp());
|
proxy.setHostName(pref.getProxyIp());
|
||||||
proxy.setPort(pref.getProxyPort());
|
proxy.setPort(pref.getProxyPort());
|
||||||
// Default proxy type is HTTP, we must change if it is SOCKS5
|
// Default proxy type is HTTP, we must change if it is SOCKS5
|
||||||
const int proxy_type = pref.getProxyType();
|
const int proxy_type = pref.getProxyType();
|
||||||
if (proxy_type == Proxy::SOCKS5 || proxy_type == Proxy::SOCKS5_PW) {
|
if(proxy_type == Proxy::SOCKS5 || proxy_type == Proxy::SOCKS5_PW) {
|
||||||
qDebug() << Q_FUNC_INFO << "using SOCKS proxy";
|
qDebug() << Q_FUNC_INFO << "using SOCKS proxy";
|
||||||
proxy.setType(QNetworkProxy::Socks5Proxy);
|
proxy.setType(QNetworkProxy::Socks5Proxy);
|
||||||
} else {
|
} else {
|
||||||
@@ -177,7 +177,7 @@ void DownloadThread::applyProxySettings() {
|
|||||||
proxy.setType(QNetworkProxy::HttpProxy);
|
proxy.setType(QNetworkProxy::HttpProxy);
|
||||||
}
|
}
|
||||||
// Authentication?
|
// Authentication?
|
||||||
if (pref.isProxyAuthEnabled()) {
|
if(pref.isProxyAuthEnabled()) {
|
||||||
qDebug("Proxy requires authentication, authenticating");
|
qDebug("Proxy requires authentication, authenticating");
|
||||||
proxy.setUser(pref.getProxyUsername());
|
proxy.setUser(pref.getProxyUsername());
|
||||||
proxy.setPassword(pref.getProxyPassword());
|
proxy.setPassword(pref.getProxyPassword());
|
||||||
@@ -189,7 +189,7 @@ void DownloadThread::applyProxySettings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString DownloadThread::errorCodeToString(QNetworkReply::NetworkError status) {
|
QString DownloadThread::errorCodeToString(QNetworkReply::NetworkError status) {
|
||||||
switch(status) {
|
switch(status){
|
||||||
case QNetworkReply::HostNotFoundError:
|
case QNetworkReply::HostNotFoundError:
|
||||||
return tr("The remote host name was not found (invalid hostname)");
|
return tr("The remote host name was not found (invalid hostname)");
|
||||||
case QNetworkReply::OperationCanceledError:
|
case QNetworkReply::OperationCanceledError:
|
||||||
|
|||||||
@@ -50,10 +50,10 @@ ExecutionLog::ExecutionLog(QWidget *parent) :
|
|||||||
ui->tabBan->layout()->addWidget(m_banList);
|
ui->tabBan->layout()->addWidget(m_banList);
|
||||||
|
|
||||||
const QStringList log_msgs = QBtSession::instance()->getConsoleMessages();
|
const QStringList log_msgs = QBtSession::instance()->getConsoleMessages();
|
||||||
foreach (const QString& msg, log_msgs)
|
foreach(const QString& msg, log_msgs)
|
||||||
addLogMessage(msg);
|
addLogMessage(msg);
|
||||||
const QStringList ban_msgs = QBtSession::instance()->getPeerBanMessages();
|
const QStringList ban_msgs = QBtSession::instance()->getPeerBanMessages();
|
||||||
foreach (const QString& msg, ban_msgs)
|
foreach(const QString& msg, ban_msgs)
|
||||||
addBanMessage(msg);
|
addBanMessage(msg);
|
||||||
connect(QBtSession::instance(), SIGNAL(newConsoleMessage(QString)), SLOT(addLogMessage(QString)));
|
connect(QBtSession::instance(), SIGNAL(newConsoleMessage(QString)), SLOT(addLogMessage(QString)));
|
||||||
connect(QBtSession::instance(), SIGNAL(newBanMessage(QString)), SLOT(addBanMessage(QString)));
|
connect(QBtSession::instance(), SIGNAL(newBanMessage(QString)), SLOT(addBanMessage(QString)));
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "fs_utils.h"
|
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
#ifndef CIFS_MAGIC_NUMBER
|
#ifndef CIFS_MAGIC_NUMBER
|
||||||
@@ -60,11 +59,11 @@ private:
|
|||||||
private:
|
private:
|
||||||
static bool isNetworkFileSystem(QString path) {
|
static bool isNetworkFileSystem(QString path) {
|
||||||
QString file = path;
|
QString file = path;
|
||||||
if (!file.endsWith(QDir::separator()))
|
if(!file.endsWith(QDir::separator()))
|
||||||
file += QDir::separator();
|
file += QDir::separator();
|
||||||
file += ".";
|
file += ".";
|
||||||
struct statfs buf;
|
struct statfs buf;
|
||||||
if (!statfs(file.toLocal8Bit().constData(), &buf)) {
|
if(!statfs(file.toLocal8Bit().constData(), &buf)) {
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
// XXX: should we make sure HAVE_STRUCT_FSSTAT_F_FSTYPENAME is defined?
|
// XXX: should we make sure HAVE_STRUCT_FSSTAT_F_FSTYPENAME is defined?
|
||||||
return (strcmp(buf.f_fstypename, "nfs") == 0 || strcmp(buf.f_fstypename, "cifs") == 0 || strcmp(buf.f_fstypename, "smbfs") == 0);
|
return (strcmp(buf.f_fstypename, "nfs") == 0 || strcmp(buf.f_fstypename, "cifs") == 0 || strcmp(buf.f_fstypename, "smbfs") == 0);
|
||||||
@@ -119,23 +118,23 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
FileSystemWatcher(QObject *parent): QFileSystemWatcher(parent) {
|
FileSystemWatcher(QObject *parent): QFileSystemWatcher(parent) {
|
||||||
m_filters << "*.torrent" << "*.magnet";
|
m_filters << "*.torrent";
|
||||||
connect(this, SIGNAL(directoryChanged(QString)), this, SLOT(scanLocalFolder(QString)));
|
connect(this, SIGNAL(directoryChanged(QString)), this, SLOT(scanLocalFolder(QString)));
|
||||||
}
|
}
|
||||||
|
|
||||||
~FileSystemWatcher() {
|
~FileSystemWatcher() {
|
||||||
#ifndef Q_WS_WIN
|
#ifndef Q_WS_WIN
|
||||||
if (watch_timer)
|
if(watch_timer)
|
||||||
delete watch_timer;
|
delete watch_timer;
|
||||||
#endif
|
#endif
|
||||||
if (m_partialTorrentTimer)
|
if(m_partialTorrentTimer)
|
||||||
delete m_partialTorrentTimer;
|
delete m_partialTorrentTimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList directories() const {
|
QStringList directories() const {
|
||||||
QStringList dirs;
|
QStringList dirs;
|
||||||
#ifndef Q_WS_WIN
|
#ifndef Q_WS_WIN
|
||||||
if (watch_timer) {
|
if(watch_timer) {
|
||||||
foreach (const QDir &dir, watched_folders)
|
foreach (const QDir &dir, watched_folders)
|
||||||
dirs << dir.canonicalPath();
|
dirs << dir.canonicalPath();
|
||||||
}
|
}
|
||||||
@@ -150,7 +149,7 @@ public:
|
|||||||
if (!dir.exists())
|
if (!dir.exists())
|
||||||
return;
|
return;
|
||||||
// Check if the path points to a network file system or not
|
// Check if the path points to a network file system or not
|
||||||
if (isNetworkFileSystem(path)) {
|
if(isNetworkFileSystem(path)) {
|
||||||
// Network mode
|
// Network mode
|
||||||
qDebug("Network folder detected: %s", qPrintable(path));
|
qDebug("Network folder detected: %s", qPrintable(path));
|
||||||
qDebug("Using file polling mode instead of inotify...");
|
qDebug("Using file polling mode instead of inotify...");
|
||||||
@@ -195,7 +194,7 @@ protected slots:
|
|||||||
// Local folders scan
|
// Local folders scan
|
||||||
addTorrentsFromDir(QDir(path), torrents);
|
addTorrentsFromDir(QDir(path), torrents);
|
||||||
// Report detected torrent files
|
// Report detected torrent files
|
||||||
if (!torrents.empty()) {
|
if(!torrents.empty()) {
|
||||||
qDebug("The following files are being reported: %s", qPrintable(torrents.join("\n")));
|
qDebug("The following files are being reported: %s", qPrintable(torrents.join("\n")));
|
||||||
emit torrentsAdded(torrents);
|
emit torrentsAdded(torrents);
|
||||||
}
|
}
|
||||||
@@ -211,7 +210,7 @@ protected slots:
|
|||||||
addTorrentsFromDir(dir, torrents);
|
addTorrentsFromDir(dir, torrents);
|
||||||
}
|
}
|
||||||
// Report detected torrent files
|
// Report detected torrent files
|
||||||
if (!torrents.empty()) {
|
if(!torrents.empty()) {
|
||||||
qDebug("The following files are being reported: %s", qPrintable(torrents.join("\n")));
|
qDebug("The following files are being reported: %s", qPrintable(torrents.join("\n")));
|
||||||
emit torrentsAdded(torrents);
|
emit torrentsAdded(torrents);
|
||||||
}
|
}
|
||||||
@@ -222,16 +221,16 @@ protected slots:
|
|||||||
QStringList no_longer_partial;
|
QStringList no_longer_partial;
|
||||||
|
|
||||||
// Check which torrents are still partial
|
// Check which torrents are still partial
|
||||||
foreach (const QString& torrent_path, m_partialTorrents.keys()) {
|
foreach(const QString& torrent_path, m_partialTorrents.keys()) {
|
||||||
if (!QFile::exists(torrent_path)) {
|
if(!QFile::exists(torrent_path)) {
|
||||||
m_partialTorrents.remove(torrent_path);
|
m_partialTorrents.remove(torrent_path);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (fsutils::isValidTorrentFile(torrent_path)) {
|
if(misc::isValidTorrentFile(torrent_path)) {
|
||||||
no_longer_partial << torrent_path;
|
no_longer_partial << torrent_path;
|
||||||
m_partialTorrents.remove(torrent_path);
|
m_partialTorrents.remove(torrent_path);
|
||||||
} else {
|
} else {
|
||||||
if (m_partialTorrents[torrent_path] >= MAX_PARTIAL_RETRIES) {
|
if(m_partialTorrents[torrent_path] >= MAX_PARTIAL_RETRIES) {
|
||||||
m_partialTorrents.remove(torrent_path);
|
m_partialTorrents.remove(torrent_path);
|
||||||
QFile::rename(torrent_path, torrent_path+".invalid");
|
QFile::rename(torrent_path, torrent_path+".invalid");
|
||||||
} else {
|
} else {
|
||||||
@@ -241,7 +240,7 @@ protected slots:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Stop the partial timer if necessary
|
// Stop the partial timer if necessary
|
||||||
if (m_partialTorrents.empty()) {
|
if(m_partialTorrents.empty()) {
|
||||||
m_partialTorrentTimer->stop();
|
m_partialTorrentTimer->stop();
|
||||||
m_partialTorrentTimer->deleteLater();
|
m_partialTorrentTimer->deleteLater();
|
||||||
qDebug("No longer any partial torrent.");
|
qDebug("No longer any partial torrent.");
|
||||||
@@ -250,7 +249,7 @@ protected slots:
|
|||||||
m_partialTorrentTimer->start(WATCH_INTERVAL);
|
m_partialTorrentTimer->start(WATCH_INTERVAL);
|
||||||
}
|
}
|
||||||
// Notify of new torrents
|
// Notify of new torrents
|
||||||
if (!no_longer_partial.isEmpty())
|
if(!no_longer_partial.isEmpty())
|
||||||
emit torrentsAdded(no_longer_partial);
|
emit torrentsAdded(no_longer_partial);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,7 +259,7 @@ signals:
|
|||||||
private:
|
private:
|
||||||
void startPartialTorrentTimer() {
|
void startPartialTorrentTimer() {
|
||||||
Q_ASSERT(!m_partialTorrents.isEmpty());
|
Q_ASSERT(!m_partialTorrents.isEmpty());
|
||||||
if (!m_partialTorrentTimer) {
|
if(!m_partialTorrentTimer) {
|
||||||
m_partialTorrentTimer = new QTimer();
|
m_partialTorrentTimer = new QTimer();
|
||||||
connect(m_partialTorrentTimer, SIGNAL(timeout()), SLOT(processPartialTorrents()));
|
connect(m_partialTorrentTimer, SIGNAL(timeout()), SLOT(processPartialTorrents()));
|
||||||
m_partialTorrentTimer->setSingleShot(true);
|
m_partialTorrentTimer->setSingleShot(true);
|
||||||
@@ -270,25 +269,19 @@ private:
|
|||||||
|
|
||||||
void addTorrentsFromDir(const QDir &dir, QStringList &torrents) {
|
void addTorrentsFromDir(const QDir &dir, QStringList &torrents) {
|
||||||
const QStringList files = dir.entryList(m_filters, QDir::Files, QDir::Unsorted);
|
const QStringList files = dir.entryList(m_filters, QDir::Files, QDir::Unsorted);
|
||||||
foreach (const QString &file, files) {
|
foreach(const QString &file, files) {
|
||||||
const QString file_abspath = dir.absoluteFilePath(file);
|
const QString file_abspath = dir.absoluteFilePath(file);
|
||||||
if (file_abspath.endsWith(".magnet")) {
|
if(misc::isValidTorrentFile(file_abspath)) {
|
||||||
QFile f(file_abspath);
|
|
||||||
if (f.open(QIODevice::ReadOnly)
|
|
||||||
&& !misc::magnetUriToHash(QString::fromLocal8Bit(f.readAll())).isEmpty()) {
|
|
||||||
torrents << file_abspath;
|
|
||||||
}
|
|
||||||
} else if (fsutils::isValidTorrentFile(file_abspath)) {
|
|
||||||
torrents << file_abspath;
|
torrents << file_abspath;
|
||||||
} else {
|
} else {
|
||||||
if (!m_partialTorrents.contains(file_abspath)) {
|
if(!m_partialTorrents.contains(file_abspath)) {
|
||||||
qDebug("Partial torrent detected at: %s", qPrintable(file_abspath));
|
qDebug("Partial torrent detected at: %s", qPrintable(file_abspath));
|
||||||
qDebug("Delay the file's processing...");
|
qDebug("Delay the file's processing...");
|
||||||
m_partialTorrents.insert(file_abspath, 0);
|
m_partialTorrents.insert(file_abspath, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!m_partialTorrents.empty())
|
if(!m_partialTorrents.empty())
|
||||||
startPartialTorrentTimer();
|
startPartialTorrentTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
556
src/fs_utils.cpp
556
src/fs_utils.cpp
File diff suppressed because it is too large
Load Diff
@@ -1,74 +0,0 @@
|
|||||||
/*
|
|
||||||
* Bittorrent Client using Qt4 and libtorrent.
|
|
||||||
* Copyright (C) 2012 Christophe Dumez
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef FS_UTILS_H
|
|
||||||
#define FS_UTILS_H
|
|
||||||
|
|
||||||
#include <QString>
|
|
||||||
#include <QCoreApplication>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Utility functions related to file system.
|
|
||||||
*/
|
|
||||||
class fsutils
|
|
||||||
{
|
|
||||||
Q_DECLARE_TR_FUNCTIONS(fsutils)
|
|
||||||
|
|
||||||
public:
|
|
||||||
static QString toDisplayPath(const QString& path);
|
|
||||||
static QString fileExtension(const QString& filename);
|
|
||||||
static QString fileName(const QString& file_path);
|
|
||||||
static qint64 computePathSize(const QString& path);
|
|
||||||
static QString fixFileNames(const QString& path);
|
|
||||||
static bool sameFiles(const QString& path1, const QString& path2);
|
|
||||||
static QString updateLabelInSavePath(QString defaultSavePath, QString save_path, const QString& old_label, const QString& new_label);
|
|
||||||
static QString toValidFileSystemName(QString filename);
|
|
||||||
static bool isValidFileSystemName(const QString& filename);
|
|
||||||
static long long freeDiskSpaceOnPath(QString path);
|
|
||||||
static QString branchPath(const QString& file_path, QString* removed = 0);
|
|
||||||
static bool sameFileNames(const QString& first, const QString& second);
|
|
||||||
static QString expandPath(const QString& path);
|
|
||||||
static bool isValidTorrentFile(const QString& path);
|
|
||||||
static bool smartRemoveEmptyFolderTree(const QString& dir_path);
|
|
||||||
static bool forceRemove(const QString& file_path);
|
|
||||||
|
|
||||||
/* Ported from Qt4 to drop dependency on QtGui */
|
|
||||||
static QString QDesktopServicesDataLocation();
|
|
||||||
static QString QDesktopServicesCacheLocation();
|
|
||||||
static QString QDesktopServicesDownloadLocation();
|
|
||||||
/* End of Qt4 code */
|
|
||||||
static QString searchEngineLocation();
|
|
||||||
static QString BTBackupLocation();
|
|
||||||
static QString cacheLocation();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // FS_UTILS_H
|
|
||||||
|
|
||||||
@@ -64,20 +64,20 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QChar>
|
#include <QChar>
|
||||||
|
|
||||||
#include "fs_utils.h"
|
#include "misc.h"
|
||||||
|
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
|
||||||
QString GeoIPManager::geoipFolder(bool embedded) {
|
QString GeoIPManager::geoipFolder(bool embedded) {
|
||||||
#ifdef WITH_GEOIP_EMBEDDED
|
#ifdef WITH_GEOIP_EMBEDDED
|
||||||
if (embedded)
|
if(embedded)
|
||||||
return ":/geoip/";
|
return ":/geoip/";
|
||||||
return fsutils::QDesktopServicesDataLocation()+"geoip"+QDir::separator();
|
return misc::QDesktopServicesDataLocation()+"geoip"+QDir::separator();
|
||||||
#else
|
#else
|
||||||
Q_UNUSED(embedded);
|
Q_UNUSED(embedded);
|
||||||
if (QFile::exists("/usr/local/share/GeoIP/GeoIP.dat"))
|
if(QFile::exists("/usr/local/share/GeoIP/GeoIP.dat"))
|
||||||
return "/usr/local/share/GeoIP/";
|
return "/usr/local/share/GeoIP/";
|
||||||
if (QFile::exists("/var/lib/GeoIP/GeoIP.dat"))
|
if(QFile::exists("/var/lib/GeoIP/GeoIP.dat"))
|
||||||
return "/var/lib/GeoIP/";
|
return "/var/lib/GeoIP/";
|
||||||
return "/usr/share/GeoIP/";
|
return "/usr/share/GeoIP/";
|
||||||
#endif
|
#endif
|
||||||
@@ -89,22 +89,22 @@ QString GeoIPManager::geoipDBpath(bool embedded) {
|
|||||||
|
|
||||||
#ifdef WITH_GEOIP_EMBEDDED
|
#ifdef WITH_GEOIP_EMBEDDED
|
||||||
void GeoIPManager::exportEmbeddedDb() {
|
void GeoIPManager::exportEmbeddedDb() {
|
||||||
if (!QFile::exists(geoipDBpath(false)) || QFile(geoipDBpath(false)).size() != QFile(geoipDBpath(true)).size()) { // Export is required
|
if(!QFile::exists(geoipDBpath(false)) || QFile(geoipDBpath(false)).size() != QFile(geoipDBpath(true)).size()) { // Export is required
|
||||||
qDebug("A local Geoip database update is required, proceeding...");
|
qDebug("A local Geoip database update is required, proceeding...");
|
||||||
// Create geoip folder is necessary
|
// Create geoip folder is necessary
|
||||||
QDir gfolder(geoipFolder(false));
|
QDir gfolder(geoipFolder(false));
|
||||||
if (!gfolder.exists()) {
|
if(!gfolder.exists()) {
|
||||||
if (!gfolder.mkpath(geoipFolder(false))) {
|
if(!gfolder.mkpath(geoipFolder(false))) {
|
||||||
std::cerr << "Failed to create geoip folder at " << qPrintable(geoipFolder(false)) << std::endl;
|
std::cerr << "Failed to create geoip folder at " << qPrintable(geoipFolder(false)) << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Remove destination files
|
// Remove destination files
|
||||||
if (QFile::exists(geoipDBpath(false)))
|
if(QFile::exists(geoipDBpath(false)))
|
||||||
fsutils::forceRemove(geoipDBpath(false));
|
misc::safeRemove(geoipDBpath(false));
|
||||||
// Copy from executable to hard disk
|
// Copy from executable to hard disk
|
||||||
qDebug("%s -> %s", qPrintable(geoipDBpath(true)), qPrintable(geoipDBpath(false)));
|
qDebug("%s -> %s", qPrintable(geoipDBpath(true)), qPrintable(geoipDBpath(false)));
|
||||||
if (!QFile::copy(geoipDBpath(true), geoipDBpath(false))) {
|
if(!QFile::copy(geoipDBpath(true), geoipDBpath(false))) {
|
||||||
std::cerr << "ERROR: Failed to copy geoip.dat from executable to hard disk" << std::endl;
|
std::cerr << "ERROR: Failed to copy geoip.dat from executable to hard disk" << std::endl;
|
||||||
}
|
}
|
||||||
qDebug("Local Geoip database was updated");
|
qDebug("Local Geoip database was updated");
|
||||||
@@ -116,7 +116,7 @@ void GeoIPManager::loadDatabase(session *s) {
|
|||||||
#ifdef WITH_GEOIP_EMBEDDED
|
#ifdef WITH_GEOIP_EMBEDDED
|
||||||
exportEmbeddedDb();
|
exportEmbeddedDb();
|
||||||
#endif
|
#endif
|
||||||
if (QFile::exists(geoipDBpath(false))) {
|
if(QFile::exists(geoipDBpath(false))) {
|
||||||
qDebug("Loading GeoIP database from %s...", qPrintable(geoipDBpath(false)));
|
qDebug("Loading GeoIP database from %s...", qPrintable(geoipDBpath(false)));
|
||||||
s->load_country_db(geoipDBpath(false).toLocal8Bit().constData());
|
s->load_country_db(geoipDBpath(false).toLocal8Bit().constData());
|
||||||
} else {
|
} else {
|
||||||
@@ -183,9 +183,9 @@ const char * country_name[253] =
|
|||||||
"Saint Barthelemy","Saint Martin"};
|
"Saint Barthelemy","Saint Martin"};
|
||||||
|
|
||||||
QString GeoIPManager::CountryISOCodeToName(const char* iso) {
|
QString GeoIPManager::CountryISOCodeToName(const char* iso) {
|
||||||
if (iso[0] == 0) return "N/A";
|
if(iso[0] == 0) return "N/A";
|
||||||
for (uint i = 0; i < num_countries; ++i) {
|
for(uint i = 0; i < num_countries; ++i) {
|
||||||
if (iso[0] == country_code[i][0] && iso[1] == country_code[i][1]) {
|
if(iso[0] == country_code[i][0] && iso[1] == country_code[i][1]) {
|
||||||
return QLatin1String(country_name[i]);
|
return QLatin1String(country_name[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -195,7 +195,7 @@ QString GeoIPManager::CountryISOCodeToName(const char* iso) {
|
|||||||
|
|
||||||
// http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm
|
// http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm
|
||||||
QIcon GeoIPManager::CountryISOCodeToIcon(const char* iso) {
|
QIcon GeoIPManager::CountryISOCodeToIcon(const char* iso) {
|
||||||
if (iso[0] == 0 || iso[0] == '!') return QIcon();
|
if(iso[0] == 0 || iso[0] == '!') return QIcon();
|
||||||
const QString isoStr = QString(QByteArray(iso, 2)).toLower();
|
const QString isoStr = QString(QByteArray(iso, 2)).toLower();
|
||||||
return QIcon(":/Icons/flags/"+isoStr+".png");
|
return QIcon(":/Icons/flags/"+isoStr+".png");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public:
|
|||||||
std::cout << qPrintable(tr("To control qBittorrent, access the Web UI at http://localhost:%1").arg(QString::number(pref.getWebUiPort()))) << std::endl;
|
std::cout << qPrintable(tr("To control qBittorrent, access the Web UI at http://localhost:%1").arg(QString::number(pref.getWebUiPort()))) << std::endl;
|
||||||
std::cout << qPrintable(tr("The Web UI administrator user name is: %1").arg(pref.getWebUiUsername())) << std::endl;
|
std::cout << qPrintable(tr("The Web UI administrator user name is: %1").arg(pref.getWebUiUsername())) << std::endl;
|
||||||
qDebug() << "Password:" << pref.getWebUiPassword();
|
qDebug() << "Password:" << pref.getWebUiPassword();
|
||||||
if (pref.getWebUiPassword() == "32fe0bd2bb001911bb8bcfe23fc92b63") {
|
if(pref.getWebUiPassword() == "32fe0bd2bb001911bb8bcfe23fc92b63") {
|
||||||
std::cout << qPrintable(tr("The Web UI administrator password is still the default one: %1").arg("adminadmin")) << std::endl;
|
std::cout << qPrintable(tr("The Web UI administrator password is still the default one: %1").arg("adminadmin")) << std::endl;
|
||||||
std::cout << qPrintable(tr("This is a security risk, please consider changing your password from program preferences.")) << std::endl;
|
std::cout << qPrintable(tr("This is a security risk, please consider changing your password from program preferences.")) << std::endl;
|
||||||
}
|
}
|
||||||
@@ -85,16 +85,16 @@ public slots:
|
|||||||
// the right addTorrent function, considering
|
// the right addTorrent function, considering
|
||||||
// the parameter type.
|
// the parameter type.
|
||||||
void processParams(const QStringList& params) {
|
void processParams(const QStringList& params) {
|
||||||
foreach (QString param, params) {
|
foreach(QString 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)) {
|
||||||
QBtSession::instance()->downloadFromUrl(param);
|
QBtSession::instance()->downloadFromUrl(param);
|
||||||
}else{
|
}else{
|
||||||
if (param.startsWith("bc://bt/", Qt::CaseInsensitive)) {
|
if(param.startsWith("bc://bt/", Qt::CaseInsensitive)) {
|
||||||
qDebug("Converting bc link to magnet link");
|
qDebug("Converting bc link to magnet link");
|
||||||
param = misc::bcLinkToMagnet(param);
|
param = misc::bcLinkToMagnet(param);
|
||||||
}
|
}
|
||||||
if (param.startsWith("magnet:", Qt::CaseInsensitive)) {
|
if(param.startsWith("magnet:", Qt::CaseInsensitive)) {
|
||||||
QBtSession::instance()->addMagnetUri(param);
|
QBtSession::instance()->addMagnetUri(param);
|
||||||
} else {
|
} else {
|
||||||
QBtSession::instance()->addTorrent(param);
|
QBtSession::instance()->addTorrent(param);
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void tabInserted(int index) {
|
void tabInserted(int index) {
|
||||||
QTabWidget::tabInserted(index);
|
QTabWidget::tabInserted(index);
|
||||||
if (count() == 1) {
|
if(count() == 1) {
|
||||||
showTabBar(false);
|
showTabBar(false);
|
||||||
} else {
|
} else {
|
||||||
showTabBar(true);
|
showTabBar(true);
|
||||||
@@ -53,7 +53,7 @@ protected:
|
|||||||
|
|
||||||
void tabRemoved(int index) {
|
void tabRemoved(int index) {
|
||||||
QTabWidget::tabInserted(index);
|
QTabWidget::tabInserted(index);
|
||||||
if (count() == 1) {
|
if(count() == 1) {
|
||||||
showTabBar(false);
|
showTabBar(false);
|
||||||
} else {
|
} else {
|
||||||
showTabBar(true);
|
showTabBar(true);
|
||||||
|
|||||||
@@ -35,21 +35,21 @@ IconProvider* IconProvider::m_instance = 0;
|
|||||||
|
|
||||||
IconProvider::IconProvider()
|
IconProvider::IconProvider()
|
||||||
{
|
{
|
||||||
#if defined(Q_WS_X11)
|
#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0))
|
||||||
m_useSystemTheme = Preferences().useSystemIconTheme();
|
m_useSystemTheme = Preferences().useSystemIconTheme();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
IconProvider * IconProvider::instance()
|
IconProvider * IconProvider::instance()
|
||||||
{
|
{
|
||||||
if (!m_instance)
|
if(!m_instance)
|
||||||
m_instance = new IconProvider;
|
m_instance = new IconProvider;
|
||||||
return m_instance;
|
return m_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IconProvider::drop()
|
void IconProvider::drop()
|
||||||
{
|
{
|
||||||
if (m_instance) {
|
if(m_instance) {
|
||||||
delete m_instance;
|
delete m_instance;
|
||||||
m_instance = 0;
|
m_instance = 0;
|
||||||
}
|
}
|
||||||
@@ -57,8 +57,8 @@ void IconProvider::drop()
|
|||||||
|
|
||||||
QIcon IconProvider::getIcon(const QString &iconId)
|
QIcon IconProvider::getIcon(const QString &iconId)
|
||||||
{
|
{
|
||||||
#if defined(Q_WS_X11)
|
#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0))
|
||||||
if (m_useSystemTheme) {
|
if(m_useSystemTheme) {
|
||||||
QIcon icon = QIcon::fromTheme(iconId, QIcon(":/Icons/oxygen/"+iconId+".png"));
|
QIcon icon = QIcon::fromTheme(iconId, QIcon(":/Icons/oxygen/"+iconId+".png"));
|
||||||
icon = generateDifferentSizes(icon);
|
icon = generateDifferentSizes(icon);
|
||||||
return icon;
|
return icon;
|
||||||
@@ -67,7 +67,7 @@ QIcon IconProvider::getIcon(const QString &iconId)
|
|||||||
return QIcon(":/Icons/oxygen/"+iconId+".png");
|
return QIcon(":/Icons/oxygen/"+iconId+".png");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_WS_X11)
|
#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0))
|
||||||
void IconProvider::useSystemIconTheme(bool enable)
|
void IconProvider::useSystemIconTheme(bool enable)
|
||||||
{
|
{
|
||||||
m_useSystemTheme = enable;
|
m_useSystemTheme = enable;
|
||||||
@@ -77,21 +77,21 @@ void IconProvider::useSystemIconTheme(bool enable)
|
|||||||
// It scales the icon from the theme if necessary
|
// It scales the icon from the theme if necessary
|
||||||
// Otherwise, the UI looks broken if the icon is not available
|
// Otherwise, the UI looks broken if the icon is not available
|
||||||
// in the correct size.
|
// in the correct size.
|
||||||
QIcon IconProvider::generateDifferentSizes(const QIcon& icon)
|
QIcon IconProvider::generateDifferentSizes(const QIcon &icon)
|
||||||
{
|
{
|
||||||
QIcon new_icon;
|
QIcon new_icon;
|
||||||
QList<QSize> required_sizes;
|
QList<QSize> required_sizes;
|
||||||
required_sizes << QSize(16, 16) << QSize(24, 24);
|
required_sizes << QSize(16, 16) << QSize(24, 24);
|
||||||
QList<QIcon::Mode> modes;
|
QList<QIcon::Mode> modes;
|
||||||
modes << QIcon::Normal << QIcon::Active << QIcon::Selected << QIcon::Disabled;
|
modes << QIcon::Normal << QIcon::Active << QIcon::Selected << QIcon::Disabled;
|
||||||
foreach (const QSize& size, required_sizes) {
|
foreach(const QSize& size, required_sizes) {
|
||||||
foreach (QIcon::Mode mode, modes) {
|
foreach(QIcon::Mode mode, modes) {
|
||||||
QPixmap pixoff = icon.pixmap(size, mode, QIcon::Off);
|
QPixmap pixoff = icon.pixmap(size, mode, QIcon::Off);
|
||||||
if (pixoff.height() > size.height())
|
if(pixoff.height() > size.height())
|
||||||
pixoff = pixoff.scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
pixoff = pixoff.scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
new_icon.addPixmap(pixoff, mode, QIcon::Off);
|
new_icon.addPixmap(pixoff, mode, QIcon::Off);
|
||||||
QPixmap pixon = icon.pixmap(size, mode, QIcon::On);
|
QPixmap pixon = icon.pixmap(size, mode, QIcon::On);
|
||||||
if (pixon.height() > size.height())
|
if(pixon.height() > size.height())
|
||||||
pixon = pixoff.scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
pixon = pixoff.scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
new_icon.addPixmap(pixon, mode, QIcon::On);
|
new_icon.addPixmap(pixon, mode, QIcon::On);
|
||||||
}
|
}
|
||||||
@@ -100,14 +100,14 @@ QIcon IconProvider::generateDifferentSizes(const QIcon& icon)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QString IconProvider::getIconPath(const QString& iconId)
|
QString IconProvider::getIconPath(const QString &iconId)
|
||||||
{
|
{
|
||||||
#if defined(Q_WS_X11)
|
#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0))
|
||||||
if (m_useSystemTheme) {
|
if(m_useSystemTheme) {
|
||||||
QString path = QDir::temp().absoluteFilePath(iconId+".png");
|
QString path = QDir::temp().absoluteFilePath(iconId+".png");
|
||||||
if (!QFile::exists(path)) {
|
if(!QFile::exists(path)) {
|
||||||
const QIcon icon = QIcon::fromTheme(iconId);
|
const QIcon icon = QIcon::fromTheme(iconId);
|
||||||
if (icon.isNull()) return ":/Icons/oxygen/"+iconId+".png";
|
if(icon.isNull()) return ":/Icons/oxygen/"+iconId+".png";
|
||||||
QPixmap px = icon.pixmap(32);
|
QPixmap px = icon.pixmap(32);
|
||||||
px.save(path);
|
px.save(path);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,9 +46,9 @@ public:
|
|||||||
static IconProvider* instance();
|
static IconProvider* instance();
|
||||||
static void drop();
|
static void drop();
|
||||||
QIcon getIcon(const QString& iconId);
|
QIcon getIcon(const QString& iconId);
|
||||||
QString getIconPath(const QString& iconId);
|
QString getIconPath(const QString &iconId);
|
||||||
|
|
||||||
#if defined(Q_WS_X11)
|
#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0))
|
||||||
public:
|
public:
|
||||||
void useSystemIconTheme(bool enable);
|
void useSystemIconTheme(bool enable);
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
1954
src/lang/qbittorrent_be.ts
Normal file → Executable file
1954
src/lang/qbittorrent_be.ts
Normal file → Executable file
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user