1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-11 07:18:08 +00:00

- Paused torrents can now be rechecked

This commit is contained in:
Christophe Dumez 2010-01-20 18:02:26 +00:00
parent cbd948f6f3
commit 1840d1c49f
4 changed files with 27 additions and 6 deletions

View File

@ -1915,12 +1915,30 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
} }
emit torrentFinishedChecking(h); emit torrentFinishedChecking(h);
emit metadataReceived(h); emit metadataReceived(h);
if(torrentsToPausedAfterChecking.contains(hash)) {
torrentsToPausedAfterChecking.removeOne(hash);
h.pause();
emit pausedTorrent(h);
}
} }
} }
a = s->pop_alert(); a = s->pop_alert();
} }
} }
void Bittorrent::recheckTorrent(QString hash) {
QTorrentHandle h = getTorrentHandle(hash);
if(h.is_valid() && h.has_metadata()) {
if(h.is_paused()) {
if(!torrentsToPausedAfterChecking.contains(h.hash())) {
torrentsToPausedAfterChecking << h.hash();
h.resume();
}
}
h.force_recheck();
}
}
QHash<QString, TrackerInfos> Bittorrent::getTrackersInfo(QString hash) const{ QHash<QString, TrackerInfos> Bittorrent::getTrackersInfo(QString hash) const{
return trackersInfos.value(hash, QHash<QString, TrackerInfos>()); return trackersInfos.value(hash, QHash<QString, TrackerInfos>());
} }

View File

@ -94,6 +94,7 @@ private:
QPointer<QTimer> timerAlerts; QPointer<QTimer> timerAlerts;
QMap<QUrl, QString> savepath_fromurl; QMap<QUrl, QString> savepath_fromurl;
QHash<QString, QHash<QString, TrackerInfos> > trackersInfos; QHash<QString, QHash<QString, TrackerInfos> > trackersInfos;
QStringList torrentsToPausedAfterChecking;
// Ratio // Ratio
QPointer<QTimer> BigRatioTimer; QPointer<QTimer> BigRatioTimer;
// HTTP // HTTP
@ -180,6 +181,7 @@ public slots:
void deleteTorrent(QString hash, bool delete_local_files = false); void deleteTorrent(QString hash, bool delete_local_files = false);
void startUpTorrents(); void startUpTorrents();
session_proxy asyncDeletion(); session_proxy asyncDeletion();
void recheckTorrent(QString hash);
/* Needed by Web UI */ /* Needed by Web UI */
void pauseAllTorrents(); void pauseAllTorrents();
void pauseTorrent(QString hash); void pauseTorrent(QString hash);

View File

@ -456,8 +456,8 @@ void HttpConnection::respondCommand(QString command)
void HttpConnection::recheckTorrent(QString hash) { void HttpConnection::recheckTorrent(QString hash) {
QTorrentHandle h = BTSession->getTorrentHandle(hash); QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid() && !h.is_paused()){ if(h.is_valid()){
h.force_recheck(); BTSession->recheckTorrent(h.hash());
} }
} }
@ -466,7 +466,7 @@ void HttpConnection::recheckAllTorrents() {
std::vector<torrent_handle>::iterator torrentIT; std::vector<torrent_handle>::iterator torrentIT;
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) { for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
QTorrentHandle h = QTorrentHandle(*torrentIT); QTorrentHandle h = QTorrentHandle(*torrentIT);
if(h.is_valid() && !h.is_paused()) if(h.is_valid())
h.force_recheck(); BTSession->recheckTorrent(h.hash());
} }
} }

View File

@ -760,8 +760,9 @@ void TransferListWidget::recheckSelectedTorrents() {
foreach(const QModelIndex &index, selectedIndexes){ foreach(const QModelIndex &index, selectedIndexes){
QString hash = getHashFromRow(mapToSource(index).row()); QString hash = getHashFromRow(mapToSource(index).row());
QTorrentHandle h = BTSession->getTorrentHandle(hash); QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid() && h.has_metadata()) if(h.is_valid()) {
h.force_recheck(); BTSession->recheckTorrent(h.hash());
}
} }
} }