You've already forked qBittorrent
							
							
				mirror of
				https://github.com/qbittorrent/qBittorrent
				synced 2025-10-26 06:12:17 +01:00 
			
		
		
		
	Compare commits
	
		
			1 Commits
		
	
	
		
			release-1.
			...
			release-1.
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 0b0d473a53 | 
							
								
								
									
										14
									
								
								COPYING
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								COPYING
									
									
									
									
									
								
							| @@ -1,17 +1,3 @@ | ||||
| qBittorrent is licensed under the GNU General Public License version 2 with the | ||||
| addition of the following special exception: | ||||
|  | ||||
| In addition, as a special exception, the copyright holders give permission to | ||||
| link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
| modified versions of it that use the same license as the "OpenSSL" library), | ||||
| and distribute the linked executables. You must obey the GNU General Public | ||||
| License in all respects for all of the code used other than "OpenSSL".  If you | ||||
| modify file(s), you may extend this exception to your version of the file(s), | ||||
| but you are not obligated to do so. If you do not wish to do so, delete this | ||||
| exception statement from your version. | ||||
|  | ||||
| ---------- | ||||
|  | ||||
| 		    GNU GENERAL PUBLIC LICENSE | ||||
| 		       Version 2, June 1991 | ||||
|  | ||||
|   | ||||
							
								
								
									
										36
									
								
								Changelog
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								Changelog
									
									
									
									
									
								
							| @@ -1,39 +1,3 @@ | ||||
| * Sun Jul 12 2009 - Christophe DUMEZ <chris@qbittorrent.org> - v1.3.4 | ||||
|     - BUGFIX: Fixed IP filter file parsing on 64bits | ||||
|     - BUGFIX: Suppressed QLayout: Attempting to add QLayout "" to properties "properties" warning message when opening a properties dialog | ||||
|     - BUGFIX: Fixed a little bug in search engine plugins helper file | ||||
|     - BUGFIX: Fixed compilation problems with Qt 4.3 | ||||
|     - BUGFIX: Percentages no longer disapear with default cleanlooks style | ||||
|     - BUGFIX: Cleanly fixed popup menus position in lists (no more workarounds) | ||||
|     - BUGFIX: Fixed memory leak in search engine | ||||
|     - BUGFIX: Torrents with an infinite ratio are no longer affected by ratio_limit set in program preferences | ||||
|     - BUGFIX: Display a ratio of 0.0 if total_upload and total_download are both 0 | ||||
|     - BUGFIX: Remove last separator in top tool bar | ||||
|     - BUGFIX: Tuned lists properties to make sure display is correct | ||||
|     - COSMETIC: Display date as well as time in log window | ||||
|  | ||||
| * Sun Apr 5 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.3.3 | ||||
|     - BUGFIX: Fixed Web UI torrent upload form | ||||
|     - BUGFIX: Fixed unicode support in search engine | ||||
|     - BUGFIX: Fixed search engine bug that prevented a torrent from appearing more than once among all tabs | ||||
|     - LICENSE: Added an exception to the license regarding OpenSSL. | ||||
|     - I18N: Updated Finnish translation | ||||
|  | ||||
| * Sat Mar 7 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.3.2 | ||||
|     - BUGFIX: Fix top toolbar disabling | ||||
|     - BUGFIX: Fix building with Qt 4.5 | ||||
|     - BUGFIX: RSS items read status is now remembered upon restart | ||||
|  | ||||
| * 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,6 +16,3 @@ See https://blueprints.launchpad.net/qbittorrent/ | ||||
| - Korean | ||||
| - Portuguese | ||||
| - Brazilian | ||||
| - Greek | ||||
| - Bulgarian | ||||
| - Finnish | ||||
|   | ||||
							
								
								
									
										65
									
								
								qcm/libcommoncpp2.qcm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								qcm/libcommoncpp2.qcm
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,65 @@ | ||||
| /* | ||||
| -----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,7 +6,6 @@ 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: | ||||
|   | ||||
| @@ -16,15 +16,6 @@ | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  * | ||||
|  * In addition, as a special exception, the copyright holders give permission to | ||||
|  * link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
|  * modified versions of it that use the same license as the "OpenSSL" library), | ||||
|  * and distribute the linked executables. You must obey the GNU General Public | ||||
|  * License in all respects for all of the code used other than "OpenSSL".  If you | ||||
|  * modify file(s), you may extend this exception to your version of the file(s), | ||||
|  * but you are not obligated to do so. If you do not wish to do so, delete this | ||||
|  * exception statement from your version. | ||||
|  * | ||||
|  * Contact : chris@qbittorrent.org | ||||
|  */ | ||||
|  | ||||
| @@ -81,9 +72,6 @@ class DLListDelegate: public QItemDelegate { | ||||
|         case RATIO:{ | ||||
|           QItemDelegate::drawBackground(painter, opt, index); | ||||
|           double ratio = index.data().toDouble(); | ||||
|           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; | ||||
|         } | ||||
|   | ||||
| @@ -16,15 +16,6 @@ | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  * | ||||
|  * In addition, as a special exception, the copyright holders give permission to | ||||
|  * link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
|  * modified versions of it that use the same license as the "OpenSSL" library), | ||||
|  * and distribute the linked executables. You must obey the GNU General Public | ||||
|  * License in all respects for all of the code used other than "OpenSSL".  If you | ||||
|  * modify file(s), you may extend this exception to your version of the file(s), | ||||
|  * but you are not obligated to do so. If you do not wish to do so, delete this | ||||
|  * exception statement from your version. | ||||
|  * | ||||
|  * Contact : chris@qbittorrent.org | ||||
|  */ | ||||
|  | ||||
| @@ -48,8 +39,6 @@ | ||||
| #define F_RATIO 4 | ||||
| #define F_HASH 5 | ||||
|  | ||||
| #define MAX_RATIO 100. | ||||
|  | ||||
| class FinishedListDelegate: public QItemDelegate { | ||||
|   Q_OBJECT | ||||
|  | ||||
| @@ -74,9 +63,6 @@ class FinishedListDelegate: public QItemDelegate { | ||||
|         case F_RATIO:{ | ||||
|           QItemDelegate::drawBackground(painter, opt, index); | ||||
|           double ratio = index.data().toDouble(); | ||||
|           if(ratio > MAX_RATIO) | ||||
|             QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::fromUtf8("∞")); | ||||
|           else | ||||
|           QItemDelegate::drawDisplay(painter, opt, opt.rect, QString(QByteArray::number(ratio, 'f', 1))); | ||||
|           break; | ||||
|         } | ||||
|   | ||||
| @@ -16,15 +16,6 @@ | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  * | ||||
|  * In addition, as a special exception, the copyright holders give permission to | ||||
|  * link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
|  * modified versions of it that use the same license as the "OpenSSL" library), | ||||
|  * and distribute the linked executables. You must obey the GNU General Public | ||||
|  * License in all respects for all of the code used other than "OpenSSL".  If you | ||||
|  * modify file(s), you may extend this exception to your version of the file(s), | ||||
|  * but you are not obligated to do so. If you do not wish to do so, delete this | ||||
|  * exception statement from your version. | ||||
|  * | ||||
|  * Contact : chris@qbittorrent.org | ||||
|  */ | ||||
| #include "FinishedTorrents.h" | ||||
| @@ -53,8 +44,6 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par | ||||
|   finishedListModel->setHeaderData(F_LEECH, Qt::Horizontal, tr("Leechers", "i.e: full/partial sources")); | ||||
|   finishedListModel->setHeaderData(F_RATIO, Qt::Horizontal, tr("Ratio")); | ||||
|   finishedList->setModel(finishedListModel); | ||||
|   finishedList->setRootIsDecorated(false); | ||||
|   finishedList->setAllColumnsShowFocus(true); | ||||
|   loadHiddenColumns(); | ||||
|   // Hide hash column | ||||
|   finishedList->hideColumn(F_HASH); | ||||
| @@ -144,8 +133,9 @@ void FinishedTorrents::setRowColor(int row, QString color){ | ||||
|  | ||||
| QStringList FinishedTorrents::getSelectedTorrents(bool only_one) const{ | ||||
|   QStringList res; | ||||
|   QModelIndex index; | ||||
|   QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes(); | ||||
|   foreach(const QModelIndex &index, selectedIndexes) { | ||||
|   foreach(index, selectedIndexes) { | ||||
|     if(index.column() == F_NAME) { | ||||
|       // Get the file hash | ||||
|       QString hash = finishedListModel->data(finishedListModel->index(index.row(), F_HASH)).toString(); | ||||
| @@ -228,8 +218,9 @@ void FinishedTorrents::saveColWidthFinishedList() const{ | ||||
|  | ||||
| void FinishedTorrents::on_actionSet_upload_limit_triggered(){ | ||||
|   QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes(); | ||||
|   QModelIndex index; | ||||
|   QStringList hashes; | ||||
|   foreach(const QModelIndex &index, selectedIndexes){ | ||||
|   foreach(index, selectedIndexes){ | ||||
|     if(index.column() == F_NAME){ | ||||
|       // Get the file hash | ||||
|       hashes << finishedListModel->data(finishedListModel->index(index.row(), F_HASH)).toString(); | ||||
| @@ -339,7 +330,8 @@ void FinishedTorrents::updateFileSize(QString hash){ | ||||
| // display properties of selected items | ||||
| void FinishedTorrents::propertiesSelection(){ | ||||
|   QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes(); | ||||
|   foreach(const QModelIndex &index, selectedIndexes){ | ||||
|   QModelIndex index; | ||||
|   foreach(index, selectedIndexes){ | ||||
|     if(index.column() == F_NAME){ | ||||
|       showProperties(index); | ||||
|     } | ||||
| @@ -348,7 +340,8 @@ void FinishedTorrents::propertiesSelection(){ | ||||
|  | ||||
| void FinishedTorrents::forceRecheck(){ | ||||
|   QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes(); | ||||
|   foreach(const QModelIndex &index, selectedIndexes){ | ||||
|   QModelIndex index; | ||||
|   foreach(index, selectedIndexes){ | ||||
|       if(index.column() == F_NAME){ | ||||
|           QString hash = finishedListModel->data(finishedListModel->index(index.row(), F_HASH)).toString(); | ||||
|           QTorrentHandle h = BTSession->getTorrentHandle(hash); | ||||
| @@ -357,12 +350,13 @@ void FinishedTorrents::forceRecheck(){ | ||||
|   } | ||||
| } | ||||
|  | ||||
| void FinishedTorrents::displayFinishedListMenu(const QPoint&){ | ||||
| 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(const QModelIndex &index, selectedIndexes) { | ||||
|   foreach(index, selectedIndexes) { | ||||
|     if(index.column() == F_NAME) { | ||||
|       // Get the file name | ||||
|       QString hash = finishedListModel->data(finishedListModel->index(index.row(), F_HASH)).toString(); | ||||
| @@ -401,7 +395,8 @@ void FinishedTorrents::displayFinishedListMenu(const QPoint&){ | ||||
|   myFinishedListMenu.addAction(actionBuy_it); | ||||
|  | ||||
|   // Call menu | ||||
|   myFinishedListMenu.exec(QCursor::pos()); | ||||
|   // XXX: why mapToGlobal() is not enough? | ||||
|   myFinishedListMenu.exec(mapToGlobal(pos)+QPoint(10,58)); | ||||
| } | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -16,15 +16,6 @@ | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  * | ||||
|  * In addition, as a special exception, the copyright holders give permission to | ||||
|  * link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
|  * modified versions of it that use the same license as the "OpenSSL" library), | ||||
|  * and distribute the linked executables. You must obey the GNU General Public | ||||
|  * License in all respects for all of the code used other than "OpenSSL".  If you | ||||
|  * modify file(s), you may extend this exception to your version of the file(s), | ||||
|  * but you are not obligated to do so. If you do not wish to do so, delete this | ||||
|  * exception statement from your version. | ||||
|  * | ||||
|  * Contact : chris@qbittorrent.org | ||||
|  */ | ||||
|  | ||||
|   | ||||
							
								
								
									
										47
									
								
								src/GUI.cpp
									
									
									
									
									
								
							
							
						
						
									
										47
									
								
								src/GUI.cpp
									
									
									
									
									
								
							| @@ -16,15 +16,6 @@ | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  * | ||||
|  * In addition, as a special exception, the copyright holders give permission to | ||||
|  * link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
|  * modified versions of it that use the same license as the "OpenSSL" library), | ||||
|  * and distribute the linked executables. You must obey the GNU General Public | ||||
|  * License in all respects for all of the code used other than "OpenSSL".  If you | ||||
|  * modify file(s), you may extend this exception to your version of the file(s), | ||||
|  * but you are not obligated to do so. If you do not wish to do so, delete this | ||||
|  * exception statement from your version. | ||||
|  * | ||||
|  * Contact : chris@qbittorrent.org | ||||
|  */ | ||||
| #include <QFileDialog> | ||||
| @@ -564,8 +555,9 @@ void GUI::openDestinationFolder() const { | ||||
|     default: | ||||
|       return; | ||||
|   } | ||||
|   QString hash; | ||||
|   QStringList pathsList; | ||||
|   foreach(const QString &hash, hashes) { | ||||
|   foreach(hash, hashes) { | ||||
|     QTorrentHandle h = BTSession->getTorrentHandle(hash); | ||||
|     QString savePath = h.save_path(); | ||||
|     if(!pathsList.contains(savePath)) { | ||||
| @@ -587,8 +579,9 @@ void GUI::goBuyPage() const { | ||||
|     default: | ||||
|       return; | ||||
|   } | ||||
|   QString hash; | ||||
|   QStringList pathsList; | ||||
|   foreach(const QString &hash, hashes) { | ||||
|   foreach(hash, hashes) { | ||||
|     QTorrentHandle h = BTSession->getTorrentHandle(hash); | ||||
|     QDesktopServices::openUrl("http://match.sharemonkey.com/?info_hash="+hash+"&n="+h.name()+"&cid=33"); | ||||
|   } | ||||
| @@ -728,7 +721,8 @@ void GUI::dropEvent(QDropEvent *event) { | ||||
|   QStringList files; | ||||
|   if(event->mimeData()->hasUrls()) { | ||||
|     QList<QUrl> urls = event->mimeData()->urls(); | ||||
|     foreach(const QUrl &url, urls) { | ||||
|     QUrl url; | ||||
|     foreach(url, urls) { | ||||
|       QString tmp = url.toString(); | ||||
|       tmp.trimmed(); | ||||
|       if(!tmp.isEmpty()) | ||||
| @@ -738,9 +732,10 @@ 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(QString file, files) { | ||||
|   foreach(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)) { | ||||
| @@ -758,7 +753,8 @@ void GUI::dropEvent(QDropEvent *event) { | ||||
|  | ||||
| // Decode if we accept drag 'n drop or not | ||||
| void GUI::dragEnterEvent(QDragEnterEvent *event) { | ||||
|   foreach(const QString &mime, event->mimeData()->formats()){ | ||||
|   QString mime; | ||||
|   foreach(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"))) { | ||||
| @@ -832,7 +828,8 @@ void GUI::on_actionDelete_Permanently_triggered() { | ||||
|   } | ||||
|   if(ret) return; | ||||
|   //User clicked YES | ||||
|   foreach(const QString &hash, hashes) { | ||||
|   QString hash; | ||||
|   foreach(hash, hashes) { | ||||
|     // Get the file name | ||||
|     QTorrentHandle h = BTSession->getTorrentHandle(hash); | ||||
|     QString fileName = h.name(); | ||||
| @@ -884,7 +881,8 @@ void GUI::on_actionDelete_triggered() { | ||||
|   } | ||||
|   if(ret) return; | ||||
|   //User clicked YES | ||||
|   foreach(const QString &hash, hashes) { | ||||
|   QString hash; | ||||
|   foreach(hash, hashes) { | ||||
|     // Get the file name | ||||
|     QTorrentHandle h = BTSession->getTorrentHandle(hash); | ||||
|     QString fileName = h.name(); | ||||
| @@ -898,9 +896,10 @@ 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(QString param, params) { | ||||
|   foreach(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); | ||||
| @@ -940,12 +939,14 @@ void GUI::configureSession(bool deleteOptions) { | ||||
|     setWindowTitle(tr("qBittorrent %1", "e.g: qBittorrent v0.x").arg(QString::fromUtf8(VERSION))); | ||||
|   } | ||||
|   displaySpeedInTitle = new_displaySpeedInTitle; | ||||
|   if(options->isToolbarDisplayed() != toolBar->isVisible()) { | ||||
|       if(options->isToolbarDisplayed()) { | ||||
|         toolBar->setVisible(true); | ||||
|         toolBar->layout()->setSpacing(7); | ||||
|       } else { | ||||
|         toolBar->setVisible(false); | ||||
|     } | ||||
|   } | ||||
|   unsigned int new_refreshInterval = options->getRefreshInterval(); | ||||
|   if(refreshInterval != new_refreshInterval) { | ||||
|     refreshInterval = new_refreshInterval; | ||||
| @@ -1013,8 +1014,6 @@ 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()) { | ||||
| @@ -1283,7 +1282,7 @@ void GUI::on_actionIncreasePriority_triggered() { | ||||
|   if(tabs->currentIndex() != 0) | ||||
|       return; | ||||
|   QStringList hashes = downloadingTorrentTab->getSelectedTorrents(); | ||||
|   foreach(const QString &hash, hashes) { | ||||
|   foreach(QString hash, hashes) { | ||||
|       BTSession->increaseDlTorrentPriority(hash); | ||||
|   } | ||||
|   updateLists(); | ||||
| @@ -1292,7 +1291,7 @@ void GUI::on_actionIncreasePriority_triggered() { | ||||
| void GUI::on_actionDecreasePriority_triggered() { | ||||
|   Q_ASSERT(tabs->currentIndex() == 0); | ||||
|   QStringList hashes = downloadingTorrentTab->getSelectedTorrents(); | ||||
|   foreach(const QString &hash, hashes) { | ||||
|   foreach(QString hash, hashes) { | ||||
|       BTSession->decreaseDlTorrentPriority(hash); | ||||
|   } | ||||
|   updateLists(); | ||||
| @@ -1310,7 +1309,8 @@ void GUI::on_actionPause_triggered() { | ||||
|   } else { | ||||
|     hashes = finishedTorrentTab->getSelectedTorrents(); | ||||
|   } | ||||
|   foreach(const QString &hash, hashes) { | ||||
|   QString hash; | ||||
|   foreach(hash, hashes) { | ||||
|     QTorrentHandle h = BTSession->getTorrentHandle(hash); | ||||
|     if(!h.is_paused()){ | ||||
|       h.pause(); | ||||
| @@ -1354,7 +1354,8 @@ void GUI::on_actionStart_triggered() { | ||||
|   } else { | ||||
|     hashes = finishedTorrentTab->getSelectedTorrents(); | ||||
|   } | ||||
|   foreach(const QString &hash, hashes) { | ||||
|   QString hash; | ||||
|   foreach(hash, hashes) { | ||||
|     QTorrentHandle h = BTSession->getTorrentHandle(hash); | ||||
|     if(h.is_paused()){ | ||||
|       h.resume(); | ||||
|   | ||||
| @@ -16,15 +16,6 @@ | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  * | ||||
|  * In addition, as a special exception, the copyright holders give permission to | ||||
|  * link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
|  * modified versions of it that use the same license as the "OpenSSL" library), | ||||
|  * and distribute the linked executables. You must obey the GNU General Public | ||||
|  * License in all respects for all of the code used other than "OpenSSL".  If you | ||||
|  * modify file(s), you may extend this exception to your version of the file(s), | ||||
|  * but you are not obligated to do so. If you do not wish to do so, delete this | ||||
|  * exception statement from your version. | ||||
|  * | ||||
|  * Contact : chris@qbittorrent.org | ||||
|  */ | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| [Desktop Entry] | ||||
| Categories=Qt;Network;P2P | ||||
| Comment=V1.3.4 | ||||
| Comment=V1.3.0 | ||||
| Exec=qbittorrent %f | ||||
| GenericName=Bittorrent client | ||||
| GenericName[bg]=Торент клиент | ||||
|   | ||||
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB | 
| @@ -121,6 +121,7 @@ | ||||
|    <addaction name="actionIncreasePriority" /> | ||||
|    <addaction name="separator" /> | ||||
|    <addaction name="actionExit" /> | ||||
|    <addaction name="separator" /> | ||||
|   </widget> | ||||
|   <widget class="QStatusBar" name="statusBar" /> | ||||
|   <action name="actionOpen" > | ||||
|   | ||||
| @@ -16,15 +16,6 @@ | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  * | ||||
|  * In addition, as a special exception, the copyright holders give permission to | ||||
|  * link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
|  * modified versions of it that use the same license as the "OpenSSL" library), | ||||
|  * and distribute the linked executables. You must obey the GNU General Public | ||||
|  * License in all respects for all of the code used other than "OpenSSL".  If you | ||||
|  * modify file(s), you may extend this exception to your version of the file(s), | ||||
|  * but you are not obligated to do so. If you do not wish to do so, delete this | ||||
|  * exception statement from your version. | ||||
|  * | ||||
|  * Contact : chris@qbittorrent.org | ||||
|  */ | ||||
|  | ||||
|   | ||||
| @@ -16,15 +16,6 @@ | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  * | ||||
|  * In addition, as a special exception, the copyright holders give permission to | ||||
|  * link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
|  * modified versions of it that use the same license as the "OpenSSL" library), | ||||
|  * and distribute the linked executables. You must obey the GNU General Public | ||||
|  * License in all respects for all of the code used other than "OpenSSL".  If you | ||||
|  * modify file(s), you may extend this exception to your version of the file(s), | ||||
|  * but you are not obligated to do so. If you do not wish to do so, delete this | ||||
|  * exception statement from your version. | ||||
|  * | ||||
|  * Contact : chris@qbittorrent.org | ||||
|  */ | ||||
|  | ||||
|   | ||||
| @@ -16,15 +16,6 @@ | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  * | ||||
|  * In addition, as a special exception, the copyright holders give permission to | ||||
|  * link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
|  * modified versions of it that use the same license as the "OpenSSL" library), | ||||
|  * and distribute the linked executables. You must obey the GNU General Public | ||||
|  * License in all respects for all of the code used other than "OpenSSL".  If you | ||||
|  * modify file(s), you may extend this exception to your version of the file(s), | ||||
|  * but you are not obligated to do so. If you do not wish to do so, delete this | ||||
|  * exception statement from your version. | ||||
|  * | ||||
|  * Contact : chris@qbittorrent.org | ||||
|  */ | ||||
|  | ||||
|   | ||||
| @@ -16,15 +16,6 @@ | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  * | ||||
|  * In addition, as a special exception, the copyright holders give permission to | ||||
|  * link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
|  * modified versions of it that use the same license as the "OpenSSL" library), | ||||
|  * and distribute the linked executables. You must obey the GNU General Public | ||||
|  * License in all respects for all of the code used other than "OpenSSL".  If you | ||||
|  * modify file(s), you may extend this exception to your version of the file(s), | ||||
|  * but you are not obligated to do so. If you do not wish to do so, delete this | ||||
|  * exception statement from your version. | ||||
|  * | ||||
|  * Contact : chris@qbittorrent.org | ||||
|  */ | ||||
|  | ||||
| @@ -56,14 +47,13 @@ SearchTab::SearchTab(SearchEngine *parent) : QWidget() | ||||
|      | ||||
|     setLayout(box); | ||||
|     // Set Search results list model | ||||
|     SearchListModel = new QStandardItemModel(0,6); | ||||
|     SearchListModel = new QStandardItemModel(0,5); | ||||
|     SearchListModel->setHeaderData(SEARCH_NAME, Qt::Horizontal, tr("Name", "i.e: file name")); | ||||
|     SearchListModel->setHeaderData(SEARCH_SIZE, Qt::Horizontal, tr("Size", "i.e: file size")); | ||||
|     SearchListModel->setHeaderData(SEARCH_SEEDERS, Qt::Horizontal, tr("Seeders", "i.e: Number of full sources")); | ||||
|     SearchListModel->setHeaderData(SEARCH_LEECHERS, Qt::Horizontal, tr("Leechers", "i.e: Number of partial sources")); | ||||
|     SearchListModel->setHeaderData(SEARCH_ENGINE, Qt::Horizontal, tr("Search engine")); | ||||
|     resultsBrowser->setModel(SearchListModel); | ||||
|     resultsBrowser->hideColumn(URL_COLUMN); // Hide url column | ||||
|     SearchDelegate = new SearchListDelegate(); | ||||
|     resultsBrowser->setItemDelegate(SearchDelegate); | ||||
|     // Make search list header clickable for sorting | ||||
| @@ -138,7 +128,7 @@ void SearchTab::sortSearchListInt(int index, Qt::SortOrder sortOrder){ | ||||
|   for(int row=0; row<lines.size(); ++row){ | ||||
|     SearchListModel->insertRow(SearchListModel->rowCount()); | ||||
|     int sourceRow = lines[row].first; | ||||
|     for(int col=0; col<6; ++col){ | ||||
|     for(int col=0; col<5; ++col){ | ||||
|       SearchListModel->setData(SearchListModel->index(nbRows_old+row, col), SearchListModel->data(SearchListModel->index(sourceRow, col))); | ||||
|       SearchListModel->setData(SearchListModel->index(nbRows_old+row, col), SearchListModel->data(SearchListModel->index(sourceRow, col), Qt::ForegroundRole), Qt::ForegroundRole); | ||||
|     } | ||||
| @@ -158,7 +148,7 @@ void SearchTab::sortSearchListString(int index, Qt::SortOrder sortOrder){ | ||||
|   for(int row=0; row<nbRows_old; ++row){ | ||||
|     SearchListModel->insertRow(SearchListModel->rowCount()); | ||||
|     int sourceRow = lines[row].first; | ||||
|     for(int col=0; col<6; ++col){ | ||||
|     for(int col=0; col<5; ++col){ | ||||
|       SearchListModel->setData(SearchListModel->index(nbRows_old+row, col), SearchListModel->data(SearchListModel->index(sourceRow, col))); | ||||
|       SearchListModel->setData(SearchListModel->index(nbRows_old+row, col), SearchListModel->data(SearchListModel->index(sourceRow, col), Qt::ForegroundRole), Qt::ForegroundRole); | ||||
|     } | ||||
|   | ||||
| @@ -16,15 +16,6 @@ | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  * | ||||
|  * In addition, as a special exception, the copyright holders give permission to | ||||
|  * link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
|  * modified versions of it that use the same license as the "OpenSSL" library), | ||||
|  * and distribute the linked executables. You must obey the GNU General Public | ||||
|  * License in all respects for all of the code used other than "OpenSSL".  If you | ||||
|  * modify file(s), you may extend this exception to your version of the file(s), | ||||
|  * but you are not obligated to do so. If you do not wish to do so, delete this | ||||
|  * exception statement from your version. | ||||
|  * | ||||
|  * Contact : chris@qbittorrent.org | ||||
|  */ | ||||
|  | ||||
| @@ -33,9 +24,6 @@ | ||||
|  | ||||
| #include "ui_search.h" | ||||
|  | ||||
| #define ENGINE_URL_COLUMN 4 | ||||
| #define URL_COLUMN 5 | ||||
|  | ||||
| class SearchListDelegate; | ||||
| class SearchEngine; | ||||
| class QTreeView; | ||||
|   | ||||
| @@ -16,15 +16,6 @@ | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  * | ||||
|  * In addition, as a special exception, the copyright holders give permission to | ||||
|  * link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
|  * modified versions of it that use the same license as the "OpenSSL" library), | ||||
|  * and distribute the linked executables. You must obey the GNU General Public | ||||
|  * License in all respects for all of the code used other than "OpenSSL".  If you | ||||
|  * modify file(s), you may extend this exception to your version of the file(s), | ||||
|  * but you are not obligated to do so. If you do not wish to do so, delete this | ||||
|  * exception statement from your version. | ||||
|  * | ||||
|  * Contact : chris@qbittorrent.org | ||||
|  */ | ||||
|  | ||||
|   | ||||
| @@ -16,15 +16,6 @@ | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  * | ||||
|  * In addition, as a special exception, the copyright holders give permission to | ||||
|  * link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
|  * modified versions of it that use the same license as the "OpenSSL" library), | ||||
|  * and distribute the linked executables. You must obey the GNU General Public | ||||
|  * License in all respects for all of the code used other than "OpenSSL".  If you | ||||
|  * modify file(s), you may extend this exception to your version of the file(s), | ||||
|  * but you are not obligated to do so. If you do not wish to do so, delete this | ||||
|  * exception statement from your version. | ||||
|  * | ||||
|  * Contact : chris@qbittorrent.org | ||||
|  */ | ||||
|  | ||||
| @@ -70,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) and Pekka Niemi (pekka.niemi@iki.fi)<br>\ | ||||
|           - <u>Finnish:</u> Niklas Laxström (nikerabbit@users.sourceforge.net)<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>\ | ||||
|   | ||||
| @@ -16,15 +16,6 @@ | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  * | ||||
|  * In addition, as a special exception, the copyright holders give permission to | ||||
|  * link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
|  * modified versions of it that use the same license as the "OpenSSL" library), | ||||
|  * and distribute the linked executables. You must obey the GNU General Public | ||||
|  * License in all respects for all of the code used other than "OpenSSL".  If you | ||||
|  * modify file(s), you may extend this exception to your version of the file(s), | ||||
|  * but you are not obligated to do so. If you do not wish to do so, delete this | ||||
|  * exception statement from your version. | ||||
|  * | ||||
|  * Contact : chris@qbittorrent.org | ||||
|  */ | ||||
|  | ||||
|   | ||||
| @@ -16,15 +16,6 @@ | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  * | ||||
|  * In addition, as a special exception, the copyright holders give permission to | ||||
|  * link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
|  * modified versions of it that use the same license as the "OpenSSL" library), | ||||
|  * and distribute the linked executables. You must obey the GNU General Public | ||||
|  * License in all respects for all of the code used other than "OpenSSL".  If you | ||||
|  * modify file(s), you may extend this exception to your version of the file(s), | ||||
|  * but you are not obligated to do so. If you do not wish to do so, delete this | ||||
|  * exception statement from your version. | ||||
|  * | ||||
|  * Contact : chris@qbittorrent.org | ||||
|  */ | ||||
|  | ||||
| @@ -41,7 +32,7 @@ class torrent_file { | ||||
|     torrent_file *parent; | ||||
|     bool is_dir; | ||||
|     QString rel_path; | ||||
|     QList<const torrent_file*> children; | ||||
|     QList<torrent_file*> children; | ||||
|     size_type size; | ||||
|     float progress; | ||||
|     int priority; | ||||
| @@ -77,7 +68,8 @@ class torrent_file { | ||||
|       } | ||||
|       float wanted = 0.; | ||||
|       float done = 0.; | ||||
|       foreach(const torrent_file *child, children) { | ||||
|       torrent_file *child; | ||||
|       foreach(child, children) { | ||||
|         wanted += child->getSize(); | ||||
|         done += child->getSize()*child->getProgress(); | ||||
|       } | ||||
| @@ -88,7 +80,8 @@ class torrent_file { | ||||
|  | ||||
|     void updatePriority(int prio) { | ||||
|       Q_ASSERT(is_dir); | ||||
|       foreach(const torrent_file *child, children) { | ||||
|       torrent_file *child; | ||||
|       foreach(child, children) { | ||||
|         if(child->getPriority() != prio) return; | ||||
|       } | ||||
|       priority = prio; | ||||
| @@ -118,13 +111,14 @@ class torrent_file { | ||||
|       return (!children.isEmpty()); | ||||
|     } | ||||
|  | ||||
|     QList<const torrent_file*> getChildren() const { | ||||
|     QList<torrent_file*> getChildren() const { | ||||
|       return children; | ||||
|     } | ||||
|  | ||||
|     const torrent_file* getChild(QString fileName) const { | ||||
|     torrent_file* getChild(QString fileName) const { | ||||
|       Q_ASSERT(is_dir); | ||||
|       foreach(const torrent_file *f, children) { | ||||
|       torrent_file* f; | ||||
|       foreach(f, children) { | ||||
|         if(f->name() == fileName) return f; | ||||
|       } | ||||
|       return 0; | ||||
| @@ -147,15 +141,16 @@ class torrent_file { | ||||
|       return f; | ||||
|     } | ||||
|  | ||||
|     bool removeFromFS(QString saveDir) const { | ||||
|     bool removeFromFS(QString saveDir) { | ||||
|       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(const torrent_file *f, children) { | ||||
|       foreach(f, children) { | ||||
|         bool s = f->removeFromFS(saveDir); | ||||
|         success = s && success; | ||||
|       } | ||||
| @@ -205,13 +200,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, ((float)fp[0])/t.file_at(0).size, prioritiesTab[0]); | ||||
|         root = new torrent_file(0, misc::toQString(t.name()), false, fi->size, 0, 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, ((float)fp[i])/t.file_at(i).size, prioritiesTab[i]); | ||||
|         addFile(path, fi->size, i, fp[i]/t.file_at(i).size, prioritiesTab[i]); | ||||
|         fi++; | ||||
|         ++i; | ||||
|       } | ||||
| @@ -244,13 +239,14 @@ 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(const QString &fileName, fileNames) { | ||||
|       foreach(fileName, fileNames) { | ||||
|         ++nb_i; | ||||
|         if(fileName == ".") continue; | ||||
|         const torrent_file* child = dad->getChild(fileName); | ||||
|         torrent_file* child = dad->getChild(fileName); | ||||
|         if(!child) { | ||||
|           if(nb_i != size) { | ||||
|             // Folder | ||||
| @@ -260,7 +256,7 @@ class arborescence { | ||||
|             child = dad->addChild(fileName, false, file_size, index, progress, priority); | ||||
|           } | ||||
|         } | ||||
|         dad = (torrent_file*)child; | ||||
|         dad = child; | ||||
|       } | ||||
|     } | ||||
| }; | ||||
|   | ||||
| @@ -16,20 +16,11 @@ | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  * | ||||
|  * In addition, as a special exception, the copyright holders give permission to | ||||
|  * link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
|  * modified versions of it that use the same license as the "OpenSSL" library), | ||||
|  * and distribute the linked executables. You must obey the GNU General Public | ||||
|  * License in all respects for all of the code used other than "OpenSSL".  If you | ||||
|  * modify file(s), you may extend this exception to your version of the file(s), | ||||
|  * but you are not obligated to do so. If you do not wish to do so, delete this | ||||
|  * exception statement from your version. | ||||
|  * | ||||
|  * Contact : chris@qbittorrent.org | ||||
|  */ | ||||
|  | ||||
| #include <QDir> | ||||
| #include <QDateTime> | ||||
| #include <QTime> | ||||
| #include <QString> | ||||
| #include <QTimer> | ||||
| #include <QFileSystemWatcher> | ||||
| @@ -52,10 +43,9 @@ | ||||
| #include <boost/filesystem/exception.hpp> | ||||
|  | ||||
| #define MAX_TRACKER_ERRORS 2 | ||||
| #define MAX_RATIO 100. | ||||
|  | ||||
| // Main constructor | ||||
| bittorrent::bittorrent() : DHTEnabled(false), preAllocateAll(false), addInPause(false), maxConnecsPerTorrent(500), maxUploadsPerTorrent(4), ratio_limit(-1), UPnPEnabled(false), NATPMPEnabled(false), LSDEnabled(false), queueingEnabled(false) { | ||||
| bittorrent::bittorrent() : DHTEnabled(false), preAllocateAll(false), addInPause(false), maxConnecsPerTorrent(500), maxUploadsPerTorrent(4), max_ratio(-1), UPnPEnabled(false), NATPMPEnabled(false), LSDEnabled(false), queueingEnabled(false) { | ||||
|   // To avoid some exceptions | ||||
|   fs::path::default_name_check(fs::no_check); | ||||
|   // Creating bittorrent session | ||||
| @@ -125,7 +115,7 @@ void bittorrent::preAllocateAllFiles(bool b) { | ||||
| } | ||||
|  | ||||
| void bittorrent::deleteBigRatios() { | ||||
|   if(ratio_limit == -1) return; | ||||
|   if(max_ratio == -1) return; | ||||
|     std::vector<torrent_handle> torrents = getTorrents(); | ||||
|     std::vector<torrent_handle>::iterator torrentIT; | ||||
|     for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) { | ||||
| @@ -133,8 +123,7 @@ void bittorrent::deleteBigRatios() { | ||||
|         if(!h.is_valid()) continue; | ||||
|         if(h.is_seed()) { | ||||
|             QString hash = h.hash(); | ||||
|             float ratio = getRealRatio(hash); | ||||
|             if(ratio <= MAX_RATIO && ratio > ratio_limit) { | ||||
|             if(getRealRatio(hash) > max_ratio) { | ||||
|               QString fileName = h.name(); | ||||
|               addConsoleMessage(tr("%1 reached the maximum ratio you set.").arg(fileName)); | ||||
|               deleteTorrent(hash); | ||||
| @@ -278,7 +267,8 @@ void bittorrent::deleteTorrent(QString hash, bool permanent) { | ||||
|   QStringList filters; | ||||
|   filters << hash+".*"; | ||||
|   QStringList files = torrentBackup.entryList(filters, QDir::Files, QDir::Unsorted); | ||||
|   foreach(const QString &file, files) { | ||||
|   QString file; | ||||
|   foreach(file, files) { | ||||
|     torrentBackup.remove(file); | ||||
|   } | ||||
|   // Remove tracker errors | ||||
| @@ -338,21 +328,23 @@ 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(); | ||||
|   foreach(const QString &existing_seed, existing_seeds) { | ||||
|   QString existing_seed; | ||||
|   foreach(existing_seed, existing_seeds) { | ||||
|     if(!url_seeds.contains(existing_seed.toUtf8())) { | ||||
|       seeds_to_delete << existing_seed; | ||||
|     } | ||||
|   } | ||||
|   foreach(const QString &existing_seed, seeds_to_delete) { | ||||
|   foreach(existing_seed, seeds_to_delete) { | ||||
|     h.remove_url_seed(existing_seed); | ||||
|   } | ||||
|   // Add the ones that were added in a previous session | ||||
|   foreach(const QByteArray &url_seed, url_seeds) { | ||||
|   foreach(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 | ||||
| @@ -772,13 +764,13 @@ float bittorrent::getRealRatio(QString hash) const{ | ||||
|   Q_ASSERT(h.all_time_upload() >= 0); | ||||
|   if(h.all_time_download() == 0) { | ||||
|       if(h.all_time_upload() == 0) | ||||
|       return 0; | ||||
|     return 101; | ||||
|           return 1.; | ||||
|       return 10.; | ||||
|   } | ||||
|   float ratio = (float)h.all_time_upload()/(float)h.all_time_download(); | ||||
|   Q_ASSERT(ratio >= 0.); | ||||
|   if(ratio > 100.) | ||||
|     ratio = 100.; | ||||
|   if(ratio > 10.) | ||||
|     ratio = 10.; | ||||
|   return ratio; | ||||
| } | ||||
|  | ||||
| @@ -852,7 +844,7 @@ void bittorrent::addConsoleMessage(QString msg, QColor color) { | ||||
|   if(consoleMessages.size() > 100) { | ||||
|     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>")); | ||||
|   consoleMessages.append(QString::fromUtf8("<font color='grey'>")+ QTime::currentTime().toString(QString::fromUtf8("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) { | ||||
| @@ -860,9 +852,9 @@ void bittorrent::addPeerBanMessage(QString ip, bool from_ipfilter) { | ||||
|     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)); | ||||
|     peerBanMessages.append(QString::fromUtf8("<font color='grey'>")+ QTime::currentTime().toString(QString::fromUtf8("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)); | ||||
|   else | ||||
|     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 banned due to corrupt pieces</i>", "x.y.z.w was banned").arg(ip)); | ||||
|     peerBanMessages.append(QString::fromUtf8("<font color='grey'>")+ QTime::currentTime().toString(QString::fromUtf8("hh:mm:ss")) + QString::fromUtf8("</font> - ")+tr("<font color='red'>%1</font> <i>was banned due to corrupt pieces</i>", "x.y.z.w was banned").arg(ip)); | ||||
| } | ||||
|  | ||||
| bool bittorrent::isFilePreviewPossible(QString hash) const{ | ||||
| @@ -887,11 +879,12 @@ 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(const QString &file, files) { | ||||
|   foreach(file, files) { | ||||
|       QString fullPath = dir.path()+QDir::separator()+file; | ||||
|       QFile torrent(fullPath); | ||||
|       if(torrent.size() != 0) { | ||||
| @@ -985,19 +978,19 @@ void bittorrent::setGlobalRatio(float ratio) { | ||||
| // be automatically deleted | ||||
| void bittorrent::setDeleteRatio(float ratio) { | ||||
|   if(ratio != -1 && ratio < 1.) ratio = 1.; | ||||
|   if(ratio_limit == -1 && ratio != -1) { | ||||
|   if(max_ratio == -1 && ratio != -1) { | ||||
|     Q_ASSERT(!BigRatioTimer); | ||||
|     BigRatioTimer = new QTimer(this); | ||||
|     connect(BigRatioTimer, SIGNAL(timeout()), this, SLOT(deleteBigRatios())); | ||||
|     BigRatioTimer->start(5000); | ||||
|   } else { | ||||
|     if(ratio_limit != -1 && ratio == -1) { | ||||
|     if(max_ratio != -1 && ratio == -1) { | ||||
|       delete BigRatioTimer; | ||||
|     } | ||||
|   } | ||||
|   if(ratio_limit != ratio) { | ||||
|     ratio_limit = ratio; | ||||
|     qDebug("* Set deleteRatio to %.1f", ratio_limit); | ||||
|   if(max_ratio != ratio) { | ||||
|     max_ratio = ratio; | ||||
|     qDebug("* Set deleteRatio to %.1f", max_ratio); | ||||
|     deleteBigRatios(); | ||||
|   } | ||||
| } | ||||
| @@ -1009,7 +1002,8 @@ 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; | ||||
|   foreach(const QString &line, lines) { | ||||
|   QString line; | ||||
|   foreach(line, lines) { | ||||
|     QStringList parts = line.split("|"); | ||||
|     if(parts.size() != 2) continue; | ||||
|     announce_entry t(parts[0].toStdString()); | ||||
| @@ -1144,7 +1138,6 @@ 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); | ||||
| @@ -1292,8 +1285,9 @@ void bittorrent::processDownloadedFile(QString url, QString file_path) { | ||||
| } | ||||
|  | ||||
| void bittorrent::downloadFromURLList(const QStringList& url_list) { | ||||
|   QString url; | ||||
|   qDebug("DownloadFromUrlList"); | ||||
|   foreach(const QString url, url_list) { | ||||
|   foreach(url, url_list) { | ||||
|     downloadFromUrl(url); | ||||
|   } | ||||
| } | ||||
| @@ -1355,7 +1349,7 @@ void bittorrent::resumeUnfinishedTorrents() { | ||||
|   fileNames = torrentBackup.entryList(filters, QDir::Files, QDir::Unsorted); | ||||
|   if(isQueueingEnabled()) { | ||||
|       QList<QPair<int, QString> > filePaths; | ||||
|       foreach(const QString &fileName, fileNames) { | ||||
|       foreach(QString fileName, fileNames) { | ||||
|         QString filePath = torrentBackup.path()+QDir::separator()+fileName; | ||||
|         int prio = 99999; | ||||
|         // Get priority | ||||
| @@ -1380,11 +1374,11 @@ void bittorrent::resumeUnfinishedTorrents() { | ||||
|       } | ||||
|     } else { | ||||
|         QStringList filePaths; | ||||
|         foreach(const QString &fileName, fileNames) { | ||||
|         foreach(QString fileName, fileNames) { | ||||
|             filePaths.append(torrentBackup.path()+QDir::separator()+fileName); | ||||
|         } | ||||
|         // Resume downloads | ||||
|           foreach(const QString &fileName, filePaths) { | ||||
|           foreach(QString fileName, filePaths) { | ||||
|             addTorrent(fileName, false, QString(), true); | ||||
|           } | ||||
|     } | ||||
|   | ||||
| @@ -16,15 +16,6 @@ | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  * | ||||
|  * In addition, as a special exception, the copyright holders give permission to | ||||
|  * link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
|  * modified versions of it that use the same license as the "OpenSSL" library), | ||||
|  * and distribute the linked executables. You must obey the GNU General Public | ||||
|  * License in all respects for all of the code used other than "OpenSSL".  If you | ||||
|  * modify file(s), you may extend this exception to your version of the file(s), | ||||
|  * but you are not obligated to do so. If you do not wish to do so, delete this | ||||
|  * exception statement from your version. | ||||
|  * | ||||
|  * Contact : chris@qbittorrent.org | ||||
|  */ | ||||
| #ifndef __BITTORRENT_H__ | ||||
| @@ -67,7 +58,7 @@ class bittorrent : public QObject { | ||||
|     bool addInPause; | ||||
|     int maxConnecsPerTorrent; | ||||
|     int maxUploadsPerTorrent; | ||||
|     float ratio_limit; | ||||
|     float max_ratio; | ||||
|     bool UPnPEnabled; | ||||
|     bool NATPMPEnabled; | ||||
|     bool LSDEnabled; | ||||
| @@ -161,11 +152,11 @@ class bittorrent : public QObject { | ||||
|     bool enableDHT(bool b); | ||||
|     void addConsoleMessage(QString msg, QColor color=QApplication::palette().color(QPalette::WindowText)); | ||||
|     void addPeerBanMessage(QString msg, bool from_ipfilter); | ||||
|     void processDownloadedFile(QString, QString); | ||||
|  | ||||
|   protected slots: | ||||
|     void scanDirectory(QString); | ||||
|     void readAlerts(); | ||||
|     void processDownloadedFile(QString, QString); | ||||
|     bool loadTrackerFile(QString hash); | ||||
|     void saveTrackerFile(QString hash); | ||||
|     void deleteBigRatios(); | ||||
|   | ||||
| @@ -16,15 +16,6 @@ | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  * | ||||
|  * In addition, as a special exception, the copyright holders give permission to | ||||
|  * link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
|  * modified versions of it that use the same license as the "OpenSSL" library), | ||||
|  * and distribute the linked executables. You must obey the GNU General Public | ||||
|  * License in all respects for all of the code used other than "OpenSSL".  If you | ||||
|  * modify file(s), you may extend this exception to your version of the file(s), | ||||
|  * but you are not obligated to do so. If you do not wish to do so, delete this | ||||
|  * exception statement from your version. | ||||
|  * | ||||
|  * Contact : chris@qbittorrent.org | ||||
|  */ | ||||
|  | ||||
|   | ||||
| @@ -16,15 +16,6 @@ | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  * | ||||
|  * In addition, as a special exception, the copyright holders give permission to | ||||
|  * link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
|  * modified versions of it that use the same license as the "OpenSSL" library), | ||||
|  * and distribute the linked executables. You must obey the GNU General Public | ||||
|  * License in all respects for all of the code used other than "OpenSSL".  If you | ||||
|  * modify file(s), you may extend this exception to your version of the file(s), | ||||
|  * but you are not obligated to do so. If you do not wish to do so, delete this | ||||
|  * exception statement from your version. | ||||
|  * | ||||
|  * Contact : chris@qbittorrent.org | ||||
|  */ | ||||
|  | ||||
|   | ||||
| @@ -16,15 +16,6 @@ | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  * | ||||
|  * In addition, as a special exception, the copyright holders give permission to | ||||
|  * link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
|  * modified versions of it that use the same license as the "OpenSSL" library), | ||||
|  * and distribute the linked executables. You must obey the GNU General Public | ||||
|  * License in all respects for all of the code used other than "OpenSSL".  If you | ||||
|  * modify file(s), you may extend this exception to your version of the file(s), | ||||
|  * but you are not obligated to do so. If you do not wish to do so, delete this | ||||
|  * exception statement from your version. | ||||
|  * | ||||
|  * Contact : chris@qbittorrent.org | ||||
|  */ | ||||
|  | ||||
|   | ||||
| @@ -16,15 +16,6 @@ | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  * | ||||
|  * In addition, as a special exception, the copyright holders give permission to | ||||
|  * link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
|  * modified versions of it that use the same license as the "OpenSSL" library), | ||||
|  * and distribute the linked executables. You must obey the GNU General Public | ||||
|  * License in all respects for all of the code used other than "OpenSSL".  If you | ||||
|  * modify file(s), you may extend this exception to your version of the file(s), | ||||
|  * but you are not obligated to do so. If you do not wish to do so, delete this | ||||
|  * exception statement from your version. | ||||
|  * | ||||
|  * Contact : chris@qbittorrent.org | ||||
|  */ | ||||
|  | ||||
|   | ||||
| @@ -16,15 +16,6 @@ | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  * | ||||
|  * In addition, as a special exception, the copyright holders give permission to | ||||
|  * link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
|  * modified versions of it that use the same license as the "OpenSSL" library), | ||||
|  * and distribute the linked executables. You must obey the GNU General Public | ||||
|  * License in all respects for all of the code used other than "OpenSSL".  If you | ||||
|  * modify file(s), you may extend this exception to your version of the file(s), | ||||
|  * but you are not obligated to do so. If you do not wish to do so, delete this | ||||
|  * exception statement from your version. | ||||
|  * | ||||
|  * Contact : chris@qbittorrent.org | ||||
|  */ | ||||
|  | ||||
|   | ||||
| @@ -16,15 +16,6 @@ | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  * | ||||
|  * In addition, as a special exception, the copyright holders give permission to | ||||
|  * link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
|  * modified versions of it that use the same license as the "OpenSSL" library), | ||||
|  * and distribute the linked executables. You must obey the GNU General Public | ||||
|  * License in all respects for all of the code used other than "OpenSSL".  If you | ||||
|  * modify file(s), you may extend this exception to your version of the file(s), | ||||
|  * but you are not obligated to do so. If you do not wish to do so, delete this | ||||
|  * exception statement from your version. | ||||
|  * | ||||
|  * Contact : chris@qbittorrent.org | ||||
|  */ | ||||
|  | ||||
|   | ||||
| @@ -16,15 +16,6 @@ | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  * | ||||
|  * In addition, as a special exception, the copyright holders give permission to | ||||
|  * link this program with the OpenSSL project's "OpenSSL" library (or with | ||||
|  * modified versions of it that use the same license as the "OpenSSL" library), | ||||
|  * and distribute the linked executables. You must obey the GNU General Public | ||||
|  * License in all respects for all of the code used other than "OpenSSL".  If you | ||||
|  * modify file(s), you may extend this exception to your version of the file(s), | ||||
|  * but you are not obligated to do so. If you do not wish to do so, delete this | ||||
|  * exception statement from your version. | ||||
|  * | ||||
|  * Contact : chris@qbittorrent.org | ||||
|  */ | ||||
| #include "downloadingTorrents.h" | ||||
| @@ -68,8 +59,6 @@ DownloadingTorrents::DownloadingTorrents(QObject *parent, bittorrent *BTSession) | ||||
|   DLListModel->setHeaderData(ETA, Qt::Horizontal, tr("ETA", "i.e: Estimated Time of Arrival / Time left")); | ||||
|   DLListModel->setHeaderData(PRIORITY, Qt::Horizontal, tr("Priority")); | ||||
|   downloadList->setModel(DLListModel); | ||||
|   downloadList->setRootIsDecorated(false); | ||||
|   downloadList->setAllColumnsShowFocus(true); | ||||
|   DLDelegate = new DLListDelegate(downloadList); | ||||
|   downloadList->setItemDelegate(DLDelegate); | ||||
|   // Hide priority column | ||||
| @@ -193,8 +182,9 @@ void DownloadingTorrents::deleteTorrent(QString hash) { | ||||
|  | ||||
| void DownloadingTorrents::on_actionSet_download_limit_triggered() { | ||||
|   QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes(); | ||||
|   QModelIndex index; | ||||
|   QStringList hashes; | ||||
|   foreach(const QModelIndex &index, selectedIndexes) { | ||||
|   foreach(index, selectedIndexes) { | ||||
|     if(index.column() == NAME) { | ||||
|       // Get the file hash | ||||
|       hashes << DLListModel->data(DLListModel->index(index.row(), HASH)).toString(); | ||||
| @@ -206,8 +196,9 @@ void DownloadingTorrents::on_actionSet_download_limit_triggered() { | ||||
|  | ||||
| void DownloadingTorrents::on_actionSet_upload_limit_triggered() { | ||||
|   QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes(); | ||||
|   QModelIndex index; | ||||
|   QStringList hashes; | ||||
|   foreach(const QModelIndex &index, selectedIndexes) { | ||||
|   foreach(index, selectedIndexes) { | ||||
|     if(index.column() == NAME) { | ||||
|       // Get the file hash | ||||
|       hashes << DLListModel->data(DLListModel->index(index.row(), HASH)).toString(); | ||||
| @@ -220,7 +211,8 @@ void DownloadingTorrents::on_actionSet_upload_limit_triggered() { | ||||
| // display properties of selected items | ||||
| void DownloadingTorrents::propertiesSelection(){ | ||||
|   QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes(); | ||||
|   foreach(const QModelIndex &index, selectedIndexes){ | ||||
|   QModelIndex index; | ||||
|   foreach(index, selectedIndexes){ | ||||
|     if(index.column() == NAME){ | ||||
|       showProperties(index); | ||||
|     } | ||||
| @@ -229,7 +221,8 @@ void DownloadingTorrents::propertiesSelection(){ | ||||
|  | ||||
| void DownloadingTorrents::forceRecheck() { | ||||
|     QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes(); | ||||
|     foreach(const QModelIndex &index, selectedIndexes){ | ||||
|     QModelIndex index; | ||||
|     foreach(index, selectedIndexes){ | ||||
|         if(index.column() == NAME){ | ||||
|             QString hash = DLListModel->data(DLListModel->index(index.row(), HASH)).toString(); | ||||
|             QTorrentHandle h = BTSession->getTorrentHandle(hash); | ||||
| @@ -238,12 +231,13 @@ void DownloadingTorrents::forceRecheck() { | ||||
|     } | ||||
| } | ||||
|  | ||||
| void DownloadingTorrents::displayDLListMenu(const QPoint&) { | ||||
| 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(const QModelIndex &index, selectedIndexes) { | ||||
|   foreach(index, selectedIndexes) { | ||||
|     if(index.column() == NAME) { | ||||
|       // Get the file name | ||||
|       QString hash = DLListModel->data(DLListModel->index(index.row(), HASH)).toString(); | ||||
| @@ -287,7 +281,8 @@ void DownloadingTorrents::displayDLListMenu(const QPoint&) { | ||||
|   myDLLlistMenu.addSeparator(); | ||||
|   myDLLlistMenu.addAction(actionBuy_it); | ||||
|   // Call menu | ||||
|   myDLLlistMenu.exec(QCursor::pos()); | ||||
|   // XXX: why mapToGlobal() is not enough? | ||||
|   myDLLlistMenu.exec(mapToGlobal(pos)+QPoint(10,35)); | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -467,8 +462,9 @@ QAction* DownloadingTorrents::getActionHoSCol(int index) { | ||||
|  | ||||
| QStringList DownloadingTorrents::getSelectedTorrents(bool only_one) const{ | ||||
|   QStringList res; | ||||
|   QModelIndex index; | ||||
|   QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes(); | ||||
|   foreach(const QModelIndex &index, selectedIndexes) { | ||||
|   foreach(index, selectedIndexes) { | ||||
|     if(index.column() == NAME) { | ||||
|       // Get the file hash | ||||
|       QString hash = DLListModel->data(DLListModel->index(index.row(), HASH)).toString(); | ||||
| @@ -579,7 +575,6 @@ void DownloadingTorrents::addTorrent(QString hash) { | ||||
|   DLListModel->setData(DLListModel->index(row, UPSPEED), QVariant((double)0.)); | ||||
|   DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant(QString::fromUtf8("0/0"))); | ||||
|   DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)h.progress())); | ||||
|   DLListModel->setData(DLListModel->index(row, RATIO), QVariant((double)0.)); | ||||
|   DLListModel->setData(DLListModel->index(row, ETA), QVariant((qlonglong)-1)); | ||||
|   if(BTSession->isQueueingEnabled()) | ||||
|     DLListModel->setData(DLListModel->index(row, PRIORITY), QVariant((int)BTSession->getDlTorrentPriority(hash))); | ||||
|   | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user