Revert "Temporarily revert PR #2885 (filename column in peers view)."

This reverts commit 69d52a06d7.
This commit is contained in:
Eugene Shalygin
2016-02-27 20:51:39 +01:00
committed by sledgehammer999
parent 0264a7bf58
commit 2e325d9506
7 changed files with 36 additions and 7 deletions

View File

@@ -408,3 +408,8 @@ QString PeerInfo::flagsDescription() const
{
return m_flagsDescription;
}
int PeerInfo::downloadingPieceIndex() const
{
return m_nativeInfo.downloading_piece_index;
}

View File

@@ -100,6 +100,7 @@ namespace BitTorrent
#ifndef DISABLE_COUNTRIES_RESOLUTION
QString country() const;
#endif
int downloadingPieceIndex() const;
private:
void calcRelevance(const TorrentHandle *torrent);

View File

@@ -211,6 +211,20 @@ QByteArray TorrentInfo::metadata() const
return QByteArray(m_nativeInfo->metadata().get(), m_nativeInfo->metadata_size());
}
QStringList TorrentInfo::filesForPiece(int pieceIndex) const
{
if (pieceIndex < 0)
return QStringList();
std::vector<libtorrent::file_slice> files(
nativeInfo()->map_block(pieceIndex, 0, nativeInfo()->piece_length()));
QStringList res;
for (const libtorrent::file_slice& s: files) {
res.append(filePath(s.file_index));
}
return res;
}
void TorrentInfo::renameFile(uint index, const QString &newPath)
{
if (!isValid()) return;

View File

@@ -85,6 +85,7 @@ namespace BitTorrent
QList<TrackerEntry> trackers() const;
QList<QUrl> urlSeeds() const;
QByteArray metadata() const;
QStringList filesForPiece(int pieceIndex) const;
void renameFile(uint index, const QString &newPath);