Browse Source

- Allow to force rechecking torrents

adaptive-webui-19844
Christophe Dumez 16 years ago
parent
commit
01bc15d3f4
  1. 1
      Changelog
  2. 23
      src/FinishedTorrents.cpp
  3. 1
      src/FinishedTorrents.h
  4. 32
      src/download.ui
  5. 36
      src/downloadingTorrents.cpp
  6. 1
      src/downloadingTorrents.h
  7. 5
      src/qtorrenthandle.cpp
  8. 1
      src/qtorrenthandle.h
  9. 9
      src/seeding.ui

1
Changelog

@ -6,6 +6,7 @@ @@ -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 <chris@qbittorrent.org> - v1.2.1
- BUGFIX: Fixed possible crash when deleting a torrent permanently

23
src/FinishedTorrents.cpp

@ -76,6 +76,7 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par @@ -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(){ @@ -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(){ @@ -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(){ @@ -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){ @@ -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();

1
src/FinishedTorrents.h

@ -74,6 +74,7 @@ class FinishedTorrents : public QWidget, public Ui::seeding { @@ -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);

32
src/download.ui

@ -18,16 +18,7 @@ @@ -18,16 +18,7 @@
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<property name="margin" >
<number>0</number>
</property>
<item>
@ -100,7 +91,8 @@ @@ -100,7 +91,8 @@
</action>
<action name="actionOpen_destination_folder" >
<property name="icon" >
<iconset resource="icons.qrc" >:/Icons/folder.png</iconset>
<iconset resource="icons.qrc" >
<normaloff>:/Icons/folder.png</normaloff>:/Icons/folder.png</iconset>
</property>
<property name="text" >
<string>Open destination folder</string>
@ -148,7 +140,8 @@ @@ -148,7 +140,8 @@
</action>
<action name="actionBuy_it" >
<property name="icon" >
<iconset resource="icons.qrc" >:/Icons/money.png</iconset>
<iconset resource="icons.qrc" >
<normaloff>:/Icons/money.png</normaloff>:/Icons/money.png</iconset>
</property>
<property name="text" >
<string>Buy it</string>
@ -161,7 +154,8 @@ @@ -161,7 +154,8 @@
</action>
<action name="actionIncreasePriority" >
<property name="icon" >
<iconset resource="icons.qrc" >:/Icons/skin/increase.png</iconset>
<iconset resource="icons.qrc" >
<normaloff>:/Icons/skin/increase.png</normaloff>:/Icons/skin/increase.png</iconset>
</property>
<property name="text" >
<string>Increase priority</string>
@ -169,12 +163,22 @@ @@ -169,12 +163,22 @@
</action>
<action name="actionDecreasePriority" >
<property name="icon" >
<iconset resource="icons.qrc" >:/Icons/skin/decrease.png</iconset>
<iconset resource="icons.qrc" >
<normaloff>:/Icons/skin/decrease.png</normaloff>:/Icons/skin/decrease.png</iconset>
</property>
<property name="text" >
<string>Decrease priority</string>
</property>
</action>
<action name="actionForce_recheck" >
<property name="icon" >
<iconset resource="icons.qrc" >
<normaloff>:/Icons/gear.png</normaloff>:/Icons/gear.png</iconset>
</property>
<property name="text" >
<string>Force recheck</string>
</property>
</action>
</widget>
<resources>
<include location="icons.qrc" />

36
src/downloadingTorrents.cpp

@ -94,6 +94,7 @@ DownloadingTorrents::DownloadingTorrents(QObject *parent, bittorrent *BTSession) @@ -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(){ @@ -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) { @@ -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() { @@ -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;

1
src/downloadingTorrents.h

@ -85,6 +85,7 @@ class DownloadingTorrents : public QWidget, public Ui::downloading{ @@ -85,6 +85,7 @@ class DownloadingTorrents : public QWidget, public Ui::downloading{
void hideOrShowColumnEta();
void hideOrShowColumnPriority();
void loadLastSortedColumn();
void forceRecheck();
public slots:
void updateDlList();

5
src/qtorrenthandle.cpp

@ -388,6 +388,11 @@ void QTorrentHandle::set_tracker_login(QString username, QString password) { @@ -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
//

1
src/qtorrenthandle.h

@ -118,6 +118,7 @@ class QTorrentHandle { @@ -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

9
src/seeding.ui

@ -120,6 +120,15 @@ @@ -120,6 +120,15 @@
<string>Buy it</string>
</property>
</action>
<action name="actionForce_recheck" >
<property name="icon" >
<iconset resource="icons.qrc" >
<normaloff>:/Icons/gear.png</normaloff>:/Icons/gear.png</iconset>
</property>
<property name="text" >
<string>Force recheck</string>
</property>
</action>
</widget>
<resources>
<include location="icons.qrc" />

Loading…
Cancel
Save