You've already forked qBittorrent
							
							
				mirror of
				https://github.com/qbittorrent/qBittorrent
				synced 2025-10-30 23:30:54 +01:00 
			
		
		
		
	Compare commits
	
		
			55 Commits
		
	
	
		
			release-2.
			...
			release-1.
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | aab28cda94 | ||
|   | 4e1ae6e448 | ||
|   | fb28a3821a | ||
|   | 0af506f38a | ||
|   | 5adca06912 | ||
|   | 1ace2303fb | ||
|   | 197d9af8ef | ||
|   | b582c5d338 | ||
|   | bde7ebd60e | ||
|   | 01a1088252 | ||
|   | 9b86ea56ab | ||
|   | a326307b0d | ||
|   | 2e888a1e68 | ||
|   | 2b1755eb2a | ||
|   | 7f3832a73d | ||
|   | 935de375b9 | ||
|   | b88ea10937 | ||
|   | 9b29302d42 | ||
|   | e67d3243e8 | ||
|   | 977dba4be6 | ||
|   | 114d96195b | ||
|   | 99786cdf17 | ||
|   | 0ad7781c8b | ||
|   | dceba7e2e1 | ||
|   | 3a6b5af494 | ||
|   | d6ca454bad | ||
|   | e7581df394 | ||
|   | 65d763b30b | ||
|   | 16798879b9 | ||
|   | 74ce8fc87e | ||
|   | 7dde3423f7 | ||
|   | 4a960a289e | ||
|   | aad78a92f6 | ||
|   | edaad3f605 | ||
|   | 6ef317da16 | ||
|   | 4ba084e7d5 | ||
|   | 6732d2e3de | ||
|   | 8e5f0404a8 | ||
|   | 080965f0e5 | ||
|   | cd9b6ec54e | ||
|   | e01a87e644 | ||
|   | e0cba78dac | ||
|   | 22ff0374d5 | ||
|   | 813f52f452 | ||
|   | 2dd376a5b1 | ||
|   | 16832d52c0 | ||
|   | d128b734b0 | ||
|   | 9a300db87a | ||
|   | c6698cbf5a | ||
|   | 4c8ecf5459 | ||
|   | 1a2fdc259c | ||
|   | 5c3f2f0aed | ||
|   | e0ef409220 | ||
|   | d9199ce836 | ||
|   | d78a47ad30 | 
							
								
								
									
										14
									
								
								COPYING
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								COPYING
									
									
									
									
									
								
							| @@ -1,3 +1,17 @@ | |||||||
|  | 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 | 		    GNU GENERAL PUBLIC LICENSE | ||||||
| 		       Version 2, June 1991 | 		       Version 2, June 1991 | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										34
									
								
								Changelog
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								Changelog
									
									
									
									
									
								
							| @@ -1,3 +1,37 @@ | |||||||
|  | * Fri Jul 24 2009 - Christophe DUMEZ <chris@qbittorrent.org> - 1.3.5 | ||||||
|  |     - BUGFIX: Made IP filter parser more robust | ||||||
|  |     - BUGFIX: Fixed torrent creation tool | ||||||
|  |     - BUGFIX: Fixed possible overflow in progress calculation in arborescence.h | ||||||
|  |     - BUGFIX: Save properties window size, position, columns width and restore them | ||||||
|  |     - BUGFIX: Set a minimum default width for NAME column in properties | ||||||
|  |     - BUGFIX: Remember visual indexes of columns in transfer lists | ||||||
|  |  | ||||||
|  | * 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 | * 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: Torrents paused due to an I/O error were displayed as queued | ||||||
|     - BUGFIX: qBittorrent now prints backtrace in terminal when segfaulting |     - BUGFIX: qBittorrent now prints backtrace in terminal when segfaulting | ||||||
|   | |||||||
							
								
								
									
										25
									
								
								TODO
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								TODO
									
									
									
									
									
								
							| @@ -1,27 +1,2 @@ | |||||||
