コード例 #1
0
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();
    }
}
コード例 #2
0
ファイル: torrentgroup.cpp プロジェクト: dreamsxin/ktorrent
void TorrentGroup::addTorrent(TorrentInterface* tor, bool new_torrent)
{
    torrents.insert(tor);
    // apply group policy if needed
    if (policy.only_apply_on_new_torrents && !new_torrent)
        return;

    if (bt::Exists(policy.default_move_on_completion_location))
        tor->setMoveWhenCompletedDir(policy.default_move_on_completion_location);
    tor->setMaxShareRatio(policy.max_share_ratio);
    tor->setMaxSeedTime(policy.max_seed_time);
    tor->setTrafficLimits(policy.max_upload_rate * 1024, policy.max_download_rate * 1024);

    torrentAdded(this);
}
コード例 #3
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();
  }
}