void TorrentModel::addTorrent(BitTorrent::TorrentHandle *const torrent)
{
    if (torrentRow(torrent->hash()) < 0) {
        beginInsertTorrent(m_items.size());
        TorrentModelItem *item = new TorrentModelItem(torrent);
        connect(item, SIGNAL(labelChanged(QString, QString)), SLOT(handleTorrentLabelChange(QString, QString)));
        m_items << item;
        emit torrentAdded(item);
        endInsertTorrent();
    }
}
Exemple #2
0
void TorrentModel::addTorrent(const Transfer& h)
{
  if (h.type() == Transfer::ED2K && h.is_seed()) {
    // do not show finished ed2k transfers
    return;
  }
  if (h.type() == Transfer::ED2K && h.state() == qt_checking_resume_data) {
    // we don't know yet whether this transfer finished or not
    m_pendingTransfers << h;
    return;
  }

  if (torrentRow(h.hash()) < 0) {
    beginInsertTorrent(m_torrents.size());
    TorrentModelItem *item = new TorrentModelItem(h);
    connect(item, SIGNAL(labelChanged(QString,QString)),
            SLOT(handleTorrentLabelChange(QString,QString)));
    m_torrents << item;
    emit torrentAdded(item);
    endInsertTorrent();
  }
}