| See https://blueprints.launchpad.net/qbittorrent/ | See https://blueprints.launchpad.net/qbittorrent/ | ||||||
|  |  | ||||||
| // TODO in v1.4.0 |  | ||||||
| - Display peers information (disabled as a default) |  | ||||||
| - Automatically move torrent to another directory on completion (disabled as a default) |  | ||||||
| - Rework program preferences (make easier) |  | ||||||
| - Provide better errors messages to make debugging easier |  | ||||||
|  |  | ||||||
| // translations done in v1.3.0 |  | ||||||
| - Romanian |  | ||||||
| - Russian |  | ||||||
| - Hungarian |  | ||||||
| - German |  | ||||||
| - Chinese (traditional) |  | ||||||
| - Chinese (simplified) |  | ||||||
| - Italian |  | ||||||
| - Swedish |  | ||||||
| - Turkish |  | ||||||
| - French |  | ||||||
| - Slovak |  | ||||||
| - Czech |  | ||||||
| - Korean |  | ||||||
| - Portuguese |  | ||||||
| - Brazilian |  | ||||||
| - Greek |  | ||||||
| - Bulgarian |  | ||||||
| - Finnish |  | ||||||
|   | |||||||
| @@ -16,6 +16,15 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,6 +16,15 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| @@ -39,6 +48,8 @@ | |||||||
| #define F_RATIO 4 | #define F_RATIO 4 | ||||||
| #define F_HASH 5 | #define F_HASH 5 | ||||||
|  |  | ||||||
|  | #define MAX_RATIO 100. | ||||||
|  |  | ||||||
| class FinishedListDelegate: public QItemDelegate { | class FinishedListDelegate: public QItemDelegate { | ||||||
|   Q_OBJECT |   Q_OBJECT | ||||||
|  |  | ||||||
| @@ -63,7 +74,7 @@ class FinishedListDelegate: public QItemDelegate { | |||||||
|         case F_RATIO:{ |         case F_RATIO:{ | ||||||
|           QItemDelegate::drawBackground(painter, opt, index); |           QItemDelegate::drawBackground(painter, opt, index); | ||||||
|           double ratio = index.data().toDouble(); |           double ratio = index.data().toDouble(); | ||||||
|           if(ratio > 100.) |           if(ratio > MAX_RATIO) | ||||||
|             QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::fromUtf8("∞")); |             QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::fromUtf8("∞")); | ||||||
|           else |           else | ||||||
|             QItemDelegate::drawDisplay(painter, opt, opt.rect, QString(QByteArray::number(ratio, 'f', 1))); |             QItemDelegate::drawDisplay(painter, opt, opt.rect, QString(QByteArray::number(ratio, 'f', 1))); | ||||||
|   | |||||||
| @@ -16,6 +16,15 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
| #include "FinishedTorrents.h" | #include "FinishedTorrents.h" | ||||||
| @@ -44,6 +53,8 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par | |||||||
|   finishedListModel->setHeaderData(F_LEECH, Qt::Horizontal, tr("Leechers", "i.e: full/partial sources")); |   finishedListModel->setHeaderData(F_LEECH, Qt::Horizontal, tr("Leechers", "i.e: full/partial sources")); | ||||||
|   finishedListModel->setHeaderData(F_RATIO, Qt::Horizontal, tr("Ratio")); |   finishedListModel->setHeaderData(F_RATIO, Qt::Horizontal, tr("Ratio")); | ||||||
|   finishedList->setModel(finishedListModel); |   finishedList->setModel(finishedListModel); | ||||||
|  |   finishedList->setRootIsDecorated(false); | ||||||
|  |   finishedList->setAllColumnsShowFocus(true); | ||||||
|   loadHiddenColumns(); |   loadHiddenColumns(); | ||||||
|   // Hide hash column |   // Hide hash column | ||||||
|   finishedList->hideColumn(F_HASH); |   finishedList->hideColumn(F_HASH); | ||||||
| @@ -165,6 +176,23 @@ bool FinishedTorrents::loadColWidthFinishedList(){ | |||||||
|         finishedList->header()->resizeSection(i, width_list.at(i).toInt()); |         finishedList->header()->resizeSection(i, width_list.at(i).toInt()); | ||||||
|   } |   } | ||||||
|   loadLastSortedColumn(); |   loadLastSortedColumn(); | ||||||
|  |   QVariantList visualIndexes = settings.value(QString::fromUtf8("FinishedListVisualIndexes"), QVariantList()).toList(); | ||||||
|  |   if(visualIndexes.size() != finishedListModel->columnCount()-1) { | ||||||
|  |     qDebug("Corrupted values for download list columns sizes"); | ||||||
|  |     return false; | ||||||
|  |   } | ||||||
|  |   bool change = false; | ||||||
|  |   do { | ||||||
|  |     change = false; | ||||||
|  |     for(int i=0;i<visualIndexes.size(); ++i) { | ||||||
|  |       int new_visual_index = visualIndexes.at(finishedList->header()->logicalIndex(i)).toInt(); | ||||||
|  |       if(i != new_visual_index) { | ||||||
|  |         qDebug("Moving column from %d to %d", finishedList->header()->logicalIndex(i), new_visual_index); | ||||||
|  |         finishedList->header()->moveSection(i, new_visual_index); | ||||||
|  |         change = true; | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   }while(change); | ||||||
|   qDebug("Finished list columns width loaded"); |   qDebug("Finished list columns width loaded"); | ||||||
|   return true; |   return true; | ||||||
| } | } | ||||||
| @@ -212,6 +240,11 @@ void FinishedTorrents::saveColWidthFinishedList() const{ | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   settings.setValue("FinishedListColsWidth", new_width_list.join(" ")); |   settings.setValue("FinishedListColsWidth", new_width_list.join(" ")); | ||||||
|  |   QVariantList visualIndexes; | ||||||
|  |   for(int i=0; i<nbColumns; ++i) { | ||||||
|  |     visualIndexes.append(finishedList->header()->visualIndex(i)); | ||||||
|  |   } | ||||||
|  |   settings.setValue(QString::fromUtf8("FinishedListVisualIndexes"), visualIndexes); | ||||||
|   qDebug("Finished list columns width saved"); |   qDebug("Finished list columns width saved"); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -346,7 +379,7 @@ void FinishedTorrents::forceRecheck(){ | |||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| void FinishedTorrents::displayFinishedListMenu(const QPoint& pos){ | void FinishedTorrents::displayFinishedListMenu(const QPoint&){ | ||||||
|   QMenu myFinishedListMenu(this); |   QMenu myFinishedListMenu(this); | ||||||
|   // Enable/disable pause/start action given the DL state |   // Enable/disable pause/start action given the DL state | ||||||
|   QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes(); |   QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes(); | ||||||
| @@ -390,8 +423,7 @@ void FinishedTorrents::displayFinishedListMenu(const QPoint& pos){ | |||||||
|   myFinishedListMenu.addAction(actionBuy_it); |   myFinishedListMenu.addAction(actionBuy_it); | ||||||
|  |  | ||||||
|   // Call menu |   // Call menu | ||||||
|   // XXX: why mapToGlobal() is not enough? |   myFinishedListMenu.exec(QCursor::pos()); | ||||||
|   myFinishedListMenu.exec(mapToGlobal(pos)+QPoint(10,58)); |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,6 +16,15 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,6 +16,15 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
| #include <QFileDialog> | #include <QFileDialog> | ||||||
|   | |||||||
| @@ -16,6 +16,15 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| [Desktop Entry] | [Desktop Entry] | ||||||
| Categories=Qt;Network;P2P | Categories=Qt;Network;P2P | ||||||
| Comment=V1.3.1 | Comment=V1.3.5 | ||||||
| Exec=qbittorrent %f | Exec=qbittorrent %f | ||||||
| GenericName=Bittorrent client | GenericName=Bittorrent client | ||||||
| GenericName[bg]=Торент клиент | GenericName[bg]=Торент клиент | ||||||
|   | |||||||
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB | 
| @@ -121,7 +121,6 @@ | |||||||
|    <addaction name="actionIncreasePriority" /> |    <addaction name="actionIncreasePriority" /> | ||||||
|    <addaction name="separator" /> |    <addaction name="separator" /> | ||||||
|    <addaction name="actionExit" /> |    <addaction name="actionExit" /> | ||||||
|    <addaction name="separator" /> |  | ||||||
|   </widget> |   </widget> | ||||||
|   <widget class="QStatusBar" name="statusBar" /> |   <widget class="QStatusBar" name="statusBar" /> | ||||||
|   <action name="actionOpen" > |   <action name="actionOpen" > | ||||||
|   | |||||||
| @@ -16,6 +16,15 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,6 +16,15 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,6 +16,15 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,6 +16,15 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| @@ -47,13 +56,14 @@ SearchTab::SearchTab(SearchEngine *parent) : QWidget() | |||||||
|      |      | ||||||
|     setLayout(box); |     setLayout(box); | ||||||
|     // Set Search results list model |     // Set Search results list model | ||||||
|     SearchListModel = new QStandardItemModel(0,5); |     SearchListModel = new QStandardItemModel(0,6); | ||||||
|     SearchListModel->setHeaderData(SEARCH_NAME, Qt::Horizontal, tr("Name", "i.e: file name")); |     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_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_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_LEECHERS, Qt::Horizontal, tr("Leechers", "i.e: Number of partial sources")); | ||||||
|     SearchListModel->setHeaderData(SEARCH_ENGINE, Qt::Horizontal, tr("Search engine")); |     SearchListModel->setHeaderData(SEARCH_ENGINE, Qt::Horizontal, tr("Search engine")); | ||||||
|     resultsBrowser->setModel(SearchListModel); |     resultsBrowser->setModel(SearchListModel); | ||||||
|  |     resultsBrowser->hideColumn(URL_COLUMN); // Hide url column | ||||||
|     SearchDelegate = new SearchListDelegate(); |     SearchDelegate = new SearchListDelegate(); | ||||||
|     resultsBrowser->setItemDelegate(SearchDelegate); |     resultsBrowser->setItemDelegate(SearchDelegate); | ||||||
|     // Make search list header clickable for sorting |     // Make search list header clickable for sorting | ||||||
| @@ -128,7 +138,7 @@ void SearchTab::sortSearchListInt(int index, Qt::SortOrder sortOrder){ | |||||||
|   for(int row=0; row<lines.size(); ++row){ |   for(int row=0; row<lines.size(); ++row){ | ||||||
|     SearchListModel->insertRow(SearchListModel->rowCount()); |     SearchListModel->insertRow(SearchListModel->rowCount()); | ||||||
|     int sourceRow = lines[row].first; |     int sourceRow = lines[row].first; | ||||||
|     for(int col=0; col<5; ++col){ |     for(int col=0; col<6; ++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))); | ||||||
|       SearchListModel->setData(SearchListModel->index(nbRows_old+row, col), SearchListModel->data(SearchListModel->index(sourceRow, col), Qt::ForegroundRole), Qt::ForegroundRole); |       SearchListModel->setData(SearchListModel->index(nbRows_old+row, col), SearchListModel->data(SearchListModel->index(sourceRow, col), Qt::ForegroundRole), Qt::ForegroundRole); | ||||||
|     } |     } | ||||||
| @@ -148,7 +158,7 @@ void SearchTab::sortSearchListString(int index, Qt::SortOrder sortOrder){ | |||||||
|   for(int row=0; row<nbRows_old; ++row){ |   for(int row=0; row<nbRows_old; ++row){ | ||||||
|     SearchListModel->insertRow(SearchListModel->rowCount()); |     SearchListModel->insertRow(SearchListModel->rowCount()); | ||||||
|     int sourceRow = lines[row].first; |     int sourceRow = lines[row].first; | ||||||
|     for(int col=0; col<5; ++col){ |     for(int col=0; col<6; ++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))); | ||||||
|       SearchListModel->setData(SearchListModel->index(nbRows_old+row, col), SearchListModel->data(SearchListModel->index(sourceRow, col), Qt::ForegroundRole), Qt::ForegroundRole); |       SearchListModel->setData(SearchListModel->index(nbRows_old+row, col), SearchListModel->data(SearchListModel->index(sourceRow, col), Qt::ForegroundRole), Qt::ForegroundRole); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -16,6 +16,15 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| @@ -24,6 +33,9 @@ | |||||||
|  |  | ||||||
| #include "ui_search.h" | #include "ui_search.h" | ||||||
|  |  | ||||||
|  | #define ENGINE_URL_COLUMN 4 | ||||||
|  | #define URL_COLUMN 5 | ||||||
|  |  | ||||||
| class SearchListDelegate; | class SearchListDelegate; | ||||||
| class SearchEngine; | class SearchEngine; | ||||||
| class QTreeView; | class QTreeView; | ||||||
|   | |||||||
| @@ -16,6 +16,15 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,6 +16,15 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,6 +16,15 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,6 +16,15 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| @@ -42,6 +51,8 @@ class torrent_file { | |||||||
|     torrent_file(torrent_file *parent, QString path, bool dir, size_type size=0, int index=-1, float progress=0., int priority=1): parent(parent), is_dir(dir), size(size), progress(progress), priority(priority), index(index){ |     torrent_file(torrent_file *parent, QString path, bool dir, size_type size=0, int index=-1, float progress=0., int priority=1): parent(parent), is_dir(dir), size(size), progress(progress), priority(priority), index(index){ | ||||||
|       qDebug("created a file with index %d", index); |       qDebug("created a file with index %d", index); | ||||||
|       rel_path = QDir::cleanPath(path); |       rel_path = QDir::cleanPath(path); | ||||||
|  |       Q_ASSERT(progress >= 0.); | ||||||
|  |       Q_ASSERT(progress <= 1.); | ||||||
|       if(parent) { |       if(parent) { | ||||||
|         parent->updateProgress(); |         parent->updateProgress(); | ||||||
|         parent->updatePriority(priority); |         parent->updatePriority(priority); | ||||||
| @@ -66,8 +77,8 @@ class torrent_file { | |||||||
|         progress = 0.; |         progress = 0.; | ||||||
|         return; |         return; | ||||||
|       } |       } | ||||||
|       float wanted = 0.; |       double wanted = 0.; | ||||||
|       float done = 0.; |       double done = 0.; | ||||||
|       foreach(const torrent_file *child, children) { |       foreach(const torrent_file *child, children) { | ||||||
|         wanted += child->getSize(); |         wanted += child->getSize(); | ||||||
|         done += child->getSize()*child->getProgress(); |         done += child->getSize()*child->getProgress(); | ||||||
| @@ -196,13 +207,13 @@ class arborescence { | |||||||
|       } else { |       } else { | ||||||
|         // XXX: Will crash if there is no file in torrent |         // XXX: Will crash if there is no file in torrent | ||||||
|         qDebug("one file in the torrent, setting it as root with index 0"); |         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, ((double)fp[0])/t.file_at(0).size, prioritiesTab[0]); | ||||||
|         return; |         return; | ||||||
|       } |       } | ||||||
|       int i = 0; |       int i = 0; | ||||||
|       while(fi != t.end_files()) { |       while(fi != t.end_files()) { | ||||||
|         QString path = QDir::cleanPath(misc::toQString(fi->path.string())); |         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, ((double)fp[i])/t.file_at(i).size, prioritiesTab[i]); | ||||||
|         fi++; |         fi++; | ||||||
|         ++i; |         ++i; | ||||||
|       } |       } | ||||||
|   | |||||||
| @@ -16,11 +16,20 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include <QDir> | #include <QDir> | ||||||
| #include <QTime> | #include <QDateTime> | ||||||
| #include <QString> | #include <QString> | ||||||
| #include <QTimer> | #include <QTimer> | ||||||
| #include <QFileSystemWatcher> | #include <QFileSystemWatcher> | ||||||
| @@ -43,9 +52,10 @@ | |||||||
| #include <boost/filesystem/exception.hpp> | #include <boost/filesystem/exception.hpp> | ||||||
|  |  | ||||||
| #define MAX_TRACKER_ERRORS 2 | #define MAX_TRACKER_ERRORS 2 | ||||||
|  | #define MAX_RATIO 100. | ||||||
|  |  | ||||||
| // Main constructor | // Main constructor | ||||||
| bittorrent::bittorrent() : DHTEnabled(false), preAllocateAll(false), addInPause(false), maxConnecsPerTorrent(500), maxUploadsPerTorrent(4), max_ratio(-1), UPnPEnabled(false), NATPMPEnabled(false), LSDEnabled(false), queueingEnabled(false) { | bittorrent::bittorrent() : DHTEnabled(false), preAllocateAll(false), addInPause(false), maxConnecsPerTorrent(500), maxUploadsPerTorrent(4), ratio_limit(-1), UPnPEnabled(false), NATPMPEnabled(false), LSDEnabled(false), queueingEnabled(false) { | ||||||
|   // To avoid some exceptions |   // To avoid some exceptions | ||||||
|   fs::path::default_name_check(fs::no_check); |   fs::path::default_name_check(fs::no_check); | ||||||
|   // Creating bittorrent session |   // Creating bittorrent session | ||||||
| @@ -115,7 +125,7 @@ void bittorrent::preAllocateAllFiles(bool b) { | |||||||
| } | } | ||||||
|  |  | ||||||
| void bittorrent::deleteBigRatios() { | void bittorrent::deleteBigRatios() { | ||||||
|   if(max_ratio == -1) return; |   if(ratio_limit == -1) return; | ||||||
|     std::vector<torrent_handle> torrents = getTorrents(); |     std::vector<torrent_handle> torrents = getTorrents(); | ||||||
|     std::vector<torrent_handle>::iterator torrentIT; |     std::vector<torrent_handle>::iterator torrentIT; | ||||||
|     for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) { |     for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) { | ||||||
| @@ -123,7 +133,8 @@ void bittorrent::deleteBigRatios() { | |||||||
|         if(!h.is_valid()) continue; |         if(!h.is_valid()) continue; | ||||||
|         if(h.is_seed()) { |         if(h.is_seed()) { | ||||||
|             QString hash = h.hash(); |             QString hash = h.hash(); | ||||||
|             if(getRealRatio(hash) > max_ratio) { |             float ratio = getRealRatio(hash); | ||||||
|  |             if(ratio <= MAX_RATIO && ratio > ratio_limit) { | ||||||
|               QString fileName = h.name(); |               QString fileName = h.name(); | ||||||
|               addConsoleMessage(tr("%1 reached the maximum ratio you set.").arg(fileName)); |               addConsoleMessage(tr("%1 reached the maximum ratio you set.").arg(fileName)); | ||||||
|               deleteTorrent(hash); |               deleteTorrent(hash); | ||||||
| @@ -760,7 +771,9 @@ float bittorrent::getRealRatio(QString hash) const{ | |||||||
|   Q_ASSERT(h.all_time_download() >= 0); |   Q_ASSERT(h.all_time_download() >= 0); | ||||||
|   Q_ASSERT(h.all_time_upload() >= 0); |   Q_ASSERT(h.all_time_upload() >= 0); | ||||||
|   if(h.all_time_download() == 0) { |   if(h.all_time_download() == 0) { | ||||||
|       return 101; |     if(h.all_time_upload() == 0) | ||||||
|  |       return 0; | ||||||
|  |     return 101; | ||||||
|   } |   } | ||||||
|   float ratio = (float)h.all_time_upload()/(float)h.all_time_download(); |   float ratio = (float)h.all_time_upload()/(float)h.all_time_download(); | ||||||
|   Q_ASSERT(ratio >= 0.); |   Q_ASSERT(ratio >= 0.); | ||||||
| @@ -839,7 +852,7 @@ void bittorrent::addConsoleMessage(QString msg, QColor color) { | |||||||
|   if(consoleMessages.size() > 100) { |   if(consoleMessages.size() > 100) { | ||||||
|     consoleMessages.removeFirst();  |     consoleMessages.removeFirst();  | ||||||
|   } |   } | ||||||
|   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>")); |   consoleMessages.append(QString::fromUtf8("<font color='grey'>")+ QDateTime::currentDateTime().toString(QString::fromUtf8("dd/MM/yyyy hh:mm:ss")) + QString::fromUtf8("</font> - <font color='") + color.name() +QString::fromUtf8("'><i>") + msg + QString::fromUtf8("</i></font>")); | ||||||
| } | } | ||||||
|  |  | ||||||
| void bittorrent::addPeerBanMessage(QString ip, bool from_ipfilter) { | void bittorrent::addPeerBanMessage(QString ip, bool from_ipfilter) { | ||||||
| @@ -847,9 +860,9 @@ void bittorrent::addPeerBanMessage(QString ip, bool from_ipfilter) { | |||||||
|     peerBanMessages.removeFirst();  |     peerBanMessages.removeFirst();  | ||||||
|   } |   } | ||||||
|   if(from_ipfilter) |   if(from_ipfilter) | ||||||
|     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)); |     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)); | ||||||
|   else |   else | ||||||
|     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)); |     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)); | ||||||
| } | } | ||||||
|  |  | ||||||
| bool bittorrent::isFilePreviewPossible(QString hash) const{ | bool bittorrent::isFilePreviewPossible(QString hash) const{ | ||||||
| @@ -972,19 +985,19 @@ void bittorrent::setGlobalRatio(float ratio) { | |||||||
| // be automatically deleted | // be automatically deleted | ||||||
| void bittorrent::setDeleteRatio(float ratio) { | void bittorrent::setDeleteRatio(float ratio) { | ||||||
|   if(ratio != -1 && ratio < 1.) ratio = 1.; |   if(ratio != -1 && ratio < 1.) ratio = 1.; | ||||||
|   if(max_ratio == -1 && ratio != -1) { |   if(ratio_limit == -1 && ratio != -1) { | ||||||
|     Q_ASSERT(!BigRatioTimer); |     Q_ASSERT(!BigRatioTimer); | ||||||
|     BigRatioTimer = new QTimer(this); |     BigRatioTimer = new QTimer(this); | ||||||
|     connect(BigRatioTimer, SIGNAL(timeout()), this, SLOT(deleteBigRatios())); |     connect(BigRatioTimer, SIGNAL(timeout()), this, SLOT(deleteBigRatios())); | ||||||
|     BigRatioTimer->start(5000); |     BigRatioTimer->start(5000); | ||||||
|   } else { |   } else { | ||||||
|     if(max_ratio != -1 && ratio == -1) { |     if(ratio_limit != -1 && ratio == -1) { | ||||||
|       delete BigRatioTimer; |       delete BigRatioTimer; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   if(max_ratio != ratio) { |   if(ratio_limit != ratio) { | ||||||
|     max_ratio = ratio; |     ratio_limit = ratio; | ||||||
|     qDebug("* Set deleteRatio to %.1f", max_ratio); |     qDebug("* Set deleteRatio to %.1f", ratio_limit); | ||||||
|     deleteBigRatios(); |     deleteBigRatios(); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -16,6 +16,15 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
| #ifndef __BITTORRENT_H__ | #ifndef __BITTORRENT_H__ | ||||||
| @@ -58,7 +67,7 @@ class bittorrent : public QObject { | |||||||
|     bool addInPause; |     bool addInPause; | ||||||
|     int maxConnecsPerTorrent; |     int maxConnecsPerTorrent; | ||||||
|     int maxUploadsPerTorrent; |     int maxUploadsPerTorrent; | ||||||
|     float max_ratio; |     float ratio_limit; | ||||||
|     bool UPnPEnabled; |     bool UPnPEnabled; | ||||||
|     bool NATPMPEnabled; |     bool NATPMPEnabled; | ||||||
|     bool LSDEnabled; |     bool LSDEnabled; | ||||||
| @@ -152,11 +161,11 @@ class bittorrent : public QObject { | |||||||
|     bool enableDHT(bool b); |     bool enableDHT(bool b); | ||||||
|     void addConsoleMessage(QString msg, QColor color=QApplication::palette().color(QPalette::WindowText)); |     void addConsoleMessage(QString msg, QColor color=QApplication::palette().color(QPalette::WindowText)); | ||||||
|     void addPeerBanMessage(QString msg, bool from_ipfilter); |     void addPeerBanMessage(QString msg, bool from_ipfilter); | ||||||
|  |     void processDownloadedFile(QString, QString); | ||||||
|  |  | ||||||
|   protected slots: |   protected slots: | ||||||
|     void scanDirectory(QString); |     void scanDirectory(QString); | ||||||
|     void readAlerts(); |     void readAlerts(); | ||||||
|     void processDownloadedFile(QString, QString); |  | ||||||
|     bool loadTrackerFile(QString hash); |     bool loadTrackerFile(QString hash); | ||||||
|     void saveTrackerFile(QString hash); |     void saveTrackerFile(QString hash); | ||||||
|     void deleteBigRatios(); |     void deleteBigRatios(); | ||||||
|   | |||||||
| @@ -16,6 +16,15 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,6 +16,15 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| @@ -175,7 +184,6 @@ void createtorrent::on_createButton_clicked(){ | |||||||
|  |  | ||||||
| void createtorrent::handleCreationFailure(QString msg) { | void createtorrent::handleCreationFailure(QString msg) { | ||||||
|   QMessageBox::information(0, tr("Torrent creation"), tr("Torrent creation was unsuccessful, reason: %1").arg(msg)); |   QMessageBox::information(0, tr("Torrent creation"), tr("Torrent creation was unsuccessful, reason: %1").arg(msg)); | ||||||
|   hide(); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void createtorrent::handleCreationSuccess(QString path, const char* branch_path) { | void createtorrent::handleCreationSuccess(QString path, const char* branch_path) { | ||||||
| @@ -196,7 +204,7 @@ void createtorrent::handleCreationSuccess(QString path, const char* branch_path) | |||||||
|         emit torrent_to_seed(path); |         emit torrent_to_seed(path); | ||||||
|     } |     } | ||||||
|     QMessageBox::information(0, tr("Torrent creation"), tr("Torrent was created successfully:")+" "+path); |     QMessageBox::information(0, tr("Torrent creation"), tr("Torrent was created successfully:")+" "+path); | ||||||
|     hide(); |     close(); | ||||||
| } | } | ||||||
|  |  | ||||||
| void createtorrent::updateProgressBar(int progress) { | void createtorrent::updateProgressBar(int progress) { | ||||||
| @@ -219,8 +227,12 @@ void torrentCreatorThread::create(QString _input_path, QString _save_path, QStri | |||||||
|   start(); |   start(); | ||||||
| } | } | ||||||
|  |  | ||||||
| void sendProgressUpdateSignal(int i, int num, QDialog *parent){ | void sendProgressUpdateSignal(int i, int num, torrentCreatorThread *parent){ | ||||||
|     ((createtorrent*)parent)->updateProgressBar((int)(i*100./(float)num)); |     parent->sendProgressSignal((int)(i*100./(float)num)); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void torrentCreatorThread::sendProgressSignal(int progress) { | ||||||
|  |   emit updateProgress(progress); | ||||||
| } | } | ||||||
|  |  | ||||||
| void torrentCreatorThread::run() { | void torrentCreatorThread::run() { | ||||||
| @@ -245,15 +257,13 @@ void torrentCreatorThread::run() { | |||||||
|     } |     } | ||||||
|     if(abort) return; |     if(abort) return; | ||||||
|     // calculate the hash for all pieces |     // calculate the hash for all pieces | ||||||
|     set_piece_hashes(t, full_path.branch_path(), boost::bind<void>(&sendProgressUpdateSignal, _1, t.num_pieces(), parent)); |     set_piece_hashes(t, full_path.branch_path(), boost::bind<void>(&sendProgressUpdateSignal, _1, t.num_pieces(), this)); | ||||||
|     // Set qBittorrent as creator and add user comment to |     // Set qBittorrent as creator and add user comment to | ||||||
|     // torrent_info structure |     // torrent_info structure | ||||||
|     t.set_creator(creator_str); |     t.set_creator(creator_str); | ||||||
|     t.set_comment((const char*)comment.toUtf8()); |     t.set_comment((const char*)comment.toUtf8()); | ||||||
|     // Is private ? |     // Is private ? | ||||||
|     if(is_private){ |     t.set_priv(is_private); | ||||||
|       t.set_priv(true); |  | ||||||
|     } |  | ||||||
|     if(abort) return; |     if(abort) return; | ||||||
|     // create the torrent and print it to out |     // create the torrent and print it to out | ||||||
|     ofstream out(complete(path((const char*)save_path.toUtf8())), std::ios_base::binary); |     ofstream out(complete(path((const char*)save_path.toUtf8())), std::ios_base::binary); | ||||||
|   | |||||||
| @@ -16,6 +16,15 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| @@ -48,6 +57,7 @@ class torrentCreatorThread : public QThread { | |||||||
|       wait(); |       wait(); | ||||||
|     } |     } | ||||||
|     void create(QString _input_path, QString _save_path, QStringList _trackers, QStringList _url_seeds, QString _comment, bool _is_private, int _piece_size); |     void create(QString _input_path, QString _save_path, QStringList _trackers, QStringList _url_seeds, QString _comment, bool _is_private, int _piece_size); | ||||||
|  |     void sendProgressSignal(int progress); | ||||||
|    |    | ||||||
|   protected: |   protected: | ||||||
|     void run(); |     void run(); | ||||||
| @@ -55,6 +65,8 @@ class torrentCreatorThread : public QThread { | |||||||
|   signals: |   signals: | ||||||
|     void creationFailure(QString msg); |     void creationFailure(QString msg); | ||||||
|     void creationSuccess(QString path, const char* branch_path); |     void creationSuccess(QString path, const char* branch_path); | ||||||
|  |  | ||||||
|  |   signals: | ||||||
|     void updateProgress(int progress); |     void updateProgress(int progress); | ||||||
| }; | }; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,6 +16,15 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,6 +16,15 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,6 +16,15 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,6 +16,15 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
| #include "downloadingTorrents.h" | #include "downloadingTorrents.h" | ||||||
| @@ -59,6 +68,8 @@ DownloadingTorrents::DownloadingTorrents(QObject *parent, bittorrent *BTSession) | |||||||
|   DLListModel->setHeaderData(ETA, Qt::Horizontal, tr("ETA", "i.e: Estimated Time of Arrival / Time left")); |   DLListModel->setHeaderData(ETA, Qt::Horizontal, tr("ETA", "i.e: Estimated Time of Arrival / Time left")); | ||||||
|   DLListModel->setHeaderData(PRIORITY, Qt::Horizontal, tr("Priority")); |   DLListModel->setHeaderData(PRIORITY, Qt::Horizontal, tr("Priority")); | ||||||
|   downloadList->setModel(DLListModel); |   downloadList->setModel(DLListModel); | ||||||
|  |   downloadList->setRootIsDecorated(false); | ||||||
|  |   downloadList->setAllColumnsShowFocus(true); | ||||||
|   DLDelegate = new DLListDelegate(downloadList); |   DLDelegate = new DLListDelegate(downloadList); | ||||||
|   downloadList->setItemDelegate(DLDelegate); |   downloadList->setItemDelegate(DLDelegate); | ||||||
|   // Hide priority column |   // Hide priority column | ||||||
| @@ -227,7 +238,7 @@ void DownloadingTorrents::forceRecheck() { | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| void DownloadingTorrents::displayDLListMenu(const QPoint& pos) { | void DownloadingTorrents::displayDLListMenu(const QPoint&) { | ||||||
|   QMenu myDLLlistMenu(this); |   QMenu myDLLlistMenu(this); | ||||||
|   // Enable/disable pause/start action given the DL state |   // Enable/disable pause/start action given the DL state | ||||||
|   QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes(); |   QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes(); | ||||||
| @@ -276,8 +287,7 @@ void DownloadingTorrents::displayDLListMenu(const QPoint& pos) { | |||||||
|   myDLLlistMenu.addSeparator(); |   myDLLlistMenu.addSeparator(); | ||||||
|   myDLLlistMenu.addAction(actionBuy_it); |   myDLLlistMenu.addAction(actionBuy_it); | ||||||
|   // Call menu |   // Call menu | ||||||
|   // XXX: why mapToGlobal() is not enough? |   myDLLlistMenu.exec(QCursor::pos()); | ||||||
|   myDLLlistMenu.exec(mapToGlobal(pos)+QPoint(10,35)); |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -569,6 +579,7 @@ void DownloadingTorrents::addTorrent(QString hash) { | |||||||
|   DLListModel->setData(DLListModel->index(row, UPSPEED), QVariant((double)0.)); |   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, SEEDSLEECH), QVariant(QString::fromUtf8("0/0"))); | ||||||
|   DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)h.progress())); |   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)); |   DLListModel->setData(DLListModel->index(row, ETA), QVariant((qlonglong)-1)); | ||||||
|   if(BTSession->isQueueingEnabled()) |   if(BTSession->isQueueingEnabled()) | ||||||
|     DLListModel->setData(DLListModel->index(row, PRIORITY), QVariant((int)BTSession->getDlTorrentPriority(hash))); |     DLListModel->setData(DLListModel->index(row, PRIORITY), QVariant((int)BTSession->getDlTorrentPriority(hash))); | ||||||
| @@ -721,6 +732,11 @@ void DownloadingTorrents::saveColWidthDLList() const{ | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   settings.setValue(QString::fromUtf8("DownloadListColsWidth"), new_width_list.join(QString::fromUtf8(" "))); |   settings.setValue(QString::fromUtf8("DownloadListColsWidth"), new_width_list.join(QString::fromUtf8(" "))); | ||||||
|  |   QVariantList visualIndexes; | ||||||
|  |   for(int i=0; i<nbColumns; ++i) { | ||||||
|  |     visualIndexes.append(downloadList->header()->visualIndex(i)); | ||||||
|  |   } | ||||||
|  |   settings.setValue(QString::fromUtf8("DownloadListVisualIndexes"), visualIndexes); | ||||||
|   qDebug("Download list columns width saved"); |   qDebug("Download list columns width saved"); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -741,6 +757,23 @@ bool DownloadingTorrents::loadColWidthDLList() { | |||||||
|   for(unsigned int i=0; i<listSize; ++i) { |   for(unsigned int i=0; i<listSize; ++i) { | ||||||
|         downloadList->header()->resizeSection(i, width_list.at(i).toInt()); |         downloadList->header()->resizeSection(i, width_list.at(i).toInt()); | ||||||
|   } |   } | ||||||
|  |   QVariantList visualIndexes = settings.value(QString::fromUtf8("DownloadListVisualIndexes"), QVariantList()).toList(); | ||||||
|  |   if(visualIndexes.size() != DLListModel->columnCount()-1) { | ||||||
|  |     qDebug("Corrupted values for download list columns sizes"); | ||||||
|  |     return false; | ||||||
|  |   } | ||||||
|  |   bool change = false; | ||||||
|  |   do { | ||||||
|  |     change = false; | ||||||
|  |     for(int i=0;i<visualIndexes.size(); ++i) { | ||||||
|  |       int new_visual_index = visualIndexes.at(downloadList->header()->logicalIndex(i)).toInt(); | ||||||
|  |       if(i != new_visual_index) { | ||||||
|  |         qDebug("Moving column from %d to %d", downloadList->header()->logicalIndex(i), new_visual_index); | ||||||
|  |         downloadList->header()->moveSection(i, new_visual_index); | ||||||
|  |         change = true; | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   }while(change); | ||||||
|   qDebug("Download list columns width loaded"); |   qDebug("Download list columns width loaded"); | ||||||
|   return true; |   return true; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -16,6 +16,15 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,12 +16,22 @@ | |||||||
|  * along with this program; if not, write to the Free Software |  * along with this program; if not, write to the Free Software | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  * 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 |  * Contact : chris@qbittorrent.org | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "engineSelectDlg.h" | #include "engineSelectDlg.h" | ||||||
| #include "downloadThread.h" | #include "downloadThread.h" | ||||||
| #include "misc.h" | #include "misc.h" | ||||||
|  | #include "ico.h" | ||||||
| #include "pluginSource.h" | #include "pluginSource.h" | ||||||
| #include <QProcess> | #include <QProcess> | ||||||
| #include <QHeaderView> | #include <QHeaderView> | ||||||
| @@ -122,7 +132,7 @@ void engineSelectDlg::saveSettings() { | |||||||
|  |  | ||||||
| void engineSelectDlg::on_updateButton_clicked() { | void engineSelectDlg::on_updateButton_clicked() { | ||||||
|   // Download version file from primary server |   // Download version file from primary server | ||||||
|   downloader->downloadUrl("http://www.dchris.eu/search_engine/versions.txt"); |   downloader->downloadUrl("http://www.dchris.eu/search_engine2/versions.txt"); | ||||||
| } | } | ||||||
|  |  | ||||||
| void engineSelectDlg::toggleEngineState(QTreeWidgetItem *item, int) { | void engineSelectDlg::toggleEngineState(QTreeWidgetItem *item, int) { | ||||||
| @@ -323,8 +333,13 @@ void engineSelectDlg::loadSupportedSearchEngines(bool first) { | |||||||
|       // Good, we already have the icon |       // Good, we already have the icon | ||||||
|       item->setData(ENGINE_NAME, Qt::DecorationRole, QVariant(QIcon(iconPath))); |       item->setData(ENGINE_NAME, Qt::DecorationRole, QVariant(QIcon(iconPath))); | ||||||
|     } else { |     } else { | ||||||
|       // Icon is missing, we must download it |       iconPath = misc::qBittorrentPath()+"search_engine"+QDir::separator()+"engines"+QDir::separator()+id+".ico"; | ||||||
|       downloader->downloadUrl(line.at(1)+"/favicon.ico"); |       if(QFile::exists(iconPath)) { // ICO support | ||||||
|  |         item->setData(ENGINE_NAME, Qt::DecorationRole, QVariant(QIcon(iconPath))); | ||||||
|  |       } else { | ||||||
|  |         // Icon is missing, we must download it | ||||||
|  |         downloader->downloadUrl(line.at(1)+"/favicon.ico"); | ||||||
|  |       } | ||||||
|     } |     } | ||||||
|     if(installed_engines.value(id, true)) |     if(installed_engines.value(id, true)) | ||||||
|       setRowColor(i, "green"); |       setRowColor(i, "green"); | ||||||
| @@ -439,7 +454,9 @@ void engineSelectDlg::installZipPlugin(QString path) { | |||||||
|       continue; |       continue; | ||||||
|     // Check if we already have a favicon for this plugin |     // Check if we already have a favicon for this plugin | ||||||
|     QString iconPath = misc::qBittorrentPath()+"search_engine"+QDir::separator()+"engines"+QDir::separator()+plugin_name+".png"; |     QString iconPath = misc::qBittorrentPath()+"search_engine"+QDir::separator()+"engines"+QDir::separator()+plugin_name+".png"; | ||||||
|     if(QFile::exists(iconPath)) continue; |     if(QFile::exists(iconPath)) { | ||||||
|  |       QFile::remove(iconPath); | ||||||
|  |     } | ||||||
|     ZZIP_FILE* fp = zzip_file_open(dir, favicon.toUtf8().data(), 0); |     ZZIP_FILE* fp = zzip_file_open(dir, favicon.toUtf8().data(), 0); | ||||||
|     if(fp) { |     if(fp) { | ||||||
|       QFile dest_icon(iconPath); |       QFile dest_icon(iconPath); | ||||||
| @@ -611,7 +628,13 @@ void engineSelectDlg::processDownloadedFile(QString url, QString filePath) { | |||||||
|       QTreeWidgetItem *item; |       QTreeWidgetItem *item; | ||||||
|       foreach(item, items){ |       foreach(item, items){ | ||||||
|         QString id = item->text(ENGINE_ID); |         QString id = item->text(ENGINE_ID); | ||||||
|         QString iconPath = misc::qBittorrentPath()+"search_engine"+QDir::separator()+"engines"+QDir::separator()+id+".png"; |         QString iconPath; | ||||||
|  |         QFile icon(filePath); | ||||||
|  |         icon.open(QIODevice::ReadOnly); | ||||||
|  |         if(ICOHandler::canRead(&icon)) | ||||||
|  |           iconPath = misc::qBittorrentPath()+"search_engine"+QDir::separator()+"engines"+QDir::separator()+id+".ico"; | ||||||
|  |         else | ||||||
|  |           iconPath = misc::qBittorrentPath()+"search_engine"+QDir::separator()+"engines"+QDir::separator()+id+".png"; | ||||||
|         QFile::copy(filePath, iconPath); |         QFile::copy(filePath, iconPath); | ||||||
|         item->setData(ENGINE_NAME, Qt::DecorationRole, QVariant(QIcon(iconPath))); |         item->setData(ENGINE_NAME, Qt::DecorationRole, QVariant(QIcon(iconPath))); | ||||||
|       } |       } | ||||||
| @@ -620,16 +643,16 @@ void engineSelectDlg::processDownloadedFile(QString url, QString filePath) { | |||||||
|     QFile::remove(filePath); |     QFile::remove(filePath); | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|   if(url == "http://www.dchris.eu/search_engine/versions.txt") { |   if(url == "http://www.dchris.eu/search_engine2/versions.txt") { | ||||||
|     if(!parseVersionsFile(filePath, "http://www.dchris.eu/search_engine/")) { |     if(!parseVersionsFile(filePath, "http://www.dchris.eu/search_engine2/")) { | ||||||
|       qDebug("Primary update server failed, try secondary"); |       qDebug("Primary update server failed, try secondary"); | ||||||
|       downloader->downloadUrl("http://hydr0g3n.free.fr/search_engine/versions.txt"); |       downloader->downloadUrl("http://hydr0g3n.free.fr/search_engine2/versions.txt"); | ||||||
|     } |     } | ||||||
|     QFile::remove(filePath); |     QFile::remove(filePath); | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|   if(url == "http://hydr0g3n.free.fr/search_engine/versions.txt") { |   if(url == "http://hydr0g3n.free.fr/search_engine2/versions.txt") { | ||||||
|     if(!parseVersionsFile(filePath, "http://hydr0g3n.free.fr/search_engine/")) { |     if(!parseVersionsFile(filePath, "http://hydr0g3n.free.fr/search_engine2/")) { | ||||||
|       QMessageBox::warning(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("Sorry, update server is temporarily unavailable.")); |       QMessageBox::warning(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("Sorry, update server is temporarily unavailable.")); | ||||||
|     } |     } | ||||||
|     QFile::remove(filePath); |     QFile::remove(filePath); | ||||||
| @@ -657,13 +680,13 @@ void engineSelectDlg::handleDownloadFailure(QString url, QString reason) { | |||||||
|     qDebug("Could not download favicon: %s, reason: %s", url.toUtf8().data(), reason.toUtf8().data()); |     qDebug("Could not download favicon: %s, reason: %s", url.toUtf8().data(), reason.toUtf8().data()); | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|   if(url == "http://www.dchris.eu/search_engine/versions.txt") { |   if(url == "http://www.dchris.eu/search_engine2/versions.txt") { | ||||||
|     // Primary update server failed, try secondary |     // Primary update server failed, try secondary | ||||||
|     qDebug("Primary update server failed, try secondary"); |     qDebug("Primary update server failed, try secondary"); | ||||||
|     downloader->downloadUrl("http://hydr0g3n.free.fr/search_engine/versions.txt"); |     downloader->downloadUrl("http://hydr0g3n.free.fr/search_engine2/versions.txt"); | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|   if(url == "http://hydr0g3n.free.fr/search_engine/versions.txt") { |   if(url == "http://hydr0g3n.free.fr/search_engine2/versions.txt") { | ||||||
|     QMessageBox::warning(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("Sorry, update server is temporarily unavailable.")); |     QMessageBox::warning(this, tr("Search plugin update")+" -- "+tr("qBittorrent"), tr("Sorry, update server is temporarily unavailable.")); | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|   | |||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user