qBittorrent
anonymous_namespace{addnewtorrentdialog.cpp}::FileStorageAdaptor Class Referencefinal
Inheritance diagram for anonymous_namespace{addnewtorrentdialog.cpp}::FileStorageAdaptor:
Collaboration diagram for anonymous_namespace{addnewtorrentdialog.cpp}::FileStorageAdaptor:

Public Member Functions

 FileStorageAdaptor (const BitTorrent::TorrentInfo &torrentInfo, QStringList &filePaths)
 
int filesCount () const override
 
qlonglong fileSize (const int index) const override
 
QString filePath (const int index) const override
 
void renameFile (const int index, const QString &newFilePath) override
 
- Public Member Functions inherited from BitTorrent::AbstractFileStorage
virtual ~AbstractFileStorage ()=default
 
void renameFile (const QString &oldPath, const QString &newPath)
 
void renameFolder (const QString &oldPath, const QString &newPath)
 

Private Attributes

const BitTorrent::TorrentInfom_torrentInfo
 
QStringList & m_filePaths
 

Detailed Description

Definition at line 80 of file addnewtorrentdialog.cpp.

Constructor & Destructor Documentation

◆ FileStorageAdaptor()

anonymous_namespace{addnewtorrentdialog.cpp}::FileStorageAdaptor::FileStorageAdaptor ( const BitTorrent::TorrentInfo torrentInfo,
QStringList &  filePaths 
)
inline

Definition at line 83 of file addnewtorrentdialog.cpp.

84  : m_torrentInfo {torrentInfo}
85  , m_filePaths {filePaths}
86  {
87  Q_ASSERT(filePaths.isEmpty() || (filePaths.size() == torrentInfo.filesCount()));
88  }

References BitTorrent::TorrentInfo::filesCount().

Here is the call graph for this function:

Member Function Documentation

◆ filePath()

QString anonymous_namespace{addnewtorrentdialog.cpp}::FileStorageAdaptor::filePath ( const int  index) const
inlineoverridevirtual

Implements BitTorrent::AbstractFileStorage.

Definition at line 101 of file addnewtorrentdialog.cpp.

102  {
103  Q_ASSERT((index >= 0) && (index < filesCount()));
104  return (m_filePaths.isEmpty() ? m_torrentInfo.filePath(index) : m_filePaths.at(index));
105  }
QString filePath(int index) const

◆ filesCount()

int anonymous_namespace{addnewtorrentdialog.cpp}::FileStorageAdaptor::filesCount ( ) const
inlineoverridevirtual

Implements BitTorrent::AbstractFileStorage.

Definition at line 90 of file addnewtorrentdialog.cpp.

91  {
92  return m_torrentInfo.filesCount();
93  }

◆ fileSize()

qlonglong anonymous_namespace{addnewtorrentdialog.cpp}::FileStorageAdaptor::fileSize ( const int  index) const
inlineoverridevirtual

Implements BitTorrent::AbstractFileStorage.

Definition at line 95 of file addnewtorrentdialog.cpp.

96  {
97  Q_ASSERT((index >= 0) && (index < filesCount()));
98  return m_torrentInfo.fileSize(index);
99  }
qlonglong fileSize(int index) const

◆ renameFile()

void anonymous_namespace{addnewtorrentdialog.cpp}::FileStorageAdaptor::renameFile ( const int  index,
const QString &  newFilePath 
)
inlineoverridevirtual

Implements BitTorrent::AbstractFileStorage.

Definition at line 107 of file addnewtorrentdialog.cpp.

108  {
109  Q_ASSERT((index >= 0) && (index < filesCount()));
110  const QString currentFilePath = filePath(index);
111  if (currentFilePath == newFilePath)
112  return;
113 
114  if (m_filePaths.isEmpty())
116 
117  m_filePaths[index] = newFilePath;
118  }
QStringList filePaths() const

Member Data Documentation

◆ m_filePaths

QStringList& anonymous_namespace{addnewtorrentdialog.cpp}::FileStorageAdaptor::m_filePaths
private

Definition at line 122 of file addnewtorrentdialog.cpp.

◆ m_torrentInfo

const BitTorrent::TorrentInfo& anonymous_namespace{addnewtorrentdialog.cpp}::FileStorageAdaptor::m_torrentInfo
private

Definition at line 121 of file addnewtorrentdialog.cpp.


The documentation for this class was generated from the following file: