You've already forked qBittorrent
mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-10-16 20:32:23 +02:00
Compare commits
22 Commits
release-1.
...
release-1.
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5c3f2f0aed | ||
![]() |
d78a47ad30 | ||
![]() |
60c3ccac7f | ||
![]() |
1fbf7d42a1 | ||
![]() |
4b73172105 | ||
![]() |
ada5d2665b | ||
![]() |
f1ca41a5c5 | ||
![]() |
17e0700a52 | ||
![]() |
cc77b2f578 | ||
![]() |
85463e3910 | ||
![]() |
7bd0dff802 | ||
![]() |
4bc043146d | ||
![]() |
fd78e0b5ce | ||
![]() |
8565f1e61e | ||
![]() |
4c6d6a35f3 | ||
![]() |
fc79b7dc56 | ||
![]() |
da11488ba1 | ||
![]() |
968c3e1c3e | ||
![]() |
68e30de763 | ||
![]() |
573f00c66c | ||
![]() |
ae81dbe088 | ||
![]() |
2edbe66d91 |
10
Changelog
10
Changelog
@@ -1,3 +1,13 @@
|
||||
* Mon Jan 26 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.3.1
|
||||
- BUGFIX: Torrents paused due to an I/O error were displayed as queued
|
||||
- BUGFIX: qBittorrent now prints backtrace in terminal when segfaulting
|
||||
- BUGFIX: Fixed files progress display in torrent properties
|
||||
- BUGFIX: Improved torrent ratio calculation
|
||||
- BUGFIX: Fixed possible crash when parsing filter file
|
||||
- BUGFIX: Made some code optimization
|
||||
- BUGFIX: Fixed download/upload speed decrease problems
|
||||
- I18N: Updated Finnish, Bulgarian and Greek translations
|
||||
|
||||
* Fri Jan 9 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.3.0
|
||||
- FEATURE: Based on libtorrent-rasterbar v0.14.2
|
||||
- FEATURE: Improved ratio calculation system
|
||||
|
3
TODO
3
TODO
@@ -16,3 +16,6 @@ See https://blueprints.launchpad.net/qbittorrent/
|
||||
- Korean
|
||||
- Portuguese
|
||||
- Brazilian
|
||||
- Greek
|
||||
- Bulgarian
|
||||
- Finnish
|
||||
|
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
-----BEGIN QCMOD-----
|
||||
name: libcommoncpp2
|
||||
arg: with-libcommoncpp2-inc=[path], Path to libcommoncpp2 include files
|
||||
arg: with-libcommoncpp2-lib=[path], Path to libcommoncpp2 library files
|
||||
-----END QCMOD-----
|
||||
*/
|
||||
class qc_libcommoncpp2 : public ConfObj
|
||||
{
|
||||
public:
|
||||
qc_libcommoncpp2(Conf *c) : ConfObj(c) {}
|
||||
QString name() const { return "GNU Common C++ library (libcommoncpp2)"; }
|
||||
QString shortname() const { return "libcommoncpp2"; }
|
||||
bool exec(){
|
||||
QString s;
|
||||
s = conf->getenv("QC_WITH_LIBCOMMONCPP2_INC");
|
||||
if(!s.isEmpty()) {
|
||||
if(!conf->checkHeader(s, "cc++/url.h")) {
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
QStringList sl;
|
||||
sl << "/usr/include";
|
||||
sl << "/usr/local/include";
|
||||
bool found = false;
|
||||
foreach(s, sl){
|
||||
if(conf->checkHeader(s, "cc++/url.h")){
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
conf->addIncludePath(s);
|
||||
|
||||
s = conf->getenv("QC_WITH_LIBCOMMONCPP2_LIB");
|
||||
if(!s.isEmpty()) {
|
||||
if(!QFile::exists(s+QString("/libccext2.so")))
|
||||
return false;
|
||||
if(!QFile::exists(s+QString("/libccgnu2.so")))
|
||||
return false;
|
||||
conf->addLib(QString("-L") + s);
|
||||
}else{
|
||||
QStringList sl;
|
||||
sl << "/usr/lib/";
|
||||
sl << "/usr/lib64/";
|
||||
sl << "/usr/local/lib/";
|
||||
sl << "/usr/local/lib64/";
|
||||
bool found = false;
|
||||
foreach(s, sl){
|
||||
if(QFile::exists(s+QString("libccext2.so"))){
|
||||
if(QFile::exists(s+QString("libccgnu2.so"))){
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!found) return false;
|
||||
conf->addLib(QString("-L") + s);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
@@ -6,6 +6,7 @@ arg: with-libtorrent-lib=[path], Path to libtorrent-rasterbar library files
|
||||
arg: with-libtorrent-static-lib=[path], Path to libtorrent-rasterbar .a file
|
||||
-----END QCMOD-----
|
||||
*/
|
||||
// see Conf::findPkgConfig
|
||||
class qc_libtorrent_rasterbar : public ConfObj
|
||||
{
|
||||
public:
|
||||
|
@@ -72,7 +72,10 @@ class DLListDelegate: public QItemDelegate {
|
||||
case RATIO:{
|
||||
QItemDelegate::drawBackground(painter, opt, index);
|
||||
double ratio = index.data().toDouble();
|
||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString(QByteArray::number(ratio, 'f', 1)));
|
||||
if(ratio > 100.)
|
||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::fromUtf8("∞"));
|
||||
else
|
||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString(QByteArray::number(ratio, 'f', 1)));
|
||||
break;
|
||||
}
|
||||
case PROGRESS:{
|
||||
|
@@ -63,7 +63,10 @@ class FinishedListDelegate: public QItemDelegate {
|
||||
case F_RATIO:{
|
||||
QItemDelegate::drawBackground(painter, opt, index);
|
||||
double ratio = index.data().toDouble();
|
||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString(QByteArray::number(ratio, 'f', 1)));
|
||||
if(ratio > 100.)
|
||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::fromUtf8("∞"));
|
||||
else
|
||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString(QByteArray::number(ratio, 'f', 1)));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@@ -133,9 +133,8 @@ void FinishedTorrents::setRowColor(int row, QString color){
|
||||
|
||||
QStringList FinishedTorrents::getSelectedTorrents(bool only_one) const{
|
||||
QStringList res;
|
||||
QModelIndex index;
|
||||
QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes();
|
||||
foreach(index, selectedIndexes) {
|
||||
foreach(const QModelIndex &index, selectedIndexes) {
|
||||
if(index.column() == F_NAME) {
|
||||
// Get the file hash
|
||||
QString hash = finishedListModel->data(finishedListModel->index(index.row(), F_HASH)).toString();
|
||||
@@ -218,9 +217,8 @@ void FinishedTorrents::saveColWidthFinishedList() const{
|
||||
|
||||
void FinishedTorrents::on_actionSet_upload_limit_triggered(){
|
||||
QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes();
|
||||
QModelIndex index;
|
||||
QStringList hashes;
|
||||
foreach(index, selectedIndexes){
|
||||
foreach(const QModelIndex &index, selectedIndexes){
|
||||
if(index.column() == F_NAME){
|
||||
// Get the file hash
|
||||
hashes << finishedListModel->data(finishedListModel->index(index.row(), F_HASH)).toString();
|
||||
@@ -330,8 +328,7 @@ void FinishedTorrents::updateFileSize(QString hash){
|
||||
// display properties of selected items
|
||||
void FinishedTorrents::propertiesSelection(){
|
||||
QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes();
|
||||
QModelIndex index;
|
||||
foreach(index, selectedIndexes){
|
||||
foreach(const QModelIndex &index, selectedIndexes){
|
||||
if(index.column() == F_NAME){
|
||||
showProperties(index);
|
||||
}
|
||||
@@ -340,8 +337,7 @@ void FinishedTorrents::propertiesSelection(){
|
||||
|
||||
void FinishedTorrents::forceRecheck(){
|
||||
QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes();
|
||||
QModelIndex index;
|
||||
foreach(index, selectedIndexes){
|
||||
foreach(const QModelIndex &index, selectedIndexes){
|
||||
if(index.column() == F_NAME){
|
||||
QString hash = finishedListModel->data(finishedListModel->index(index.row(), F_HASH)).toString();
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
@@ -352,11 +348,10 @@ void FinishedTorrents::forceRecheck(){
|
||||
|
||||
void FinishedTorrents::displayFinishedListMenu(const QPoint& pos){
|
||||
QMenu myFinishedListMenu(this);
|
||||
QModelIndex index;
|
||||
// Enable/disable pause/start action given the DL state
|
||||
QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes();
|
||||
bool has_pause = false, has_start = false, has_preview = false;
|
||||
foreach(index, selectedIndexes) {
|
||||
foreach(const QModelIndex &index, selectedIndexes) {
|
||||
if(index.column() == F_NAME) {
|
||||
// Get the file name
|
||||
QString hash = finishedListModel->data(finishedListModel->index(index.row(), F_HASH)).toString();
|
||||
|
36
src/GUI.cpp
36
src/GUI.cpp
@@ -555,9 +555,8 @@ void GUI::openDestinationFolder() const {
|
||||
default:
|
||||
return;
|
||||
}
|
||||
QString hash;
|
||||
QStringList pathsList;
|
||||
foreach(hash, hashes) {
|
||||
foreach(const QString &hash, hashes) {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
QString savePath = h.save_path();
|
||||
if(!pathsList.contains(savePath)) {
|
||||
@@ -579,9 +578,8 @@ void GUI::goBuyPage() const {
|
||||
default:
|
||||
return;
|
||||
}
|
||||
QString hash;
|
||||
QStringList pathsList;
|
||||
foreach(hash, hashes) {
|
||||
foreach(const QString &hash, hashes) {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
QDesktopServices::openUrl("http://match.sharemonkey.com/?info_hash="+hash+"&n="+h.name()+"&cid=33");
|
||||
}
|
||||
@@ -721,8 +719,7 @@ void GUI::dropEvent(QDropEvent *event) {
|
||||
QStringList files;
|
||||
if(event->mimeData()->hasUrls()) {
|
||||
QList<QUrl> urls = event->mimeData()->urls();
|
||||
QUrl url;
|
||||
foreach(url, urls) {
|
||||
foreach(const QUrl &url, urls) {
|
||||
QString tmp = url.toString();
|
||||
tmp.trimmed();
|
||||
if(!tmp.isEmpty())
|
||||
@@ -732,10 +729,9 @@ void GUI::dropEvent(QDropEvent *event) {
|
||||
files = event->mimeData()->text().split(QString::fromUtf8("\n"));
|
||||
}
|
||||
// Add file to download list
|
||||
QString file;
|
||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||
bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
|
||||
foreach(file, files) {
|
||||
foreach(QString file, files) {
|
||||
file = file.trimmed().replace(QString::fromUtf8("file://"), QString::fromUtf8(""), Qt::CaseInsensitive);
|
||||
qDebug("Dropped file %s on download list", file.toUtf8().data());
|
||||
if(file.startsWith(QString::fromUtf8("http://"), Qt::CaseInsensitive) || file.startsWith(QString::fromUtf8("ftp://"), Qt::CaseInsensitive) || file.startsWith(QString::fromUtf8("https://"), Qt::CaseInsensitive)) {
|
||||
@@ -753,8 +749,7 @@ void GUI::dropEvent(QDropEvent *event) {
|
||||
|
||||
// Decode if we accept drag 'n drop or not
|
||||
void GUI::dragEnterEvent(QDragEnterEvent *event) {
|
||||
QString mime;
|
||||
foreach(mime, event->mimeData()->formats()){
|
||||
foreach(const QString &mime, event->mimeData()->formats()){
|
||||
qDebug("mimeData: %s", mime.toUtf8().data());
|
||||
}
|
||||
if (event->mimeData()->hasFormat(QString::fromUtf8("text/plain")) || event->mimeData()->hasFormat(QString::fromUtf8("text/uri-list"))) {
|
||||
@@ -828,8 +823,7 @@ void GUI::on_actionDelete_Permanently_triggered() {
|
||||
}
|
||||
if(ret) return;
|
||||
//User clicked YES
|
||||
QString hash;
|
||||
foreach(hash, hashes) {
|
||||
foreach(const QString &hash, hashes) {
|
||||
// Get the file name
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
QString fileName = h.name();
|
||||
@@ -881,8 +875,7 @@ void GUI::on_actionDelete_triggered() {
|
||||
}
|
||||
if(ret) return;
|
||||
//User clicked YES
|
||||
QString hash;
|
||||
foreach(hash, hashes) {
|
||||
foreach(const QString &hash, hashes) {
|
||||
// Get the file name
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
QString fileName = h.name();
|
||||
@@ -896,10 +889,9 @@ void GUI::on_actionDelete_triggered() {
|
||||
// the right addTorrent function, considering
|
||||
// the parameter type.
|
||||
void GUI::processParams(const QStringList& params) {
|
||||
QString param;
|
||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||
bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
|
||||
foreach(param, params) {
|
||||
foreach(QString param, params) {
|
||||
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)) {
|
||||
BTSession->downloadFromUrl(param);
|
||||
@@ -1014,6 +1006,8 @@ void GUI::configureSession(bool deleteOptions) {
|
||||
}
|
||||
sessionSettings.upnp_ignore_nonrouters = true;
|
||||
sessionSettings.use_dht_as_fallback = false;
|
||||
// To keep same behavior as in qbittorrent v1.2.0
|
||||
sessionSettings.rate_limit_ip_overhead = false;
|
||||
// Queueing System
|
||||
if(options->isQueueingSystemEnabled()) {
|
||||
if(!BTSession->isQueueingEnabled()) {
|
||||
@@ -1282,7 +1276,7 @@ void GUI::on_actionIncreasePriority_triggered() {
|
||||
if(tabs->currentIndex() != 0)
|
||||
return;
|
||||
QStringList hashes = downloadingTorrentTab->getSelectedTorrents();
|
||||
foreach(QString hash, hashes) {
|
||||
foreach(const QString &hash, hashes) {
|
||||
BTSession->increaseDlTorrentPriority(hash);
|
||||
}
|
||||
updateLists();
|
||||
@@ -1291,7 +1285,7 @@ void GUI::on_actionIncreasePriority_triggered() {
|
||||
void GUI::on_actionDecreasePriority_triggered() {
|
||||
Q_ASSERT(tabs->currentIndex() == 0);
|
||||
QStringList hashes = downloadingTorrentTab->getSelectedTorrents();
|
||||
foreach(QString hash, hashes) {
|
||||
foreach(const QString &hash, hashes) {
|
||||
BTSession->decreaseDlTorrentPriority(hash);
|
||||
}
|
||||
updateLists();
|
||||
@@ -1309,8 +1303,7 @@ void GUI::on_actionPause_triggered() {
|
||||
} else {
|
||||
hashes = finishedTorrentTab->getSelectedTorrents();
|
||||
}
|
||||
QString hash;
|
||||
foreach(hash, hashes) {
|
||||
foreach(const QString &hash, hashes) {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
if(!h.is_paused()){
|
||||
h.pause();
|
||||
@@ -1354,8 +1347,7 @@ void GUI::on_actionStart_triggered() {
|
||||
} else {
|
||||
hashes = finishedTorrentTab->getSelectedTorrents();
|
||||
}
|
||||
QString hash;
|
||||
foreach(hash, hashes) {
|
||||
foreach(const QString &hash, hashes) {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
if(h.is_paused()){
|
||||
h.resume();
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[Desktop Entry]
|
||||
Categories=Qt;Network;P2P
|
||||
Comment=V1.3.0
|
||||
Comment=V1.3.1
|
||||
Exec=qbittorrent %f
|
||||
GenericName=Bittorrent client
|
||||
GenericName[bg]=Торент клиент
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
@@ -61,7 +61,7 @@ class about : public QDialog, private Ui::AboutDlg{
|
||||
- <u>Czech:</u> Jirka Vilim (web@tets.cz)<br>\
|
||||
- <u>Danish:</u> Mathias Nielsen (comoneo@gmail.com)<br>\
|
||||
- <u>Dutch:</u> Joost Schipper (heavyjoost@users.sourceforge.net) and Peter Koeleman (peter@peerweb.nl)<br>\
|
||||
- <u>Finnish:</u> Niklas Laxström (nikerabbit@users.sourceforge.net)<br>\
|
||||
- <u>Finnish:</u> Niklas Laxström (nikerabbit@users.sourceforge.net) and Pekka Niemi (pekka.niemi@iki.fi)<br>\
|
||||
- <u>German:</u> Niels Hoffmann (zentralmaschine@users.sourceforge.net)<br>\
|
||||
- <u>Greek:</u> Tsvetan Bankov (emerge_life@users.sourceforge.net)<br>\
|
||||
- <u>Hungarian:</u> Majoros Péter (majoros.peterj@gmail.com)<br>\
|
||||
|
@@ -32,7 +32,7 @@ class torrent_file {
|
||||
torrent_file *parent;
|
||||
bool is_dir;
|
||||
QString rel_path;
|
||||
QList<torrent_file*> children;
|
||||
QList<const torrent_file*> children;
|
||||
size_type size;
|
||||
float progress;
|
||||
int priority;
|
||||
@@ -68,8 +68,7 @@ class torrent_file {
|
||||
}
|
||||
float wanted = 0.;
|
||||
float done = 0.;
|
||||
torrent_file *child;
|
||||
foreach(child, children) {
|
||||
foreach(const torrent_file *child, children) {
|
||||
wanted += child->getSize();
|
||||
done += child->getSize()*child->getProgress();
|
||||
}
|
||||
@@ -80,8 +79,7 @@ class torrent_file {
|
||||
|
||||
void updatePriority(int prio) {
|
||||
Q_ASSERT(is_dir);
|
||||
torrent_file *child;
|
||||
foreach(child, children) {
|
||||
foreach(const torrent_file *child, children) {
|
||||
if(child->getPriority() != prio) return;
|
||||
}
|
||||
priority = prio;
|
||||
@@ -111,14 +109,13 @@ class torrent_file {
|
||||
return (!children.isEmpty());
|
||||
}
|
||||
|
||||
QList<torrent_file*> getChildren() const {
|
||||
QList<const torrent_file*> getChildren() const {
|
||||
return children;
|
||||
}
|
||||
|
||||
torrent_file* getChild(QString fileName) const {
|
||||
const torrent_file* getChild(QString fileName) const {
|
||||
Q_ASSERT(is_dir);
|
||||
torrent_file* f;
|
||||
foreach(f, children) {
|
||||
foreach(const torrent_file *f, children) {
|
||||
if(f->name() == fileName) return f;
|
||||
}
|
||||
return 0;
|
||||
@@ -141,16 +138,15 @@ class torrent_file {
|
||||
return f;
|
||||
}
|
||||
|
||||
bool removeFromFS(QString saveDir) {
|
||||
bool removeFromFS(QString saveDir) const {
|
||||
QString full_path = saveDir + QDir::separator() + rel_path;
|
||||
if(!QFile::exists(full_path)) {
|
||||
qDebug("%s does not exist, no need to remove it", full_path.toUtf8().data());
|
||||
return true;
|
||||
}
|
||||
bool success = true;
|
||||
torrent_file *f;
|
||||
qDebug("We have %d children", children.size());
|
||||
foreach(f, children) {
|
||||
foreach(const torrent_file *f, children) {
|
||||
bool s = f->removeFromFS(saveDir);
|
||||
success = s && success;
|
||||
}
|
||||
@@ -200,13 +196,13 @@ class arborescence {
|
||||
} else {
|
||||
// XXX: Will crash if there is no file in torrent
|
||||
qDebug("one file in the torrent, setting it as root with index 0");
|
||||
root = new torrent_file(0, misc::toQString(t.name()), false, fi->size, 0, fp[0]/t.file_at(0).size, prioritiesTab[0]);
|
||||
root = new torrent_file(0, misc::toQString(t.name()), false, fi->size, 0, ((float)fp[0])/t.file_at(0).size, prioritiesTab[0]);
|
||||
return;
|
||||
}
|
||||
int i = 0;
|
||||
while(fi != t.end_files()) {
|
||||
QString path = QDir::cleanPath(misc::toQString(fi->path.string()));
|
||||
addFile(path, fi->size, i, fp[i]/t.file_at(i).size, prioritiesTab[i]);
|
||||
addFile(path, fi->size, i, ((float)fp[i])/t.file_at(i).size, prioritiesTab[i]);
|
||||
fi++;
|
||||
++i;
|
||||
}
|
||||
@@ -239,14 +235,13 @@ class arborescence {
|
||||
if(relative_path.at(0) ==QDir::separator())
|
||||
relative_path.remove(0, 1);
|
||||
QStringList fileNames = relative_path.split(QDir::separator());
|
||||
QString fileName;
|
||||
torrent_file *dad = root;
|
||||
unsigned int nb_i = 0;
|
||||
unsigned int size = fileNames.size();
|
||||
foreach(fileName, fileNames) {
|
||||
foreach(const QString &fileName, fileNames) {
|
||||
++nb_i;
|
||||
if(fileName == ".") continue;
|
||||
torrent_file* child = dad->getChild(fileName);
|
||||
const torrent_file* child = dad->getChild(fileName);
|
||||
if(!child) {
|
||||
if(nb_i != size) {
|
||||
// Folder
|
||||
@@ -256,7 +251,7 @@ class arborescence {
|
||||
child = dad->addChild(fileName, false, file_size, index, progress, priority);
|
||||
}
|
||||
}
|
||||
dad = child;
|
||||
dad = (torrent_file*)child;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@@ -267,8 +267,7 @@ void bittorrent::deleteTorrent(QString hash, bool permanent) {
|
||||
QStringList filters;
|
||||
filters << hash+".*";
|
||||
QStringList files = torrentBackup.entryList(filters, QDir::Files, QDir::Unsorted);
|
||||
QString file;
|
||||
foreach(file, files) {
|
||||
foreach(const QString &file, files) {
|
||||
torrentBackup.remove(file);
|
||||
}
|
||||
// Remove tracker errors
|
||||
@@ -328,23 +327,21 @@ void bittorrent::loadWebSeeds(QString hash) {
|
||||
QByteArray urlseeds_lines = urlseeds_file.readAll();
|
||||
urlseeds_file.close();
|
||||
QList<QByteArray> url_seeds = urlseeds_lines.split('\n');
|
||||
QByteArray url_seed;
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
// First remove from the torrent the url seeds that were deleted
|
||||
// in a previous session
|
||||
QStringList seeds_to_delete;
|
||||
QStringList existing_seeds = h.url_seeds();
|
||||
QString existing_seed;
|
||||
foreach(existing_seed, existing_seeds) {
|
||||
foreach(const QString &existing_seed, existing_seeds) {
|
||||
if(!url_seeds.contains(existing_seed.toUtf8())) {
|
||||
seeds_to_delete << existing_seed;
|
||||
}
|
||||
}
|
||||
foreach(existing_seed, seeds_to_delete) {
|
||||
foreach(const QString &existing_seed, seeds_to_delete) {
|
||||
h.remove_url_seed(existing_seed);
|
||||
}
|
||||
// Add the ones that were added in a previous session
|
||||
foreach(url_seed, url_seeds) {
|
||||
foreach(const QByteArray &url_seed, url_seeds) {
|
||||
if(!url_seed.isEmpty()) {
|
||||
// XXX: Should we check if it is already in the list before adding it
|
||||
// or is libtorrent clever enough to know
|
||||
@@ -763,14 +760,12 @@ float bittorrent::getRealRatio(QString hash) const{
|
||||
Q_ASSERT(h.all_time_download() >= 0);
|
||||
Q_ASSERT(h.all_time_upload() >= 0);
|
||||
if(h.all_time_download() == 0) {
|
||||
if(h.all_time_upload() == 0)
|
||||
return 1.;
|
||||
return 10.;
|
||||
return 101;
|
||||
}
|
||||
float ratio = (float)h.all_time_upload()/(float)h.all_time_download();
|
||||
Q_ASSERT(ratio >= 0.);
|
||||
if(ratio > 10.)
|
||||
ratio = 10.;
|
||||
if(ratio > 100.)
|
||||
ratio = 100.;
|
||||
return ratio;
|
||||
}
|
||||
|
||||
@@ -879,12 +874,11 @@ bool bittorrent::isFilePreviewPossible(QString hash) const{
|
||||
void bittorrent::scanDirectory(QString scan_dir) {
|
||||
FSMutex->lock();
|
||||
qDebug("Scanning directory: %s", scan_dir.toUtf8().data());
|
||||
QString file;
|
||||
QDir dir(scan_dir);
|
||||
QStringList filters;
|
||||
filters << "*.torrent";
|
||||
QStringList files = dir.entryList(filters, QDir::Files, QDir::Unsorted);
|
||||
foreach(file, files) {
|
||||
foreach(const QString &file, files) {
|
||||
QString fullPath = dir.path()+QDir::separator()+file;
|
||||
QFile torrent(fullPath);
|
||||
if(torrent.size() != 0) {
|
||||
@@ -1002,8 +996,7 @@ bool bittorrent::loadTrackerFile(QString hash) {
|
||||
tracker_file.open(QIODevice::ReadOnly | QIODevice::Text);
|
||||
QStringList lines = QString::fromUtf8(tracker_file.readAll().data()).split("\n");
|
||||
std::vector<announce_entry> trackers;
|
||||
QString line;
|
||||
foreach(line, lines) {
|
||||
foreach(const QString &line, lines) {
|
||||
QStringList parts = line.split("|");
|
||||
if(parts.size() != 2) continue;
|
||||
announce_entry t(parts[0].toStdString());
|
||||
@@ -1138,6 +1131,7 @@ void bittorrent::readAlerts() {
|
||||
}
|
||||
else if (file_error_alert* p = dynamic_cast<file_error_alert*>(a.get())) {
|
||||
QTorrentHandle h(p->handle);
|
||||
h.auto_managed(false);
|
||||
qDebug("File Error: %s", p->message().c_str());
|
||||
if(h.is_valid())
|
||||
emit fullDiskError(h);
|
||||
@@ -1285,9 +1279,8 @@ void bittorrent::processDownloadedFile(QString url, QString file_path) {
|
||||
}
|
||||
|
||||
void bittorrent::downloadFromURLList(const QStringList& url_list) {
|
||||
QString url;
|
||||
qDebug("DownloadFromUrlList");
|
||||
foreach(url, url_list) {
|
||||
foreach(const QString url, url_list) {
|
||||
downloadFromUrl(url);
|
||||
}
|
||||
}
|
||||
@@ -1349,7 +1342,7 @@ void bittorrent::resumeUnfinishedTorrents() {
|
||||
fileNames = torrentBackup.entryList(filters, QDir::Files, QDir::Unsorted);
|
||||
if(isQueueingEnabled()) {
|
||||
QList<QPair<int, QString> > filePaths;
|
||||
foreach(QString fileName, fileNames) {
|
||||
foreach(const QString &fileName, fileNames) {
|
||||
QString filePath = torrentBackup.path()+QDir::separator()+fileName;
|
||||
int prio = 99999;
|
||||
// Get priority
|
||||
@@ -1374,11 +1367,11 @@ void bittorrent::resumeUnfinishedTorrents() {
|
||||
}
|
||||
} else {
|
||||
QStringList filePaths;
|
||||
foreach(QString fileName, fileNames) {
|
||||
foreach(const QString &fileName, fileNames) {
|
||||
filePaths.append(torrentBackup.path()+QDir::separator()+fileName);
|
||||
}
|
||||
// Resume downloads
|
||||
foreach(QString fileName, filePaths) {
|
||||
foreach(const QString &fileName, filePaths) {
|
||||
addTorrent(fileName, false, QString(), true);
|
||||
}
|
||||
}
|
||||
|
@@ -182,9 +182,8 @@ void DownloadingTorrents::deleteTorrent(QString hash) {
|
||||
|
||||
void DownloadingTorrents::on_actionSet_download_limit_triggered() {
|
||||
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
||||
QModelIndex index;
|
||||
QStringList hashes;
|
||||
foreach(index, selectedIndexes) {
|
||||
foreach(const QModelIndex &index, selectedIndexes) {
|
||||
if(index.column() == NAME) {
|
||||
// Get the file hash
|
||||
hashes << DLListModel->data(DLListModel->index(index.row(), HASH)).toString();
|
||||
@@ -196,9 +195,8 @@ void DownloadingTorrents::on_actionSet_download_limit_triggered() {
|
||||
|
||||
void DownloadingTorrents::on_actionSet_upload_limit_triggered() {
|
||||
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
||||
QModelIndex index;
|
||||
QStringList hashes;
|
||||
foreach(index, selectedIndexes) {
|
||||
foreach(const QModelIndex &index, selectedIndexes) {
|
||||
if(index.column() == NAME) {
|
||||
// Get the file hash
|
||||
hashes << DLListModel->data(DLListModel->index(index.row(), HASH)).toString();
|
||||
@@ -211,8 +209,7 @@ void DownloadingTorrents::on_actionSet_upload_limit_triggered() {
|
||||
// display properties of selected items
|
||||
void DownloadingTorrents::propertiesSelection(){
|
||||
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
||||
QModelIndex index;
|
||||
foreach(index, selectedIndexes){
|
||||
foreach(const QModelIndex &index, selectedIndexes){
|
||||
if(index.column() == NAME){
|
||||
showProperties(index);
|
||||
}
|
||||
@@ -221,8 +218,7 @@ void DownloadingTorrents::propertiesSelection(){
|
||||
|
||||
void DownloadingTorrents::forceRecheck() {
|
||||
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
||||
QModelIndex index;
|
||||
foreach(index, selectedIndexes){
|
||||
foreach(const QModelIndex &index, selectedIndexes){
|
||||
if(index.column() == NAME){
|
||||
QString hash = DLListModel->data(DLListModel->index(index.row(), HASH)).toString();
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
@@ -233,11 +229,10 @@ void DownloadingTorrents::forceRecheck() {
|
||||
|
||||
void DownloadingTorrents::displayDLListMenu(const QPoint& pos) {
|
||||
QMenu myDLLlistMenu(this);
|
||||
QModelIndex index;
|
||||
// Enable/disable pause/start action given the DL state
|
||||
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
||||
bool has_pause = false, has_start = false, has_preview = false;
|
||||
foreach(index, selectedIndexes) {
|
||||
foreach(const QModelIndex &index, selectedIndexes) {
|
||||
if(index.column() == NAME) {
|
||||
// Get the file name
|
||||
QString hash = DLListModel->data(DLListModel->index(index.row(), HASH)).toString();
|
||||
@@ -462,9 +457,8 @@ QAction* DownloadingTorrents::getActionHoSCol(int index) {
|
||||
|
||||
QStringList DownloadingTorrents::getSelectedTorrents(bool only_one) const{
|
||||
QStringList res;
|
||||
QModelIndex index;
|
||||
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
||||
foreach(index, selectedIndexes) {
|
||||
foreach(const QModelIndex &index, selectedIndexes) {
|
||||
if(index.column() == NAME) {
|
||||
// Get the file hash
|
||||
QString hash = DLListModel->data(DLListModel->index(index.row(), HASH)).toString();
|
||||
|
@@ -178,22 +178,26 @@ class FilterParserThread : public QThread {
|
||||
}
|
||||
// Now Add to the filter
|
||||
QStringList IP;
|
||||
if(IPv4) {
|
||||
//IPv4 addresses
|
||||
IP = strStartIP.split('.');
|
||||
address_v4 start((IP.at(0).toInt() << 24) + (IP.at(1).toInt() << 16) + (IP.at(2).toInt() << 8) + IP.at(3).toInt());
|
||||
IP = strEndIP.split('.');
|
||||
address_v4 last((IP.at(0).toInt() << 24) + (IP.at(1).toInt() << 16) + (IP.at(2).toInt() << 8) + IP.at(3).toInt());
|
||||
// Apply to bittorrent session
|
||||
filter.add_rule(start, last, ip_filter::blocked);
|
||||
} else {
|
||||
// IPv6, ex : 1fff:0000:0a88:85a3:0000:0000:ac1f:8001
|
||||
IP = strStartIP.split(':');
|
||||
address_v6 start = address_v6::from_string(strStartIP.remove(':', 0).toUtf8().data());
|
||||
IP = strEndIP.split(':');
|
||||
address_v6 last = address_v6::from_string(strEndIP.remove(':', 0).toUtf8().data());
|
||||
// Apply to bittorrent session
|
||||
filter.add_rule(start, last, ip_filter::blocked);
|
||||
try {
|
||||
if(IPv4) {
|
||||
//IPv4 addresses
|
||||
IP = strStartIP.split('.');
|
||||
address_v4 start((IP.at(0).toInt() << 24) + (IP.at(1).toInt() << 16) + (IP.at(2).toInt() << 8) + IP.at(3).toInt());
|
||||
IP = strEndIP.split('.');
|
||||
address_v4 last((IP.at(0).toInt() << 24) + (IP.at(1).toInt() << 16) + (IP.at(2).toInt() << 8) + IP.at(3).toInt());
|
||||
// Apply to bittorrent session
|
||||
filter.add_rule(start, last, ip_filter::blocked);
|
||||
} else {
|
||||
// IPv6, ex : 1fff:0000:0a88:85a3:0000:0000:ac1f:8001
|
||||
IP = strStartIP.split(':');
|
||||
address_v6 start = address_v6::from_string(strStartIP.remove(':', 0).toUtf8().data());
|
||||
IP = strEndIP.split(':');
|
||||
address_v6 last = address_v6::from_string(strEndIP.remove(':', 0).toUtf8().data());
|
||||
// Apply to bittorrent session
|
||||
filter.add_rule(start, last, ip_filter::blocked);
|
||||
}
|
||||
}catch(exception){
|
||||
qDebug("Bad line in filter file, avoided crash...");
|
||||
}
|
||||
}
|
||||
file.close();
|
||||
|
@@ -174,7 +174,7 @@ void HttpConnection::respondCommand(QString command)
|
||||
{
|
||||
QString urls = parser.post("urls");
|
||||
QStringList list = urls.split('\n');
|
||||
foreach(QString url, list){
|
||||
foreach(QString url, list){
|
||||
url = url.trimmed();
|
||||
if(!url.isEmpty()){
|
||||
qDebug("Downloading url: %s", (const char*)url.toUtf8());
|
||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user