void TorrentModel::handleTorrentUpdate(const Transfer& h) { const int row = torrentRow(h.hash()); if (row >= 0) { notifyTorrentChanged(row); } }
bool TorrentModel::setData(const QModelIndex &index, const QVariant &value, int role) { qDebug() << Q_FUNC_INFO << value; if (!index.isValid() || (role != Qt::DisplayRole)) return false; qDebug("Index is valid and role is DisplayRole"); if ((index.row() >= 0) && (index.row() < rowCount()) && (index.column() >= 0) && (index.column() < columnCount())) { bool change = m_items[index.row()]->setData(index.column(), value, role); if (change) notifyTorrentChanged(index.row()); return change; } return false; }
bool TorrentModel::setData(const QModelIndex &index, const QVariant &value, int role) { qDebug() << Q_FUNC_INFO << value; if (!index.isValid() || role != Qt::DisplayRole) return false; qDebug("Index is valid and role is DisplayRole"); try { if (index.row() >= 0 && index.row() < rowCount() && index.column() >= 0 && index.column() < columnCount()) { bool change = m_torrents[index.row()]->setData(index.column(), value, role); if (change) notifyTorrentChanged(index.row()); return change; } } catch(libtorrent::invalid_handle&) {} catch(libed2k::libed2k_exception&) {} return false; }
void TorrentModel::handleTorrentStatusUpdated(BitTorrent::TorrentHandle *const torrent) { const int row = torrentRow(torrent->hash()); if (row >= 0) notifyTorrentChanged(row); }