示例#1
0
void TorrentModel::populate() {
  // Load the torrents
  std::vector<Transfer> torrents = Session::instance()->getTransfers();
  std::vector<Transfer>::const_iterator it;
  for (it = torrents.begin(); it != torrents.end(); it++) {
    addTorrent(*it);
  }
  // Refresh timer
  connect(&m_refreshTimer, SIGNAL(timeout()), SLOT(forceModelRefresh()));
  m_refreshTimer.start(m_refreshInterval);
  // Listen for torrent changes
  connect(Session::instance(), SIGNAL(addedTransfer(Transfer)),
          SLOT(addTorrent(Transfer)));
  connect(Session::instance(), SIGNAL(transferAboutToBeRemoved(Transfer, bool)),
          SLOT(handleTorrentAboutToBeRemoved(Transfer, bool)));
  connect(Session::instance(), SIGNAL(deletedTransfer(QString)),
          SLOT(removeTorrent(QString)));
  connect(Session::instance(), SIGNAL(finishedTransfer(Transfer)),
          SLOT(handleTorrentUpdate(Transfer)));
  connect(Session::instance(), SIGNAL(metadataReceived(Transfer)),
          SLOT(handleTorrentUpdate(Transfer)));
  connect(Session::instance(), SIGNAL(resumedTransfer(Transfer)),
          SLOT(handleTorrentUpdate(Transfer)));
  connect(Session::instance(), SIGNAL(pausedTransfer(Transfer)),
          SLOT(handleTorrentUpdate(Transfer)));
  connect(Session::instance(), SIGNAL(transferFinishedChecking(Transfer)),
          SLOT(handleTorrentUpdate(Transfer)));
}
示例#2
0
void TorrentGroup::torrentRemoved(TorrentInterface* tor)
{
    removeTorrent(tor);
}