qBittorrent
BitTorrent Namespace Reference

Namespaces

 LT
 
 SessionSettingsEnums
 
 TorrentContentLayoutNS
 
 TorrentOperatingModeNS
 

Classes

class  AbstractFileStorage
 
struct  AddTorrentParams
 
class  BencodeResumeDataStorage
 
struct  CacheStatus
 
struct  CategoryOptions
 
class  DBResumeDataStorage
 
class  TorrentID
 
class  InfoHash
 
struct  LoadTorrentParams
 
class  MagnetUri
 
struct  PeerAddress
 
class  PeerInfo
 
class  ResumeDataStorage
 
struct  SessionMetricIndices
 
class  Session
 
struct  SessionStatus
 
class  Torrent
 
struct  TorrentCreatorParams
 
class  TorrentCreatorThread
 
struct  FileErrorInfo
 
class  TorrentImpl
 
class  TorrentInfo
 
struct  Peer
 
class  Tracker
 
struct  TrackerEntry
 

Enumerations

enum class  DownloadPriority : int {
  Ignored = 0 , Normal = 1 , High = 6 , Maximum = 7 ,
  Mixed = -1
}
 
enum class  BTProtocol : int { Both = 0 , TCP = 1 , UTP = 2 }
 
enum class  ChokingAlgorithm : int { FixedSlots = 0 , RateBased = 1 }
 
enum class  MixedModeAlgorithm : int { TCP = 0 , Proportional = 1 }
 
enum class  SeedChokingAlgorithm : int { RoundRobin = 0 , FastestUpload = 1 , AntiLeech = 2 }
 
enum class  ResumeDataStorageType { Legacy , SQLite }
 
enum class  TorrentOperatingMode { AutoManaged = 0 , Forced = 1 }
 
enum class  TorrentState {
  Unknown = -1 , ForcedDownloading , Downloading , ForcedDownloadingMetadata ,
  DownloadingMetadata , StalledDownloading , ForcedUploading , Uploading ,
  StalledUploading , CheckingResumeData , QueuedDownloading , QueuedUploading ,
  CheckingUploading , CheckingDownloading , PausedDownloading , PausedUploading ,
  Moving , MissingFiles , Error
}
 
enum class  TorrentContentLayout { Original , Subfolder , NoSubfolder }
 
enum class  MoveStorageMode { KeepExistingFiles , Overwrite }
 
enum class  MaintenanceJob { None , HandleMetadata }
 

Functions

bool operator== (const CategoryOptions::DownloadPathOption &left, const CategoryOptions::DownloadPathOption &right)
 
bool operator== (const CategoryOptions &left, const CategoryOptions &right)
 
bool isValidDownloadPriority (const DownloadPriority priority)
 
uint qHash (const TorrentID &key, uint seed)
 
bool operator== (const InfoHash &left, const InfoHash &right)
 
bool operator!= (const InfoHash &left, const InfoHash &right)
 
bool operator== (const PeerAddress &left, const PeerAddress &right)
 
uint qHash (const PeerAddress &addr, uint seed)
 
uint qHash (const TorrentState key, const uint seed)
 
TorrentContentLayout detectContentLayout (const QStringList &filePaths)
 
void applyContentLayout (QStringList &filePaths, TorrentContentLayout contentLayout, const QString &rootFolder={})
 
bool operator== (const Peer &left, const Peer &right)
 
bool operator!= (const Peer &left, const Peer &right)
 
uint qHash (const Peer &key, const uint seed)
 
bool operator== (const TrackerEntry &left, const TrackerEntry &right)
 
uint qHash (const TrackerEntry &key, uint seed)
 

Enumeration Type Documentation

◆ DownloadPriority

enum BitTorrent::DownloadPriority : int
strong
Enumerator
Ignored 
Normal 
High 
Maximum 
Mixed 

Definition at line 33 of file downloadpriority.h.

◆ MaintenanceJob

Enumerator
None 
HandleMetadata 

Definition at line 65 of file torrentimpl.h.

◆ MoveStorageMode

Enumerator
KeepExistingFiles 
Overwrite 

Definition at line 59 of file torrentimpl.h.

◆ TorrentState

Enumerator
Unknown 
ForcedDownloading 
Downloading 
ForcedDownloadingMetadata 
DownloadingMetadata 
StalledDownloading 
ForcedUploading 
Uploading 
StalledUploading 
CheckingResumeData 
QueuedDownloading 
QueuedUploading 
CheckingUploading 
CheckingDownloading 
PausedDownloading 
PausedUploading 
Moving 
MissingFiles 
Error 

Definition at line 69 of file torrent.h.

70  {
71  Unknown = -1,
72 
78 
80  Uploading,
82 
86 
89 
92 
93  Moving,
94 
96  Error
97  };

Function Documentation

◆ applyContentLayout()

void BitTorrent::applyContentLayout ( QStringList &  filePaths,
const BitTorrent::TorrentContentLayout  contentLayout,
const QString &  rootFolder = {} 
)

Definition at line 52 of file torrentcontentlayout.cpp.

53 {
54  Q_ASSERT(!filePaths.isEmpty());
55 
56  switch (contentLayout)
57  {
58  case TorrentContentLayout::Subfolder:
59  if (Utils::Fs::findRootFolder(filePaths).isEmpty())
60  Utils::Fs::addRootFolder(filePaths, !rootFolder.isEmpty() ? rootFolder : removeExtension(filePaths.at(0)));
61  break;
62 
63  case TorrentContentLayout::NoSubfolder:
64  Utils::Fs::stripRootFolder(filePaths);
65  break;
66 
67  default:
68  break;
69  }
70 }
void stripRootFolder(QStringList &filePaths)
Definition: fs.cpp:422
QString findRootFolder(const QStringList &filePaths)
Definition: fs.cpp:403
void addRootFolder(QStringList &filePaths, const QString &name)
Definition: fs.cpp:432
QString removeExtension(const QString &fileName)

References Utils::Fs::addRootFolder(), Utils::Fs::findRootFolder(), anonymous_namespace{torrentcontentlayout.cpp}::removeExtension(), and Utils::Fs::stripRootFolder().

Referenced by BitTorrent::Session::addTorrent_impl(), AddNewTorrentDialog::contentLayoutChanged(), BitTorrent::TorrentImpl::handleSaveResumeDataAlert(), and AddNewTorrentDialog::setupTreeview().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ detectContentLayout()

BitTorrent::TorrentContentLayout BitTorrent::detectContentLayout ( const QStringList &  filePaths)

Definition at line 44 of file torrentcontentlayout.cpp.

45 {
46  const QString rootFolder = Utils::Fs::findRootFolder(filePaths);
47  return (rootFolder.isEmpty()
48  ? TorrentContentLayout::NoSubfolder
49  : TorrentContentLayout::Subfolder);
50 }

References Utils::Fs::findRootFolder().

Referenced by BitTorrent::Session::addTorrent_impl(), BitTorrent::TorrentInfo::contentLayout(), AddNewTorrentDialog::contentLayoutChanged(), and AddNewTorrentDialog::setupTreeview().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isValidDownloadPriority()

bool BitTorrent::isValidDownloadPriority ( const DownloadPriority  priority)

Definition at line 33 of file downloadpriority.cpp.

34  {
35  switch (priority)
36  {
37  case DownloadPriority::Ignored:
38  case DownloadPriority::Normal:
39  case DownloadPriority::High:
40  case DownloadPriority::Maximum:
41  case DownloadPriority::Mixed:
42  return true;
43  default:
44  return false;
45  }
46  }

References High, Ignored, Maximum, Mixed, and Normal.

Referenced by TorrentsController::filePrioAction().

Here is the caller graph for this function:

◆ operator!=() [1/2]

bool BitTorrent::operator!= ( const InfoHash left,
const InfoHash right 
)

Definition at line 96 of file infohash.cpp.

97 {
98  return !(left == right);
99 }

◆ operator!=() [2/2]

bool BitTorrent::operator!= ( const Peer left,
const Peer right 
)

Definition at line 138 of file tracker.cpp.

139  {
140  return !(left == right);
141  }

◆ operator==() [1/6]

bool BitTorrent::operator== ( const CategoryOptions left,
const CategoryOptions right 
)

Definition at line 74 of file categoryoptions.cpp.

75 {
76  return ((left.savePath == right.savePath)
77  && (left.downloadPath == right.downloadPath));
78 }

References BitTorrent::CategoryOptions::downloadPath, and BitTorrent::CategoryOptions::savePath.

◆ operator==() [2/6]

bool BitTorrent::operator== ( const CategoryOptions::DownloadPathOption left,
const CategoryOptions::DownloadPathOption right 
)

Definition at line 68 of file categoryoptions.cpp.

69 {
70  return ((left.enabled == right.enabled)
71  && (left.path == right.path));
72 }

References BitTorrent::CategoryOptions::DownloadPathOption::enabled, and BitTorrent::CategoryOptions::DownloadPathOption::path.

◆ operator==() [3/6]

bool BitTorrent::operator== ( const InfoHash left,
const InfoHash right 
)

Definition at line 91 of file infohash.cpp.

92 {
93  return (static_cast<InfoHash::WrappedType>(left) == static_cast<InfoHash::WrappedType>(right));
94 }

◆ operator==() [4/6]

bool BitTorrent::operator== ( const Peer left,
const Peer right 
)

Definition at line 133 of file tracker.cpp.

134  {
135  return (left.uniqueID() == right.uniqueID());
136  }
QByteArray uniqueID() const
Definition: tracker.cpp:128

References BitTorrent::Peer::uniqueID().

Here is the call graph for this function:

◆ operator==() [5/6]

bool BitTorrent::operator== ( const PeerAddress left,
const PeerAddress right 
)

Definition at line 75 of file peeraddress.cpp.

76 {
77  return (left.ip == right.ip) && (left.port == right.port);
78 }

References BitTorrent::PeerAddress::ip, and BitTorrent::PeerAddress::port.

◆ operator==() [6/6]

bool BitTorrent::operator== ( const TrackerEntry left,
const TrackerEntry right 
)

Definition at line 33 of file trackerentry.cpp.

34 {
35  return ((left.tier == right.tier)
36  && QUrl(left.url) == QUrl(right.url));
37 }

References BitTorrent::TrackerEntry::tier, and BitTorrent::TrackerEntry::url.

◆ qHash() [1/5]

uint BitTorrent::qHash ( const Peer key,
const uint  seed 
)

Definition at line 143 of file tracker.cpp.

144  {
145  return qHash(key.uniqueID(), seed);
146  }
uint qHash(const Peer &key, const uint seed)
Definition: tracker.cpp:143

References qHash(), and BitTorrent::Peer::uniqueID().

Here is the call graph for this function:

◆ qHash() [2/5]

uint BitTorrent::qHash ( const PeerAddress addr,
uint  seed 
)

Definition at line 80 of file peeraddress.cpp.

81 {
82  return (::qHash(addr.ip, seed) ^ ::qHash(addr.port));
83 }
uint qHash(const TorrentID &key, uint seed)
Definition: infohash.cpp:86

References BitTorrent::PeerAddress::ip, BitTorrent::PeerAddress::port, and qHash().

Here is the call graph for this function:

◆ qHash() [3/5]

uint BitTorrent::qHash ( const TorrentID key,
uint  seed 
)

Definition at line 86 of file infohash.cpp.

87 {
88  return ::qHash(std::hash<TorrentID::UnderlyingType>()(key), seed);
89 }

Referenced by qHash(), and Net::qHash().

Here is the caller graph for this function:

◆ qHash() [4/5]

uint BitTorrent::qHash ( const TorrentState  key,
const uint  seed 
)

Definition at line 38 of file torrent.cpp.

39  {
40  return ::qHash(static_cast<std::underlying_type_t<TorrentState>>(key), seed);
41  }
uint qHash(const TorrentState key, const uint seed)
Definition: torrent.cpp:38

◆ qHash() [5/5]

uint BitTorrent::qHash ( const TrackerEntry key,
uint  seed 
)

Definition at line 39 of file trackerentry.cpp.

40 {
41  return (::qHash(key.url, seed) ^ ::qHash(key.tier));
42 }

References qHash(), BitTorrent::TrackerEntry::tier, and BitTorrent::TrackerEntry::url.

Here is the call graph for this function: