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 @@
- FEATURE: Now seeds priorities are handled automatically by libtorrent-rasterbar (queueing) - FEATURE: Now seeds priorities are handled automatically by libtorrent-rasterbar (queueing)
- FEATURE: Code cleanup and optimization (save memory and cpu) - FEATURE: Code cleanup and optimization (save memory and cpu)
- FEATURE: ETA calculation now relies on average speed over all sessions - 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 * Unknown - Christophe Dumez <chris@qbittorrent.org> - v1.2.1
- BUGFIX: Fixed possible crash when deleting a torrent permanently - BUGFIX: Fixed possible crash when deleting a torrent permanently

23
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(actionOpen_destination_folder, SIGNAL(triggered()), (GUI*)parent, SLOT(openDestinationFolder()));
connect(actionBuy_it, SIGNAL(triggered()), (GUI*)parent, SLOT(goBuyPage())); connect(actionBuy_it, SIGNAL(triggered()), (GUI*)parent, SLOT(goBuyPage()));
connect(actionTorrent_Properties, SIGNAL(triggered()), this, SLOT(propertiesSelection())); connect(actionTorrent_Properties, SIGNAL(triggered()), this, SLOT(propertiesSelection()));
connect(actionForce_recheck, SIGNAL(triggered()), this, SLOT(forceRecheck()));
connect(actionHOSColName, SIGNAL(triggered()), this, SLOT(hideOrShowColumnName())); connect(actionHOSColName, SIGNAL(triggered()), this, SLOT(hideOrShowColumnName()));
connect(actionHOSColSize, SIGNAL(triggered()), this, SLOT(hideOrShowColumnSize())); connect(actionHOSColSize, SIGNAL(triggered()), this, SLOT(hideOrShowColumnSize()));
@ -257,7 +258,11 @@ void FinishedTorrents::updateFinishedList(){
Q_ASSERT(row != -1); Q_ASSERT(row != -1);
// Update queued torrent // Update queued torrent
if(BTSession->isQueueingEnabled() && BTSession->isTorrentQueued(hash)) { 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")); setRowColor(row, QString::fromUtf8("grey"));
} }
if(h.is_paused() || h.is_queued()) continue; if(h.is_paused() || h.is_queued()) continue;
@ -276,7 +281,7 @@ void FinishedTorrents::updateFinishedList(){
} }
continue; 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); finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/time.png"))), Qt::DecorationRole);
setRowColor(row, QString::fromUtf8("grey")); setRowColor(row, QString::fromUtf8("grey"));
continue; 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){ void FinishedTorrents::displayFinishedListMenu(const QPoint& pos){
QMenu myFinishedListMenu(this); QMenu myFinishedListMenu(this);
QModelIndex index; QModelIndex index;
@ -407,6 +424,8 @@ void FinishedTorrents::displayFinishedListMenu(const QPoint& pos){
myFinishedListMenu.addSeparator(); myFinishedListMenu.addSeparator();
myFinishedListMenu.addAction(actionSet_upload_limit); myFinishedListMenu.addAction(actionSet_upload_limit);
myFinishedListMenu.addSeparator(); myFinishedListMenu.addSeparator();
myFinishedListMenu.addAction(actionForce_recheck);
myFinishedListMenu.addSeparator();
myFinishedListMenu.addAction(actionOpen_destination_folder); myFinishedListMenu.addAction(actionOpen_destination_folder);
myFinishedListMenu.addAction(actionTorrent_Properties); myFinishedListMenu.addAction(actionTorrent_Properties);
myFinishedListMenu.addSeparator(); myFinishedListMenu.addSeparator();

1
src/FinishedTorrents.h

@ -74,6 +74,7 @@ class FinishedTorrents : public QWidget, public Ui::seeding {
void hideOrShowColumnUpSpeed(); void hideOrShowColumnUpSpeed();
void hideOrShowColumnLeechers(); void hideOrShowColumnLeechers();
void hideOrShowColumnRatio(); void hideOrShowColumnRatio();
void forceRecheck();
public slots: public slots:
void addTorrent(QString hash); void addTorrent(QString hash);

32
src/download.ui

@ -18,16 +18,7 @@
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" > <property name="margin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
@ -100,7 +91,8 @@
</action> </action>
<action name="actionOpen_destination_folder" > <action name="actionOpen_destination_folder" >
<property name="icon" > <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>
<property name="text" > <property name="text" >
<string>Open destination folder</string> <string>Open destination folder</string>
@ -148,7 +140,8 @@
</action> </action>
<action name="actionBuy_it" > <action name="actionBuy_it" >
<property name="icon" > <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>
<property name="text" > <property name="text" >
<string>Buy it</string> <string>Buy it</string>
@ -161,7 +154,8 @@
</action> </action>
<action name="actionIncreasePriority" > <action name="actionIncreasePriority" >
<property name="icon" > <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>
<property name="text" > <property name="text" >
<string>Increase priority</string> <string>Increase priority</string>
@ -169,12 +163,22 @@
</action> </action>
<action name="actionDecreasePriority" > <action name="actionDecreasePriority" >
<property name="icon" > <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>
<property name="text" > <property name="text" >
<string>Decrease priority</string> <string>Decrease priority</string>
</property> </property>
</action> </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> </widget>
<resources> <resources>
<include location="icons.qrc" /> <include location="icons.qrc" />

36
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(actionDelete_Permanently, SIGNAL(triggered()), (GUI*)parent, SLOT(on_actionDelete_Permanently_triggered()));
connect(actionOpen_destination_folder, SIGNAL(triggered()), (GUI*)parent, SLOT(openDestinationFolder())); connect(actionOpen_destination_folder, SIGNAL(triggered()), (GUI*)parent, SLOT(openDestinationFolder()));
connect(actionTorrent_Properties, SIGNAL(triggered()), this, SLOT(propertiesSelection())); 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(actionBuy_it, SIGNAL(triggered()), (GUI*)parent, SLOT(goBuyPage()));
connect(actionHOSColName, SIGNAL(triggered()), this, SLOT(hideOrShowColumnName())); 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) { void DownloadingTorrents::displayDLListMenu(const QPoint& pos) {
QMenu myDLLlistMenu(this); QMenu myDLLlistMenu(this);
QModelIndex index; QModelIndex index;
@ -265,6 +278,8 @@ void DownloadingTorrents::displayDLListMenu(const QPoint& pos) {
myDLLlistMenu.addAction(actionSet_download_limit); myDLLlistMenu.addAction(actionSet_download_limit);
myDLLlistMenu.addAction(actionSet_upload_limit); myDLLlistMenu.addAction(actionSet_upload_limit);
myDLLlistMenu.addSeparator(); myDLLlistMenu.addSeparator();
myDLLlistMenu.addAction(actionForce_recheck);
myDLLlistMenu.addSeparator();
myDLLlistMenu.addAction(actionOpen_destination_folder); myDLLlistMenu.addAction(actionOpen_destination_folder);
myDLLlistMenu.addAction(actionTorrent_Properties); myDLLlistMenu.addAction(actionTorrent_Properties);
if(BTSession->isQueueingEnabled()) { if(BTSession->isQueueingEnabled()) {
@ -492,14 +507,21 @@ void DownloadingTorrents::updateDlList() {
Q_ASSERT(row != -1); Q_ASSERT(row != -1);
// Update Priority // Update Priority
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)));
if(BTSession->isTorrentQueued(hash)) { if(BTSession->isTorrentQueued(hash)) {
DLListModel->setData(DLListModel->index(row, 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) {
if(!downloadList->isColumnHidden(ETA)) { DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/time.png"))), Qt::DecorationRole);
DLListModel->setData(DLListModel->index(row, ETA), QVariant((qlonglong)-1)); 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 // No need to update a paused torrent
if(h.is_paused() || h.is_queued()) continue; if(h.is_paused() || h.is_queued()) continue;

1
src/downloadingTorrents.h

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

5
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())); 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 // Operators
// //

1
src/qtorrenthandle.h

@ -118,6 +118,7 @@ class QTorrentHandle {
void queue_position_down() const; void queue_position_down() const;
void queue_position_up() const; void queue_position_up() const;
void auto_managed(bool) const; void auto_managed(bool) const;
void force_recheck() const;
// //
// Operators // Operators

9
src/seeding.ui

@ -120,6 +120,15 @@
<string>Buy it</string> <string>Buy it</string>
</property> </property>
</action> </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> </widget>
<resources> <resources>
<include location="icons.qrc" /> <include location="icons.qrc" />

Loading…
Cancel
Save