- Now finished torrents are moved correctly to download tab if for some reason the files disapear from the hard-drive :)

This commit is contained in:
Christophe Dumez 2007-04-15 17:42:43 +00:00
parent 5fc754520a
commit 79253c76f1
3 changed files with 31 additions and 3 deletions

3
TODO
View file

@ -45,4 +45,5 @@
- Use its piece prioritization support (debug)
- Improve ratio display / calculation / saving / per torrent...
- Sorting in Download Status column should be smarter than just an alphabetical sort
- Windows port : http://www.peerweb.nl/qbittorrent/experimentalbuild/testing.zip
- Windows port : http://www.peerweb.nl/qbittorrent/experimentalbuild/testing.zip
- MUST Improve torrent switching between download & finished list (and vice-versa) (USE SIGNALs/SLOTS)

View file

@ -490,8 +490,9 @@ void GUI::updateDlList(bool force){
if(finishedSHAs.indexOf(fileHash) != -1) continue;
int row = getRowFromHash(fileHash);
if(row == -1){
std::cerr << "Error: Could not find filename in download list..\n";
continue;
qDebug("Could not find filename in download list, adding it...");
restoreInDownloadList(h);
row = getRowFromHash(fileHash);
}
// Parse download state
torrent_info ti = h.get_torrent_info();
@ -554,6 +555,31 @@ void GUI::updateDlList(bool force){
// qDebug("Updated Download list");
}
void GUI::restoreInDownloadList(torrent_handle h){
unsigned int row = DLListModel->rowCount();
QString hash = QString(misc::toString(h.info_hash()).c_str());
// Adding torrent to download list
DLListModel->insertRow(row);
DLListModel->setData(DLListModel->index(row, NAME), QVariant(h.name().c_str()));
DLListModel->setData(DLListModel->index(row, SIZE), QVariant((qlonglong)torrentEffectiveSize(hash)));
DLListModel->setData(DLListModel->index(row, DLSPEED), QVariant((double)0.));
DLListModel->setData(DLListModel->index(row, UPSPEED), QVariant((double)0.));
DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant("0/0"));
DLListModel->setData(DLListModel->index(row, ETA), QVariant((qlonglong)-1));
DLListModel->setData(DLListModel->index(row, HASH), QVariant(hash));
// Pause torrent if it was paused last time
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".paused")){
DLListModel->setData(DLListModel->index(row, STATUS), QVariant(tr("Paused")));
DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(":/Icons/skin/paused.png")), Qt::DecorationRole);
setRowColor(row, "red");
}else{
DLListModel->setData(DLListModel->index(row, STATUS), QVariant(tr("Connecting...")));
DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(":/Icons/skin/connecting.png")), Qt::DecorationRole);
setRowColor(row, "grey");
}
++nbTorrents;
}
void GUI::setTabText(int index, QString text){
tabs->setTabText(index, text);
}

View file

@ -131,6 +131,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
void on_actionTorrent_Properties_triggered();
void on_actionPause_triggered();
void on_actionPause_All_triggered();
void restoreInDownloadList(torrent_handle h);
void on_actionStart_triggered();
void on_actionStart_All_triggered();
void on_actionOpen_triggered();