Esempio n. 1
0
void TorrentModel::handleTorrentAboutToBeRemoved(const Transfer &h, bool)
{
  const int row = torrentRow(h.hash());
  if (row >= 0) {
    emit torrentAboutToBeRemoved(m_torrents.at(row));
  }
}
Esempio n. 2
0
void TorrentModel::handleTorrentUpdate(const Transfer& h)
{
  const int row = torrentRow(h.hash());
  if (row >= 0) {
    notifyTorrentChanged(row);
  }
}
Esempio n. 3
0
void TorrentModel::removeTorrent(const QString &hash)
{
  const int row = torrentRow(hash);
  qDebug() << Q_FUNC_INFO << hash << row;
  if (row >= 0) {
    beginRemoveTorrent(row);
    m_torrents.removeAt(row);
    endRemoveTorrent();
  }
}
Esempio n. 4
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();
    }
}
Esempio n. 5
0
void TorrentModel::handleTorrentAboutToBeRemoved(BitTorrent::TorrentHandle *const torrent)
{
    const int row = torrentRow(torrent->hash());
    qDebug() << Q_FUNC_INFO << row;
    if (row >= 0) {
        emit torrentAboutToBeRemoved(m_items.at(row));

        beginRemoveTorrent(row);
        delete m_items.takeAt(row);
        endRemoveTorrent();
    }
}
Esempio n. 6
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();
  }
}
Esempio n. 7
0
void TorrentModel::handleTorrentStatusUpdated(BitTorrent::TorrentHandle *const torrent)
{
    const int row = torrentRow(torrent->hash());
    if (row >= 0)
        notifyTorrentChanged(row);
}