Browse Source

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

adaptive-webui-19844
Christophe Dumez 18 years ago
parent
commit
79253c76f1
  1. 1
      TODO
  2. 30
      src/GUI.cpp
  3. 1
      src/GUI.h

1
TODO

@ -46,3 +46,4 @@
- Improve ratio display / calculation / saving / per torrent... - Improve ratio display / calculation / saving / per torrent...
- Sorting in Download Status column should be smarter than just an alphabetical sort - 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)

30
src/GUI.cpp

@ -490,8 +490,9 @@ void GUI::updateDlList(bool force){
if(finishedSHAs.indexOf(fileHash) != -1) continue; if(finishedSHAs.indexOf(fileHash) != -1) continue;
int row = getRowFromHash(fileHash); int row = getRowFromHash(fileHash);
if(row == -1){ if(row == -1){
std::cerr << "Error: Could not find filename in download list..\n"; qDebug("Could not find filename in download list, adding it...");
continue; restoreInDownloadList(h);
row = getRowFromHash(fileHash);
} }
// Parse download state // Parse download state
torrent_info ti = h.get_torrent_info(); torrent_info ti = h.get_torrent_info();
@ -554,6 +555,31 @@ void GUI::updateDlList(bool force){
// qDebug("Updated Download list"); // 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){ void GUI::setTabText(int index, QString text){
tabs->setTabText(index, text); tabs->setTabText(index, text);
} }

1
src/GUI.h

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

Loading…
Cancel
Save