diff --git a/Changelog b/Changelog index c07ccaf82..7ba618f98 100644 --- a/Changelog +++ b/Changelog @@ -6,6 +6,7 @@ - FEATURE: Now seeds priorities are handled automatically by libtorrent-rasterbar (queueing) - FEATURE: Code cleanup and optimization (save memory and cpu) - FEATURE: ETA calculation now relies on average speed over all sessions + - FEATURE: Allow to force rechecking torrents * Unknown - Christophe Dumez - v1.2.1 - BUGFIX: Fixed possible crash when deleting a torrent permanently diff --git a/src/FinishedTorrents.cpp b/src/FinishedTorrents.cpp index 6bba0f818..2db896a58 100644 --- a/src/FinishedTorrents.cpp +++ b/src/FinishedTorrents.cpp @@ -76,6 +76,7 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par connect(actionOpen_destination_folder, SIGNAL(triggered()), (GUI*)parent, SLOT(openDestinationFolder())); connect(actionBuy_it, SIGNAL(triggered()), (GUI*)parent, SLOT(goBuyPage())); connect(actionTorrent_Properties, SIGNAL(triggered()), this, SLOT(propertiesSelection())); + connect(actionForce_recheck, SIGNAL(triggered()), this, SLOT(forceRecheck())); connect(actionHOSColName, SIGNAL(triggered()), this, SLOT(hideOrShowColumnName())); connect(actionHOSColSize, SIGNAL(triggered()), this, SLOT(hideOrShowColumnSize())); @@ -257,7 +258,11 @@ void FinishedTorrents::updateFinishedList(){ Q_ASSERT(row != -1); // Update queued torrent if(BTSession->isQueueingEnabled() && BTSession->isTorrentQueued(hash)) { - finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/queued.png"))), Qt::DecorationRole); + if(h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking){ + finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/time.png"))), Qt::DecorationRole); + } else { + finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/queued.png"))), Qt::DecorationRole); + } setRowColor(row, QString::fromUtf8("grey")); } if(h.is_paused() || h.is_queued()) continue; @@ -276,7 +281,7 @@ void FinishedTorrents::updateFinishedList(){ } continue; } - if(h.state() == torrent_status::checking_files){ + if(h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking){ finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/time.png"))), Qt::DecorationRole); setRowColor(row, QString::fromUtf8("grey")); continue; @@ -370,6 +375,18 @@ void FinishedTorrents::propertiesSelection(){ } } +void FinishedTorrents::forceRecheck(){ + QModelIndexList selectedIndexes = finishedList->selectionModel()->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); + h.force_recheck(); + } + } +} + void FinishedTorrents::displayFinishedListMenu(const QPoint& pos){ QMenu myFinishedListMenu(this); QModelIndex index; @@ -407,6 +424,8 @@ void FinishedTorrents::displayFinishedListMenu(const QPoint& pos){ myFinishedListMenu.addSeparator(); myFinishedListMenu.addAction(actionSet_upload_limit); myFinishedListMenu.addSeparator(); + myFinishedListMenu.addAction(actionForce_recheck); + myFinishedListMenu.addSeparator(); myFinishedListMenu.addAction(actionOpen_destination_folder); myFinishedListMenu.addAction(actionTorrent_Properties); myFinishedListMenu.addSeparator(); diff --git a/src/FinishedTorrents.h b/src/FinishedTorrents.h index dd2308bbd..ccf2afb37 100644 --- a/src/FinishedTorrents.h +++ b/src/FinishedTorrents.h @@ -74,6 +74,7 @@ class FinishedTorrents : public QWidget, public Ui::seeding { void hideOrShowColumnUpSpeed(); void hideOrShowColumnLeechers(); void hideOrShowColumnRatio(); + void forceRecheck(); public slots: void addTorrent(QString hash); diff --git a/src/download.ui b/src/download.ui index 745afdd5f..2abe6e936 100644 --- a/src/download.ui +++ b/src/download.ui @@ -18,16 +18,7 @@ 6 - - 0 - - - 0 - - - 0 - - + 0 @@ -100,7 +91,8 @@ - :/Icons/folder.png + + :/Icons/folder.png:/Icons/folder.png Open destination folder @@ -148,7 +140,8 @@ - :/Icons/money.png + + :/Icons/money.png:/Icons/money.png Buy it @@ -161,7 +154,8 @@ - :/Icons/skin/increase.png + + :/Icons/skin/increase.png:/Icons/skin/increase.png Increase priority @@ -169,12 +163,22 @@ - :/Icons/skin/decrease.png + + :/Icons/skin/decrease.png:/Icons/skin/decrease.png Decrease priority + + + + :/Icons/gear.png:/Icons/gear.png + + + Force recheck + + diff --git a/src/downloadingTorrents.cpp b/src/downloadingTorrents.cpp index 5be3c3b6c..336ee8345 100644 --- a/src/downloadingTorrents.cpp +++ b/src/downloadingTorrents.cpp @@ -94,6 +94,7 @@ DownloadingTorrents::DownloadingTorrents(QObject *parent, bittorrent *BTSession) connect(actionDelete_Permanently, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionDelete_Permanently_triggered())); connect(actionOpen_destination_folder, SIGNAL(triggered()), (GUI*)parent, SLOT(openDestinationFolder())); connect(actionTorrent_Properties, SIGNAL(triggered()), this, SLOT(propertiesSelection())); + connect(actionForce_recheck, SIGNAL(triggered()), this, SLOT(forceRecheck())); connect(actionBuy_it, SIGNAL(triggered()), (GUI*)parent, SLOT(goBuyPage())); connect(actionHOSColName, SIGNAL(triggered()), this, SLOT(hideOrShowColumnName())); @@ -227,6 +228,18 @@ void DownloadingTorrents::propertiesSelection(){ } } +void DownloadingTorrents::forceRecheck() { + QModelIndexList selectedIndexes = downloadList->selectionModel()->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); + h.force_recheck(); + } + } +} + void DownloadingTorrents::displayDLListMenu(const QPoint& pos) { QMenu myDLLlistMenu(this); QModelIndex index; @@ -265,6 +278,8 @@ void DownloadingTorrents::displayDLListMenu(const QPoint& pos) { myDLLlistMenu.addAction(actionSet_download_limit); myDLLlistMenu.addAction(actionSet_upload_limit); myDLLlistMenu.addSeparator(); + myDLLlistMenu.addAction(actionForce_recheck); + myDLLlistMenu.addSeparator(); myDLLlistMenu.addAction(actionOpen_destination_folder); myDLLlistMenu.addAction(actionTorrent_Properties); if(BTSession->isQueueingEnabled()) { @@ -492,14 +507,21 @@ void DownloadingTorrents::updateDlList() { Q_ASSERT(row != -1); // Update Priority if(BTSession->isQueueingEnabled()) { - DLListModel->setData(DLListModel->index(row, PRIORITY), QVariant((int)BTSession->getDlTorrentPriority(hash))); - if(BTSession->isTorrentQueued(hash)) { - DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/queued.png"))), Qt::DecorationRole); - if(!downloadList->isColumnHidden(ETA)) { - DLListModel->setData(DLListModel->index(row, ETA), QVariant((qlonglong)-1)); + DLListModel->setData(DLListModel->index(row, PRIORITY), QVariant((int)BTSession->getDlTorrentPriority(hash))); + if(BTSession->isTorrentQueued(hash)) { + if(h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking) { + DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/time.png"))), Qt::DecorationRole); + if(!downloadList->isColumnHidden(PROGRESS)) { + DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)h.progress())); + } + }else { + DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/queued.png"))), Qt::DecorationRole); + if(!downloadList->isColumnHidden(ETA)) { + DLListModel->setData(DLListModel->index(row, ETA), QVariant((qlonglong)-1)); + } + } + setRowColor(row, QString::fromUtf8("grey")); } - setRowColor(row, QString::fromUtf8("grey")); - } } // No need to update a paused torrent if(h.is_paused() || h.is_queued()) continue; diff --git a/src/downloadingTorrents.h b/src/downloadingTorrents.h index 4c22164b1..e1511df45 100644 --- a/src/downloadingTorrents.h +++ b/src/downloadingTorrents.h @@ -85,6 +85,7 @@ class DownloadingTorrents : public QWidget, public Ui::downloading{ void hideOrShowColumnEta(); void hideOrShowColumnPriority(); void loadLastSortedColumn(); + void forceRecheck(); public slots: void updateDlList(); diff --git a/src/qtorrenthandle.cpp b/src/qtorrenthandle.cpp index 0f27c7025..9a3a74dc0 100644 --- a/src/qtorrenthandle.cpp +++ b/src/qtorrenthandle.cpp @@ -388,6 +388,11 @@ void QTorrentHandle::set_tracker_login(QString username, QString password) { h.set_tracker_login(std::string(username.toUtf8().data()), std::string(password.toUtf8().data())); } +void QTorrentHandle::force_recheck() const { + Q_ASSERT(h.is_valid()); + h.force_recheck(); +} + // // Operators // diff --git a/src/qtorrenthandle.h b/src/qtorrenthandle.h index 66930b2cc..387c66352 100644 --- a/src/qtorrenthandle.h +++ b/src/qtorrenthandle.h @@ -118,6 +118,7 @@ class QTorrentHandle { void queue_position_down() const; void queue_position_up() const; void auto_managed(bool) const; + void force_recheck() const; // // Operators diff --git a/src/seeding.ui b/src/seeding.ui index 8f575110c..66f98a9d2 100644 --- a/src/seeding.ui +++ b/src/seeding.ui @@ -120,6 +120,15 @@ Buy it + + + + :/Icons/gear.png:/Icons/gear.png + + + Force recheck + +