mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-03 06:02:29 -06: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:
committed by
sledgehammer999
parent
0cbd15890a
commit
1880082017
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user