You've already forked qBittorrent
mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-10-09 18:32:15 +02:00
Compare commits
78 Commits
release-4.
...
release-2.
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b46d8934ed | ||
![]() |
493b537215 | ||
![]() |
fae08f7014 | ||
![]() |
31d65ddf77 | ||
![]() |
4cd9cfdb59 | ||
![]() |
8d55368f6a | ||
![]() |
2a07fc0dea | ||
![]() |
be6099a797 | ||
![]() |
b131b139f7 | ||
![]() |
c40455dbbf | ||
![]() |
75f0d86710 | ||
![]() |
33447bf9fb | ||
![]() |
a9365bc126 | ||
![]() |
f54b65a56d | ||
![]() |
f9abbea1cc | ||
![]() |
c267f6911d | ||
![]() |
dd51d39f5b | ||
![]() |
a3e90e1c05 | ||
![]() |
6bd1d2551b | ||
![]() |
cf0c359abf | ||
![]() |
461cca2f52 | ||
![]() |
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 |
59
Changelog
59
Changelog
@@ -1,3 +1,62 @@
|
||||
* Thu Mar 4 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.1.6
|
||||
- BUGFIX: Fix Web UI authentication with Konqueror
|
||||
- BUGFIX: Fix save path display in properties
|
||||
- BUGFIX: Fix ratio calculation for directly seeded torrents (Thanks phorane)
|
||||
- BUGFIX: Fix memory leak in RSS parser
|
||||
- BUGFIX: Only one log window can be opened at a time
|
||||
- BUGFIX: Command-line parameters are no longer required to be in UTF-8
|
||||
|
||||
* Web Feb 10 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.1.5
|
||||
- BUGFIX: Fix actions on selected torrents (non-selected torrents could be affected)
|
||||
- BUGFIX: Only one program preferences dialog is allowed at a time
|
||||
- BUGFIX: Link against boost and ssl to fix issues with gold linker
|
||||
- BUGFIX: Fix memory leak in RSS
|
||||
- BUGFIX: Improved HTTP gzip compression detection in downloader
|
||||
- BUGFIX: Fix possible race condition in search engine
|
||||
|
||||
* 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
|
||||
|
||||
* 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 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 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)
|
||||
- FEATURE: Torrents can be labeled/categorized
|
||||
|
8
INSTALL
8
INSTALL
@@ -12,6 +12,8 @@ qBittorrent - A BitTorrent client in C++ / Qt4
|
||||
Dependencies:
|
||||
- Qt >= 4.4.0 (libqt-devel, libqtgui, libqtcore, libqtnetwork, libqtxml)
|
||||
|
||||
- pkg-config executable
|
||||
|
||||
- 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.
|
||||
@@ -38,9 +40,11 @@ qBittorrent - A BitTorrent client in C++ / Qt4
|
||||
will install and execute qBittorrent hopefully without any problems.
|
||||
|
||||
Dependencies:
|
||||
- Qt >= 4.4.0 (libqt-devel, libqtcore, libqtnetwork, libqtxml)
|
||||
- Qt >= 4.4.0 (libqt-devel, libqtcore, libqtnetwork)
|
||||
|
||||
- libtorrent-rasterbar by Arvid Norberg (>= 0.14.0 REQUIRED, >= v0.15.0 ADVISED)
|
||||
- pkg-config executable
|
||||
|
||||
- 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.
|
||||
|
||||
|
52
configure
vendored
52
configure
vendored
@@ -319,6 +319,23 @@ public:
|
||||
|
||||
}
|
||||
};
|
||||
#line 1 "pkg-config.qcm"
|
||||
/*
|
||||
-----BEGIN QCMOD-----
|
||||
name: pkg-config
|
||||
-----END QCMOD-----
|
||||
*/
|
||||
#include <QProcess>
|
||||
class qc_pkg_config : public ConfObj
|
||||
{
|
||||
public:
|
||||
qc_pkg_config(Conf *c) : ConfObj(c) {}
|
||||
QString name() const { return "pkg-config executable"; }
|
||||
QString shortname() const { return "pkg-config"; }
|
||||
bool exec(){
|
||||
return !conf->findProgram("pkg-config").isEmpty();
|
||||
}
|
||||
};
|
||||
#line 1 "libtorrent-rasterbar.qcm"
|
||||
/*
|
||||
-----BEGIN QCMOD-----
|
||||
@@ -342,12 +359,18 @@ public:
|
||||
return false;
|
||||
for(int n = 0; n < incs.count(); ++n)
|
||||
conf->addIncludePath(incs[n]);
|
||||
if(!libs.isEmpty())
|
||||
conf->addLib(libs);
|
||||
//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.\nSome feature will be disabled because they require v%s.\n", version.toLocal8Bit().data(), adv_ver.toUtf8().data());
|
||||
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());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -421,10 +444,14 @@ public:
|
||||
qc_libnotify(Conf *c) : ConfObj(c) {}
|
||||
QString name() const { return "libnotify >= 0.4.2 (optional)"; }
|
||||
QString shortname() const { return "libnotify"; }
|
||||
QString checkString() const {
|
||||
if(!conf->getenv("QC_DISABLE_libnotify").isEmpty() || !conf->getenv("QC_DISABLE_GUI").isEmpty())
|
||||
return "";
|
||||
return ConfObj::checkString();
|
||||
}
|
||||
bool exec(){
|
||||
if(!conf->getenv("QC_DISABLE_GUI").isEmpty()) {
|
||||
printf("\nNot Required");
|
||||
return true;
|
||||
if(!conf->getenv("QC_DISABLE_libnotify").isEmpty() || !conf->getenv("QC_DISABLE_GUI").isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
QStringList incs;
|
||||
QString req_ver = "0.4.2";
|
||||
@@ -468,10 +495,14 @@ public:
|
||||
qc_geoip_database(Conf *c) : ConfObj(c) {}
|
||||
QString name() const { return "GeoIP Database (optional)"; }
|
||||
QString shortname() const { return "GeoIP Database"; }
|
||||
QString checkString() const {
|
||||
if(!conf->getenv("QC_DISABLE_geoip_database").isEmpty() || !conf->getenv("QC_DISABLE_GUI").isEmpty())
|
||||
return "";
|
||||
return ConfObj::checkString();
|
||||
}
|
||||
bool exec() {
|
||||
if(!conf->getenv("QC_DISABLE_GUI").isEmpty()) {
|
||||
printf("\nNot Required");
|
||||
return true;
|
||||
if(!conf->getenv("QC_DISABLE_geoip_database").isEmpty() || !conf->getenv("QC_DISABLE_GUI").isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
#ifdef Q_WS_X11
|
||||
if(!conf->getenv("QC_WITH_GEOIP_DATABASE_EMBEDDED").isEmpty()) {
|
||||
@@ -494,6 +525,9 @@ cat >$1/modules_new.cpp <<EOT
|
||||
o = new qc_qt4(conf);
|
||||
o->required = true;
|
||||
o->disabled = false;
|
||||
o = new qc_pkg_config(conf);
|
||||
o->required = true;
|
||||
o->disabled = false;
|
||||
o = new qc_libtorrent_rasterbar(conf);
|
||||
o->required = true;
|
||||
o->disabled = false;
|
||||
|
@@ -1,6 +1,4 @@
|
||||
TEMPLATE = subdirs
|
||||
|
||||
include(conf.pri)
|
||||
|
||||
SUBDIRS += src
|
||||
|
||||
|
@@ -6,6 +6,9 @@
|
||||
<dep type='qt4'>
|
||||
<required/>
|
||||
</dep>
|
||||
<dep type='pkg-config'>
|
||||
<required/>
|
||||
</dep>
|
||||
<dep type='libtorrent-rasterbar'>
|
||||
<required/>
|
||||
</dep>
|
||||
|
@@ -11,10 +11,14 @@ public:
|
||||
qc_geoip_database(Conf *c) : ConfObj(c) {}
|
||||
QString name() const { return "GeoIP Database (optional)"; }
|
||||
QString shortname() const { return "GeoIP Database"; }
|
||||
QString checkString() const {
|
||||
if(!conf->getenv("QC_DISABLE_geoip_database").isEmpty() || !conf->getenv("QC_DISABLE_GUI").isEmpty())
|
||||
return "";
|
||||
return ConfObj::checkString();
|
||||
}
|
||||
bool exec() {
|
||||
if(!conf->getenv("QC_DISABLE_GUI").isEmpty()) {
|
||||
printf("\nNot Required");
|
||||
return true;
|
||||
if(!conf->getenv("QC_DISABLE_geoip_database").isEmpty() || !conf->getenv("QC_DISABLE_GUI").isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
#ifdef Q_WS_X11
|
||||
if(!conf->getenv("QC_WITH_GEOIP_DATABASE_EMBEDDED").isEmpty()) {
|
||||
|
@@ -10,10 +10,14 @@ public:
|
||||
qc_libnotify(Conf *c) : ConfObj(c) {}
|
||||
QString name() const { return "libnotify >= 0.4.2 (optional)"; }
|
||||
QString shortname() const { return "libnotify"; }
|
||||
QString checkString() const {
|
||||
if(!conf->getenv("QC_DISABLE_libnotify").isEmpty() || !conf->getenv("QC_DISABLE_GUI").isEmpty())
|
||||
return "";
|
||||
return ConfObj::checkString();
|
||||
}
|
||||
bool exec(){
|
||||
if(!conf->getenv("QC_DISABLE_GUI").isEmpty()) {
|
||||
printf("\nNot Required");
|
||||
return true;
|
||||
if(!conf->getenv("QC_DISABLE_libnotify").isEmpty() || !conf->getenv("QC_DISABLE_GUI").isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
QStringList incs;
|
||||
QString req_ver = "0.4.2";
|
||||
|
@@ -20,12 +20,18 @@ public:
|
||||
return false;
|
||||
for(int n = 0; n < incs.count(); ++n)
|
||||
conf->addIncludePath(incs[n]);
|
||||
if(!libs.isEmpty())
|
||||
conf->addLib(libs);
|
||||
//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.\nSome feature will be disabled because they require v%s.\n", version.toLocal8Bit().data(), adv_ver.toUtf8().data());
|
||||
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());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
16
qcm/pkg-config.qcm
Normal file
16
qcm/pkg-config.qcm
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
-----BEGIN QCMOD-----
|
||||
name: pkg-config
|
||||
-----END QCMOD-----
|
||||
*/
|
||||
#include <QProcess>
|
||||
class qc_pkg_config : public ConfObj
|
||||
{
|
||||
public:
|
||||
qc_pkg_config(Conf *c) : ConfObj(c) {}
|
||||
QString name() const { return "pkg-config executable"; }
|
||||
QString shortname() const { return "pkg-config"; }
|
||||
bool exec(){
|
||||
return !conf->findProgram("pkg-config").isEmpty();
|
||||
}
|
||||
};
|
41
src/GUI.cpp
41
src/GUI.cpp
@@ -35,7 +35,6 @@
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QDesktopWidget>
|
||||
#include <QTimer>
|
||||
#include <QDesktopServices>
|
||||
#include <QStatusBar>
|
||||
@@ -218,7 +217,10 @@ GUI::~GUI() {
|
||||
delete status_bar;
|
||||
delete transferList;
|
||||
delete guiUpdater;
|
||||
|
||||
if (console)
|
||||
delete console;
|
||||
if(options)
|
||||
delete options;
|
||||
if(rssWidget)
|
||||
delete rssWidget;
|
||||
delete searchEngine;
|
||||
@@ -356,7 +358,7 @@ void GUI::readSettings() {
|
||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||
settings.beginGroup(QString::fromUtf8("MainWindow"));
|
||||
resize(settings.value(QString::fromUtf8("size"), size()).toSize());
|
||||
move(settings.value(QString::fromUtf8("pos"), screenCenter()).toPoint());
|
||||
move(settings.value(QString::fromUtf8("pos"), misc::screenCenter(this)).toPoint());
|
||||
QStringList sizes_str = settings.value("vSplitterSizes", QStringList()).toStringList();
|
||||
// Splitter size
|
||||
QList<int> sizes;
|
||||
@@ -394,7 +396,7 @@ void GUI::readParamsOnSocket() {
|
||||
if(clientConnection) {
|
||||
QByteArray params = clientConnection->readAll();
|
||||
if(!params.isEmpty()) {
|
||||
processParams(QString::fromUtf8(params.data()).split(QString::fromUtf8("\n")));
|
||||
processParams(QString::fromLocal8Bit(params.constData()).split("\n"));
|
||||
qDebug("Received parameters from another instance");
|
||||
}
|
||||
clientConnection->deleteLater();
|
||||
@@ -421,7 +423,11 @@ void GUI::on_actionSet_global_upload_limit_triggered() {
|
||||
}
|
||||
|
||||
void GUI::on_actionShow_console_triggered() {
|
||||
new consoleDlg(this, BTSession);
|
||||
if(!console) {
|
||||
console = new consoleDlg(this, BTSession);
|
||||
} else {
|
||||
console->setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void GUI::on_actionSet_global_download_limit_triggered() {
|
||||
@@ -475,22 +481,6 @@ void GUI::toggleVisibility(QSystemTrayIcon::ActivationReason e) {
|
||||
}
|
||||
}
|
||||
|
||||
// Center window
|
||||
QPoint GUI::screenCenter() const{
|
||||
int scrn = 0;
|
||||
QWidget *w = this->topLevelWidget();
|
||||
|
||||
if(w)
|
||||
scrn = QApplication::desktop()->screenNumber(w);
|
||||
else if(QApplication::desktop()->isVirtualDesktop())
|
||||
scrn = QApplication::desktop()->screenNumber(QCursor::pos());
|
||||
else
|
||||
scrn = QApplication::desktop()->screenNumber(this);
|
||||
|
||||
QRect desk(QApplication::desktop()->availableGeometry(scrn));
|
||||
return QPoint((desk.width() - this->frameGeometry().width()) / 2, (desk.height() - this->frameGeometry().height()) / 2);
|
||||
}
|
||||
|
||||
// Display About Dialog
|
||||
void GUI::on_actionAbout_triggered() {
|
||||
//About dialog
|
||||
@@ -925,8 +915,13 @@ void GUI::createTrayIcon() {
|
||||
|
||||
// Display Program Options
|
||||
void GUI::on_actionOptions_triggered() {
|
||||
options = new options_imp(this);
|
||||
connect(options, SIGNAL(status_changed()), this, SLOT(optionsSaved()));
|
||||
if(!options) {
|
||||
options = new options_imp(this);
|
||||
connect(options, SIGNAL(status_changed()), this, SLOT(optionsSaved()));
|
||||
} else {
|
||||
// Get focus
|
||||
options->setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
|
@@ -55,6 +55,7 @@ class TransferListFiltersWidget;
|
||||
class QSplitter;
|
||||
class PropertiesWidget;
|
||||
class StatusBar;
|
||||
class consoleDlg;
|
||||
|
||||
class GUI : public QMainWindow, private Ui::MainWindow{
|
||||
Q_OBJECT
|
||||
@@ -68,6 +69,7 @@ private:
|
||||
QTabWidget *tabs;
|
||||
StatusBar *status_bar;
|
||||
QPointer<options_imp> options;
|
||||
QPointer<consoleDlg> console;
|
||||
QPointer<QSystemTrayIcon> systrayIcon;
|
||||
QPointer<QTimer> systrayCreator;
|
||||
QMenu *myTrayIconMenu;
|
||||
@@ -156,7 +158,6 @@ public:
|
||||
~GUI();
|
||||
// Methods
|
||||
int getCurrentTabIndex() const;
|
||||
QPoint screenCenter() const;
|
||||
TransferListWidget* getTransferList() const { return transferList; }
|
||||
};
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[Desktop Entry]
|
||||
Categories=Qt;Network;P2P;
|
||||
Comment=V2.1.0
|
||||
Comment=V2.1.6
|
||||
Exec=qbittorrent %f
|
||||
GenericName=Bittorrent client
|
||||
GenericName[bg]=Торент клиент
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
@@ -746,15 +746,18 @@ QTorrentHandle Bittorrent::addMagnetUri(QString magnet_uri, bool resumed) {
|
||||
addConsoleMessage(tr("'%1' is not a valid magnet URI.").arg(magnet_uri));
|
||||
return h;
|
||||
}
|
||||
QDir torrentBackup(misc::BTBackupLocation());
|
||||
if(resumed) {
|
||||
qDebug("Resuming magnet URI: %s", hash.toLocal8Bit().data());
|
||||
// Load metadata
|
||||
if(QFile::exists(torrentBackup.path()+QDir::separator()+hash+QString(".torrent")))
|
||||
return addTorrent(torrentBackup.path()+QDir::separator()+hash+QString(".torrent"), false, false, true);
|
||||
} else {
|
||||
qDebug("Adding new magnet URI");
|
||||
}
|
||||
|
||||
bool fastResume=false;
|
||||
Q_ASSERT(magnet_uri.startsWith("magnet:"));
|
||||
QDir torrentBackup(misc::BTBackupLocation());
|
||||
|
||||
// Check if torrent is already in download list
|
||||
if(s->find_torrent(sha1_hash(hash.toLocal8Bit().data())).is_valid()) {
|
||||
@@ -799,7 +802,7 @@ QTorrentHandle Bittorrent::addMagnetUri(QString magnet_uri, bool resumed) {
|
||||
else
|
||||
p.storage_mode = storage_mode_sparse;
|
||||
// Start in pause
|
||||
p.paused = false;
|
||||
p.paused = true;
|
||||
p.duplicate_is_error = false; // Already checked
|
||||
p.auto_managed = false; // Because it is added in paused state
|
||||
// Adding torrent to Bittorrent session
|
||||
@@ -839,7 +842,7 @@ QTorrentHandle Bittorrent::addMagnetUri(QString magnet_uri, bool resumed) {
|
||||
}
|
||||
QString label = TorrentTempData::getLabel(hash);
|
||||
// Save persistent data for new torrent
|
||||
TorrentPersistentData::saveTorrentPersistentData(h);
|
||||
TorrentPersistentData::saveTorrentPersistentData(h, true);
|
||||
// Save Label
|
||||
if(!label.isEmpty()) {
|
||||
TorrentPersistentData::saveLabel(hash, label);
|
||||
@@ -850,7 +853,7 @@ QTorrentHandle Bittorrent::addMagnetUri(QString magnet_uri, bool resumed) {
|
||||
TorrentPersistentData::saveSavePath(hash, savePath);
|
||||
}
|
||||
}
|
||||
if(!addInPause && !fastResume) {
|
||||
if(!fastResume && (!addInPause || (Preferences::useAdditionDialog()))) {
|
||||
// Start torrent because it was added in paused state
|
||||
h.resume();
|
||||
}
|
||||
@@ -1020,11 +1023,16 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
|
||||
h.set_sequential_download(TorrentTempData::isSequential(hash));
|
||||
// Import Files names from torrent addition dialog
|
||||
QStringList files_path = TorrentTempData::getFilesPath(hash);
|
||||
bool force_recheck = false;
|
||||
if(files_path.size() == h.num_files()) {
|
||||
for(int i=0; i<h.num_files(); ++i) {
|
||||
QString path = files_path.at(i);
|
||||
if(!force_recheck && QFile::exists(h.save_path()+QDir::separator()+path))
|
||||
force_recheck = true;
|
||||
h.rename_file(i, path);
|
||||
}
|
||||
// Force recheck
|
||||
if(force_recheck) h.force_recheck();
|
||||
}
|
||||
}
|
||||
QString label = TorrentTempData::getLabel(hash);
|
||||
@@ -1053,7 +1061,7 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
|
||||
// Copy it to torrentBackup directory
|
||||
QFile::copy(file, newFile);
|
||||
}
|
||||
if(!addInPause && !fastResume) {
|
||||
if(!fastResume && (!addInPause || (Preferences::useAdditionDialog() && !fromScanDir))) {
|
||||
// Start torrent because it was added in paused state
|
||||
h.resume();
|
||||
}
|
||||
@@ -1224,14 +1232,14 @@ bool Bittorrent::enableDHT(bool b) {
|
||||
|
||||
float Bittorrent::getRealRatio(QString hash) const{
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
Q_ASSERT(h.all_time_download() >= 0);
|
||||
Q_ASSERT(h.total_done() >= 0);
|
||||
Q_ASSERT(h.all_time_upload() >= 0);
|
||||
if(h.all_time_download() == 0) {
|
||||
if(h.total_done() == 0) {
|
||||
if(h.all_time_upload() == 0)
|
||||
return 0;
|
||||
return 101;
|
||||
}
|
||||
float ratio = (float)h.all_time_upload()/(float)h.all_time_download();
|
||||
float ratio = (float)h.all_time_upload()/(float)h.total_done();
|
||||
Q_ASSERT(ratio >= 0.);
|
||||
if(ratio > 100.)
|
||||
ratio = 100.;
|
||||
@@ -1599,9 +1607,9 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
|
||||
}
|
||||
}
|
||||
|
||||
// Set DHT port (>= 1000 or 0 if same as BT)
|
||||
// Set DHT port (>= 1 or 0 if same as BT)
|
||||
void Bittorrent::setDHTPort(int dht_port) {
|
||||
if(dht_port == 0 || dht_port >= 1000) {
|
||||
if(dht_port >= 0) {
|
||||
if(dht_port == current_dht_port) return;
|
||||
struct dht_settings DHTSettings;
|
||||
DHTSettings.service_port = dht_port;
|
||||
@@ -1667,7 +1675,7 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
|
||||
qDebug("Disabling HTTP communications proxy");
|
||||
#ifdef Q_WS_WIN
|
||||
putenv("http_proxy=");
|
||||
putenv("sock_proxy=")
|
||||
putenv("sock_proxy=");
|
||||
#else
|
||||
unsetenv("http_proxy");
|
||||
unsetenv("sock_proxy");
|
||||
@@ -1703,6 +1711,11 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
|
||||
QString hash = h.hash();
|
||||
// Remember finished state
|
||||
TorrentPersistentData::saveSeedStatus(h);
|
||||
#ifdef LIBTORRENT_0_15
|
||||
// Remove .!qB extension if necessary
|
||||
if(appendqBExtension)
|
||||
appendqBextensionToTorrent(h, false);
|
||||
#endif
|
||||
// Move to download directory if necessary
|
||||
if(!defaultTempPath.isEmpty()) {
|
||||
// Check if directory is different
|
||||
@@ -1767,6 +1780,10 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
|
||||
appendqBextensionToTorrent(h, true);
|
||||
#endif
|
||||
emit metadataReceived(h);
|
||||
// Save metadata
|
||||
QDir torrentBackup(misc::BTBackupLocation());
|
||||
if(!QFile::exists(torrentBackup.path()+QDir::separator()+h.hash()+QString(".torrent")))
|
||||
h.save_torrent_file(torrentBackup.path()+QDir::separator()+h.hash()+QString(".torrent"));
|
||||
if(h.is_paused()) {
|
||||
// XXX: Unfortunately libtorrent-rasterbar does not send a torrent_paused_alert
|
||||
// and the torrent can be paused when metadata is received
|
||||
@@ -1908,12 +1925,30 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
|
||||
}
|
||||
emit torrentFinishedChecking(h);
|
||||
emit metadataReceived(h);
|
||||
if(torrentsToPausedAfterChecking.contains(hash)) {
|
||||
torrentsToPausedAfterChecking.removeOne(hash);
|
||||
h.pause();
|
||||
emit pausedTorrent(h);
|
||||
}
|
||||
}
|
||||
}
|
||||
a = s->pop_alert();
|
||||
}
|
||||
}
|
||||
|
||||
void Bittorrent::recheckTorrent(QString hash) {
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
if(h.is_valid() && h.has_metadata()) {
|
||||
if(h.is_paused()) {
|
||||
if(!torrentsToPausedAfterChecking.contains(h.hash())) {
|
||||
torrentsToPausedAfterChecking << h.hash();
|
||||
h.resume();
|
||||
}
|
||||
}
|
||||
h.force_recheck();
|
||||
}
|
||||
}
|
||||
|
||||
QHash<QString, TrackerInfos> Bittorrent::getTrackersInfo(QString hash) const{
|
||||
return trackersInfos.value(hash, QHash<QString, TrackerInfos>());
|
||||
}
|
||||
|
@@ -94,6 +94,7 @@ private:
|
||||
QPointer<QTimer> timerAlerts;
|
||||
QMap<QUrl, QString> savepath_fromurl;
|
||||
QHash<QString, QHash<QString, TrackerInfos> > trackersInfos;
|
||||
QStringList torrentsToPausedAfterChecking;
|
||||
// Ratio
|
||||
QPointer<QTimer> BigRatioTimer;
|
||||
// HTTP
|
||||
@@ -180,6 +181,7 @@ public slots:
|
||||
void deleteTorrent(QString hash, bool delete_local_files = false);
|
||||
void startUpTorrents();
|
||||
session_proxy asyncDeletion();
|
||||
void recheckTorrent(QString hash);
|
||||
/* Needed by Web UI */
|
||||
void pauseAllTorrents();
|
||||
void pauseTorrent(QString hash);
|
||||
|
@@ -33,6 +33,7 @@
|
||||
|
||||
#include <QDialog>
|
||||
#include "ui_confirmdeletiondlg.h"
|
||||
#include "misc.h"
|
||||
|
||||
class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg {
|
||||
Q_OBJECT
|
||||
@@ -40,6 +41,7 @@ class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg {
|
||||
public:
|
||||
DeletionConfirmationDlg(QWidget *parent=0): QDialog(parent) {
|
||||
setupUi(this);
|
||||
move(misc::screenCenter(this));
|
||||
}
|
||||
|
||||
bool shouldDeleteLocalFiles() const {
|
||||
|
@@ -56,6 +56,18 @@ void downloadThread::processDlFinished(QNetworkReply* reply) {
|
||||
// Failure
|
||||
emit downloadFailure(url, errorCodeToString(reply->error()));
|
||||
} else {
|
||||
QVariant redirection = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
|
||||
if(redirection.isValid()) {
|
||||
// We should redirect
|
||||
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;
|
||||
}
|
||||
// Checking if it was redirecting, restoring initial URL
|
||||
if(redirect_mapping.contains(url)) {
|
||||
url = redirect_mapping.take(url);
|
||||
}
|
||||
// Success
|
||||
QString filePath;
|
||||
QTemporaryFile tmpfile;
|
||||
@@ -91,6 +103,7 @@ void 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");
|
||||
request.setRawHeader("Accept-Encoding", "");
|
||||
qDebug("Downloading %s...", request.url().toString().toLocal8Bit().data());
|
||||
networkManager->get(request);
|
||||
}
|
||||
|
@@ -33,6 +33,7 @@
|
||||
|
||||
#include <QNetworkReply>
|
||||
#include <QObject>
|
||||
#include <QHash>
|
||||
|
||||
class QNetworkAccessManager;
|
||||
|
||||
@@ -41,6 +42,7 @@ class downloadThread : public QObject {
|
||||
|
||||
private:
|
||||
QNetworkAccessManager *networkManager;
|
||||
QHash<QString, QString> redirect_mapping;
|
||||
|
||||
signals:
|
||||
void downloadFinished(QString url, QString file_path);
|
||||
|
@@ -282,7 +282,9 @@ QVariantMap EventManager::getPropGeneralInfo(QString hash) const {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
if(h.is_valid() && h.has_metadata()) {
|
||||
// Save path
|
||||
data["save_path"] = TorrentPersistentData::getSavePath(hash);
|
||||
QString p = TorrentPersistentData::getSavePath(hash);
|
||||
if(p.isEmpty()) p = h.save_path();
|
||||
data["save_path"] = p;
|
||||
// Creation date
|
||||
data["creation_date"] = h.creation_date();
|
||||
// Comment
|
||||
|
@@ -154,7 +154,9 @@ signals:
|
||||
|
||||
protected slots:
|
||||
void updateCurrentFeed(QTreeWidgetItem* new_item) {
|
||||
if((new_item && getItemType(new_item) == RssFile::STREAM) || new_item == unread_item)
|
||||
if(!new_item) return;
|
||||
if(!mapping.contains(new_item)) return;
|
||||
if((getItemType(new_item) == RssFile::STREAM) || new_item == unread_item)
|
||||
current_feed = new_item;
|
||||
}
|
||||
|
||||
|
@@ -46,7 +46,7 @@ protected:
|
||||
static QString geoipFolder(bool embedded=false) {
|
||||
if(embedded)
|
||||
return ":/geoip/";
|
||||
return misc::qBittorrentPath()+"geoip"+QDir::separator();
|
||||
return misc::QDesktopServicesDataLocation()+"geoip"+QDir::separator();
|
||||
#else
|
||||
static QString geoipFolder(bool) {
|
||||
if(QFile::exists("/usr/local/share/GeoIP/GeoIP.dat"))
|
||||
|
@@ -138,6 +138,7 @@ void HttpConnection::respond() {
|
||||
return;
|
||||
}
|
||||
QString auth = parser.value("Authorization");
|
||||
qDebug("Auth: %s", auth.split(" ").first().toLocal8Bit().data());
|
||||
if (QString::compare(auth.split(" ").first(), "Digest", Qt::CaseInsensitive) != 0 || !parent->isAuthorized(auth.toLocal8Bit(), parser.method())) {
|
||||
// Update failed attempt counter
|
||||
parent->client_failed_attempts.insert(socket->peerAddress().toString(), nb_fail+1);
|
||||
@@ -456,8 +457,8 @@ void HttpConnection::respondCommand(QString command)
|
||||
|
||||
void HttpConnection::recheckTorrent(QString hash) {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
if(h.is_valid() && !h.is_paused()){
|
||||
h.force_recheck();
|
||||
if(h.is_valid()){
|
||||
BTSession->recheckTorrent(h.hash());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -466,7 +467,7 @@ void HttpConnection::recheckAllTorrents() {
|
||||
std::vector<torrent_handle>::iterator torrentIT;
|
||||
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
|
||||
QTorrentHandle h = QTorrentHandle(*torrentIT);
|
||||
if(h.is_valid() && !h.is_paused())
|
||||
h.force_recheck();
|
||||
if(h.is_valid())
|
||||
BTSession->recheckTorrent(h.hash());
|
||||
}
|
||||
}
|
||||
|
@@ -207,7 +207,7 @@ bool HttpServer::isAuthorized(QByteArray auth, QString method) const {
|
||||
}
|
||||
QByteArray prop_cnonce = regex_cnonce.cap(1).toLocal8Bit();
|
||||
qDebug("prop cnonce is: %s", prop_cnonce.data());
|
||||
QRegExp regex_qop(".*qop=(\\w+).*");
|
||||
QRegExp regex_qop(".*qop=[\"]?(\\w+)[\"]?.*");
|
||||
if(regex_qop.indexIn(auth) < 0) {
|
||||
qDebug("AUTH-PROB: missing qop");
|
||||
return false;
|
||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user