qBittorrent
|
#include <torrentinfo.h>
Public Types | |
using | PieceRange = IndexRange< int > |
Public Member Functions | |
TorrentInfo ()=default | |
TorrentInfo (const TorrentInfo &other) | |
TorrentInfo (const lt::torrent_info &nativeInfo) | |
nonstd::expected< void, QString > | saveToFile (const QString &path) const |
TorrentInfo & | operator= (const TorrentInfo &other) |
bool | isValid () const |
InfoHash | infoHash () const |
QString | name () const |
QDateTime | creationDate () const |
QString | creator () const |
QString | comment () const |
bool | isPrivate () const |
qlonglong | totalSize () const |
int | filesCount () const |
int | pieceLength () const |
int | pieceLength (int index) const |
int | piecesCount () const |
QString | filePath (int index) const |
QStringList | filePaths () const |
qlonglong | fileSize (int index) const |
qlonglong | fileOffset (int index) const |
QVector< TrackerEntry > | trackers () const |
QVector< QUrl > | urlSeeds () const |
QByteArray | metadata () const |
QStringList | filesForPiece (int pieceIndex) const |
QVector< int > | fileIndicesForPiece (int pieceIndex) const |
QVector< QByteArray > | pieceHashes () const |
PieceRange | filePieces (const QString &file) const |
PieceRange | filePieces (int fileIndex) const |
QString | rootFolder () const |
bool | hasRootFolder () const |
std::shared_ptr< lt::torrent_info > | nativeInfo () const |
QVector< lt::file_index_t > | nativeIndexes () const |
Static Public Member Functions | |
static nonstd::expected< TorrentInfo, QString > | load (const QByteArray &data) noexcept |
static nonstd::expected< TorrentInfo, QString > | loadFromFile (const QString &path) noexcept |
Private Member Functions | |
int | fileIndex (const QString &fileName) const |
TorrentContentLayout | contentLayout () const |
Private Attributes | |
std::shared_ptr< const lt::torrent_info > | m_nativeInfo |
QVector< lt::file_index_t > | m_nativeIndexes |
Definition at line 50 of file torrentinfo.h.
using BitTorrent::TorrentInfo::PieceRange = IndexRange<int> |
Definition at line 89 of file torrentinfo.h.
|
default |
TorrentInfo::TorrentInfo | ( | const TorrentInfo & | other | ) |
Definition at line 68 of file torrentinfo.cpp.
|
explicit |
Definition at line 54 of file torrentinfo.cpp.
References m_nativeIndexes, and m_nativeInfo.
QString TorrentInfo::comment | ( | ) | const |
Definition at line 190 of file torrentinfo.cpp.
References isValid(), and m_nativeInfo.
Referenced by BitTorrent::TorrentImpl::comment(), and AddNewTorrentDialog::setupTreeview().
|
private |
Definition at line 425 of file torrentinfo.cpp.
References BitTorrent::detectContentLayout(), filePaths(), and isValid().
QDateTime TorrentInfo::creationDate | ( | ) | const |
Definition at line 175 of file torrentinfo.cpp.
References isValid(), and m_nativeInfo.
Referenced by BitTorrent::TorrentImpl::creationDate(), and AddNewTorrentDialog::setupTreeview().
QString TorrentInfo::creator | ( | ) | const |
Definition at line 183 of file torrentinfo.cpp.
References isValid(), and m_nativeInfo.
Referenced by BitTorrent::TorrentImpl::creator().
|
private |
Definition at line 399 of file torrentinfo.cpp.
References Utils::Fs::fileName(), filePath(), and filesCount().
Referenced by filePieces().
QVector< int > TorrentInfo::fileIndicesForPiece | ( | int | pieceIndex | ) | const |
Definition at line 328 of file torrentinfo.cpp.
References files(), isValid(), m_nativeIndexes, m_nativeInfo, and piecesCount().
Referenced by filesForPiece(), PiecesBar::highlightFile(), and PiecesBar::showToolTip().
qlonglong TorrentInfo::fileOffset | ( | int | index | ) | const |
Definition at line 264 of file torrentinfo.cpp.
References isValid(), m_nativeIndexes, and m_nativeInfo.
Referenced by filePieces().
QString TorrentInfo::filePath | ( | int | index | ) | const |
Definition at line 239 of file torrentinfo.cpp.
References isValid(), m_nativeIndexes, m_nativeInfo, and Utils::Fs::toUniformPath().
Referenced by BitTorrent::Session::addTorrent_impl(), fileIndex(), filePaths(), and PiecesBar::showToolTip().
QStringList TorrentInfo::filePaths | ( | ) | const |
Definition at line 247 of file torrentinfo.cpp.
References filePath(), and filesCount().
Referenced by BitTorrent::Session::addTorrent_impl(), contentLayout(), AddNewTorrentDialog::contentLayoutChanged(), BitTorrent::Session::findIncompleteFiles(), BitTorrent::TorrentImpl::handleSaveResumeDataAlert(), rootFolder(), and AddNewTorrentDialog::setupTreeview().
TorrentInfo::PieceRange TorrentInfo::filePieces | ( | const QString & | file | ) | const |
Definition at line 362 of file torrentinfo.cpp.
References file(), fileIndex(), isValid(), and name().
Referenced by BitTorrent::TorrentImpl::applyFirstLastPiecePriority(), BitTorrent::TorrentImpl::availableFileFractions(), TorrentsController::filesAction(), and PiecesBar::highlightFile().
TorrentInfo::PieceRange TorrentInfo::filePieces | ( | int | fileIndex | ) | const |
Definition at line 376 of file torrentinfo.cpp.
References fileIndex(), fileOffset(), files(), filesCount(), fileSize(), isValid(), m_nativeIndexes, m_nativeInfo, makeInterval(), name(), and pieceLength().
int TorrentInfo::filesCount | ( | ) | const |
Definition at line 211 of file torrentinfo.cpp.
References isValid(), and m_nativeIndexes.
Referenced by BitTorrent::Session::addTorrent_impl(), fileIndex(), filePaths(), filePieces(), BitTorrent::TorrentImpl::filesCount(), anonymous_namespace{addnewtorrentdialog.cpp}::FileStorageAdaptor::FileStorageAdaptor(), BitTorrent::Session::findIncompleteFiles(), BitTorrent::TorrentImpl::TorrentImpl(), and AddNewTorrentDialog::updateDiskSpaceLabel().
QStringList TorrentInfo::filesForPiece | ( | int | pieceIndex | ) | const |
Definition at line 315 of file torrentinfo.cpp.
References fileIndicesForPiece().
Referenced by SyncController::torrentPeersAction(), and PeerListWidget::updatePeer().
qlonglong TorrentInfo::fileSize | ( | int | index | ) | const |
Definition at line 257 of file torrentinfo.cpp.
References isValid(), m_nativeIndexes, and m_nativeInfo.
Referenced by filePieces(), BitTorrent::TorrentImpl::fileSize(), PiecesBar::showToolTip(), and AddNewTorrentDialog::updateDiskSpaceLabel().
bool TorrentInfo::hasRootFolder | ( | ) | const |
Definition at line 420 of file torrentinfo.cpp.
References rootFolder().
InfoHash TorrentInfo::infoHash | ( | ) | const |
Definition at line 157 of file torrentinfo.cpp.
References isValid(), and m_nativeInfo.
Referenced by BitTorrent::Session::findIncompleteFiles(), AddNewTorrentDialog::loadTorrentImpl(), and AddNewTorrentDialog::updateMetadata().
bool TorrentInfo::isPrivate | ( | ) | const |
Definition at line 197 of file torrentinfo.cpp.
References isValid(), and m_nativeInfo.
Referenced by BitTorrent::Session::addTorrent_impl(), BitTorrent::TorrentImpl::isPrivate(), and AddNewTorrentDialog::loadTorrentImpl().
bool TorrentInfo::isValid | ( | ) | const |
Definition at line 84 of file torrentinfo.cpp.
References m_nativeInfo.
Referenced by comment(), contentLayout(), creationDate(), creator(), fileIndicesForPiece(), fileOffset(), filePath(), filePieces(), filesCount(), fileSize(), AddNewTorrentDialog::hasMetadata(), BitTorrent::TorrentImpl::hasMetadata(), infoHash(), isPrivate(), metadata(), name(), nativeInfo(), pieceHashes(), pieceLength(), piecesCount(), rootFolder(), saveToFile(), totalSize(), trackers(), AddNewTorrentDialog::updateMetadata(), and urlSeeds().
|
staticnoexcept |
Definition at line 89 of file torrentinfo.cpp.
Referenced by TorrentsController::addAction(), AddNewTorrentDialog::handleDownloadFinished(), and BitTorrent::Session::handleDownloadFinished().
|
staticnoexcept |
Definition at line 109 of file torrentinfo.cpp.
References nova3.nova2dl::e, file(), Utils::Misc::friendlyUnit(), and MAX_TORRENT_SIZE.
Referenced by BitTorrent::Session::addTorrent(), TorrentCreatorDialog::handleCreationSuccess(), BitTorrent::Session::handleTorrentFinished(), AddNewTorrentDialog::loadTorrentFile(), TorrentFilesWatcher::Worker::processFailedTorrents(), TorrentFilesWatcher::Worker::processFolder(), and BitTorrent::Session::recursiveTorrentDownload().
QByteArray TorrentInfo::metadata | ( | ) | const |
Definition at line 304 of file torrentinfo.cpp.
References isValid(), and m_nativeInfo.
QString TorrentInfo::name | ( | ) | const |
Definition at line 168 of file torrentinfo.cpp.
References isValid(), and m_nativeInfo.
Referenced by BitTorrent::Session::addTorrent_impl(), filePieces(), BitTorrent::TorrentImpl::name(), AddNewTorrentDialog::saveTorrentFile(), and AddNewTorrentDialog::setupTreeview().
QVector< lt::file_index_t > TorrentInfo::nativeIndexes | ( | ) | const |
Definition at line 441 of file torrentinfo.cpp.
References m_nativeIndexes.
Referenced by BitTorrent::TorrentImpl::actualFilePath(), BitTorrent::Session::addTorrent_impl(), BitTorrent::TorrentImpl::endReceivedMetadataHandling(), BitTorrent::TorrentImpl::filePriorities(), BitTorrent::Session::fileSearchFinished(), BitTorrent::TorrentImpl::filesProgress(), BitTorrent::TorrentImpl::handleFileCompletedAlert(), BitTorrent::TorrentImpl::handleFileRenamedAlert(), BitTorrent::TorrentImpl::handleFileRenameFailedAlert(), BitTorrent::TorrentImpl::prioritizeFiles(), BitTorrent::TorrentImpl::renameFile(), and BitTorrent::TorrentImpl::TorrentImpl().
std::shared_ptr< lt::torrent_info > TorrentInfo::nativeInfo | ( | ) | const |
Definition at line 433 of file torrentinfo.cpp.
References isValid(), and m_nativeInfo.
Referenced by BitTorrent::Session::addTorrent_impl(), BitTorrent::TorrentImpl::prioritizeFiles(), and saveToFile().
TorrentInfo & TorrentInfo::operator= | ( | const TorrentInfo & | other | ) |
QVector< QByteArray > TorrentInfo::pieceHashes | ( | ) | const |
Definition at line 347 of file torrentinfo.cpp.
References isValid(), Digest32< 160 >::length(), m_nativeInfo, and piecesCount().
Referenced by TorrentsController::pieceHashesAction().
int TorrentInfo::pieceLength | ( | ) | const |
Definition at line 218 of file torrentinfo.cpp.
References isValid(), and m_nativeInfo.
Referenced by filePieces(), BitTorrent::TorrentImpl::pieceLength(), and PiecesBar::showToolTip().
int TorrentInfo::pieceLength | ( | int | index | ) | const |
Definition at line 225 of file torrentinfo.cpp.
References isValid(), and m_nativeInfo.
int TorrentInfo::piecesCount | ( | ) | const |
Definition at line 232 of file torrentinfo.cpp.
References isValid(), and m_nativeInfo.
Referenced by fileIndicesForPiece(), pieceHashes(), and BitTorrent::TorrentImpl::piecesCount().
QString TorrentInfo::rootFolder | ( | ) | const |
Definition at line 412 of file torrentinfo.cpp.
References filePaths(), Utils::Fs::findRootFolder(), and isValid().
Referenced by BitTorrent::Session::addTorrent_impl(), hasRootFolder(), and BitTorrent::TorrentImpl::rootPath().
nonstd::expected< void, QString > TorrentInfo::saveToFile | ( | const QString & | path | ) | const |
Definition at line 136 of file torrentinfo.cpp.
References isValid(), nativeInfo(), and Utils::IO::saveToFile().
Referenced by BitTorrent::Session::exportTorrentFile(), and AddNewTorrentDialog::saveTorrentFile().
qlonglong TorrentInfo::totalSize | ( | ) | const |
Definition at line 204 of file torrentinfo.cpp.
References isValid(), and m_nativeInfo.
Referenced by anonymous_namespace{piecesbar.cpp}::PieceIndexToImagePos::PieceIndexToImagePos(), BitTorrent::TorrentImpl::totalSize(), and AddNewTorrentDialog::updateDiskSpaceLabel().
QVector< TrackerEntry > TorrentInfo::trackers | ( | ) | const |
Definition at line 271 of file torrentinfo.cpp.
References isValid(), and m_nativeInfo.
Referenced by BitTorrent::Session::addTorrent_impl(), and AddNewTorrentDialog::loadTorrentImpl().
QVector< QUrl > TorrentInfo::urlSeeds | ( | ) | const |
Definition at line 286 of file torrentinfo.cpp.
References isValid(), and m_nativeInfo.
Referenced by BitTorrent::Session::addTorrent_impl(), and AddNewTorrentDialog::loadTorrentImpl().
|
private |
Definition at line 110 of file torrentinfo.h.
Referenced by fileIndicesForPiece(), fileOffset(), filePath(), filePieces(), filesCount(), fileSize(), nativeIndexes(), operator=(), and TorrentInfo().
|
private |
Definition at line 106 of file torrentinfo.h.
Referenced by comment(), creationDate(), creator(), fileIndicesForPiece(), fileOffset(), filePath(), filePieces(), fileSize(), infoHash(), isPrivate(), isValid(), metadata(), name(), nativeInfo(), operator=(), pieceHashes(), pieceLength(), piecesCount(), TorrentInfo(), totalSize(), trackers(), and urlSeeds().