Browse Source

- Fixed torrents moving back from finished list to download list (without recheck)

adaptive-webui-19844
Christophe Dumez 16 years ago
parent
commit
a3cfa6bba1
  1. 6
      src/GUI.cpp
  2. 9
      src/downloadingTorrents.cpp
  3. 2
      src/downloadingTorrents.h

6
src/GUI.cpp

@ -1365,7 +1365,11 @@ void GUI::updateLists(bool force) { @@ -1365,7 +1365,11 @@ void GUI::updateLists(bool force) {
finishedTorrentTab->updateTorrent(h);
} else {
// Update in download list
downloadingTorrentTab->updateTorrent(h);
if(downloadingTorrentTab->updateTorrent(h)) {
// Torrent was added, we may need to remove it from finished tab
finishedTorrentTab->deleteTorrent(h.hash());
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+h.hash()+".finished");
}
}
}
}

9
src/downloadingTorrents.cpp

@ -484,7 +484,8 @@ QStringList DownloadingTorrents::getSelectedTorrents(bool only_one) const{ @@ -484,7 +484,8 @@ QStringList DownloadingTorrents::getSelectedTorrents(bool only_one) const{
// get information from torrent handles and
// update download list accordingly
void DownloadingTorrents::updateTorrent(QTorrentHandle h) {
bool DownloadingTorrents::updateTorrent(QTorrentHandle h) {
bool added = false;
try{
QString hash = h.hash();
int row = getRowFromHash(hash);
@ -492,6 +493,7 @@ void DownloadingTorrents::updateTorrent(QTorrentHandle h) { @@ -492,6 +493,7 @@ void DownloadingTorrents::updateTorrent(QTorrentHandle h) {
qDebug("Info: Could not find filename in download list, adding it...");
addTorrent(hash);
row = getRowFromHash(hash);
added = true;
}
Q_ASSERT(row != -1);
// Update Priority
@ -514,11 +516,11 @@ void DownloadingTorrents::updateTorrent(QTorrentHandle h) { @@ -514,11 +516,11 @@ void DownloadingTorrents::updateTorrent(QTorrentHandle h) {
DLListModel->setData(DLListModel->index(row, UPSPEED), QVariant((double)0.));
DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant("0/0"));
setRowColor(row, QString::fromUtf8("grey"));
return;
return added;
}
}
// No need to update a paused torrent
if(h.is_paused()) return;
if(h.is_paused()) return added;
// Parse download state
// Setting download state
switch(h.state()) {
@ -567,6 +569,7 @@ void DownloadingTorrents::updateTorrent(QTorrentHandle h) { @@ -567,6 +569,7 @@ void DownloadingTorrents::updateTorrent(QTorrentHandle h) {
DLListModel->setData(DLListModel->index(row, RATIO), QVariant(misc::toQString(BTSession->getRealRatio(hash))));
}
}catch(invalid_handle e) {}
return added;
}
void DownloadingTorrents::addTorrent(QString hash) {

2
src/downloadingTorrents.h

@ -84,7 +84,7 @@ class DownloadingTorrents : public QWidget, public Ui::downloading{ @@ -84,7 +84,7 @@ class DownloadingTorrents : public QWidget, public Ui::downloading{
void forceRecheck();
public slots:
void updateTorrent(QTorrentHandle h);
bool updateTorrent(QTorrentHandle h);
void pauseTorrent(QString hash);
void resumeTorrent(QString hash);
void deleteTorrent(QString hash);

Loading…
Cancel
Save