qBittorrent
anonymous_namespace{transferlistwidget.cpp} Namespace Reference

Functions

QVector< BitTorrent::TorrentIDextractIDs (const QVector< BitTorrent::Torrent * > &torrents)
 
bool torrentContainsPreviewableFiles (const BitTorrent::Torrent *const torrent)
 
void openDestinationFolder (const BitTorrent::Torrent *const torrent)
 
void removeTorrents (const QVector< BitTorrent::Torrent * > &torrents, const bool isDeleteFileSelected)
 

Function Documentation

◆ extractIDs()

QVector<BitTorrent::TorrentID> anonymous_namespace{transferlistwidget.cpp}::extractIDs ( const QVector< BitTorrent::Torrent * > &  torrents)

Definition at line 79 of file transferlistwidget.cpp.

80  {
81  QVector<BitTorrent::TorrentID> torrentIDs;
82  torrentIDs.reserve(torrents.size());
83  for (const BitTorrent::Torrent *torrent : torrents)
84  torrentIDs << torrent->id();
85  return torrentIDs;
86  }

Referenced by TransferListWidget::bottomQueuePosSelectedTorrents(), TransferListWidget::decreaseQueuePosSelectedTorrents(), TransferListWidget::increaseQueuePosSelectedTorrents(), and TransferListWidget::topQueuePosSelectedTorrents().

Here is the caller graph for this function:

◆ openDestinationFolder()

void anonymous_namespace{transferlistwidget.cpp}::openDestinationFolder ( const BitTorrent::Torrent *const  torrent)

Definition at line 103 of file transferlistwidget.cpp.

104  {
105 #ifdef Q_OS_MACOS
106  MacUtils::openFiles({torrent->contentPath()});
107 #else
108  if (torrent->filesCount() == 1)
110  else
111  Utils::Gui::openPath(torrent->contentPath());
112 #endif
113  }
virtual int filesCount() const =0
virtual QString contentPath() const =0
void openFiles(const QSet< QString > &pathsList)
Definition: macutilities.mm:98
void openFolderSelect(const QString &absolutePath)
Definition: utils.cpp:158
void openPath(const QString &absolutePath)
Definition: utils.cpp:146

References BitTorrent::Torrent::contentPath(), BitTorrent::AbstractFileStorage::filesCount(), MacUtils::openFiles(), Utils::Gui::openFolderSelect(), and Utils::Gui::openPath().

Referenced by TransferListWidget::torrentDoubleClicked().

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

◆ removeTorrents()

void anonymous_namespace{transferlistwidget.cpp}::removeTorrents ( const QVector< BitTorrent::Torrent * > &  torrents,
const bool  isDeleteFileSelected 
)

Definition at line 115 of file transferlistwidget.cpp.

116  {
117  auto *session = BitTorrent::Session::instance();
118  const DeleteOption deleteOption = isDeleteFileSelected ? DeleteTorrentAndFiles : DeleteTorrent;
119  for (const BitTorrent::Torrent *torrent : torrents)
120  session->deleteTorrent(torrent->id(), deleteOption);
121  }
static Session * instance()
Definition: session.cpp:997
DeleteOption
Definition: session.h:80
@ DeleteTorrent
Definition: session.h:81
@ DeleteTorrentAndFiles
Definition: session.h:82

References DeleteTorrent, DeleteTorrentAndFiles, and BitTorrent::Session::instance().

Referenced by TransferListWidget::deleteSelectedTorrents(), and TransferListWidget::deleteVisibleTorrents().

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

◆ torrentContainsPreviewableFiles()

bool anonymous_namespace{transferlistwidget.cpp}::torrentContainsPreviewableFiles ( const BitTorrent::Torrent *const  torrent)

Definition at line 88 of file transferlistwidget.cpp.

89  {
90  if (!torrent->hasMetadata())
91  return false;
92 
93  for (const QString &filePath : asConst(torrent->filePaths()))
94  {
95  const QString fileName = Utils::Fs::fileName(filePath);
97  return true;
98  }
99 
100  return false;
101  }
virtual QStringList filePaths() const =0
virtual bool hasMetadata() const =0
constexpr std::add_const_t< T > & asConst(T &t) noexcept
Definition: global.h:42
QString fileName(const QString &filePath)
Definition: fs.cpp:87
bool isPreviewable(const QString &filename)
Definition: misc.cpp:295

References asConst(), Utils::Fs::fileName(), BitTorrent::Torrent::filePaths(), BitTorrent::Torrent::hasMetadata(), and Utils::Misc::isPreviewable().

Referenced by TransferListWidget::previewSelectedTorrents(), and TransferListWidget::torrentDoubleClicked().

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