mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 13:23:34 -07:00
Remove redundant suffix from TorrentHandle class
Originally, it was just a wrapper for libtorrent::torrent_handle class, so it mimicked its name. It was then transformed into a more complex aggregate, but the name was retained (just by inertia). Unlike libtorrent::torrent_handle class in whose name "handle" means the pattern used, it does not matter for qBittorrent classes and just eats up space in the source code.
This commit is contained in:
parent
35731b96dc
commit
0b4fef19f6
52 changed files with 647 additions and 647 deletions
|
@ -42,7 +42,7 @@
|
|||
#include "base/bittorrent/infohash.h"
|
||||
#include "base/bittorrent/magneturi.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/exceptions.h"
|
||||
#include "base/global.h"
|
||||
#include "base/net/downloadmanager.h"
|
||||
|
@ -275,7 +275,7 @@ bool AddNewTorrentDialog::loadTorrentImpl()
|
|||
// Prevent showing the dialog if download is already present
|
||||
if (BitTorrent::Session::instance()->isKnownTorrent(infoHash))
|
||||
{
|
||||
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(infoHash);
|
||||
BitTorrent::Torrent *const torrent = BitTorrent::Session::instance()->findTorrent(infoHash);
|
||||
if (torrent)
|
||||
{
|
||||
if (torrent->isPrivate() || m_torrentInfo.isPrivate())
|
||||
|
@ -316,7 +316,7 @@ bool AddNewTorrentDialog::loadMagnet(const BitTorrent::MagnetUri &magnetUri)
|
|||
// Prevent showing the dialog if download is already present
|
||||
if (BitTorrent::Session::instance()->isKnownTorrent(infoHash))
|
||||
{
|
||||
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(infoHash);
|
||||
BitTorrent::Torrent *const torrent = BitTorrent::Session::instance()->findTorrent(infoHash);
|
||||
if (torrent)
|
||||
{
|
||||
if (torrent->isPrivate())
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <QIcon>
|
||||
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/global.h"
|
||||
#include "uithememanager.h"
|
||||
|
||||
|
@ -336,7 +336,7 @@ void CategoryFilterModel::categoryRemoved(const QString &categoryName)
|
|||
}
|
||||
}
|
||||
|
||||
void CategoryFilterModel::torrentAdded(BitTorrent::TorrentHandle *const torrent)
|
||||
void CategoryFilterModel::torrentAdded(BitTorrent::Torrent *const torrent)
|
||||
{
|
||||
CategoryModelItem *item = findItem(torrent->category());
|
||||
Q_ASSERT(item);
|
||||
|
@ -345,7 +345,7 @@ void CategoryFilterModel::torrentAdded(BitTorrent::TorrentHandle *const torrent)
|
|||
m_rootItem->childAt(0)->increaseTorrentsCount();
|
||||
}
|
||||
|
||||
void CategoryFilterModel::torrentAboutToBeRemoved(BitTorrent::TorrentHandle *const torrent)
|
||||
void CategoryFilterModel::torrentAboutToBeRemoved(BitTorrent::Torrent *const torrent)
|
||||
{
|
||||
CategoryModelItem *item = findItem(torrent->category());
|
||||
Q_ASSERT(item);
|
||||
|
@ -354,7 +354,7 @@ void CategoryFilterModel::torrentAboutToBeRemoved(BitTorrent::TorrentHandle *con
|
|||
m_rootItem->childAt(0)->decreaseTorrentsCount();
|
||||
}
|
||||
|
||||
void CategoryFilterModel::torrentCategoryChanged(BitTorrent::TorrentHandle *const torrent, const QString &oldCategory)
|
||||
void CategoryFilterModel::torrentCategoryChanged(BitTorrent::Torrent *const torrent, const QString &oldCategory)
|
||||
{
|
||||
QModelIndex i;
|
||||
|
||||
|
@ -403,7 +403,7 @@ void CategoryFilterModel::populate()
|
|||
m_rootItem->addChild(UID_ALL, new CategoryModelItem(nullptr, tr("All"), torrents.count()));
|
||||
|
||||
// Uncategorized torrents
|
||||
using Torrent = BitTorrent::TorrentHandle;
|
||||
using Torrent = BitTorrent::Torrent;
|
||||
m_rootItem->addChild(
|
||||
UID_UNCATEGORIZED
|
||||
, new CategoryModelItem(
|
||||
|
@ -411,7 +411,7 @@ void CategoryFilterModel::populate()
|
|||
, std::count_if(torrents.begin(), torrents.end()
|
||||
, [](Torrent *torrent) { return torrent->category().isEmpty(); })));
|
||||
|
||||
using Torrent = BitTorrent::TorrentHandle;
|
||||
using Torrent = BitTorrent::Torrent;
|
||||
for (auto i = session->categories().cbegin(); i != session->categories().cend(); ++i)
|
||||
{
|
||||
const QString &category = i.key();
|
||||
|
|
|
@ -36,7 +36,7 @@ class CategoryModelItem;
|
|||
|
||||
namespace BitTorrent
|
||||
{
|
||||
class TorrentHandle;
|
||||
class Torrent;
|
||||
}
|
||||
|
||||
class CategoryFilterModel final : public QAbstractItemModel
|
||||
|
@ -63,9 +63,9 @@ public:
|
|||
private slots:
|
||||
void categoryAdded(const QString &categoryName);
|
||||
void categoryRemoved(const QString &categoryName);
|
||||
void torrentAdded(BitTorrent::TorrentHandle *const torrent);
|
||||
void torrentAboutToBeRemoved(BitTorrent::TorrentHandle *const torrent);
|
||||
void torrentCategoryChanged(BitTorrent::TorrentHandle *const torrent, const QString &oldCategory);
|
||||
void torrentAdded(BitTorrent::Torrent *const torrent);
|
||||
void torrentAboutToBeRemoved(BitTorrent::Torrent *const torrent);
|
||||
void torrentCategoryChanged(BitTorrent::Torrent *const torrent, const QString &oldCategory);
|
||||
void subcategoriesSupportChanged();
|
||||
|
||||
private:
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/sessionstatus.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/global.h"
|
||||
#include "base/logger.h"
|
||||
#include "base/net/downloadmanager.h"
|
||||
|
@ -260,11 +260,11 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::trackerlessStateChanged, m_transferListFiltersWidget, &TransferListFiltersWidget::changeTrackerless);
|
||||
|
||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::trackerSuccess
|
||||
, m_transferListFiltersWidget, qOverload<const BitTorrent::TorrentHandle *, const QString &>(&TransferListFiltersWidget::trackerSuccess));
|
||||
, m_transferListFiltersWidget, qOverload<const BitTorrent::Torrent *, const QString &>(&TransferListFiltersWidget::trackerSuccess));
|
||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::trackerError
|
||||
, m_transferListFiltersWidget, qOverload<const BitTorrent::TorrentHandle *, const QString &>(&TransferListFiltersWidget::trackerError));
|
||||
, m_transferListFiltersWidget, qOverload<const BitTorrent::Torrent *, const QString &>(&TransferListFiltersWidget::trackerError));
|
||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::trackerWarning
|
||||
, m_transferListFiltersWidget, qOverload<const BitTorrent::TorrentHandle *, const QString &>(&TransferListFiltersWidget::trackerWarning));
|
||||
, m_transferListFiltersWidget, qOverload<const BitTorrent::Torrent *, const QString &>(&TransferListFiltersWidget::trackerWarning));
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
// Increase top spacing to avoid tab overlapping
|
||||
|
@ -858,20 +858,20 @@ void MainWindow::addTorrentFailed(const QString &error) const
|
|||
}
|
||||
|
||||
// called when a torrent was added
|
||||
void MainWindow::torrentNew(BitTorrent::TorrentHandle *const torrent) const
|
||||
void MainWindow::torrentNew(BitTorrent::Torrent *const torrent) const
|
||||
{
|
||||
if (isTorrentAddedNotificationsEnabled())
|
||||
showNotificationBaloon(tr("Torrent added"), tr("'%1' was added.", "e.g: xxx.avi was added.").arg(torrent->name()));
|
||||
}
|
||||
|
||||
// called when a torrent has finished
|
||||
void MainWindow::finishedTorrent(BitTorrent::TorrentHandle *const torrent) const
|
||||
void MainWindow::finishedTorrent(BitTorrent::Torrent *const torrent) const
|
||||
{
|
||||
showNotificationBaloon(tr("Download completion"), tr("'%1' has finished downloading.", "e.g: xxx.avi has finished downloading.").arg(torrent->name()));
|
||||
}
|
||||
|
||||
// Notification when disk is full
|
||||
void MainWindow::fullDiskError(BitTorrent::TorrentHandle *const torrent, const QString &msg) const
|
||||
void MainWindow::fullDiskError(BitTorrent::Torrent *const torrent, const QString &msg) const
|
||||
{
|
||||
showNotificationBaloon(tr("I/O Error", "i.e: Input/Output Error")
|
||||
, tr("An I/O error occurred for torrent '%1'.\n Reason: %2"
|
||||
|
@ -961,7 +961,7 @@ void MainWindow::displayExecutionLogTab()
|
|||
|
||||
// End of keyboard shortcuts slots
|
||||
|
||||
void MainWindow::askRecursiveTorrentDownloadConfirmation(BitTorrent::TorrentHandle *const torrent)
|
||||
void MainWindow::askRecursiveTorrentDownloadConfirmation(BitTorrent::Torrent *const torrent)
|
||||
{
|
||||
Preferences *const pref = Preferences::instance();
|
||||
if (pref->recursiveDownloadDisabled()) return;
|
||||
|
@ -1639,7 +1639,7 @@ void MainWindow::reloadSessionStats()
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::reloadTorrentStats(const QVector<BitTorrent::TorrentHandle *> &torrents)
|
||||
void MainWindow::reloadTorrentStats(const QVector<BitTorrent::Torrent *> &torrents)
|
||||
{
|
||||
if (currentTabWidget() == m_transferListWidget)
|
||||
{
|
||||
|
|
|
@ -58,7 +58,7 @@ class TransferListWidget;
|
|||
|
||||
namespace BitTorrent
|
||||
{
|
||||
class TorrentHandle;
|
||||
class Torrent;
|
||||
}
|
||||
|
||||
namespace Net
|
||||
|
@ -110,7 +110,7 @@ private slots:
|
|||
void balloonClicked();
|
||||
void writeSettings();
|
||||
void readSettings();
|
||||
void fullDiskError(BitTorrent::TorrentHandle *const torrent, const QString &msg) const;
|
||||
void fullDiskError(BitTorrent::Torrent *const torrent, const QString &msg) const;
|
||||
void handleDownloadFromUrlFailure(const QString &, const QString &) const;
|
||||
void tabChanged(int newTab);
|
||||
bool defineUILockPassword();
|
||||
|
@ -127,12 +127,12 @@ private slots:
|
|||
void displayExecutionLogTab();
|
||||
void focusSearchFilter();
|
||||
void reloadSessionStats();
|
||||
void reloadTorrentStats(const QVector<BitTorrent::TorrentHandle *> &torrents);
|
||||
void reloadTorrentStats(const QVector<BitTorrent::Torrent *> &torrents);
|
||||
void loadPreferences(bool configureSession = true);
|
||||
void addTorrentFailed(const QString &error) const;
|
||||
void torrentNew(BitTorrent::TorrentHandle *const torrent) const;
|
||||
void finishedTorrent(BitTorrent::TorrentHandle *const torrent) const;
|
||||
void askRecursiveTorrentDownloadConfirmation(BitTorrent::TorrentHandle *const torrent);
|
||||
void torrentNew(BitTorrent::Torrent *const torrent) const;
|
||||
void finishedTorrent(BitTorrent::Torrent *const torrent) const;
|
||||
void askRecursiveTorrentDownloadConfirmation(BitTorrent::Torrent *const torrent);
|
||||
void optionsSaved();
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
||||
void handleUpdateCheckFinished(bool updateAvailable, QString newVersion, bool invokedByUser);
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include <QTableView>
|
||||
|
||||
#include "base/bittorrent/common.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/misc.h"
|
||||
|
@ -47,7 +47,7 @@
|
|||
|
||||
#define SETTINGS_KEY(name) "PreviewSelectDialog/" name
|
||||
|
||||
PreviewSelectDialog::PreviewSelectDialog(QWidget *parent, const BitTorrent::TorrentHandle *torrent)
|
||||
PreviewSelectDialog::PreviewSelectDialog(QWidget *parent, const BitTorrent::Torrent *torrent)
|
||||
: QDialog(parent)
|
||||
, m_ui(new Ui::PreviewSelectDialog)
|
||||
, m_torrent(torrent)
|
||||
|
|
|
@ -36,7 +36,7 @@ class QStandardItemModel;
|
|||
|
||||
namespace BitTorrent
|
||||
{
|
||||
class TorrentHandle;
|
||||
class Torrent;
|
||||
}
|
||||
namespace Ui
|
||||
{
|
||||
|
@ -60,7 +60,7 @@ public:
|
|||
NB_COLUMNS
|
||||
};
|
||||
|
||||
PreviewSelectDialog(QWidget *parent, const BitTorrent::TorrentHandle *torrent);
|
||||
PreviewSelectDialog(QWidget *parent, const BitTorrent::Torrent *torrent);
|
||||
~PreviewSelectDialog();
|
||||
|
||||
signals:
|
||||
|
@ -78,7 +78,7 @@ private:
|
|||
Ui::PreviewSelectDialog *m_ui;
|
||||
QStandardItemModel *m_previewListModel;
|
||||
PreviewListDelegate *m_listDelegate;
|
||||
const BitTorrent::TorrentHandle *m_torrent;
|
||||
const BitTorrent::Torrent *m_torrent;
|
||||
bool m_headerStateInitialized = false;
|
||||
|
||||
// Settings
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include "base/bittorrent/peeraddress.h"
|
||||
#include "base/bittorrent/peerinfo.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/global.h"
|
||||
#include "base/logger.h"
|
||||
#include "base/net/geoipmanager.h"
|
||||
|
@ -260,7 +260,7 @@ void PeerListWidget::updatePeerCountryResolutionState()
|
|||
|
||||
void PeerListWidget::showPeerListMenu(const QPoint &)
|
||||
{
|
||||
BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent();
|
||||
BitTorrent::Torrent *const torrent = m_properties->getCurrentTorrent();
|
||||
if (!torrent) return;
|
||||
|
||||
QMenu *menu = new QMenu(this);
|
||||
|
@ -370,7 +370,7 @@ void PeerListWidget::saveSettings() const
|
|||
Preferences::instance()->setPeerListState(header()->saveState());
|
||||
}
|
||||
|
||||
void PeerListWidget::loadPeers(const BitTorrent::TorrentHandle *torrent)
|
||||
void PeerListWidget::loadPeers(const BitTorrent::Torrent *torrent)
|
||||
{
|
||||
if (!torrent) return;
|
||||
|
||||
|
@ -406,7 +406,7 @@ void PeerListWidget::loadPeers(const BitTorrent::TorrentHandle *torrent)
|
|||
}
|
||||
}
|
||||
|
||||
void PeerListWidget::updatePeer(const BitTorrent::TorrentHandle *torrent, const BitTorrent::PeerInfo &peer, bool &isNewPeer)
|
||||
void PeerListWidget::updatePeer(const BitTorrent::Torrent *torrent, const BitTorrent::PeerInfo &peer, bool &isNewPeer)
|
||||
{
|
||||
const PeerEndpoint peerEndpoint {peer.address(), peer.connectionType()};
|
||||
const QString peerIp = peerEndpoint.address.ip.toString();
|
||||
|
|
|
@ -43,7 +43,7 @@ struct PeerEndpoint;
|
|||
|
||||
namespace BitTorrent
|
||||
{
|
||||
class TorrentHandle;
|
||||
class Torrent;
|
||||
class PeerInfo;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ public:
|
|||
explicit PeerListWidget(PropertiesWidget *parent);
|
||||
~PeerListWidget() override;
|
||||
|
||||
void loadPeers(const BitTorrent::TorrentHandle *torrent);
|
||||
void loadPeers(const BitTorrent::Torrent *torrent);
|
||||
void updatePeerHostNameResolutionState();
|
||||
void updatePeerCountryResolutionState();
|
||||
void clear();
|
||||
|
@ -96,7 +96,7 @@ private slots:
|
|||
void handleResolved(const QHostAddress &ip, const QString &hostname) const;
|
||||
|
||||
private:
|
||||
void updatePeer(const BitTorrent::TorrentHandle *torrent, const BitTorrent::PeerInfo &peer, bool &isNewPeer);
|
||||
void updatePeer(const BitTorrent::Torrent *torrent, const BitTorrent::PeerInfo &peer, bool &isNewPeer);
|
||||
|
||||
void wheelEvent(QWheelEvent *event) override;
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include <QToolTip>
|
||||
|
||||
#include "base/indexrange.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/bittorrent/torrentinfo.h"
|
||||
#include "base/utils/misc.h"
|
||||
|
||||
|
@ -119,7 +119,7 @@ PiecesBar::PiecesBar(QWidget *parent)
|
|||
setMouseTracking(true);
|
||||
}
|
||||
|
||||
void PiecesBar::setTorrent(const BitTorrent::TorrentHandle *torrent)
|
||||
void PiecesBar::setTorrent(const BitTorrent::Torrent *torrent)
|
||||
{
|
||||
m_torrent = torrent;
|
||||
if (!m_torrent)
|
||||
|
|
|
@ -37,7 +37,7 @@ class QHelpEvent;
|
|||
|
||||
namespace BitTorrent
|
||||
{
|
||||
class TorrentHandle;
|
||||
class Torrent;
|
||||
}
|
||||
|
||||
class PiecesBar : public QWidget
|
||||
|
@ -49,7 +49,7 @@ class PiecesBar : public QWidget
|
|||
public:
|
||||
explicit PiecesBar(QWidget *parent = nullptr);
|
||||
|
||||
void setTorrent(const BitTorrent::TorrentHandle *torrent);
|
||||
void setTorrent(const BitTorrent::Torrent *torrent);
|
||||
|
||||
virtual void clear();
|
||||
|
||||
|
@ -87,7 +87,7 @@ private:
|
|||
virtual bool updateImage(QImage &image) = 0;
|
||||
void updatePieceColors();
|
||||
|
||||
const BitTorrent::TorrentHandle *m_torrent;
|
||||
const BitTorrent::Torrent *m_torrent;
|
||||
QImage m_image;
|
||||
// buffered 256 levels gradient from bg_color to piece_color
|
||||
QVector<QRgb> m_pieceColors;
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include "base/bittorrent/downloadpriority.h"
|
||||
#include "base/bittorrent/infohash.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/unicodestrings.h"
|
||||
#include "base/utils/fs.h"
|
||||
|
@ -265,7 +265,7 @@ void PropertiesWidget::clear()
|
|||
m_propListModel->model()->clear();
|
||||
}
|
||||
|
||||
BitTorrent::TorrentHandle *PropertiesWidget::getCurrentTorrent() const
|
||||
BitTorrent::Torrent *PropertiesWidget::getCurrentTorrent() const
|
||||
{
|
||||
return m_torrent;
|
||||
}
|
||||
|
@ -285,25 +285,25 @@ QTreeView *PropertiesWidget::getFilesList() const
|
|||
return m_ui->filesList;
|
||||
}
|
||||
|
||||
void PropertiesWidget::updateSavePath(BitTorrent::TorrentHandle *const torrent)
|
||||
void PropertiesWidget::updateSavePath(BitTorrent::Torrent *const torrent)
|
||||
{
|
||||
if (torrent == m_torrent)
|
||||
m_ui->labelSavePathVal->setText(Utils::Fs::toNativePath(m_torrent->savePath()));
|
||||
}
|
||||
|
||||
void PropertiesWidget::loadTrackers(BitTorrent::TorrentHandle *const torrent)
|
||||
void PropertiesWidget::loadTrackers(BitTorrent::Torrent *const torrent)
|
||||
{
|
||||
if (torrent == m_torrent)
|
||||
m_trackerList->loadTrackers();
|
||||
}
|
||||
|
||||
void PropertiesWidget::updateTorrentInfos(BitTorrent::TorrentHandle *const torrent)
|
||||
void PropertiesWidget::updateTorrentInfos(BitTorrent::Torrent *const torrent)
|
||||
{
|
||||
if (torrent == m_torrent)
|
||||
loadTorrentInfos(m_torrent);
|
||||
}
|
||||
|
||||
void PropertiesWidget::loadTorrentInfos(BitTorrent::TorrentHandle *const torrent)
|
||||
void PropertiesWidget::loadTorrentInfos(BitTorrent::Torrent *const torrent)
|
||||
{
|
||||
clear();
|
||||
m_torrent = torrent;
|
||||
|
@ -437,7 +437,7 @@ void PropertiesWidget::loadDynamicData()
|
|||
|
||||
// Update ratio info
|
||||
const qreal ratio = m_torrent->realRatio();
|
||||
m_ui->labelShareRatioVal->setText(ratio > BitTorrent::TorrentHandle::MAX_RATIO ? QString::fromUtf8(C_INFINITY) : Utils::String::fromDouble(ratio, 2));
|
||||
m_ui->labelShareRatioVal->setText(ratio > BitTorrent::Torrent::MAX_RATIO ? QString::fromUtf8(C_INFINITY) : Utils::String::fromDouble(ratio, 2));
|
||||
|
||||
m_ui->labelSeedsVal->setText(tr("%1 (%2 total)", "%1 and %2 are numbers, e.g. 3 (10 total)")
|
||||
.arg(QString::number(m_torrent->seedsCount())
|
||||
|
|
|
@ -45,7 +45,7 @@ class TrackerListWidget;
|
|||
|
||||
namespace BitTorrent
|
||||
{
|
||||
class TorrentHandle;
|
||||
class Torrent;
|
||||
}
|
||||
|
||||
namespace Ui
|
||||
|
@ -68,24 +68,24 @@ public:
|
|||
explicit PropertiesWidget(QWidget *parent);
|
||||
~PropertiesWidget() override;
|
||||
|
||||
BitTorrent::TorrentHandle *getCurrentTorrent() const;
|
||||
BitTorrent::Torrent *getCurrentTorrent() const;
|
||||
TrackerListWidget *getTrackerList() const;
|
||||
PeerListWidget *getPeerList() const;
|
||||
QTreeView *getFilesList() const;
|
||||
|
||||
public slots:
|
||||
void setVisibility(bool visible);
|
||||
void loadTorrentInfos(BitTorrent::TorrentHandle *const torrent);
|
||||
void loadTorrentInfos(BitTorrent::Torrent *const torrent);
|
||||
void loadDynamicData();
|
||||
void clear();
|
||||
void readSettings();
|
||||
void saveSettings();
|
||||
void reloadPreferences();
|
||||
void openItem(const QModelIndex &index) const;
|
||||
void loadTrackers(BitTorrent::TorrentHandle *const torrent);
|
||||
void loadTrackers(BitTorrent::Torrent *const torrent);
|
||||
|
||||
protected slots:
|
||||
void updateTorrentInfos(BitTorrent::TorrentHandle *const torrent);
|
||||
void updateTorrentInfos(BitTorrent::Torrent *const torrent);
|
||||
void loadUrlSeeds();
|
||||
void askWebSeed();
|
||||
void deleteSelectedUrlSeeds();
|
||||
|
@ -101,7 +101,7 @@ protected slots:
|
|||
private slots:
|
||||
void configure();
|
||||
void filterText(const QString &filter);
|
||||
void updateSavePath(BitTorrent::TorrentHandle *const torrent);
|
||||
void updateSavePath(BitTorrent::Torrent *const torrent);
|
||||
|
||||
private:
|
||||
QPushButton *getButtonFromIndex(int index);
|
||||
|
@ -110,7 +110,7 @@ private:
|
|||
QString getFullPath(const QModelIndex &index) const;
|
||||
|
||||
Ui::PropertiesWidget *m_ui;
|
||||
BitTorrent::TorrentHandle *m_torrent;
|
||||
BitTorrent::Torrent *m_torrent;
|
||||
SlideState m_state;
|
||||
TorrentContentFilterModel *m_propListModel;
|
||||
PropListDelegate *m_propListDelegate;
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#endif
|
||||
|
||||
#include "base/bittorrent/downloadpriority.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "gui/torrentcontentmodel.h"
|
||||
#include "propertieswidget.h"
|
||||
|
||||
|
@ -111,7 +111,7 @@ QWidget *PropListDelegate::createEditor(QWidget *parent, const QStyleOptionViewI
|
|||
|
||||
if (m_properties)
|
||||
{
|
||||
const BitTorrent::TorrentHandle *torrent = m_properties->getCurrentTorrent();
|
||||
const BitTorrent::Torrent *torrent = m_properties->getCurrentTorrent();
|
||||
if (!torrent || !torrent->hasMetadata() || torrent->isSeed())
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
#include "base/bittorrent/peerinfo.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/bittorrent/trackerentry.h"
|
||||
#include "base/global.h"
|
||||
#include "base/preferences.h"
|
||||
|
@ -172,7 +172,7 @@ void TrackerListWidget::setRowColor(const int row, const QColor &color)
|
|||
|
||||
void TrackerListWidget::moveSelectionUp()
|
||||
{
|
||||
BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent();
|
||||
BitTorrent::Torrent *const torrent = m_properties->getCurrentTorrent();
|
||||
if (!torrent)
|
||||
{
|
||||
clear();
|
||||
|
@ -218,7 +218,7 @@ void TrackerListWidget::moveSelectionUp()
|
|||
|
||||
void TrackerListWidget::moveSelectionDown()
|
||||
{
|
||||
BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent();
|
||||
BitTorrent::Torrent *const torrent = m_properties->getCurrentTorrent();
|
||||
if (!torrent)
|
||||
{
|
||||
clear();
|
||||
|
@ -281,7 +281,7 @@ void TrackerListWidget::clear()
|
|||
m_LSDItem->setText(COL_MSG, "");
|
||||
}
|
||||
|
||||
void TrackerListWidget::loadStickyItems(const BitTorrent::TorrentHandle *torrent)
|
||||
void TrackerListWidget::loadStickyItems(const BitTorrent::Torrent *torrent)
|
||||
{
|
||||
const QString working {tr("Working")};
|
||||
const QString disabled {tr("Disabled")};
|
||||
|
@ -361,7 +361,7 @@ void TrackerListWidget::loadStickyItems(const BitTorrent::TorrentHandle *torrent
|
|||
void TrackerListWidget::loadTrackers()
|
||||
{
|
||||
// Load trackers from torrent handle
|
||||
const BitTorrent::TorrentHandle *torrent = m_properties->getCurrentTorrent();
|
||||
const BitTorrent::Torrent *torrent = m_properties->getCurrentTorrent();
|
||||
if (!torrent) return;
|
||||
|
||||
loadStickyItems(torrent);
|
||||
|
@ -438,7 +438,7 @@ void TrackerListWidget::loadTrackers()
|
|||
// Ask the user for new trackers and add them to the torrent
|
||||
void TrackerListWidget::askForTrackers()
|
||||
{
|
||||
BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent();
|
||||
BitTorrent::Torrent *const torrent = m_properties->getCurrentTorrent();
|
||||
if (!torrent) return;
|
||||
|
||||
QVector<BitTorrent::TrackerEntry> trackers;
|
||||
|
@ -466,7 +466,7 @@ void TrackerListWidget::copyTrackerUrl()
|
|||
|
||||
void TrackerListWidget::deleteSelectedTrackers()
|
||||
{
|
||||
BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent();
|
||||
BitTorrent::Torrent *const torrent = m_properties->getCurrentTorrent();
|
||||
if (!torrent)
|
||||
{
|
||||
clear();
|
||||
|
@ -504,7 +504,7 @@ void TrackerListWidget::deleteSelectedTrackers()
|
|||
|
||||
void TrackerListWidget::editSelectedTracker()
|
||||
{
|
||||
BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent();
|
||||
BitTorrent::Torrent *const torrent = m_properties->getCurrentTorrent();
|
||||
if (!torrent) return;
|
||||
|
||||
const QVector<QTreeWidgetItem *> selectedTrackerItems = getSelectedTrackerItems();
|
||||
|
@ -555,7 +555,7 @@ void TrackerListWidget::reannounceSelected()
|
|||
const QList<QTreeWidgetItem *> selItems = selectedItems();
|
||||
if (selItems.isEmpty()) return;
|
||||
|
||||
BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent();
|
||||
BitTorrent::Torrent *const torrent = m_properties->getCurrentTorrent();
|
||||
if (!torrent) return;
|
||||
|
||||
const QVector<BitTorrent::TrackerEntry> trackers = torrent->trackers();
|
||||
|
@ -585,7 +585,7 @@ void TrackerListWidget::reannounceSelected()
|
|||
|
||||
void TrackerListWidget::showTrackerListMenu(const QPoint &)
|
||||
{
|
||||
BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent();
|
||||
BitTorrent::Torrent *const torrent = m_properties->getCurrentTorrent();
|
||||
if (!torrent) return;
|
||||
|
||||
QMenu *menu = new QMenu(this);
|
||||
|
@ -617,7 +617,7 @@ void TrackerListWidget::showTrackerListMenu(const QPoint &)
|
|||
const QAction *reannounceAllAct = menu->addAction(UIThemeManager::instance()->getIcon("view-refresh"), tr("Force reannounce to all trackers"));
|
||||
connect(reannounceAllAct, &QAction::triggered, this, [this]()
|
||||
{
|
||||
BitTorrent::TorrentHandle *h = m_properties->getCurrentTorrent();
|
||||
BitTorrent::Torrent *h = m_properties->getCurrentTorrent();
|
||||
h->forceReannounce();
|
||||
h->forceDHTAnnounce();
|
||||
});
|
||||
|
|
|
@ -35,7 +35,7 @@ class PropertiesWidget;
|
|||
|
||||
namespace BitTorrent
|
||||
{
|
||||
class TorrentHandle;
|
||||
class Torrent;
|
||||
}
|
||||
|
||||
class TrackerListWidget : public QTreeWidget
|
||||
|
@ -70,7 +70,7 @@ public slots:
|
|||
void moveSelectionDown();
|
||||
|
||||
void clear();
|
||||
void loadStickyItems(const BitTorrent::TorrentHandle *torrent);
|
||||
void loadStickyItems(const BitTorrent::Torrent *torrent);
|
||||
void loadTrackers();
|
||||
void askForTrackers();
|
||||
void copyTrackerUrl();
|
||||
|
|
|
@ -32,14 +32,14 @@
|
|||
#include <QMessageBox>
|
||||
#include <QStringList>
|
||||
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/bittorrent/trackerentry.h"
|
||||
#include "base/global.h"
|
||||
#include "base/net/downloadmanager.h"
|
||||
#include "gui/uithememanager.h"
|
||||
#include "ui_trackersadditiondialog.h"
|
||||
|
||||
TrackersAdditionDialog::TrackersAdditionDialog(QWidget *parent, BitTorrent::TorrentHandle *const torrent)
|
||||
TrackersAdditionDialog::TrackersAdditionDialog(QWidget *parent, BitTorrent::Torrent *const torrent)
|
||||
: QDialog(parent)
|
||||
, m_ui(new Ui::TrackersAdditionDialog())
|
||||
, m_torrent(torrent)
|
||||
|
@ -129,7 +129,7 @@ void TrackersAdditionDialog::torrentListDownloadFinished(const Net::DownloadResu
|
|||
QMessageBox::information(this, tr("No change"), tr("No additional trackers were found."), QMessageBox::Ok);
|
||||
}
|
||||
|
||||
QStringList TrackersAdditionDialog::askForTrackers(QWidget *parent, BitTorrent::TorrentHandle *const torrent)
|
||||
QStringList TrackersAdditionDialog::askForTrackers(QWidget *parent, BitTorrent::Torrent *const torrent)
|
||||
{
|
||||
QStringList trackers;
|
||||
TrackersAdditionDialog dlg(parent, torrent);
|
||||
|
|
|
@ -35,7 +35,7 @@ class QString;
|
|||
|
||||
namespace BitTorrent
|
||||
{
|
||||
class TorrentHandle;
|
||||
class Torrent;
|
||||
}
|
||||
|
||||
namespace Net
|
||||
|
@ -53,11 +53,11 @@ class TrackersAdditionDialog : public QDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TrackersAdditionDialog(QWidget *parent, BitTorrent::TorrentHandle *const torrent);
|
||||
TrackersAdditionDialog(QWidget *parent, BitTorrent::Torrent *const torrent);
|
||||
~TrackersAdditionDialog();
|
||||
|
||||
QStringList newTrackers() const;
|
||||
static QStringList askForTrackers(QWidget *parent, BitTorrent::TorrentHandle *const torrent);
|
||||
static QStringList askForTrackers(QWidget *parent, BitTorrent::Torrent *const torrent);
|
||||
|
||||
public slots:
|
||||
void on_uTorrentListButton_clicked();
|
||||
|
@ -65,5 +65,5 @@ public slots:
|
|||
|
||||
private:
|
||||
Ui::TrackersAdditionDialog *m_ui;
|
||||
BitTorrent::TorrentHandle *const m_torrent;
|
||||
BitTorrent::Torrent *const m_torrent;
|
||||
};
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include "base/bittorrent/cachestatus.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/sessionstatus.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/global.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "base/utils/string.h"
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <QVector>
|
||||
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/global.h"
|
||||
#include "uithememanager.h"
|
||||
|
||||
|
@ -203,7 +203,7 @@ void TagFilterModel::tagRemoved(const QString &tag)
|
|||
endRemoveRows();
|
||||
}
|
||||
|
||||
void TagFilterModel::torrentTagAdded(BitTorrent::TorrentHandle *const torrent, const QString &tag)
|
||||
void TagFilterModel::torrentTagAdded(BitTorrent::Torrent *const torrent, const QString &tag)
|
||||
{
|
||||
if (torrent->tags().count() == 1)
|
||||
untaggedItem()->decreaseTorrentsCount();
|
||||
|
@ -217,7 +217,7 @@ void TagFilterModel::torrentTagAdded(BitTorrent::TorrentHandle *const torrent, c
|
|||
emit dataChanged(i, i);
|
||||
}
|
||||
|
||||
void TagFilterModel::torrentTagRemoved(BitTorrent::TorrentHandle *const torrent, const QString &tag)
|
||||
void TagFilterModel::torrentTagRemoved(BitTorrent::Torrent *const torrent, const QString &tag)
|
||||
{
|
||||
if (torrent->tags().empty())
|
||||
untaggedItem()->increaseTorrentsCount();
|
||||
|
@ -232,7 +232,7 @@ void TagFilterModel::torrentTagRemoved(BitTorrent::TorrentHandle *const torrent,
|
|||
emit dataChanged(i, i);
|
||||
}
|
||||
|
||||
void TagFilterModel::torrentAdded(BitTorrent::TorrentHandle *const torrent)
|
||||
void TagFilterModel::torrentAdded(BitTorrent::Torrent *const torrent)
|
||||
{
|
||||
allTagsItem()->increaseTorrentsCount();
|
||||
|
||||
|
@ -244,7 +244,7 @@ void TagFilterModel::torrentAdded(BitTorrent::TorrentHandle *const torrent)
|
|||
item->increaseTorrentsCount();
|
||||
}
|
||||
|
||||
void TagFilterModel::torrentAboutToBeRemoved(BitTorrent::TorrentHandle *const torrent)
|
||||
void TagFilterModel::torrentAboutToBeRemoved(BitTorrent::Torrent *const torrent)
|
||||
{
|
||||
allTagsItem()->decreaseTorrentsCount();
|
||||
|
||||
|
@ -266,7 +266,7 @@ QString TagFilterModel::tagDisplayName(const QString &tag)
|
|||
|
||||
void TagFilterModel::populate()
|
||||
{
|
||||
using Torrent = BitTorrent::TorrentHandle;
|
||||
using Torrent = BitTorrent::Torrent;
|
||||
|
||||
const auto *session = BitTorrent::Session::instance();
|
||||
const auto torrents = session->torrents();
|
||||
|
|
|
@ -37,7 +37,7 @@ class TagModelItem;
|
|||
|
||||
namespace BitTorrent
|
||||
{
|
||||
class TorrentHandle;
|
||||
class Torrent;
|
||||
}
|
||||
|
||||
class TagFilterModel final : public QAbstractListModel
|
||||
|
@ -62,10 +62,10 @@ public:
|
|||
private slots:
|
||||
void tagAdded(const QString &tag);
|
||||
void tagRemoved(const QString &tag);
|
||||
void torrentTagAdded(BitTorrent::TorrentHandle *const torrent, const QString &tag);
|
||||
void torrentTagRemoved(BitTorrent::TorrentHandle *const, const QString &tag);
|
||||
void torrentAdded(BitTorrent::TorrentHandle *const torrent);
|
||||
void torrentAboutToBeRemoved(BitTorrent::TorrentHandle *const torrent);
|
||||
void torrentTagAdded(BitTorrent::Torrent *const torrent, const QString &tag);
|
||||
void torrentTagRemoved(BitTorrent::Torrent *const, const QString &tag);
|
||||
void torrentAdded(BitTorrent::Torrent *const torrent);
|
||||
void torrentAboutToBeRemoved(BitTorrent::Torrent *const torrent);
|
||||
|
||||
private:
|
||||
static QString tagDisplayName(const QString &tag);
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "base/bittorrent/abstractfilestorage.h"
|
||||
#include "base/bittorrent/common.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/bittorrent/torrentinfo.h"
|
||||
#include "base/exceptions.h"
|
||||
#include "base/global.h"
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
namespace BitTorrent
|
||||
{
|
||||
class AbstractFileStorage;
|
||||
class TorrentHandle;
|
||||
class Torrent;
|
||||
class TorrentInfo;
|
||||
}
|
||||
|
||||
|
|
|
@ -246,8 +246,8 @@ void TorrentCreatorDialog::handleCreationSuccess(const QString &path, const QStr
|
|||
params.skipChecking = true;
|
||||
if (m_ui->checkIgnoreShareLimits->isChecked())
|
||||
{
|
||||
params.ratioLimit = BitTorrent::TorrentHandle::NO_RATIO_LIMIT;
|
||||
params.seedingTimeLimit = BitTorrent::TorrentHandle::NO_SEEDING_TIME_LIMIT;
|
||||
params.ratioLimit = BitTorrent::Torrent::NO_RATIO_LIMIT;
|
||||
params.seedingTimeLimit = BitTorrent::Torrent::NO_SEEDING_TIME_LIMIT;
|
||||
}
|
||||
params.useAutoTMM = false; // otherwise if it is on by default, it will overwrite `savePath` to the default save path
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#include "base/bittorrent/infohash.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/global.h"
|
||||
#include "base/unicodestrings.h"
|
||||
#include "ui_torrentoptionsdialog.h"
|
||||
|
@ -53,7 +53,7 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
TorrentOptionsDialog::TorrentOptionsDialog(QWidget *parent, const QVector<BitTorrent::TorrentHandle *> &torrents)
|
||||
TorrentOptionsDialog::TorrentOptionsDialog(QWidget *parent, const QVector<BitTorrent::Torrent *> &torrents)
|
||||
: QDialog {parent}
|
||||
, m_ui {new Ui::TorrentOptionsDialog}
|
||||
, m_storeDialogSize {SETTINGS_KEY("Size")}
|
||||
|
@ -76,7 +76,7 @@ TorrentOptionsDialog::TorrentOptionsDialog(QWidget *parent, const QVector<BitTor
|
|||
const bool isFirstTorrentLSDDisabled = torrents[0]->isLSDDisabled();
|
||||
|
||||
m_torrentHashes.reserve(torrents.size());
|
||||
for (const BitTorrent::TorrentHandle *torrent : torrents)
|
||||
for (const BitTorrent::Torrent *torrent : torrents)
|
||||
{
|
||||
m_torrentHashes << torrent->hash();
|
||||
if (allSameUpLimit)
|
||||
|
@ -180,8 +180,8 @@ TorrentOptionsDialog::TorrentOptionsDialog(QWidget *parent, const QVector<BitTor
|
|||
}
|
||||
|
||||
const bool useGlobalValue = allSameRatio && allSameSeedingTime
|
||||
&& (firstTorrentRatio == BitTorrent::TorrentHandle::USE_GLOBAL_RATIO)
|
||||
&& (firstTorrentSeedingTime == BitTorrent::TorrentHandle::USE_GLOBAL_SEEDING_TIME);
|
||||
&& (firstTorrentRatio == BitTorrent::Torrent::USE_GLOBAL_RATIO)
|
||||
&& (firstTorrentSeedingTime == BitTorrent::Torrent::USE_GLOBAL_SEEDING_TIME);
|
||||
|
||||
if (!allSameRatio || !allSameSeedingTime)
|
||||
{
|
||||
|
@ -193,8 +193,8 @@ TorrentOptionsDialog::TorrentOptionsDialog(QWidget *parent, const QVector<BitTor
|
|||
{
|
||||
m_ui->radioUseGlobalShareLimits->setChecked(true);
|
||||
}
|
||||
else if ((firstTorrentRatio == BitTorrent::TorrentHandle::NO_RATIO_LIMIT)
|
||||
&& (firstTorrentSeedingTime == BitTorrent::TorrentHandle::NO_SEEDING_TIME_LIMIT))
|
||||
else if ((firstTorrentRatio == BitTorrent::Torrent::NO_RATIO_LIMIT)
|
||||
&& (firstTorrentSeedingTime == BitTorrent::Torrent::NO_SEEDING_TIME_LIMIT))
|
||||
{
|
||||
m_ui->radioNoLimit->setChecked(true);
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ void TorrentOptionsDialog::accept()
|
|||
const auto *session = BitTorrent::Session::instance();
|
||||
for (const BitTorrent::InfoHash &hash : asConst(m_torrentHashes))
|
||||
{
|
||||
BitTorrent::TorrentHandle *torrent = session->findTorrent(hash);
|
||||
BitTorrent::Torrent *torrent = session->findTorrent(hash);
|
||||
if (!torrent) continue;
|
||||
|
||||
if (m_initialValues.upSpeedLimit != m_ui->spinUploadLimit->value())
|
||||
|
@ -324,10 +324,10 @@ qreal TorrentOptionsDialog::getRatio() const
|
|||
return MIXED_SHARE_LIMITS;
|
||||
|
||||
if (m_ui->radioUseGlobalShareLimits->isChecked())
|
||||
return BitTorrent::TorrentHandle::USE_GLOBAL_RATIO;
|
||||
return BitTorrent::Torrent::USE_GLOBAL_RATIO;
|
||||
|
||||
if (m_ui->radioNoLimit->isChecked() || !m_ui->checkMaxRatio->isChecked())
|
||||
return BitTorrent::TorrentHandle::NO_RATIO_LIMIT;
|
||||
return BitTorrent::Torrent::NO_RATIO_LIMIT;
|
||||
|
||||
return m_ui->spinRatioLimit->value();
|
||||
}
|
||||
|
@ -338,10 +338,10 @@ int TorrentOptionsDialog::getSeedingTime() const
|
|||
return MIXED_SHARE_LIMITS;
|
||||
|
||||
if (m_ui->radioUseGlobalShareLimits->isChecked())
|
||||
return BitTorrent::TorrentHandle::USE_GLOBAL_SEEDING_TIME;
|
||||
return BitTorrent::Torrent::USE_GLOBAL_SEEDING_TIME;
|
||||
|
||||
if (m_ui->radioNoLimit->isChecked() || !m_ui->checkMaxTime->isChecked())
|
||||
return BitTorrent::TorrentHandle::NO_SEEDING_TIME_LIMIT;
|
||||
return BitTorrent::Torrent::NO_SEEDING_TIME_LIMIT;
|
||||
|
||||
return m_ui->spinTimeLimit->value();
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
namespace BitTorrent
|
||||
{
|
||||
class InfoHash;
|
||||
class TorrentHandle;
|
||||
class Torrent;
|
||||
}
|
||||
|
||||
namespace Ui
|
||||
|
@ -49,7 +49,7 @@ class TorrentOptionsDialog final : public QDialog
|
|||
Q_DISABLE_COPY(TorrentOptionsDialog)
|
||||
|
||||
public:
|
||||
explicit TorrentOptionsDialog(QWidget *parent, const QVector<BitTorrent::TorrentHandle *> &torrents);
|
||||
explicit TorrentOptionsDialog(QWidget *parent, const QVector<BitTorrent::Torrent *> &torrents);
|
||||
~TorrentOptionsDialog() override;
|
||||
|
||||
public slots:
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
#include "base/bittorrent/infohash.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/bittorrent/trackerentry.h"
|
||||
#include "base/global.h"
|
||||
#include "base/logger.h"
|
||||
|
@ -240,8 +240,8 @@ void StatusFilterWidget::updateTorrentNumbers()
|
|||
int nbStalledDownloading = 0;
|
||||
int nbErrored = 0;
|
||||
|
||||
const QVector<BitTorrent::TorrentHandle *> torrents = BitTorrent::Session::instance()->torrents();
|
||||
for (const BitTorrent::TorrentHandle *torrent : torrents)
|
||||
const QVector<BitTorrent::Torrent *> torrents = BitTorrent::Session::instance()->torrents();
|
||||
for (const BitTorrent::Torrent *torrent : torrents)
|
||||
{
|
||||
if (torrent->isDownloading())
|
||||
++nbDownloading;
|
||||
|
@ -288,9 +288,9 @@ void StatusFilterWidget::applyFilter(int row)
|
|||
transferList->applyStatusFilter(row);
|
||||
}
|
||||
|
||||
void StatusFilterWidget::handleNewTorrent(BitTorrent::TorrentHandle *const) {}
|
||||
void StatusFilterWidget::handleNewTorrent(BitTorrent::Torrent *const) {}
|
||||
|
||||
void StatusFilterWidget::torrentAboutToBeDeleted(BitTorrent::TorrentHandle *const) {}
|
||||
void StatusFilterWidget::torrentAboutToBeDeleted(BitTorrent::Torrent *const) {}
|
||||
|
||||
TrackerFiltersList::TrackerFiltersList(QWidget *parent, TransferListWidget *transferList, const bool downloadFavicon)
|
||||
: BaseFilterWidget(parent, transferList)
|
||||
|
@ -577,7 +577,7 @@ void TrackerFiltersList::applyFilter(const int row)
|
|||
transferList->applyTrackerFilter(getInfoHashes(row));
|
||||
}
|
||||
|
||||
void TrackerFiltersList::handleNewTorrent(BitTorrent::TorrentHandle *const torrent)
|
||||
void TrackerFiltersList::handleNewTorrent(BitTorrent::Torrent *const torrent)
|
||||
{
|
||||
const BitTorrent::InfoHash hash {torrent->hash()};
|
||||
const QVector<BitTorrent::TrackerEntry> trackers {torrent->trackers()};
|
||||
|
@ -591,7 +591,7 @@ void TrackerFiltersList::handleNewTorrent(BitTorrent::TorrentHandle *const torre
|
|||
item(ALL_ROW)->setText(tr("All (%1)", "this is for the tracker filter").arg(++m_totalTorrents));
|
||||
}
|
||||
|
||||
void TrackerFiltersList::torrentAboutToBeDeleted(BitTorrent::TorrentHandle *const torrent)
|
||||
void TrackerFiltersList::torrentAboutToBeDeleted(BitTorrent::Torrent *const torrent)
|
||||
{
|
||||
const BitTorrent::InfoHash hash {torrent->hash()};
|
||||
const QVector<BitTorrent::TrackerEntry> trackers {torrent->trackers()};
|
||||
|
@ -742,34 +742,34 @@ void TransferListFiltersWidget::setDownloadTrackerFavicon(bool value)
|
|||
m_trackerFilters->setDownloadTrackerFavicon(value);
|
||||
}
|
||||
|
||||
void TransferListFiltersWidget::addTrackers(const BitTorrent::TorrentHandle *torrent, const QVector<BitTorrent::TrackerEntry> &trackers)
|
||||
void TransferListFiltersWidget::addTrackers(const BitTorrent::Torrent *torrent, const QVector<BitTorrent::TrackerEntry> &trackers)
|
||||
{
|
||||
for (const BitTorrent::TrackerEntry &tracker : trackers)
|
||||
m_trackerFilters->addItem(tracker.url(), torrent->hash());
|
||||
}
|
||||
|
||||
void TransferListFiltersWidget::removeTrackers(const BitTorrent::TorrentHandle *torrent, const QVector<BitTorrent::TrackerEntry> &trackers)
|
||||
void TransferListFiltersWidget::removeTrackers(const BitTorrent::Torrent *torrent, const QVector<BitTorrent::TrackerEntry> &trackers)
|
||||
{
|
||||
for (const BitTorrent::TrackerEntry &tracker : trackers)
|
||||
m_trackerFilters->removeItem(tracker.url(), torrent->hash());
|
||||
}
|
||||
|
||||
void TransferListFiltersWidget::changeTrackerless(const BitTorrent::TorrentHandle *torrent, const bool trackerless)
|
||||
void TransferListFiltersWidget::changeTrackerless(const BitTorrent::Torrent *torrent, const bool trackerless)
|
||||
{
|
||||
m_trackerFilters->changeTrackerless(trackerless, torrent->hash());
|
||||
}
|
||||
|
||||
void TransferListFiltersWidget::trackerSuccess(const BitTorrent::TorrentHandle *torrent, const QString &tracker)
|
||||
void TransferListFiltersWidget::trackerSuccess(const BitTorrent::Torrent *torrent, const QString &tracker)
|
||||
{
|
||||
emit trackerSuccess(torrent->hash(), tracker);
|
||||
}
|
||||
|
||||
void TransferListFiltersWidget::trackerWarning(const BitTorrent::TorrentHandle *torrent, const QString &tracker)
|
||||
void TransferListFiltersWidget::trackerWarning(const BitTorrent::Torrent *torrent, const QString &tracker)
|
||||
{
|
||||
emit trackerWarning(torrent->hash(), tracker);
|
||||
}
|
||||
|
||||
void TransferListFiltersWidget::trackerError(const BitTorrent::TorrentHandle *torrent, const QString &tracker)
|
||||
void TransferListFiltersWidget::trackerError(const BitTorrent::Torrent *torrent, const QString &tracker)
|
||||
{
|
||||
emit trackerError(torrent->hash(), tracker);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ class TransferListWidget;
|
|||
namespace BitTorrent
|
||||
{
|
||||
class InfoHash;
|
||||
class TorrentHandle;
|
||||
class Torrent;
|
||||
class TrackerEntry;
|
||||
}
|
||||
|
||||
|
@ -69,8 +69,8 @@ protected:
|
|||
private slots:
|
||||
virtual void showMenu(const QPoint &) = 0;
|
||||
virtual void applyFilter(int row) = 0;
|
||||
virtual void handleNewTorrent(BitTorrent::TorrentHandle *const) = 0;
|
||||
virtual void torrentAboutToBeDeleted(BitTorrent::TorrentHandle *const) = 0;
|
||||
virtual void handleNewTorrent(BitTorrent::Torrent *const) = 0;
|
||||
virtual void torrentAboutToBeDeleted(BitTorrent::Torrent *const) = 0;
|
||||
};
|
||||
|
||||
class StatusFilterWidget final : public BaseFilterWidget
|
||||
|
@ -90,8 +90,8 @@ private:
|
|||
// No need to redeclare them here as slots.
|
||||
void showMenu(const QPoint &) override;
|
||||
void applyFilter(int row) override;
|
||||
void handleNewTorrent(BitTorrent::TorrentHandle *const) override;
|
||||
void torrentAboutToBeDeleted(BitTorrent::TorrentHandle *const) override;
|
||||
void handleNewTorrent(BitTorrent::Torrent *const) override;
|
||||
void torrentAboutToBeDeleted(BitTorrent::Torrent *const) override;
|
||||
};
|
||||
|
||||
class TrackerFiltersList final : public BaseFilterWidget
|
||||
|
@ -122,8 +122,8 @@ private:
|
|||
// No need to redeclare them here as slots.
|
||||
void showMenu(const QPoint &) override;
|
||||
void applyFilter(int row) override;
|
||||
void handleNewTorrent(BitTorrent::TorrentHandle *const torrent) override;
|
||||
void torrentAboutToBeDeleted(BitTorrent::TorrentHandle *const torrent) override;
|
||||
void handleNewTorrent(BitTorrent::Torrent *const torrent) override;
|
||||
void torrentAboutToBeDeleted(BitTorrent::Torrent *const torrent) override;
|
||||
QString trackerFromRow(int row) const;
|
||||
int rowFromTracker(const QString &tracker) const;
|
||||
QSet<BitTorrent::InfoHash> getInfoHashes(int row) const;
|
||||
|
@ -150,12 +150,12 @@ public:
|
|||
void setDownloadTrackerFavicon(bool value);
|
||||
|
||||
public slots:
|
||||
void addTrackers(const BitTorrent::TorrentHandle *torrent, const QVector<BitTorrent::TrackerEntry> &trackers);
|
||||
void removeTrackers(const BitTorrent::TorrentHandle *torrent, const QVector<BitTorrent::TrackerEntry> &trackers);
|
||||
void changeTrackerless(const BitTorrent::TorrentHandle *torrent, bool trackerless);
|
||||
void trackerSuccess(const BitTorrent::TorrentHandle *torrent, const QString &tracker);
|
||||
void trackerWarning(const BitTorrent::TorrentHandle *torrent, const QString &tracker);
|
||||
void trackerError(const BitTorrent::TorrentHandle *torrent, const QString &tracker);
|
||||
void addTrackers(const BitTorrent::Torrent *torrent, const QVector<BitTorrent::TrackerEntry> &trackers);
|
||||
void removeTrackers(const BitTorrent::Torrent *torrent, const QVector<BitTorrent::TrackerEntry> &trackers);
|
||||
void changeTrackerless(const BitTorrent::Torrent *torrent, bool trackerless);
|
||||
void trackerSuccess(const BitTorrent::Torrent *torrent, const QString &tracker);
|
||||
void trackerWarning(const BitTorrent::Torrent *torrent, const QString &tracker);
|
||||
void trackerError(const BitTorrent::Torrent *torrent, const QString &tracker);
|
||||
|
||||
signals:
|
||||
void trackerSuccess(const BitTorrent::InfoHash &hash, const QString &tracker);
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include <QPalette>
|
||||
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/global.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/unicodestrings.h"
|
||||
|
@ -133,7 +133,7 @@ TransferListModel::TransferListModel(QObject *parent)
|
|||
|
||||
// Load the torrents
|
||||
using namespace BitTorrent;
|
||||
for (TorrentHandle *const torrent : asConst(Session::instance()->torrents()))
|
||||
for (Torrent *const torrent : asConst(Session::instance()->torrents()))
|
||||
addTorrent(torrent);
|
||||
|
||||
// Listen for torrent changes
|
||||
|
@ -234,7 +234,7 @@ QVariant TransferListModel::headerData(int section, Qt::Orientation orientation,
|
|||
return {};
|
||||
}
|
||||
|
||||
QString TransferListModel::displayValue(const BitTorrent::TorrentHandle *torrent, const int column) const
|
||||
QString TransferListModel::displayValue(const BitTorrent::Torrent *torrent, const int column) const
|
||||
{
|
||||
bool hideValues = false;
|
||||
if (m_hideZeroValuesMode == HideZeroValuesMode::Always)
|
||||
|
@ -276,7 +276,7 @@ QString TransferListModel::displayValue(const BitTorrent::TorrentHandle *torrent
|
|||
if (hideValues && (value <= 0))
|
||||
return {};
|
||||
|
||||
return ((static_cast<int>(value) == -1) || (value > BitTorrent::TorrentHandle::MAX_RATIO))
|
||||
return ((static_cast<int>(value) == -1) || (value > BitTorrent::Torrent::MAX_RATIO))
|
||||
? QString::fromUtf8(C_INFINITY) : Utils::String::fromDouble(value, 2);
|
||||
};
|
||||
|
||||
|
@ -399,7 +399,7 @@ QString TransferListModel::displayValue(const BitTorrent::TorrentHandle *torrent
|
|||
return {};
|
||||
}
|
||||
|
||||
QVariant TransferListModel::internalValue(const BitTorrent::TorrentHandle *torrent, const int column, const bool alt) const
|
||||
QVariant TransferListModel::internalValue(const BitTorrent::Torrent *torrent, const int column, const bool alt) const
|
||||
{
|
||||
switch (column)
|
||||
{
|
||||
|
@ -474,7 +474,7 @@ QVariant TransferListModel::data(const QModelIndex &index, const int role) const
|
|||
{
|
||||
if (!index.isValid()) return {};
|
||||
|
||||
const BitTorrent::TorrentHandle *torrent = m_torrentList.value(index.row());
|
||||
const BitTorrent::Torrent *torrent = m_torrentList.value(index.row());
|
||||
if (!torrent) return {};
|
||||
|
||||
switch (role)
|
||||
|
@ -537,7 +537,7 @@ bool TransferListModel::setData(const QModelIndex &index, const QVariant &value,
|
|||
{
|
||||
if (!index.isValid() || (role != Qt::DisplayRole)) return false;
|
||||
|
||||
BitTorrent::TorrentHandle *const torrent = m_torrentList.value(index.row());
|
||||
BitTorrent::Torrent *const torrent = m_torrentList.value(index.row());
|
||||
if (!torrent) return false;
|
||||
|
||||
// Category and Name columns can be edited
|
||||
|
@ -556,7 +556,7 @@ bool TransferListModel::setData(const QModelIndex &index, const QVariant &value,
|
|||
return true;
|
||||
}
|
||||
|
||||
void TransferListModel::addTorrent(BitTorrent::TorrentHandle *const torrent)
|
||||
void TransferListModel::addTorrent(BitTorrent::Torrent *const torrent)
|
||||
{
|
||||
Q_ASSERT(!m_torrentMap.contains(torrent));
|
||||
|
||||
|
@ -576,14 +576,14 @@ Qt::ItemFlags TransferListModel::flags(const QModelIndex &index) const
|
|||
return QAbstractListModel::flags(index) | Qt::ItemIsEditable;
|
||||
}
|
||||
|
||||
BitTorrent::TorrentHandle *TransferListModel::torrentHandle(const QModelIndex &index) const
|
||||
BitTorrent::Torrent *TransferListModel::torrentHandle(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid()) return nullptr;
|
||||
|
||||
return m_torrentList.value(index.row());
|
||||
}
|
||||
|
||||
void TransferListModel::handleTorrentAboutToBeRemoved(BitTorrent::TorrentHandle *const torrent)
|
||||
void TransferListModel::handleTorrentAboutToBeRemoved(BitTorrent::Torrent *const torrent)
|
||||
{
|
||||
const int row = m_torrentMap.value(torrent, -1);
|
||||
Q_ASSERT(row >= 0);
|
||||
|
@ -599,7 +599,7 @@ void TransferListModel::handleTorrentAboutToBeRemoved(BitTorrent::TorrentHandle
|
|||
endRemoveRows();
|
||||
}
|
||||
|
||||
void TransferListModel::handleTorrentStatusUpdated(BitTorrent::TorrentHandle *const torrent)
|
||||
void TransferListModel::handleTorrentStatusUpdated(BitTorrent::Torrent *const torrent)
|
||||
{
|
||||
const int row = m_torrentMap.value(torrent, -1);
|
||||
Q_ASSERT(row >= 0);
|
||||
|
@ -607,13 +607,13 @@ void TransferListModel::handleTorrentStatusUpdated(BitTorrent::TorrentHandle *co
|
|||
emit dataChanged(index(row, 0), index(row, columnCount() - 1));
|
||||
}
|
||||
|
||||
void TransferListModel::handleTorrentsUpdated(const QVector<BitTorrent::TorrentHandle *> &torrents)
|
||||
void TransferListModel::handleTorrentsUpdated(const QVector<BitTorrent::Torrent *> &torrents)
|
||||
{
|
||||
const int columns = (columnCount() - 1);
|
||||
|
||||
if (torrents.size() <= (m_torrentList.size() * 0.5))
|
||||
{
|
||||
for (BitTorrent::TorrentHandle *const torrent : torrents)
|
||||
for (BitTorrent::Torrent *const torrent : torrents)
|
||||
{
|
||||
const int row = m_torrentMap.value(torrent, -1);
|
||||
Q_ASSERT(row >= 0);
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <QHash>
|
||||
#include <QList>
|
||||
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
|
||||
namespace BitTorrent
|
||||
{
|
||||
|
@ -99,21 +99,21 @@ public:
|
|||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
|
||||
BitTorrent::TorrentHandle *torrentHandle(const QModelIndex &index) const;
|
||||
BitTorrent::Torrent *torrentHandle(const QModelIndex &index) const;
|
||||
|
||||
private slots:
|
||||
void addTorrent(BitTorrent::TorrentHandle *const torrent);
|
||||
void handleTorrentAboutToBeRemoved(BitTorrent::TorrentHandle *const torrent);
|
||||
void handleTorrentStatusUpdated(BitTorrent::TorrentHandle *const torrent);
|
||||
void handleTorrentsUpdated(const QVector<BitTorrent::TorrentHandle *> &torrents);
|
||||
void addTorrent(BitTorrent::Torrent *const torrent);
|
||||
void handleTorrentAboutToBeRemoved(BitTorrent::Torrent *const torrent);
|
||||
void handleTorrentStatusUpdated(BitTorrent::Torrent *const torrent);
|
||||
void handleTorrentsUpdated(const QVector<BitTorrent::Torrent *> &torrents);
|
||||
|
||||
private:
|
||||
void configure();
|
||||
QString displayValue(const BitTorrent::TorrentHandle *torrent, int column) const;
|
||||
QVariant internalValue(const BitTorrent::TorrentHandle *torrent, int column, bool alt = false) const;
|
||||
QString displayValue(const BitTorrent::Torrent *torrent, int column) const;
|
||||
QVariant internalValue(const BitTorrent::Torrent *torrent, int column, bool alt = false) const;
|
||||
|
||||
QList<BitTorrent::TorrentHandle *> m_torrentList; // maps row number to torrent handle
|
||||
QHash<BitTorrent::TorrentHandle *, int> m_torrentMap; // maps torrent handle to row number
|
||||
QList<BitTorrent::Torrent *> m_torrentList; // maps row number to torrent handle
|
||||
QHash<BitTorrent::Torrent *, int> m_torrentMap; // maps torrent handle to row number
|
||||
const QHash<BitTorrent::TorrentState, QString> m_statusStrings;
|
||||
// row text colors
|
||||
const QHash<BitTorrent::TorrentState, QColor> m_stateThemeColors;
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <QDateTime>
|
||||
|
||||
#include "base/bittorrent/infohash.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/global.h"
|
||||
#include "base/types.h"
|
||||
#include "base/utils/string.h"
|
||||
|
@ -292,7 +292,7 @@ bool TransferListSortModel::matchFilter(const int sourceRow, const QModelIndex &
|
|||
const auto *model = qobject_cast<TransferListModel *>(sourceModel());
|
||||
if (!model) return false;
|
||||
|
||||
const BitTorrent::TorrentHandle *torrent = model->torrentHandle(model->index(sourceRow, 0, sourceParent));
|
||||
const BitTorrent::Torrent *torrent = model->torrentHandle(model->index(sourceRow, 0, sourceParent));
|
||||
if (!torrent) return false;
|
||||
|
||||
return m_filter.match(torrent);
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
#include "base/bittorrent/infohash.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/bittorrent/trackerentry.h"
|
||||
#include "base/global.h"
|
||||
#include "base/logger.h"
|
||||
|
@ -77,16 +77,16 @@
|
|||
|
||||
namespace
|
||||
{
|
||||
QVector<BitTorrent::InfoHash> extractHashes(const QVector<BitTorrent::TorrentHandle *> &torrents)
|
||||
QVector<BitTorrent::InfoHash> extractHashes(const QVector<BitTorrent::Torrent *> &torrents)
|
||||
{
|
||||
QVector<BitTorrent::InfoHash> hashes;
|
||||
hashes.reserve(torrents.size());
|
||||
for (const BitTorrent::TorrentHandle *torrent : torrents)
|
||||
for (const BitTorrent::Torrent *torrent : torrents)
|
||||
hashes << torrent->hash();
|
||||
return hashes;
|
||||
}
|
||||
|
||||
bool torrentContainsPreviewableFiles(const BitTorrent::TorrentHandle *const torrent)
|
||||
bool torrentContainsPreviewableFiles(const BitTorrent::Torrent *const torrent)
|
||||
{
|
||||
if (!torrent->hasMetadata())
|
||||
return false;
|
||||
|
@ -100,7 +100,7 @@ namespace
|
|||
return false;
|
||||
}
|
||||
|
||||
void openDestinationFolder(const BitTorrent::TorrentHandle *const torrent)
|
||||
void openDestinationFolder(const BitTorrent::Torrent *const torrent)
|
||||
{
|
||||
#ifdef Q_OS_MACOS
|
||||
MacUtils::openFiles({torrent->contentPath(true)});
|
||||
|
@ -112,11 +112,11 @@ namespace
|
|||
#endif
|
||||
}
|
||||
|
||||
void removeTorrents(const QVector<BitTorrent::TorrentHandle *> &torrents, const bool isDeleteFileSelected)
|
||||
void removeTorrents(const QVector<BitTorrent::Torrent *> &torrents, const bool isDeleteFileSelected)
|
||||
{
|
||||
auto *session = BitTorrent::Session::instance();
|
||||
const DeleteOption deleteOption = isDeleteFileSelected ? TorrentAndFiles : Torrent;
|
||||
for (const BitTorrent::TorrentHandle *torrent : torrents)
|
||||
const DeleteOption deleteOption = isDeleteFileSelected ? DeleteTorrentAndFiles : DeleteTorrent;
|
||||
for (const BitTorrent::Torrent *torrent : torrents)
|
||||
session->deleteTorrent(torrent->hash(), deleteOption);
|
||||
}
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ void TransferListWidget::torrentDoubleClicked()
|
|||
if ((selectedIndexes.size() != 1) || !selectedIndexes.first().isValid()) return;
|
||||
|
||||
const QModelIndex index = m_listModel->index(mapToSource(selectedIndexes.first()).row());
|
||||
BitTorrent::TorrentHandle *const torrent = m_listModel->torrentHandle(index);
|
||||
BitTorrent::Torrent *const torrent = m_listModel->torrentHandle(index);
|
||||
if (!torrent) return;
|
||||
|
||||
int action;
|
||||
|
@ -307,22 +307,22 @@ void TransferListWidget::torrentDoubleClicked()
|
|||
}
|
||||
}
|
||||
|
||||
QVector<BitTorrent::TorrentHandle *> TransferListWidget::getSelectedTorrents() const
|
||||
QVector<BitTorrent::Torrent *> TransferListWidget::getSelectedTorrents() const
|
||||
{
|
||||
const QModelIndexList selectedRows = selectionModel()->selectedRows();
|
||||
|
||||
QVector<BitTorrent::TorrentHandle *> torrents;
|
||||
QVector<BitTorrent::Torrent *> torrents;
|
||||
torrents.reserve(selectedRows.size());
|
||||
for (const QModelIndex &index : selectedRows)
|
||||
torrents << m_listModel->torrentHandle(mapToSource(index));
|
||||
return torrents;
|
||||
}
|
||||
|
||||
QVector<BitTorrent::TorrentHandle *> TransferListWidget::getVisibleTorrents() const
|
||||
QVector<BitTorrent::Torrent *> TransferListWidget::getVisibleTorrents() const
|
||||
{
|
||||
const int visibleTorrentsCount = m_sortFilterModel->rowCount();
|
||||
|
||||
QVector<BitTorrent::TorrentHandle *> torrents;
|
||||
QVector<BitTorrent::Torrent *> torrents;
|
||||
torrents.reserve(visibleTorrentsCount);
|
||||
for (int i = 0; i < visibleTorrentsCount; ++i)
|
||||
torrents << m_listModel->torrentHandle(mapToSource(m_sortFilterModel->index(i, 0)));
|
||||
|
@ -331,7 +331,7 @@ QVector<BitTorrent::TorrentHandle *> TransferListWidget::getVisibleTorrents() co
|
|||
|
||||
void TransferListWidget::setSelectedTorrentsLocation()
|
||||
{
|
||||
const QVector<BitTorrent::TorrentHandle *> torrents = getSelectedTorrents();
|
||||
const QVector<BitTorrent::Torrent *> torrents = getSelectedTorrents();
|
||||
if (torrents.isEmpty()) return;
|
||||
|
||||
const QString oldLocation = torrents[0]->savePath();
|
||||
|
@ -340,49 +340,49 @@ void TransferListWidget::setSelectedTorrentsLocation()
|
|||
if (newLocation.isEmpty() || !QDir(newLocation).exists()) return;
|
||||
|
||||
// Actually move storage
|
||||
for (BitTorrent::TorrentHandle *const torrent : torrents)
|
||||
for (BitTorrent::Torrent *const torrent : torrents)
|
||||
torrent->move(Utils::Fs::expandPathAbs(newLocation));
|
||||
}
|
||||
|
||||
void TransferListWidget::pauseAllTorrents()
|
||||
{
|
||||
for (BitTorrent::TorrentHandle *const torrent : asConst(BitTorrent::Session::instance()->torrents()))
|
||||
for (BitTorrent::Torrent *const torrent : asConst(BitTorrent::Session::instance()->torrents()))
|
||||
torrent->pause();
|
||||
}
|
||||
|
||||
void TransferListWidget::resumeAllTorrents()
|
||||
{
|
||||
for (BitTorrent::TorrentHandle *const torrent : asConst(BitTorrent::Session::instance()->torrents()))
|
||||
for (BitTorrent::Torrent *const torrent : asConst(BitTorrent::Session::instance()->torrents()))
|
||||
torrent->resume();
|
||||
}
|
||||
|
||||
void TransferListWidget::startSelectedTorrents()
|
||||
{
|
||||
for (BitTorrent::TorrentHandle *const torrent : asConst(getSelectedTorrents()))
|
||||
for (BitTorrent::Torrent *const torrent : asConst(getSelectedTorrents()))
|
||||
torrent->resume();
|
||||
}
|
||||
|
||||
void TransferListWidget::forceStartSelectedTorrents()
|
||||
{
|
||||
for (BitTorrent::TorrentHandle *const torrent : asConst(getSelectedTorrents()))
|
||||
for (BitTorrent::Torrent *const torrent : asConst(getSelectedTorrents()))
|
||||
torrent->resume(BitTorrent::TorrentOperatingMode::Forced);
|
||||
}
|
||||
|
||||
void TransferListWidget::startVisibleTorrents()
|
||||
{
|
||||
for (BitTorrent::TorrentHandle *const torrent : asConst(getVisibleTorrents()))
|
||||
for (BitTorrent::Torrent *const torrent : asConst(getVisibleTorrents()))
|
||||
torrent->resume();
|
||||
}
|
||||
|
||||
void TransferListWidget::pauseSelectedTorrents()
|
||||
{
|
||||
for (BitTorrent::TorrentHandle *const torrent : asConst(getSelectedTorrents()))
|
||||
for (BitTorrent::Torrent *const torrent : asConst(getSelectedTorrents()))
|
||||
torrent->pause();
|
||||
}
|
||||
|
||||
void TransferListWidget::pauseVisibleTorrents()
|
||||
{
|
||||
for (BitTorrent::TorrentHandle *const torrent : asConst(getVisibleTorrents()))
|
||||
for (BitTorrent::Torrent *const torrent : asConst(getVisibleTorrents()))
|
||||
torrent->pause();
|
||||
}
|
||||
|
||||
|
@ -400,7 +400,7 @@ void TransferListWidget::deleteSelectedTorrents(const bool deleteLocalFiles)
|
|||
{
|
||||
if (m_mainWindow->currentTabWidget() != this) return;
|
||||
|
||||
const QVector<BitTorrent::TorrentHandle *> torrents = getSelectedTorrents();
|
||||
const QVector<BitTorrent::Torrent *> torrents = getSelectedTorrents();
|
||||
if (torrents.empty()) return;
|
||||
|
||||
if (Preferences::instance()->confirmTorrentDeletion())
|
||||
|
@ -423,7 +423,7 @@ void TransferListWidget::deleteSelectedTorrents(const bool deleteLocalFiles)
|
|||
|
||||
void TransferListWidget::deleteVisibleTorrents()
|
||||
{
|
||||
const QVector<BitTorrent::TorrentHandle *> torrents = getVisibleTorrents();
|
||||
const QVector<BitTorrent::Torrent *> torrents = getVisibleTorrents();
|
||||
if (torrents.empty()) return;
|
||||
|
||||
if (Preferences::instance()->confirmTorrentDeletion())
|
||||
|
@ -473,7 +473,7 @@ void TransferListWidget::bottomQueuePosSelectedTorrents()
|
|||
void TransferListWidget::copySelectedMagnetURIs() const
|
||||
{
|
||||
QStringList magnetUris;
|
||||
for (BitTorrent::TorrentHandle *const torrent : asConst(getSelectedTorrents()))
|
||||
for (BitTorrent::Torrent *const torrent : asConst(getSelectedTorrents()))
|
||||
magnetUris << torrent->createMagnetURI();
|
||||
|
||||
qApp->clipboard()->setText(magnetUris.join('\n'));
|
||||
|
@ -482,7 +482,7 @@ void TransferListWidget::copySelectedMagnetURIs() const
|
|||
void TransferListWidget::copySelectedNames() const
|
||||
{
|
||||
QStringList torrentNames;
|
||||
for (BitTorrent::TorrentHandle *const torrent : asConst(getSelectedTorrents()))
|
||||
for (BitTorrent::Torrent *const torrent : asConst(getSelectedTorrents()))
|
||||
torrentNames << torrent->name();
|
||||
|
||||
qApp->clipboard()->setText(torrentNames.join('\n'));
|
||||
|
@ -491,7 +491,7 @@ void TransferListWidget::copySelectedNames() const
|
|||
void TransferListWidget::copySelectedHashes() const
|
||||
{
|
||||
QStringList torrentHashes;
|
||||
for (BitTorrent::TorrentHandle *const torrent : asConst(getSelectedTorrents()))
|
||||
for (BitTorrent::Torrent *const torrent : asConst(getSelectedTorrents()))
|
||||
torrentHashes << torrent->hash();
|
||||
|
||||
qApp->clipboard()->setText(torrentHashes.join('\n'));
|
||||
|
@ -510,14 +510,14 @@ void TransferListWidget::openSelectedTorrentsFolder() const
|
|||
#ifdef Q_OS_MACOS
|
||||
// On macOS you expect both the files and folders to be opened in their parent
|
||||
// folders prehilighted for opening, so we use a custom method.
|
||||
for (BitTorrent::TorrentHandle *const torrent : asConst(getSelectedTorrents()))
|
||||
for (BitTorrent::Torrent *const torrent : asConst(getSelectedTorrents()))
|
||||
{
|
||||
QString path = torrent->contentPath(true);
|
||||
pathsList.insert(path);
|
||||
}
|
||||
MacUtils::openFiles(pathsList);
|
||||
#else
|
||||
for (BitTorrent::TorrentHandle *const torrent : asConst(getSelectedTorrents()))
|
||||
for (BitTorrent::Torrent *const torrent : asConst(getSelectedTorrents()))
|
||||
{
|
||||
QString path = torrent->contentPath(true);
|
||||
if (!pathsList.contains(path))
|
||||
|
@ -534,7 +534,7 @@ void TransferListWidget::openSelectedTorrentsFolder() const
|
|||
|
||||
void TransferListWidget::previewSelectedTorrents()
|
||||
{
|
||||
for (const BitTorrent::TorrentHandle *torrent : asConst(getSelectedTorrents()))
|
||||
for (const BitTorrent::Torrent *torrent : asConst(getSelectedTorrents()))
|
||||
{
|
||||
if (torrentContainsPreviewableFiles(torrent))
|
||||
{
|
||||
|
@ -553,7 +553,7 @@ void TransferListWidget::previewSelectedTorrents()
|
|||
|
||||
void TransferListWidget::setTorrentOptions()
|
||||
{
|
||||
const QVector<BitTorrent::TorrentHandle *> selectedTorrents = getSelectedTorrents();
|
||||
const QVector<BitTorrent::Torrent *> selectedTorrents = getSelectedTorrents();
|
||||
if (selectedTorrents.empty()) return;
|
||||
|
||||
auto dialog = new TorrentOptionsDialog {this, selectedTorrents};
|
||||
|
@ -569,13 +569,13 @@ void TransferListWidget::recheckSelectedTorrents()
|
|||
if (ret != QMessageBox::Yes) return;
|
||||
}
|
||||
|
||||
for (BitTorrent::TorrentHandle *const torrent : asConst(getSelectedTorrents()))
|
||||
for (BitTorrent::Torrent *const torrent : asConst(getSelectedTorrents()))
|
||||
torrent->forceRecheck();
|
||||
}
|
||||
|
||||
void TransferListWidget::reannounceSelectedTorrents()
|
||||
{
|
||||
for (BitTorrent::TorrentHandle *const torrent : asConst(getSelectedTorrents()))
|
||||
for (BitTorrent::Torrent *const torrent : asConst(getSelectedTorrents()))
|
||||
torrent->forceReannounce();
|
||||
}
|
||||
|
||||
|
@ -627,7 +627,7 @@ void TransferListWidget::displayDLHoSMenu(const QPoint&)
|
|||
|
||||
void TransferListWidget::setSelectedTorrentsSuperSeeding(const bool enabled) const
|
||||
{
|
||||
for (BitTorrent::TorrentHandle *const torrent : asConst(getSelectedTorrents()))
|
||||
for (BitTorrent::Torrent *const torrent : asConst(getSelectedTorrents()))
|
||||
{
|
||||
if (torrent->hasMetadata())
|
||||
torrent->setSuperSeeding(enabled);
|
||||
|
@ -636,19 +636,19 @@ void TransferListWidget::setSelectedTorrentsSuperSeeding(const bool enabled) con
|
|||
|
||||
void TransferListWidget::setSelectedTorrentsSequentialDownload(const bool enabled) const
|
||||
{
|
||||
for (BitTorrent::TorrentHandle *const torrent : asConst(getSelectedTorrents()))
|
||||
for (BitTorrent::Torrent *const torrent : asConst(getSelectedTorrents()))
|
||||
torrent->setSequentialDownload(enabled);
|
||||
}
|
||||
|
||||
void TransferListWidget::setSelectedFirstLastPiecePrio(const bool enabled) const
|
||||
{
|
||||
for (BitTorrent::TorrentHandle *const torrent : asConst(getSelectedTorrents()))
|
||||
for (BitTorrent::Torrent *const torrent : asConst(getSelectedTorrents()))
|
||||
torrent->setFirstLastPiecePriority(enabled);
|
||||
}
|
||||
|
||||
void TransferListWidget::setSelectedAutoTMMEnabled(const bool enabled) const
|
||||
{
|
||||
for (BitTorrent::TorrentHandle *const torrent : asConst(getSelectedTorrents()))
|
||||
for (BitTorrent::Torrent *const torrent : asConst(getSelectedTorrents()))
|
||||
torrent->setAutoTMMEnabled(enabled);
|
||||
}
|
||||
|
||||
|
@ -668,14 +668,14 @@ void TransferListWidget::askAddTagsForSelection()
|
|||
|
||||
void TransferListWidget::editTorrentTrackers()
|
||||
{
|
||||
const QVector<BitTorrent::TorrentHandle *> torrents = getSelectedTorrents();
|
||||
const QVector<BitTorrent::Torrent *> torrents = getSelectedTorrents();
|
||||
QVector<BitTorrent::TrackerEntry> commonTrackers;
|
||||
|
||||
if (!torrents.empty())
|
||||
{
|
||||
commonTrackers = torrents[0]->trackers();
|
||||
|
||||
for (const BitTorrent::TorrentHandle *torrent : torrents)
|
||||
for (const BitTorrent::Torrent *torrent : torrents)
|
||||
{
|
||||
QSet<BitTorrent::TrackerEntry> trackerSet;
|
||||
|
||||
|
@ -694,7 +694,7 @@ void TransferListWidget::editTorrentTrackers()
|
|||
|
||||
connect(trackerDialog, &QDialog::accepted, this, [torrents, trackerDialog]()
|
||||
{
|
||||
for (BitTorrent::TorrentHandle *torrent : torrents)
|
||||
for (BitTorrent::Torrent *torrent : torrents)
|
||||
torrent->replaceTrackers(trackerDialog->trackers());
|
||||
});
|
||||
|
||||
|
@ -737,11 +737,11 @@ QStringList TransferListWidget::askTagsForSelection(const QString &dialogTitle)
|
|||
return tags;
|
||||
}
|
||||
|
||||
void TransferListWidget::applyToSelectedTorrents(const std::function<void (BitTorrent::TorrentHandle *const)> &fn)
|
||||
void TransferListWidget::applyToSelectedTorrents(const std::function<void (BitTorrent::Torrent *const)> &fn)
|
||||
{
|
||||
for (const QModelIndex &index : asConst(selectionModel()->selectedRows()))
|
||||
{
|
||||
BitTorrent::TorrentHandle *const torrent = m_listModel->torrentHandle(mapToSource(index));
|
||||
BitTorrent::Torrent *const torrent = m_listModel->torrentHandle(mapToSource(index));
|
||||
Q_ASSERT(torrent);
|
||||
fn(torrent);
|
||||
}
|
||||
|
@ -753,7 +753,7 @@ void TransferListWidget::renameSelectedTorrent()
|
|||
if ((selectedIndexes.size() != 1) || !selectedIndexes.first().isValid()) return;
|
||||
|
||||
const QModelIndex mi = m_listModel->index(mapToSource(selectedIndexes.first()).row(), TransferListModel::TR_NAME);
|
||||
BitTorrent::TorrentHandle *const torrent = m_listModel->torrentHandle(mi);
|
||||
BitTorrent::Torrent *const torrent = m_listModel->torrentHandle(mi);
|
||||
if (!torrent) return;
|
||||
|
||||
// Ask for a new Name
|
||||
|
@ -775,17 +775,17 @@ void TransferListWidget::setSelectionCategory(const QString &category)
|
|||
|
||||
void TransferListWidget::addSelectionTag(const QString &tag)
|
||||
{
|
||||
applyToSelectedTorrents([&tag](BitTorrent::TorrentHandle *const torrent) { torrent->addTag(tag); });
|
||||
applyToSelectedTorrents([&tag](BitTorrent::Torrent *const torrent) { torrent->addTag(tag); });
|
||||
}
|
||||
|
||||
void TransferListWidget::removeSelectionTag(const QString &tag)
|
||||
{
|
||||
applyToSelectedTorrents([&tag](BitTorrent::TorrentHandle *const torrent) { torrent->removeTag(tag); });
|
||||
applyToSelectedTorrents([&tag](BitTorrent::Torrent *const torrent) { torrent->removeTag(tag); });
|
||||
}
|
||||
|
||||
void TransferListWidget::clearSelectionTags()
|
||||
{
|
||||
applyToSelectedTorrents([](BitTorrent::TorrentHandle *const torrent) { torrent->removeAllTags(); });
|
||||
applyToSelectedTorrents([](BitTorrent::Torrent *const torrent) { torrent->removeAllTags(); });
|
||||
}
|
||||
|
||||
void TransferListWidget::displayListMenu(const QPoint &)
|
||||
|
@ -866,7 +866,7 @@ void TransferListWidget::displayListMenu(const QPoint &)
|
|||
{
|
||||
// Get the file name
|
||||
// Get handle and pause the torrent
|
||||
const BitTorrent::TorrentHandle *torrent = m_listModel->torrentHandle(mapToSource(index));
|
||||
const BitTorrent::Torrent *torrent = m_listModel->torrentHandle(mapToSource(index));
|
||||
if (!torrent) continue;
|
||||
|
||||
if (firstCategory.isEmpty() && first)
|
||||
|
@ -1100,7 +1100,7 @@ void TransferListWidget::displayListMenu(const QPoint &)
|
|||
void TransferListWidget::currentChanged(const QModelIndex ¤t, const QModelIndex&)
|
||||
{
|
||||
qDebug("CURRENT CHANGED");
|
||||
BitTorrent::TorrentHandle *torrent = nullptr;
|
||||
BitTorrent::Torrent *torrent = nullptr;
|
||||
if (current.isValid())
|
||||
{
|
||||
torrent = m_listModel->torrentHandle(mapToSource(current));
|
||||
|
|
|
@ -40,7 +40,7 @@ class TransferListSortModel;
|
|||
namespace BitTorrent
|
||||
{
|
||||
class InfoHash;
|
||||
class TorrentHandle;
|
||||
class Torrent;
|
||||
}
|
||||
|
||||
class TransferListWidget final : public QTreeView
|
||||
|
@ -96,7 +96,7 @@ protected:
|
|||
QModelIndex mapToSource(const QModelIndex &index) const;
|
||||
QModelIndex mapFromSource(const QModelIndex &index) const;
|
||||
bool loadSettings();
|
||||
QVector<BitTorrent::TorrentHandle *> getSelectedTorrents() const;
|
||||
QVector<BitTorrent::Torrent *> getSelectedTorrents() const;
|
||||
|
||||
protected slots:
|
||||
void torrentDoubleClicked();
|
||||
|
@ -110,7 +110,7 @@ protected slots:
|
|||
void saveSettings();
|
||||
|
||||
signals:
|
||||
void currentTorrentChanged(BitTorrent::TorrentHandle *const torrent);
|
||||
void currentTorrentChanged(BitTorrent::Torrent *const torrent);
|
||||
|
||||
private:
|
||||
void wheelEvent(QWheelEvent *event) override;
|
||||
|
@ -118,8 +118,8 @@ private:
|
|||
void editTorrentTrackers();
|
||||
void confirmRemoveAllTagsForSelection();
|
||||
QStringList askTagsForSelection(const QString &dialogTitle);
|
||||
void applyToSelectedTorrents(const std::function<void (BitTorrent::TorrentHandle *const)> &fn);
|
||||
QVector<BitTorrent::TorrentHandle *> getVisibleTorrents() const;
|
||||
void applyToSelectedTorrents(const std::function<void (BitTorrent::Torrent *const)> &fn);
|
||||
QVector<BitTorrent::Torrent *> getVisibleTorrents() const;
|
||||
|
||||
TransferListDelegate *m_listDelegate;
|
||||
TransferListModel *m_listModel;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue