From b1ed521d6bee6f45799c94505ccea79d05d0c1b2 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Tue, 3 Jul 2007 09:04:04 +0000 Subject: [PATCH] Fixed downloadFromUrl --- qBittorrent.kdevelop | 22 +++++++++++----------- src/GUI.cpp | 2 +- src/bittorrent.cpp | 11 +++++++---- src/downloadFromURLImp.h | 2 +- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/qBittorrent.kdevelop b/qBittorrent.kdevelop index f9b6baee8..7e9ccd42c 100644 --- a/qBittorrent.kdevelop +++ b/qBittorrent.kdevelop @@ -13,8 +13,8 @@ . false - - + + kdevsubversion @@ -72,11 +72,11 @@ - - - - - + + + + + true false false @@ -154,8 +154,8 @@ executable /home/chris/qbittorrent_svn/trunk/src/qbittorrent - - + + /home/chris/qbittorrent_svn/trunk true false @@ -169,7 +169,7 @@ false 1 false - + 0 @@ -186,7 +186,7 @@ - + /home/chris/qbittorrent_svn/trunk/tags diff --git a/src/GUI.cpp b/src/GUI.cpp index caf5121d3..ae87ca1b1 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -1618,5 +1618,5 @@ void GUI::OptionsSaved(const QString& info, bool deleteOptions){ // an url void GUI::on_actionDownload_from_URL_triggered(){ downloadFromURLDialog = new downloadFromURL(this); - connect(downloadFromURLDialog, SIGNAL(downloadFinished(QString, QString, int, QString)), &BTSession, SLOT(processDownloadedFile(QString, QString, int, QString))); + connect(downloadFromURLDialog, SIGNAL(urlsReadyToBeDownloaded(const QStringList&)), &BTSession, SLOT(downloadFromURLList(const QStringList&))); } diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index 0d42b888e..2ab79a6c7 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -408,7 +408,7 @@ void bittorrent::disableDHT(){ // and ask torrent_handle to consider them void bittorrent::loadFilteredFiles(torrent_handle &h){ torrent_info torrentInfo = h.get_torrent_info(); - unsigned int nbTorrents = torrentInfo.num_files(); + unsigned int nbFiles = torrentInfo.num_files(); if(!h.is_valid()){ qDebug("/!\\ Error: Invalid handle"); return; @@ -417,20 +417,22 @@ void bittorrent::loadFilteredFiles(torrent_handle &h){ QFile pieces_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+fileHash+".priorities"); // Read saved file if(!pieces_file.open(QIODevice::ReadOnly | QIODevice::Text)){ + qDebug("* Error: Couldn't open priorities file"); return; } QByteArray pieces_priorities = pieces_file.readAll(); pieces_file.close(); QList pieces_priorities_list = pieces_priorities.split('\n'); - if((unsigned int)pieces_priorities_list.size() != nbTorrents+1){ - std::cerr << "Error: Corrupted pieces file\n"; + if((unsigned int)pieces_priorities_list.size() != nbFiles+1){ + std::cerr << "* Error: Corrupted priorities file\n"; return; } - for(unsigned int i=0; i 7){ priority = 1; } + qDebug("Setting piece piority to %d", priority); h.piece_priority(i, priority); } } @@ -836,6 +838,7 @@ void bittorrent::processDownloadedFile(const QString& url, const QString& file_p void bittorrent::downloadFromURLList(const QStringList& url_list){ QString url; + qDebug("DownloadFromUrlList"); foreach(url, url_list){ downloadFromUrl(url); } diff --git a/src/downloadFromURLImp.h b/src/downloadFromURLImp.h index aceef2473..7d0079d76 100644 --- a/src/downloadFromURLImp.h +++ b/src/downloadFromURLImp.h @@ -37,7 +37,6 @@ class downloadFromURL : public QDialog, private Ui::downloadFromURL{ setupUi(this); setAttribute(Qt::WA_DeleteOnClose); icon_lbl->setPixmap(QPixmap(QString::fromUtf8(":/Icons/skin/url.png"))); - connect(this, SIGNAL(urlsReadyToBeDownloaded(const QStringList&)), parent, SLOT(downloadFromURLList(const QStringList&))); show(); } @@ -65,6 +64,7 @@ class downloadFromURL : public QDialog, private Ui::downloadFromURL{ return; } emit urlsReadyToBeDownloaded(url_list_cleaned); + qDebug("Emitted urlsReadytobedownloaded signal"); close(); }