mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
- Huge code refactoring (qBittorrent no longer store torrents and access them using libtorrent API)
This commit is contained in:
parent
4a6ab376af
commit
4f2a2dfab9
9 changed files with 173 additions and 317 deletions
|
@ -32,16 +32,13 @@ HttpServer::HttpServer(bittorrent *_BTSession, int msec, QObject* parent) : QTcp
|
|||
BTSession = _BTSession;
|
||||
manager = new EventManager(this, BTSession);
|
||||
//add torrents
|
||||
QStringList list = BTSession->getUnfinishedTorrents();
|
||||
foreach(QString hash, list) {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
if(h.is_valid()) manager->addedTorrent(h);
|
||||
}
|
||||
list = BTSession->getFinishedTorrents();
|
||||
foreach(QString hash, list) {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
if(h.is_valid()) manager->addedTorrent(h);
|
||||
}
|
||||
std::vector<torrent_handle> torrents = BTSession->getTorrents();
|
||||
std::vector<torrent_handle>::iterator torrentIT;
|
||||
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
|
||||
QTorrentHandle h = QTorrentHandle(*torrentIT);
|
||||
if(h.is_valid())
|
||||
manager->addedTorrent(h);
|
||||
}
|
||||
//connect BTSession to manager
|
||||
connect(BTSession, SIGNAL(addedTorrent(QTorrentHandle&)), manager, SLOT(addedTorrent(QTorrentHandle&)));
|
||||
connect(BTSession, SIGNAL(deletedTorrent(QString)), manager, SLOT(deletedTorrent(QString)));
|
||||
|
@ -74,17 +71,13 @@ void HttpServer::newHttpConnection()
|
|||
}
|
||||
}
|
||||
|
||||
void HttpServer::onTimer()
|
||||
{
|
||||
QStringList list = BTSession->getUnfinishedTorrents();
|
||||
foreach(QString hash, list) {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
if(h.is_valid()) manager->modifiedTorrent(h);
|
||||
}
|
||||
list = BTSession->getFinishedTorrents();
|
||||
foreach(QString hash, list) {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
if(h.is_valid()) manager->modifiedTorrent(h);
|
||||
void HttpServer::onTimer() {
|
||||
std::vector<torrent_handle> torrents = BTSession->getTorrents();
|
||||
std::vector<torrent_handle>::iterator torrentIT;
|
||||
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
|
||||
QTorrentHandle h = QTorrentHandle(*torrentIT);
|
||||
if(h.is_valid())
|
||||
manager->modifiedTorrent(h);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue