|
|
@ -122,6 +122,8 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis |
|
|
|
connect(BTSession, SIGNAL(fullDiskError(QTorrentHandle&)), this, SLOT(fullDiskError(QTorrentHandle&))); |
|
|
|
connect(BTSession, SIGNAL(fullDiskError(QTorrentHandle&)), this, SLOT(fullDiskError(QTorrentHandle&))); |
|
|
|
connect(BTSession, SIGNAL(finishedTorrent(QTorrentHandle&)), this, SLOT(finishedTorrent(QTorrentHandle&))); |
|
|
|
connect(BTSession, SIGNAL(finishedTorrent(QTorrentHandle&)), this, SLOT(finishedTorrent(QTorrentHandle&))); |
|
|
|
connect(BTSession, SIGNAL(addedTorrent(QTorrentHandle&)), this, SLOT(addedTorrent(QTorrentHandle&))); |
|
|
|
connect(BTSession, SIGNAL(addedTorrent(QTorrentHandle&)), this, SLOT(addedTorrent(QTorrentHandle&))); |
|
|
|
|
|
|
|
connect(BTSession, SIGNAL(pausedTorrent(QTorrentHandle&)), this, SLOT(pausedTorrent(QTorrentHandle&))); |
|
|
|
|
|
|
|
connect(BTSession, SIGNAL(resumedTorrent(QTorrentHandle&)), this, SLOT(resumedTorrent(QTorrentHandle&))); |
|
|
|
connect(BTSession, SIGNAL(torrentFinishedChecking(QTorrentHandle&)), this, SLOT(checkedTorrent(QTorrentHandle&))); |
|
|
|
connect(BTSession, SIGNAL(torrentFinishedChecking(QTorrentHandle&)), this, SLOT(checkedTorrent(QTorrentHandle&))); |
|
|
|
connect(BTSession, SIGNAL(trackerAuthenticationRequired(QTorrentHandle&)), this, SLOT(trackerAuthenticationRequired(QTorrentHandle&))); |
|
|
|
connect(BTSession, SIGNAL(trackerAuthenticationRequired(QTorrentHandle&)), this, SLOT(trackerAuthenticationRequired(QTorrentHandle&))); |
|
|
|
connect(BTSession, SIGNAL(newDownloadedTorrent(QString, QString)), this, SLOT(processDownloadedFiles(QString, QString))); |
|
|
|
connect(BTSession, SIGNAL(newDownloadedTorrent(QString, QString)), this, SLOT(processDownloadedFiles(QString, QString))); |
|
|
@ -371,6 +373,22 @@ void GUI::addedTorrent(QTorrentHandle& h) const { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void GUI::pausedTorrent(QTorrentHandle& h) const { |
|
|
|
|
|
|
|
if(h.is_seed()) { |
|
|
|
|
|
|
|
finishedTorrentTab->pauseTorrent(h.hash()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
downloadingTorrentTab->pauseTorrent(h.hash()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void GUI::resumedTorrent(QTorrentHandle& h) const { |
|
|
|
|
|
|
|
if(h.is_seed()) { |
|
|
|
|
|
|
|
finishedTorrentTab->updateTorrent(h); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
downloadingTorrentTab->updateTorrent(h); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void GUI::checkedTorrent(QTorrentHandle& h) const { |
|
|
|
void GUI::checkedTorrent(QTorrentHandle& h) const { |
|
|
|
if(h.is_seed()) { |
|
|
|
if(h.is_seed()) { |
|
|
|
// Move torrent to finished tab
|
|
|
|
// Move torrent to finished tab
|
|
|
@ -1193,20 +1211,18 @@ void GUI::togglePausedState(QString hash) { |
|
|
|
QTorrentHandle h = BTSession->getTorrentHandle(hash); |
|
|
|
QTorrentHandle h = BTSession->getTorrentHandle(hash); |
|
|
|
if(h.is_paused()) { |
|
|
|
if(h.is_paused()) { |
|
|
|
h.resume(); |
|
|
|
h.resume(); |
|
|
|
|
|
|
|
resumedTorrent(h); |
|
|
|
if(inDownloadList) { |
|
|
|
if(inDownloadList) { |
|
|
|
downloadingTorrentTab->resumeTorrent(hash); |
|
|
|
|
|
|
|
updateUnfinishedTorrentNumber(downloadingTorrentTab->getNbTorrentsInList()); |
|
|
|
updateUnfinishedTorrentNumber(downloadingTorrentTab->getNbTorrentsInList()); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
finishedTorrentTab->resumeTorrent(hash); |
|
|
|
|
|
|
|
updateFinishedTorrentNumber(finishedTorrentTab->getNbTorrentsInList()); |
|
|
|
updateFinishedTorrentNumber(finishedTorrentTab->getNbTorrentsInList()); |
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
h.pause(); |
|
|
|
h.pause(); |
|
|
|
|
|
|
|
pausedTorrent(h); |
|
|
|
if(inDownloadList) { |
|
|
|
if(inDownloadList) { |
|
|
|
downloadingTorrentTab->pauseTorrent(hash); |
|
|
|
|
|
|
|
updateUnfinishedTorrentNumber(downloadingTorrentTab->getNbTorrentsInList()); |
|
|
|
updateUnfinishedTorrentNumber(downloadingTorrentTab->getNbTorrentsInList()); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
finishedTorrentTab->pauseTorrent(hash); |
|
|
|
|
|
|
|
updateFinishedTorrentNumber(finishedTorrentTab->getNbTorrentsInList()); |
|
|
|
updateFinishedTorrentNumber(finishedTorrentTab->getNbTorrentsInList()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1222,13 +1238,7 @@ void GUI::on_actionPause_All_triggered() { |
|
|
|
if(!h.is_valid() || h.is_paused()) continue; |
|
|
|
if(!h.is_valid() || h.is_paused()) continue; |
|
|
|
change = true; |
|
|
|
change = true; |
|
|
|
h.pause(); |
|
|
|
h.pause(); |
|
|
|
if(h.is_seed()) { |
|
|
|
pausedTorrent(h); |
|
|
|
// Update in finished list
|
|
|
|
|
|
|
|
finishedTorrentTab->pauseTorrent(h.hash()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// Update in download list
|
|
|
|
|
|
|
|
downloadingTorrentTab->pauseTorrent(h.hash()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if(change) { |
|
|
|
if(change) { |
|
|
|
updateUnfinishedTorrentNumber(downloadingTorrentTab->getNbTorrentsInList()); |
|
|
|
updateUnfinishedTorrentNumber(downloadingTorrentTab->getNbTorrentsInList()); |
|
|
@ -1271,11 +1281,10 @@ void GUI::on_actionPause_triggered() { |
|
|
|
QTorrentHandle h = BTSession->getTorrentHandle(hash); |
|
|
|
QTorrentHandle h = BTSession->getTorrentHandle(hash); |
|
|
|
if(!h.is_paused()){ |
|
|
|
if(!h.is_paused()){ |
|
|
|
h.pause(); |
|
|
|
h.pause(); |
|
|
|
|
|
|
|
pausedTorrent(h); |
|
|
|
if(inDownloadList) { |
|
|
|
if(inDownloadList) { |
|
|
|
downloadingTorrentTab->pauseTorrent(hash); |
|
|
|
|
|
|
|
updateUnfinishedTorrentNumber(downloadingTorrentTab->getNbTorrentsInList()); |
|
|
|
updateUnfinishedTorrentNumber(downloadingTorrentTab->getNbTorrentsInList()); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
finishedTorrentTab->pauseTorrent(hash); |
|
|
|
|
|
|
|
updateFinishedTorrentNumber(finishedTorrentTab->getNbTorrentsInList()); |
|
|
|
updateFinishedTorrentNumber(finishedTorrentTab->getNbTorrentsInList()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1299,13 +1308,7 @@ void GUI::on_actionStart_All_triggered() { |
|
|
|
if(!h.is_valid() || !h.is_paused()) continue; |
|
|
|
if(!h.is_valid() || !h.is_paused()) continue; |
|
|
|
change = true; |
|
|
|
change = true; |
|
|
|
h.resume(); |
|
|
|
h.resume(); |
|
|
|
if(h.is_seed()) { |
|
|
|
resumedTorrent(h); |
|
|
|
// Update in finished list
|
|
|
|
|
|
|
|
finishedTorrentTab->resumeTorrent(h.hash()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// Update in download list
|
|
|
|
|
|
|
|
downloadingTorrentTab->resumeTorrent(h.hash()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if(change) { |
|
|
|
if(change) { |
|
|
|
updateUnfinishedTorrentNumber(downloadingTorrentTab->getNbTorrentsInList()); |
|
|
|
updateUnfinishedTorrentNumber(downloadingTorrentTab->getNbTorrentsInList()); |
|
|
@ -1330,11 +1333,10 @@ void GUI::on_actionStart_triggered() { |
|
|
|
QTorrentHandle h = BTSession->getTorrentHandle(hash); |
|
|
|
QTorrentHandle h = BTSession->getTorrentHandle(hash); |
|
|
|
if(h.is_paused()){ |
|
|
|
if(h.is_paused()){ |
|
|
|
h.resume(); |
|
|
|
h.resume(); |
|
|
|
|
|
|
|
resumedTorrent(h); |
|
|
|
if(inDownloadList) { |
|
|
|
if(inDownloadList) { |
|
|
|
downloadingTorrentTab->resumeTorrent(hash); |
|
|
|
|
|
|
|
updateUnfinishedTorrentNumber(downloadingTorrentTab->getNbTorrentsInList()); |
|
|
|
updateUnfinishedTorrentNumber(downloadingTorrentTab->getNbTorrentsInList()); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
finishedTorrentTab->resumeTorrent(hash); |
|
|
|
|
|
|
|
updateFinishedTorrentNumber(finishedTorrentTab->getNbTorrentsInList()); |
|
|
|
updateFinishedTorrentNumber(finishedTorrentTab->getNbTorrentsInList()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|