mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-14 17:23:07 -07:00
- Update torrent metadata in transfer list once it is received
This commit is contained in:
parent
8d59f3c4e1
commit
33324c190e
2 changed files with 12 additions and 0 deletions
|
@ -89,6 +89,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, bittorrent *_BTSession):
|
||||||
// Listen for BTSession events
|
// Listen for BTSession events
|
||||||
connect(BTSession, SIGNAL(addedTorrent(QTorrentHandle&)), this, SLOT(addTorrent(QTorrentHandle&)));
|
connect(BTSession, SIGNAL(addedTorrent(QTorrentHandle&)), this, SLOT(addTorrent(QTorrentHandle&)));
|
||||||
connect(BTSession, SIGNAL(finishedTorrent(QTorrentHandle&)), this, SLOT(setFinished(QTorrentHandle&)));
|
connect(BTSession, SIGNAL(finishedTorrent(QTorrentHandle&)), this, SLOT(setFinished(QTorrentHandle&)));
|
||||||
|
connect(BTSession, SIGNAL(metadataReceived(QTorrentHandle&)), this, SLOT(updateMetadata(QTorrentHandle&)));
|
||||||
|
|
||||||
// Listen for list events
|
// Listen for list events
|
||||||
connect(this, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(torrentDoubleClicked(QModelIndex)));
|
connect(this, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(torrentDoubleClicked(QModelIndex)));
|
||||||
|
@ -170,6 +171,16 @@ void TransferListWidget::resumeTorrent(int row) {
|
||||||
updateTorrent(row);
|
updateTorrent(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TransferListWidget::updateMetadata(QTorrentHandle &h) {
|
||||||
|
QString hash = h.hash();
|
||||||
|
int row = getRowFromHash(hash);
|
||||||
|
if(row != -1) {
|
||||||
|
qDebug("Updating torrent metadata in download list");
|
||||||
|
listModel->setData(listModel->index(row, NAME), QVariant(h.name()));
|
||||||
|
listModel->setData(listModel->index(row, SIZE), QVariant((qlonglong)h.actual_size()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TransferListWidget::updateTorrent(int row) {
|
void TransferListWidget::updateTorrent(int row) {
|
||||||
QString hash = getHashFromRow(row);
|
QString hash = getHashFromRow(row);
|
||||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||||
|
|
|
@ -71,6 +71,7 @@ protected slots:
|
||||||
bool loadHiddenColumns();
|
bool loadHiddenColumns();
|
||||||
void saveHiddenColumns();
|
void saveHiddenColumns();
|
||||||
void displayListMenu(const QPoint&);
|
void displayListMenu(const QPoint&);
|
||||||
|
void updateMetadata(QTorrentHandle &h);
|
||||||
//void setRowColor(int row, QColor color);
|
//void setRowColor(int row, QColor color);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue