Browse Source

- Added some checking before adding torrents to finished/download lists to avoid duplicate in some circumstances

adaptive-webui-19844
Christophe Dumez 18 years ago
parent
commit
a4a98e3ada
  1. 4
      src/FinishedTorrents.cpp
  2. 4
      src/GUI.cpp

4
src/FinishedTorrents.cpp

@ -75,7 +75,9 @@ FinishedTorrents::~FinishedTorrents(){ @@ -75,7 +75,9 @@ FinishedTorrents::~FinishedTorrents(){
}
void FinishedTorrents::addFinishedTorrent(QString hash){
int row = finishedListModel->rowCount();
int row = getRowFromHash(hash);
if(row != -1) return;
row = finishedListModel->rowCount();
torrent_handle h = BTSession->getTorrentHandle(hash);
// Adding torrent to download list
finishedListModel->insertRow(row);

4
src/GUI.cpp

@ -633,8 +633,10 @@ unsigned int GUI::getCurrentTabIndex() const{ @@ -633,8 +633,10 @@ unsigned int GUI::getCurrentTabIndex() const{
}
void GUI::restoreInDownloadList(torrent_handle h){
unsigned int row = DLListModel->rowCount();
QString hash = QString(misc::toString(h.info_hash()).c_str());
int row = getRowFromHash(hash);
if(row != -1) return;
row = DLListModel->rowCount();
// Adding torrent to download list
DLListModel->insertRow(row);
DLListModel->setData(DLListModel->index(row, NAME), QVariant(h.name().c_str()));

Loading…
Cancel
Save