1
mirror of https://github.com/qbittorrent/qBittorrent synced 2025-10-14 11:52:15 +02:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Christophe Dumez
6d31359181 Tagged v2.0.0rc2 release 2009-11-27 16:33:22 +00:00
140 changed files with 12912 additions and 19948 deletions

View File

@@ -12,6 +12,11 @@ Code from other projects:
copyright: Malte Starostik <malte@kde.org>
license: LGPL
GeoIP database author:
* files: src/geoip/GeoIP.dat
copyright: MaxMind, Inc (http://maxmind.com/)
license: Open Data License (see src/geoip/LICENSE.txt)
Images Authors:
* files: src/Icons/*.png
copyright: Gnome Icon Theme
@@ -73,11 +78,10 @@ Translations authors:
- Japanese: Nardog (nardog@e2umail.com)
- Korean: Jin Woo Sin (jin828sin@users.sourceforge.net)
- Norwegian: Lars-Erik Labori (hamil@users.sourceforge.net)
- Polish: Mariusz Fik (fisiu@opensuse.org)
- Polish: Jarek Smieja (ajep9691@wp.pl)
- Portuguese: Nick Marinho (nickmarinho@gmail.com)
- Romanian: Obada Denis (obadadenis@users.sourceforge.net)
- Russian: Nick Khazov (m2k3d0n at users.sourceforge.net)
- Serbian: Anaximandar Milet (anaximandar at operamail.com)
- Slovak: helix84
- Spanish: Vicente Raul Plata Fonseca (silverxnt@users.sourceforge.net)
- Swedish: Daniel Nylander (po@danielnylander.se)

View File

@@ -4,7 +4,7 @@
- FEATURE: Display more information regarding the torrent in its properties
- FEATURE: Various optimizations to save CPU and memory
- FEATURE: Folder scanning now works with CIFS and NFS mounted folders
- FEATURE: Speed up qBittorrent startup and shutdown
- FEATURE: Speed up qBittorrent startup
- FEATURE: Display per-torrent peer list
- FEATURE: Make sure torrent files are always sorted by name
- FEATURE: Seeds and Peers columns are now sortable
@@ -21,9 +21,6 @@
- FEATURE: Dropped Qt 4.3 support (Qt >= 4.4 is now required)
- FEATURE: Display close tab button into the tabs in search engine (Qt >= 4.5 only)
- FEATURE: Show official documentation when pressing F1 key
- FEATURE: Search engine plugins now handle HTTP protocol gzip compression
- FEATURE: Enabled lazy bitfield as a counter-measure for ISP speed throttling
- FEATURE: Fall back to a random port if qBittorrent could not listen on the chosen port
- FEATURE: Announce to all trackers specified for a torrent (µTorrent behavior) (libtorrent >= v0.15 only)
- FEATURE: Added per-torrent super seeding mode (libtorrent >= v0.15 only)
- FEATURE: Support for storing symbolic links in .torrent files (libtorrent >= v0.15 only)
@@ -37,12 +34,10 @@
- FEATURE: Include DHT traffic in the rate limiter (libtorrent >= v0.15 only)
- FEATURE: Support for bitcomet padding files (libtorrent >= v0.15 only)
- FEATURE: Option to skip file checking and start seeding immediately in torrent addition dialog (Stephanos Antaris) (libtorrent >= v0.15 only)
- BUGFIX: Made sure qBittorrent does not scrape the tracker too frequently (libtorrent >= 0.15 only)
- WEB UI: Remodeled Web UI to match new qBittorrent UI (Properties and preferences available)
- WEB UI: Added internationalization support
- WEB UI: Reduced computation in Javascript (do this one server side instead)
- WEB UI: Fixed Transfer list flickering
- I18N: Added Serbian translation (By Anaximandar Milet)
- COSMETIC: Merged download / upload lists
- COSMETIC: Torrents can be filtered based on their status
- COSMETIC: Torrent properties are now displayed in main window

View File

@@ -23,9 +23,6 @@ Dependencies:
* Can be used for system notifications to replace standard Qt notifications
so that it integrates better into the Desktop
- geoip-database (optional)
* If qBittorrent cannot find this database, it will try to resolve countries using the Internet but it will be a lot slower.
DOCUMENTATION:
Please note that there is a documentation with a "compiling howto" at http://wiki.qbittorrent.org.

55
configure vendored
View File

@@ -18,12 +18,8 @@ Main options:
--help This help text.
Dependency options:
--with-libboost-inc=[path] Path to libboost include files
--disable-libnotify Disable use of libnotify
--disable-geoip-database Disable use of geoip-database
--with-geoip-database-embedded Geoip Database will be embedded in
qBittorrent executable (please follow
instructions in src/geoip/README)
--with-libboost-inc=[path] Path to libboost include files
--disable-libnotify Disable use of libnotify
EOT
}
@@ -150,16 +146,6 @@ while [ $# -gt 0 ]; do
shift
;;
--disable-geoip-database)
QC_DISABLE_geoip_database="Y"
shift
;;
--with-geoip-database-embedded)
QC_WITH_GEOIP_DATABASE_EMBEDDED="Y"
shift
;;
--verbose)
QC_VERBOSE="Y"
shift
@@ -183,8 +169,6 @@ echo DATADIR=$DATADIR
echo EX_QTDIR=$EX_QTDIR
echo QC_WITH_LIBBOOST_INC=$QC_WITH_LIBBOOST_INC
echo QC_DISABLE_libnotify=$QC_DISABLE_libnotify
echo QC_DISABLE_geoip_database=$QC_DISABLE_geoip_database
echo QC_WITH_GEOIP_DATABASE_EMBEDDED=$QC_WITH_GEOIP_DATABASE_EMBEDDED
echo
fi
@@ -438,36 +422,6 @@ public:
return true;
}
};
#line 1 "geoip-database.qcm"
/*
-----BEGIN QCMOD-----
name: geoip-database
arg: with-geoip-database-embedded, Geoip Database will be embedded in qBittorrent executable (please follow instructions in src/geoip/README)
-----END QCMOD-----
*/
// see Conf::findPkgConfig
class qc_geoip_database : public ConfObj
{
public:
qc_geoip_database(Conf *c) : ConfObj(c) {}
QString name() const { return "GeoIP Database (optional)"; }
QString shortname() const { return "GeoIP Database"; }
bool exec() {
#ifdef Q_WS_X11
if(!conf->getenv("QC_WITH_GEOIP_DATABASE_EMBEDDED").isEmpty()) {
#endif
conf->addDefine("WITH_GEOIP_EMBEDDED");
printf(" embedded and");
return true;
#ifdef Q_WS_X11
}
if(QFile::exists("/usr/share/GeoIP/GeoIP.dat") || QFile::exists("/usr/local/share/GeoIP/GeoIP.dat"))
return true;
printf("\nWarning: GeoIP database was not found at /usr/share/GeoIP/GeoIP.dat\nCountry resolution will be slow.");
return false;
#endif
}
};
EOT
cat >$1/modules_new.cpp <<EOT
@@ -483,9 +437,6 @@ cat >$1/modules_new.cpp <<EOT
o = new qc_libnotify(conf);
o->required = false;
o->disabled = false;
o = new qc_geoip_database(conf);
o->required = false;
o->disabled = false;
EOT
cat >$1/conf4.h <<EOT
@@ -1433,8 +1384,6 @@ export DATADIR
export EX_QTDIR
export QC_WITH_LIBBOOST_INC
export QC_DISABLE_libnotify
export QC_DISABLE_geoip_database
export QC_WITH_GEOIP_DATABASE_EMBEDDED
export QC_VERBOSE
rm -rf .qconftemp
(

View File

@@ -14,6 +14,4 @@
</dep>
<dep type='libnotify'>
</dep>
<dep type='geoip-database'>
</dep>
</qconf>

View File

@@ -1,29 +0,0 @@
/*
-----BEGIN QCMOD-----
name: geoip-database
arg: with-geoip-database-embedded, Geoip Database will be embedded in qBittorrent executable (please follow instructions in src/geoip/README)
-----END QCMOD-----
*/
// see Conf::findPkgConfig
class qc_geoip_database : public ConfObj
{
public:
qc_geoip_database(Conf *c) : ConfObj(c) {}
QString name() const { return "GeoIP Database (optional)"; }
QString shortname() const { return "GeoIP Database"; }
bool exec() {
#ifdef Q_WS_X11
if(!conf->getenv("QC_WITH_GEOIP_DATABASE_EMBEDDED").isEmpty()) {
#endif
conf->addDefine("WITH_GEOIP_EMBEDDED");
printf(" embedded and");
return true;
#ifdef Q_WS_X11
}
if(QFile::exists("/usr/share/GeoIP/GeoIP.dat") || QFile::exists("/usr/local/share/GeoIP/GeoIP.dat"))
return true;
printf("\nWarning: GeoIP database was not found at /usr/share/GeoIP/GeoIP.dat\nCountry resolution will be slow.");
return false;
#endif
}
};

View File

@@ -196,24 +196,17 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
GUI::~GUI() {
qDebug("GUI destruction");
hide();
// Async deletion of Bittorrent session as early as possible
// in order to speed up exit
session_proxy sp = BTSession->asyncDeletion();
// Some saving
properties->saveSettings();
disconnect(tabs, SIGNAL(currentChanged(int)), this, SLOT(tab_changed(int)));
// Delete other GUI objects
delete status_bar;
delete transferList;
delete guiUpdater;
if(rssWidget)
delete rssWidget;
delete searchEngine;
delete transferListFilters;
delete properties;
delete transferList;
delete hSplitter;
delete vSplitter;
delete guiUpdater;
qDebug("1");
if(systrayCreator) {
delete systrayCreator;
}
@@ -221,21 +214,19 @@ GUI::~GUI() {
delete systrayIcon;
delete myTrayIconMenu;
}
qDebug("2");
localServer->close();
delete localServer;
delete tabs;
qDebug("3");
// Keyboard shortcuts
delete switchSearchShortcut;
delete switchSearchShortcut2;
delete switchTransferShortcut;
delete switchRSSShortcut;
// Delete BTSession objects
qDebug("4");
delete BTSession;
// May freeze for a few seconds after the next line
// because the Bittorrent session proxy will
// actually be deleted now and destruction
// becomes synchronous
qDebug("Exiting GUI destructor...");
qDebug("5");
}
void GUI::displayRSSTab(bool enable) {
@@ -812,12 +803,11 @@ void GUI::showNotificationBaloon(QString title, QString msg) const {
if (notify_init ("summary-body")) {
NotifyNotification* notification;
notification = notify_notification_new (title.toLocal8Bit().data(), msg.toLocal8Bit().data(), "qbittorrent", 0);
gboolean success = notify_notification_show (notification, NULL);
g_object_unref(G_OBJECT(notification));
GError* error = 0;
gboolean success = notify_notification_show (notification, &error);
notify_uninit ();
if(success) {
if(success)
return;
}
}
#endif
if(systrayIcon)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 496 B

After

Width:  |  Height:  |  Size: 185 B

View File

@@ -21,7 +21,6 @@ GenericName[pt_BR]=Cliente Bittorrent
GenericName[ro]=Client Bittorrent
GenericName[ru]=клиент Bittorrent
GenericName[sk]=Klient siete Bittorrent
GenericName[sr]=БитТоррент клијент
GenericName[sv]=Bittorrent-klient
GenericName[tr]=Bittorrent istemcisi
GenericName[uk]=Bittorrent-клієнт

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -78,11 +78,10 @@ class about : public QDialog, private Ui::AboutDlg{
- <u>Japanese:</u> Nardog (nardog@e2umail.com)<br>\
- <u>Korean:</u> Jin Woo Sin (jin828sin@users.sourceforge.net)<br>\
- <u>Norwegian:</u> Lars-Erik Labori (hamil@users.sourceforge.net)<br>\
- <u>Polish:</u> Mariusz Fik (fisiu@opensuse.org)<br>\
- <u>Polish:</u> Jarek Smieja (ajep9691@wp.pl)<br>\
- <u>Portuguese:</u> Nick Marinho (nickmarinho@gmail.com)<br>\
- <u>Romanian:</u> Obada Denis (obadadenis@users.sourceforge.net)<br>\
- <u>Russian:</u> Nick Khazov (m2k3d0n@users.sourceforge.net) and Alexey Morsov (samurai@ricom.ru)<br>\
- <u>Serbian:</u> Anaximandar Milet (anaximandar@operamail.com)<br>\
- <u>Slovak:</u> helix84<br>\
- <u>Spanish:</u> Vicente Raul Plata Fonseca (silverxnt@users.sourceforge.net) and Gabriel de Oliveira (deadloop@hotmail.com)<br>\
- <u>Swedish:</u> Daniel Nylander (po@danielnylander.se)<br>\

View File

@@ -33,7 +33,6 @@
#include <QString>
#include <QTimer>
#include <QSettings>
#include <stdlib.h>
#include "filesystemwatcher.h"
#include "bittorrent.h"
@@ -63,7 +62,7 @@
enum ProxyType {HTTP=1, SOCKS5=2, HTTP_PW=3, SOCKS5_PW=4};
// Main constructor
Bittorrent::Bittorrent() : preAllocateAll(false), addInPause(false), ratio_limit(-1), UPnPEnabled(false), NATPMPEnabled(false), LSDEnabled(false), DHTEnabled(false), queueingEnabled(false), geoipDBLoaded(false), exiting(false) {
Bittorrent::Bittorrent() : preAllocateAll(false), addInPause(false), ratio_limit(-1), UPnPEnabled(false), NATPMPEnabled(false), LSDEnabled(false), DHTEnabled(false), queueingEnabled(false), geoipDBLoaded(false) {
resolve_countries = false;
// To avoid some exceptions
fs::path::default_name_check(fs::no_check);
@@ -102,32 +101,13 @@ Bittorrent::Bittorrent() : preAllocateAll(false), addInPause(false), ratio_limit
qDebug("* BTSession constructed");
}
session_proxy Bittorrent::asyncDeletion() {
qDebug("Bittorrent session async deletion IN");
exiting = true;
// Main destructor
Bittorrent::~Bittorrent() {
qDebug("BTSession deletion");
// Do some BT related saving
saveDHTEntry();
saveSessionState();
saveFastResumeData();
// Delete session
session_proxy sp = s->abort();
delete s;
qDebug("Bittorrent session async deletion OUT");
return sp;
}
// Main destructor
Bittorrent::~Bittorrent() {
qDebug("BTSession destructor IN");
if(!exiting) {
// Do some BT related saving
saveDHTEntry();
saveSessionState();
saveFastResumeData();
// Delete session
session_proxy sp = s->abort();
delete s;
}
// Disable directory scanning
disableDirectoryScanning();
// Delete our objects
@@ -145,7 +125,10 @@ Bittorrent::~Bittorrent() {
delete httpServer;
if(timerETA)
delete timerETA;
qDebug("BTSession destructor OUT");
// Delete BT session
qDebug("Deleting session");
delete s;
qDebug("Session deleted");
}
void Bittorrent::preAllocateAllFiles(bool b) {
@@ -198,12 +181,11 @@ void Bittorrent::setUploadLimit(QString hash, long val) {
void Bittorrent::handleDownloadFailure(QString url, QString reason) {
emit downloadFromUrlFailure(url, reason);
// Clean up
QUrl qurl = QUrl::fromEncoded(url.toLocal8Bit());
int index = url_skippingDlg.indexOf(qurl);
int index = url_skippingDlg.indexOf(url);
if(index >= 0)
url_skippingDlg.removeAt(index);
if(savepath_fromurl.contains(qurl))
savepath_fromurl.remove(qurl);
if(savepath_fromurl.contains(url))
savepath_fromurl.remove(url);
}
void Bittorrent::startTorrentsInPause(bool b) {
@@ -309,15 +291,9 @@ void Bittorrent::configureSession() {
}
sessionSettings.upnp_ignore_nonrouters = true;
sessionSettings.use_dht_as_fallback = false;
// To prevent ISPs from blocking seeding
sessionSettings.lazy_bitfields = true;
// Speed up exit
sessionSettings.stop_tracker_timeout = 1;
//sessionSettings.announce_to_all_trackers = true;
sessionSettings.auto_scrape_interval = 1200; // 20 minutes
#ifdef LIBTORRENT_0_15
sessionSettings.announce_to_all_tiers = true; //uTorrent behavior
sessionSettings.auto_scrape_min_interval = 900; // 15 minutes
#endif
// To keep same behavior as in qBittorrent v1.2.0
sessionSettings.rate_limit_ip_overhead = false;
@@ -843,9 +819,9 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
}
}
QString savePath;
if(!from_url.isEmpty() && savepath_fromurl.contains(QUrl::fromEncoded(from_url.toLocal8Bit()))) {
if(!from_url.isEmpty() && savepath_fromurl.contains(from_url)) {
// Enforcing the save path defined before URL download (from RSS for example)
savePath = savepath_fromurl.take(QUrl::fromEncoded(from_url.toLocal8Bit()));
savePath = savepath_fromurl.take(from_url);
} else {
savePath = getSavePath(hash);
}
@@ -1146,10 +1122,8 @@ void Bittorrent::saveFastResumeData() {
if (rda) {
--num_resume_data;
s->pop_alert();
try {
// Remove torrent from session
s->remove_torrent(rda->handle);
}catch(libtorrent::libtorrent_exception){}
// Remove torrent from session
s->remove_torrent(rda->handle);
continue;
}
save_resume_data_alert const* rd = dynamic_cast<save_resume_data_alert const*>(a);
@@ -1185,14 +1159,14 @@ QStringList Bittorrent::getPeerBanMessages() const {
void Bittorrent::addConsoleMessage(QString msg, QColor color) {
if(consoleMessages.size() > 100) {
consoleMessages.removeFirst();
consoleMessages.removeFirst();
}
consoleMessages.append(QString::fromUtf8("<font color='grey'>")+ QDateTime::currentDateTime().toString(QString::fromUtf8("dd/MM/yyyy hh:mm:ss")) + QString::fromUtf8("</font> - <font color='") + color.name() +QString::fromUtf8("'><i>") + msg + QString::fromUtf8("</i></font>"));
}
void Bittorrent::addPeerBanMessage(QString ip, bool from_ipfilter) {
if(peerBanMessages.size() > 100) {
peerBanMessages.removeFirst();
peerBanMessages.removeFirst();
}
if(from_ipfilter)
peerBanMessages.append(QString::fromUtf8("<font color='grey'>")+ QDateTime::currentDateTime().toString(QString::fromUtf8("dd/MM/yyyy hh:mm:ss")) + QString::fromUtf8("</font> - ")+tr("<font color='red'>%1</font> <i>was blocked due to your IP filter</i>", "x.y.z.w was blocked").arg(ip));
@@ -1516,16 +1490,9 @@ void Bittorrent::readAlerts() {
}
}
}
else if (listen_failed_alert* p = dynamic_cast<listen_failed_alert*>(a.get())) {
else if (dynamic_cast<listen_failed_alert*>(a.get())) {
// Level: fatal
int tried_port = p->endpoint.port();
srand(time(0));
int fallback_port = tried_port;
do {
fallback_port = rand() % 64512 + 1024;
} while(fallback_port == tried_port);
addConsoleMessage(tr("Couldn't listen on port %1, using %2 instead.").arg(QString::number(tried_port)).arg(QString::number(fallback_port)), QString::fromUtf8("red"));
setListeningPort(fallback_port);
addConsoleMessage(tr("Couldn't listen on any of the given ports."), QString::fromUtf8("red"));
//emit portListeningFailure();
}
/*else if (torrent_paused_alert* p = dynamic_cast<torrent_paused_alert*>(a.get())) {
@@ -1546,7 +1513,7 @@ void Bittorrent::readAlerts() {
QHash<QString, TrackerInfos> trackers_data = trackersInfos.value(h.hash(), QHash<QString, TrackerInfos>());
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
data.last_message = misc::toQString(p->msg);
#ifndef LIBTORRENT_0_15
#ifndef LIBTORRENT_0_15
data.verified = false;
++data.fail_count;
#endif
@@ -1703,17 +1670,16 @@ void Bittorrent::addMagnetSkipAddDlg(QString uri) {
void Bittorrent::downloadUrlAndSkipDialog(QString url, QString save_path) {
//emit aboutToDownloadFromUrl(url);
QUrl qurl = QUrl::fromEncoded(url.toLocal8Bit());
if(!save_path.isEmpty())
savepath_fromurl[qurl] = save_path;
url_skippingDlg << qurl;
savepath_fromurl[url] = save_path;
url_skippingDlg << url;
// Launch downloader thread
downloader->downloadUrl(url);
}
// Add to Bittorrent session the downloaded torrent file
void Bittorrent::processDownloadedFile(QString url, QString file_path) {
int index = url_skippingDlg.indexOf(QUrl::fromEncoded(url.toLocal8Bit()));
int index = url_skippingDlg.indexOf(url);
if(index < 0) {
// Add file to torrent download list
emit newDownloadedTorrent(file_path, url);

View File

@@ -31,8 +31,6 @@
#define __BITTORRENT_H__
#include <QHash>
#include <QMap>
#include <QUrl>
#include <QStringList>
#include <QApplication>
#include <QPalette>
@@ -88,7 +86,7 @@ private:
// Bittorrent
session *s;
QPointer<QTimer> timerAlerts;
QMap<QUrl, QString> savepath_fromurl;
QHash<QString, QString> savepath_fromurl;
QHash<QString, QHash<QString, TrackerInfos> > trackersInfos;
// Ratio
QPointer<QTimer> BigRatioTimer;
@@ -121,9 +119,7 @@ private:
QString filterPath;
// Web UI
QPointer<HttpServer> httpServer;
QList<QUrl> url_skippingDlg;
// Fast exit (async)
bool exiting;
QStringList url_skippingDlg;
protected:
QString getSavePath(QString hash);
@@ -167,7 +163,6 @@ public slots:
void downloadFromUrl(QString url);
void deleteTorrent(QString hash, bool delete_local_files = false);
void startUpTorrents();
session_proxy asyncDeletion();
/* Needed by Web UI */
void pauseAllTorrents();
void pauseTorrent(QString hash);

View File

@@ -46,7 +46,6 @@
#include <libtorrent/file_pool.hpp>
#include <libtorrent/create_torrent.hpp>
#include "torrentpersistentdata.h"
#include "createtorrent_imp.h"
#include "misc.h"
@@ -57,9 +56,9 @@ using namespace boost::filesystem;
// name starts with a .
bool file_filter(boost::filesystem::path const& filename)
{
if (filename.leaf()[0] == '.') return false;
std::cerr << filename << std::endl;
return true;
if (filename.leaf()[0] == '.') return false;
std::cerr << filename << std::endl;
return true;
}
createtorrent::createtorrent(QWidget *parent): QDialog(parent){
@@ -99,30 +98,30 @@ void createtorrent::on_removeTracker_button_clicked() {
int createtorrent::getPieceSize() const {
switch(comboPieceSize->currentIndex()) {
case 0:
return 32*1024;
case 1:
return 64*1024;
case 2:
return 128*1024;
case 3:
return 256*1024;
case 4:
return 512*1024;
case 5:
return 1024*1024;
case 6:
return 2048*1024;
default:
return 256*1024;
case 0:
return 32*1024;
case 1:
return 64*1024;
case 2:
return 128*1024;
case 3:
return 256*1024;
case 4:
return 512*1024;
case 5:
return 1024*1024;
case 6:
return 2048*1024;
default:
return 256*1024;
}
}
void createtorrent::on_addTracker_button_clicked() {
bool ok;
QString URL = QInputDialog::getText(this, tr("Please type an announce URL"),
tr("Announce URL:", "Tracker URL"), QLineEdit::Normal,
"http://", &ok);
tr("Announce URL:", "Tracker URL"), QLineEdit::Normal,
"http://", &ok);
if(ok){
if(trackers_list->findItems(URL, Qt::MatchFixedString).size() == 0)
trackers_list->addItem(URL);
@@ -140,8 +139,8 @@ void createtorrent::on_removeURLSeed_button_clicked(){
void createtorrent::on_addURLSeed_button_clicked(){
bool ok;
QString URL = QInputDialog::getText(this, tr("Please type a web seed url"),
tr("Web seed URL:"), QLineEdit::Normal,
"http://", &ok);
tr("Web seed URL:"), QLineEdit::Normal,
"http://", &ok);
if(ok){
if(URLSeeds_list->findItems(URL, Qt::MatchFixedString).size() == 0)
URLSeeds_list->addItem(URL);
@@ -188,25 +187,24 @@ void createtorrent::handleCreationFailure(QString msg) {
}
void createtorrent::handleCreationSuccess(QString path, const char* branch_path) {
if(checkStartSeeding->isChecked()) {
// Create save path temp data
boost::intrusive_ptr<torrent_info> t;
try {
t = new torrent_info(path.toLocal8Bit().data());
} catch(std::exception&) {
QMessageBox::critical(0, tr("Torrent creation"), tr("Created torrent file is invalid. It won't be added to download list."));
return;
if(checkStartSeeding->isChecked()) {
// Create save path file
boost::intrusive_ptr<torrent_info> t;
try {
t = new torrent_info(path.toLocal8Bit().data());
} catch(std::exception&) {
QMessageBox::critical(0, tr("Torrent creation"), tr("Created torrent file is invalid. It won't be added to download list."));
return;
}
QString hash = misc::toQString(t->info_hash());
QFile savepath_file(misc::qBittorrentPath()+QString::fromUtf8("BT_backup")+QDir::separator()+hash+QString::fromUtf8(".savepath"));
savepath_file.open(QIODevice::WriteOnly | QIODevice::Text);
savepath_file.write(branch_path);
savepath_file.close();
emit torrent_to_seed(path);
}
QString hash = misc::toQString(t->info_hash());
TorrentTempData::setSavePath(hash, QString(branch_path));
#ifdef LIBTORRENT_0_15
// Enable seeding mode (do not recheck the files)
TorrentTempData::setSeedingMode(hash, true);
#endif
emit torrent_to_seed(path);
}
QMessageBox::information(0, tr("Torrent creation"), tr("Torrent was created successfully:")+" "+path);
close();
QMessageBox::information(0, tr("Torrent creation"), tr("Torrent was created successfully:")+" "+path);
close();
}
void createtorrent::updateProgressBar(int progress) {
@@ -230,7 +228,7 @@ void torrentCreatorThread::create(QString _input_path, QString _save_path, QStri
}
void sendProgressUpdateSignal(int i, int num, torrentCreatorThread *parent){
parent->sendProgressSignal((int)(i*100./(float)num));
parent->sendProgressSignal((int)(i*100./(float)num));
}
void torrentCreatorThread::sendProgressSignal(int progress) {

View File

@@ -84,13 +84,7 @@ void downloadThread::downloadUrl(QString url){
// Update proxy settings
applyProxySettings();
// Process download request
QNetworkRequest request;
request.setUrl(QUrl::fromEncoded(url.toLocal8Bit()));
// Spoof Firefox 3.5 user agent to avoid
// Web server banning
request.setRawHeader("User-Agent", "Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5");
qDebug("Downloading %s...", request.url().toString().toLocal8Bit().data());
networkManager->get(request);
networkManager->get(QNetworkRequest(QUrl(url)));
}
void downloadThread::applyProxySettings() {

View File

@@ -94,7 +94,7 @@ QList<QVariantMap> EventManager::getPropTrackersInfo(QString hash) const {
QList<QVariantMap> EventManager::getPropFilesInfo(QString hash) const {
QList<QVariantMap> files;
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(!h.is_valid() || !h.has_metadata()) return files;
if(!h.is_valid()) return files;
std::vector<int> priorities = h.file_priorities();
std::vector<size_type> fp;
h.file_progress(fp);
@@ -111,10 +111,7 @@ QList<QVariantMap> EventManager::getPropFilesInfo(QString hash) const {
file["name"] = name;
}
file["size"] = misc::friendlyUnit((double)fi->size);
if(fi->size > 0)
file["progress"] = fp[i]/(double)fi->size;
else
file["progress"] = 1.; // Empty file...
file["progress"] = fp[i]/(double)fi->size;
file["priority"] = priorities[i];
files << file;
++i;
@@ -136,7 +133,7 @@ QVariantMap EventManager::getGlobalPreferences() const {
QVariantMap EventManager::getPropGeneralInfo(QString hash) const {
QVariantMap data;
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid() && h.has_metadata()) {
if(h.is_valid()) {
// Save path
data["save_path"] = TorrentPersistentData::getSavePath(hash);
// Creation date
@@ -161,11 +158,19 @@ QVariantMap EventManager::getPropGeneralInfo(QString hash) const {
data["time_elapsed"] = elapsed_txt;
data["nb_connections"] = QString::number(h.num_connections())+" ("+tr("%1 max", "e.g. 10 max").arg(QString::number(h.connections_limit()))+")";
// Update ratio info
double ratio = BTSession->getRealRatio(h.hash());
if(ratio > 100.)
data["share_ratio"] = QString::fromUtf8("∞");
float ratio;
if(h.total_payload_download() == 0){
if(h.total_payload_upload() == 0)
ratio = 1.;
else
data["share_ratio"] = QString(QByteArray::number(ratio, 'f', 1));
ratio = 10.; // Max ratio
}else{
ratio = (double)h.total_payload_upload()/(double)h.total_payload_download();
if(ratio > 10.){
ratio = 10.;
}
}
data["share_ratio"] = QString(QByteArray::number(ratio, 'f', 1));
}
return data;
}
@@ -202,7 +207,7 @@ void EventManager::modifiedTorrent(QTorrentHandle h)
case torrent_status::finished:
case torrent_status::seeding:
if(h.upload_payload_rate() > 0) {
event["state"] = QVariant("uploading");
event["state"] = QVariant("seeding");
} else {
event["state"] = QVariant("stalledUP");
}
@@ -255,7 +260,7 @@ void EventManager::modifiedTorrent(QTorrentHandle h)
event["seed"] = QVariant(h.is_seed());
double ratio = BTSession->getRealRatio(hash);
if(ratio > 100.)
event["ratio"] = QString::fromUtf8("∞");
QString::fromUtf8("∞");
else
event["ratio"] = QVariant(QString::number(ratio, 'f', 1));
event["hash"] = QVariant(hash);

View File

@@ -36,10 +36,6 @@ public:
setCurrentItem(unread_item);
}
~FeedList() {
delete unread_item;
}
void itemAdded(QTreeWidgetItem *item, RssFile* file) {
mapping[item] = file;
if(file->getType() == RssFile::STREAM) {
@@ -69,7 +65,7 @@ public:
QStringList path;
if(item) {
if(item->parent())
path << getItemPath(item->parent());
path.append(getItemPath(item->parent()));
path.append(getRSSItem(item)->getID());
}
return path;
@@ -91,7 +87,7 @@ public:
if(getItemType(item) == RssFile::FOLDER && item->isExpanded()) {
QList<QTreeWidgetItem*> open_subfolders = getAllOpenFolders(item);
if(!open_subfolders.empty()) {
open_folders << open_subfolders;
open_folders.append(open_subfolders);
} else {
open_folders << item;
}
@@ -108,7 +104,7 @@ public:
if(getItemType(item) == RssFile::STREAM) {
feeds << item;
} else {
feeds << getAllFeedItems(item);
feeds.append(getAllFeedItems(item));
}
}
return feeds;

View File

@@ -32,6 +32,7 @@
#define FEEDDOWNLOADER_H
#include <QString>
#include <QHash>
#include <QSettings>
#include <QListWidget>
#include <QListWidgetItem>
@@ -46,14 +47,6 @@
#include "bittorrent.h"
#include "ui_feeddownloader.h"
#ifdef QT_4_5
#include <QHash>
#else
#include <QMap>
#define QHash QMap
#define toHash toMap
#endif
class FeedFilter: public QHash<QString, QVariant> {
private:
bool valid;
@@ -287,17 +280,6 @@ protected slots:
}
}
void on_browse_button_clicked() {
QString default_path = savepath_line->text();
if(default_path.isEmpty() || !QDir(default_path).exists()) {
default_path = QDir::homePath();
}
QString dir = QFileDialog::getExistingDirectory(this, tr("Choose save path"), QDir::homePath());
if(!dir.isNull() and QDir(dir).exists()) {
savepath_line->setText(dir);
}
}
void fillFiltersList() {
// Fill filter list
foreach(QString filter_name, filters.names()) {
@@ -445,11 +427,7 @@ protected slots:
}
void on_testButton_clicked(bool) {
test_res_lbl->clear();
if(selected_filter.isEmpty()) {
qDebug("No filter is selected!!!");
return;
}
if(selected_filter.isEmpty()) return;
QString s = test_line->text().trimmed();
if(s.isEmpty()) {
QMessageBox::warning(0, tr("Filter testing error"), tr("Please specify a test torrent name."));
@@ -499,7 +477,4 @@ protected slots:
};
#undef QHash
#undef toHash
#endif // FEEDDOWNLOADER_H

View File

@@ -40,27 +40,43 @@
using namespace libtorrent;
// TODO: Update from Internet
class GeoIP {
protected:
static QString geoipFolder(bool embedded=false) {
#ifdef WITH_GEOIP_EMBEDDED
if(embedded)
return ":/geoip/";
return misc::qBittorrentPath()+"geoip"+QDir::separator();
#else
if(QFile::exists("/usr/local/share/GeoIP/GeoIP.dat"))
return "/usr/local/share/GeoIP/";
return "/usr/share/GeoIP/";
#endif
}
static QString geoipDBpath(bool embedded=false) {
return geoipFolder(embedded)+"GeoIP.dat";
}
#ifdef WITH_GEOIP_EMBEDDED
static void exportEmbeddedDb() {
if(!QFile::exists(geoipDBpath(false)) || QFile(geoipDBpath(false)).size() != QFile(geoipDBpath(true)).size()) { // Export is required
static QString geoipVersionPath(bool embedded=false) {
return geoipFolder(embedded)+"VERSION";
}
static int getDBVersion(bool embedded = false) {
QFile vFile(geoipVersionPath(embedded));
qDebug("Reading file at %s", geoipVersionPath(embedded).toLocal8Bit().data());
if(vFile.exists() && vFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
qDebug("File exists and was opened");
QByteArray v = vFile.readAll().trimmed();
/*while(!v.isEmpty() && v[0] == '0') {
v = v.mid(1);
}*/
qDebug("Read version: %s", v.data());
bool ok = false;
int version = v.toInt(&ok);
qDebug("Read version %d (Error? %d)", version, (int) !ok);
if(ok) return version;
}
return 0;
}
static void updateLocalDb() {
if(getDBVersion(true) > getDBVersion(false)) { // Update required
qDebug("A local Geoip database update is required, proceeding...");
// Create geoip folder is necessary
QDir gfolder(geoipFolder(false));
@@ -70,18 +86,18 @@ protected:
// Remove destination files
if(QFile::exists(geoipDBpath(false)))
QFile::remove(geoipDBpath(false));
if(QFile::exists(geoipVersionPath(false)))
QFile::remove(geoipVersionPath(false));
// Copy from executable to hard disk
QFile::copy(geoipDBpath(true), geoipDBpath(false));
QFile::copy(geoipVersionPath(true), geoipVersionPath(false));
qDebug("Local Geoip database was updated");
}
}
#endif
public:
static void loadDatabase(session *s) {
#ifdef WITH_GEOIP_EMBEDDED
exportEmbeddedDb();
#endif
updateLocalDb();
if(QFile::exists(geoipDBpath(false))) {
qDebug("Loading GeoIP database from %s...", geoipDBpath(false).toLocal8Bit().data());
if(!s->load_country_db(geoipDBpath(false).toLocal8Bit().data())) {

View File

@@ -1,5 +1,7 @@
<RCC>
<qresource prefix="/" >
<file>geoip/GeoIP.dat</file>
</qresource>
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>geoip/GeoIP.dat</file>
<file>geoip/VERSION</file>
</qresource>
</RCC>

BIN
src/geoip/GeoIP.dat Normal file

Binary file not shown.

39
src/geoip/LICENSE.txt Normal file
View File

@@ -0,0 +1,39 @@
There are two licenses, one for the C library software, and one for
the database.
SOFTWARE LICENSE (C library)
The GeoIP C Library is licensed under the LGPL. For details see
the COPYING file.
OPEN DATA LICENSE (GeoLite Country and GeoLite City databases)
Copyright (c) 2008 MaxMind, Inc. All Rights Reserved.
All advertising materials and documentation mentioning features or use of
this database must display the following acknowledgment:
"This product includes GeoLite data created by MaxMind, available from
http://maxmind.com/"
Redistribution and use with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions must retain the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
2. All advertising materials and documentation mentioning features or use of
this database must display the following acknowledgement:
"This product includes GeoLite data created by MaxMind, available from
http://maxmind.com/"
3. "MaxMind" may not be used to endorse or promote products derived from this
database without specific prior written permission.
THIS DATABASE IS PROVIDED BY MAXMIND, INC ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL MAXMIND BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
DATABASE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -1,12 +0,0 @@
If you wish to embed GeoIP database into qBittorrent executable, please download put GeoIP.dat in this folder.
GeoIP Database can be downloaded from here:
* http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
Note that the database should be uncompressed.
Embedding GeoIP database into qBittorrent executable is advised for:
* Windows
* Mac OS X
* Linux distributions that don't provide GeoIP database in a separate package
On Linux operating system, since this is not the default behavior, you also need to pass --with-geoip-database-embedded parameter to the configure file.

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