- Initial commit (both lists are merged but not all the features are there and it is probably buggy)

This commit is contained in:
Christophe Dumez 2009-11-07 19:55:33 +00:00
parent 7792b4f849
commit d6e90883cb
10 changed files with 821 additions and 550 deletions

View file

@ -243,32 +243,15 @@ QTorrentHandle bittorrent::getTorrentHandle(QString hash) const{
return QTorrentHandle(s->find_torrent(misc::fromString<sha1_hash>((hash.toStdString()))));
}
unsigned int bittorrent::getFinishedPausedTorrentsNb() const {
unsigned int nbPaused = 0;
bool bittorrent::hasActiveTorrents() const {
std::vector<torrent_handle> torrents = getTorrents();
std::vector<torrent_handle>::iterator torrentIT;
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
QTorrentHandle h = QTorrentHandle(*torrentIT);
if(!h.is_valid()) continue;
if(h.is_seed() && h.is_paused()) {
++nbPaused;
}
if(h.is_valid() && !h.is_paused() && !h.is_queued())
return true;
}
return nbPaused;
}
unsigned int bittorrent::getUnfinishedPausedTorrentsNb() const {
unsigned int nbPaused = 0;
std::vector<torrent_handle> torrents = getTorrents();
std::vector<torrent_handle>::iterator torrentIT;
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
QTorrentHandle h = QTorrentHandle(*torrentIT);
if(!h.is_valid()) continue;
if(!h.is_seed() && h.is_paused()) {
++nbPaused;
}
}
return nbPaused;
return false;
}
// Delete a torrent from the session, given its hash