mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 13:18:06 -06:00
committed by
GitHub
parent
d2fceaa228
commit
5ef2a1df07
@@ -38,6 +38,7 @@
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
#include <QList>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
@@ -46,7 +47,6 @@
|
||||
#include <QSize>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
#include <QVector>
|
||||
|
||||
#include "base/bittorrent/addtorrentparams.h"
|
||||
#include "base/bittorrent/downloadpriority.h"
|
||||
@@ -143,7 +143,7 @@ class AddNewTorrentDialog::TorrentContentAdaptor final
|
||||
{
|
||||
public:
|
||||
TorrentContentAdaptor(const BitTorrent::TorrentInfo &torrentInfo, PathList &filePaths
|
||||
, QVector<BitTorrent::DownloadPriority> &filePriorities, std::function<void ()> onFilePrioritiesChanged)
|
||||
, QList<BitTorrent::DownloadPriority> &filePriorities, std::function<void ()> onFilePrioritiesChanged)
|
||||
: m_torrentInfo {torrentInfo}
|
||||
, m_filePaths {filePaths}
|
||||
, m_filePriorities {filePriorities}
|
||||
@@ -227,29 +227,29 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
QVector<BitTorrent::DownloadPriority> filePriorities() const override
|
||||
QList<BitTorrent::DownloadPriority> filePriorities() const override
|
||||
{
|
||||
return m_filePriorities.isEmpty()
|
||||
? QVector<BitTorrent::DownloadPriority>(filesCount(), BitTorrent::DownloadPriority::Normal)
|
||||
? QList<BitTorrent::DownloadPriority>(filesCount(), BitTorrent::DownloadPriority::Normal)
|
||||
: m_filePriorities;
|
||||
}
|
||||
|
||||
QVector<qreal> filesProgress() const override
|
||||
QList<qreal> filesProgress() const override
|
||||
{
|
||||
return QVector<qreal>(filesCount(), 0);
|
||||
return QList<qreal>(filesCount(), 0);
|
||||
}
|
||||
|
||||
QVector<qreal> availableFileFractions() const override
|
||||
QList<qreal> availableFileFractions() const override
|
||||
{
|
||||
return QVector<qreal>(filesCount(), 0);
|
||||
return QList<qreal>(filesCount(), 0);
|
||||
}
|
||||
|
||||
void fetchAvailableFileFractions(std::function<void (QVector<qreal>)> resultHandler) const override
|
||||
void fetchAvailableFileFractions(std::function<void (QList<qreal>)> resultHandler) const override
|
||||
{
|
||||
resultHandler(availableFileFractions());
|
||||
}
|
||||
|
||||
void prioritizeFiles(const QVector<BitTorrent::DownloadPriority> &priorities) override
|
||||
void prioritizeFiles(const QList<BitTorrent::DownloadPriority> &priorities) override
|
||||
{
|
||||
Q_ASSERT(priorities.size() == filesCount());
|
||||
m_filePriorities = priorities;
|
||||
@@ -274,7 +274,7 @@ public:
|
||||
private:
|
||||
const BitTorrent::TorrentInfo &m_torrentInfo;
|
||||
PathList &m_filePaths;
|
||||
QVector<BitTorrent::DownloadPriority> &m_filePriorities;
|
||||
QList<BitTorrent::DownloadPriority> &m_filePriorities;
|
||||
std::function<void ()> m_onFilePrioritiesChanged;
|
||||
Path m_originalRootFolder;
|
||||
BitTorrent::TorrentContentLayout m_currentContentLayout;
|
||||
@@ -594,7 +594,7 @@ void AddNewTorrentDialog::updateDiskSpaceLabel()
|
||||
if (hasMetadata)
|
||||
{
|
||||
const auto torrentInfo = *torrentDescr.info();
|
||||
const QVector<BitTorrent::DownloadPriority> &priorities = m_contentAdaptor->filePriorities();
|
||||
const QList<BitTorrent::DownloadPriority> &priorities = m_contentAdaptor->filePriorities();
|
||||
Q_ASSERT(priorities.size() == torrentInfo.filesCount());
|
||||
for (int i = 0; i < priorities.size(); ++i)
|
||||
{
|
||||
@@ -916,7 +916,7 @@ void AddNewTorrentDialog::setupTreeview()
|
||||
if (BitTorrent::Session::instance()->isExcludedFileNamesEnabled())
|
||||
{
|
||||
// Check file name blacklist for torrents that are manually added
|
||||
QVector<BitTorrent::DownloadPriority> priorities = m_contentAdaptor->filePriorities();
|
||||
QList<BitTorrent::DownloadPriority> priorities = m_contentAdaptor->filePriorities();
|
||||
BitTorrent::Session::instance()->applyFilenameFilter(m_contentAdaptor->filePaths(), priorities);
|
||||
m_contentAdaptor->prioritizeFiles(priorities);
|
||||
}
|
||||
|
||||
36
src/gui/filtermode.h
Normal file
36
src/gui/filtermode.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2024 Vladimir Golovnev <glassez@yandex.ru>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* In addition, as a special exception, the copyright holders give permission to
|
||||
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
||||
* modified versions of it that use the same license as the "OpenSSL" library),
|
||||
* and distribute the linked executables. You must obey the GNU General Public
|
||||
* License in all respects for all of the code used other than "OpenSSL". If you
|
||||
* modify file(s), you may extend this exception to your version of the file(s),
|
||||
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||
* exception statement from your version.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
enum class FilterMode
|
||||
{
|
||||
PlainText = 0,
|
||||
Wildcard = 1,
|
||||
Regex = 2
|
||||
};
|
||||
@@ -254,7 +254,7 @@ MainWindow::MainWindow(IGUIApplication *app, const WindowState initialState, con
|
||||
#endif
|
||||
tr("Transfers"));
|
||||
// Filter types
|
||||
const QVector<TransferListModel::Column> filterTypes = {TransferListModel::Column::TR_NAME, TransferListModel::Column::TR_SAVE_PATH};
|
||||
const QList<TransferListModel::Column> filterTypes = {TransferListModel::Column::TR_NAME, TransferListModel::Column::TR_SAVE_PATH};
|
||||
for (const TransferListModel::Column type : filterTypes)
|
||||
{
|
||||
const QString typeName = m_transferListWidget->getSourceModel()->headerData(type, Qt::Horizontal, Qt::DisplayRole).value<QString>();
|
||||
@@ -1172,7 +1172,7 @@ void MainWindow::closeEvent(QCloseEvent *e)
|
||||
}
|
||||
#endif // Q_OS_MACOS
|
||||
|
||||
const QVector<BitTorrent::Torrent *> allTorrents = BitTorrent::Session::instance()->torrents();
|
||||
const QList<BitTorrent::Torrent *> allTorrents = BitTorrent::Session::instance()->torrents();
|
||||
const bool hasActiveTorrents = std::any_of(allTorrents.cbegin(), allTorrents.cend(), [](BitTorrent::Torrent *torrent)
|
||||
{
|
||||
return torrent->isActive();
|
||||
@@ -1523,7 +1523,7 @@ void MainWindow::loadSessionStats()
|
||||
refreshWindowTitle();
|
||||
}
|
||||
|
||||
void MainWindow::reloadTorrentStats(const QVector<BitTorrent::Torrent *> &torrents)
|
||||
void MainWindow::reloadTorrentStats(const QList<BitTorrent::Torrent *> &torrents)
|
||||
{
|
||||
if (currentTabWidget() == m_transferListWidget)
|
||||
{
|
||||
@@ -1868,7 +1868,7 @@ void MainWindow::updatePowerManagementState() const
|
||||
const bool preventFromSuspendWhenDownloading = pref->preventFromSuspendWhenDownloading();
|
||||
const bool preventFromSuspendWhenSeeding = pref->preventFromSuspendWhenSeeding();
|
||||
|
||||
const QVector<BitTorrent::Torrent *> allTorrents = BitTorrent::Session::instance()->torrents();
|
||||
const QList<BitTorrent::Torrent *> allTorrents = BitTorrent::Session::instance()->torrents();
|
||||
const bool inhibitSuspend = std::any_of(allTorrents.cbegin(), allTorrents.cend(), [&](const BitTorrent::Torrent *torrent)
|
||||
{
|
||||
if (preventFromSuspendWhenDownloading && (!torrent->isFinished() && !torrent->isStopped() && !torrent->isErrored() && torrent->hasMetadata()))
|
||||
|
||||
@@ -128,7 +128,7 @@ private slots:
|
||||
void displayExecutionLogTab();
|
||||
void toggleFocusBetweenLineEdits();
|
||||
void loadSessionStats();
|
||||
void reloadTorrentStats(const QVector<BitTorrent::Torrent *> &torrents);
|
||||
void reloadTorrentStats(const QList<BitTorrent::Torrent *> &torrents);
|
||||
void loadPreferences();
|
||||
void optionsSaved();
|
||||
void toggleAlternativeSpeeds();
|
||||
|
||||
@@ -1179,7 +1179,7 @@ void OptionsDialog::saveBittorrentTabOptions() const
|
||||
session->setGlobalMaxRatio(getMaxRatio());
|
||||
session->setGlobalMaxSeedingMinutes(getMaxSeedingMinutes());
|
||||
session->setGlobalMaxInactiveSeedingMinutes(getMaxInactiveSeedingMinutes());
|
||||
const QVector<BitTorrent::ShareLimitAction> actIndex =
|
||||
const QList<BitTorrent::ShareLimitAction> actIndex =
|
||||
{
|
||||
BitTorrent::ShareLimitAction::Stop,
|
||||
BitTorrent::ShareLimitAction::Remove,
|
||||
|
||||
@@ -81,7 +81,7 @@ PreviewSelectDialog::PreviewSelectDialog(QWidget *parent, const BitTorrent::Torr
|
||||
m_ui->previewList->setItemDelegate(listDelegate);
|
||||
|
||||
// Fill list in
|
||||
const QVector<qreal> fp = torrent->filesProgress();
|
||||
const QList<qreal> fp = torrent->filesProgress();
|
||||
for (int i = 0; i < torrent->filesCount(); ++i)
|
||||
{
|
||||
const Path filePath = torrent->filePath(i);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <cmath>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QVector>
|
||||
#include <QList>
|
||||
|
||||
#include "base/global.h"
|
||||
|
||||
@@ -51,9 +51,9 @@ DownloadedPiecesBar::DownloadedPiecesBar(QWidget *parent)
|
||||
{
|
||||
}
|
||||
|
||||
QVector<float> DownloadedPiecesBar::bitfieldToFloatVector(const QBitArray &vecin, int reqSize)
|
||||
QList<float> DownloadedPiecesBar::bitfieldToFloatVector(const QBitArray &vecin, int reqSize)
|
||||
{
|
||||
QVector<float> result(reqSize, 0.0);
|
||||
QList<float> result(reqSize, 0.0);
|
||||
if (vecin.isEmpty()) return result;
|
||||
|
||||
const float ratio = vecin.size() / static_cast<float>(reqSize);
|
||||
@@ -145,8 +145,8 @@ bool DownloadedPiecesBar::updateImage(QImage &image)
|
||||
return true;
|
||||
}
|
||||
|
||||
QVector<float> scaledPieces = bitfieldToFloatVector(m_pieces, image2.width());
|
||||
QVector<float> scaledPiecesDl = bitfieldToFloatVector(m_downloadedPieces, image2.width());
|
||||
QList<float> scaledPieces = bitfieldToFloatVector(m_pieces, image2.width());
|
||||
QList<float> scaledPiecesDl = bitfieldToFloatVector(m_downloadedPieces, image2.width());
|
||||
|
||||
// filling image
|
||||
for (int x = 0; x < scaledPieces.size(); ++x)
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
|
||||
private:
|
||||
// scale bitfield vector to float vector
|
||||
QVector<float> bitfieldToFloatVector(const QBitArray &vecin, int reqSize);
|
||||
QList<float> bitfieldToFloatVector(const QBitArray &vecin, int reqSize);
|
||||
bool updateImage(QImage &image) override;
|
||||
QString simpleToolTipText() const override;
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <QClipboard>
|
||||
#include <QHeaderView>
|
||||
#include <QHostAddress>
|
||||
#include <QList>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QPointer>
|
||||
@@ -42,7 +43,6 @@
|
||||
#include <QShortcut>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QStandardItemModel>
|
||||
#include <QVector>
|
||||
#include <QWheelEvent>
|
||||
|
||||
#include "base/bittorrent/peeraddress.h"
|
||||
@@ -290,7 +290,7 @@ void PeerListWidget::showPeerListMenu()
|
||||
QAction *addNewPeer = menu->addAction(UIThemeManager::instance()->getIcon(u"peers-add"_s), tr("Add peers...")
|
||||
, this, [this, torrent]()
|
||||
{
|
||||
const QVector<BitTorrent::PeerAddress> peersList = PeersAdditionDialog::askForPeers(this);
|
||||
const QList<BitTorrent::PeerAddress> peersList = PeersAdditionDialog::askForPeers(this);
|
||||
const int peerCount = std::count_if(peersList.cbegin(), peersList.cend(), [torrent](const BitTorrent::PeerAddress &peer)
|
||||
{
|
||||
return torrent->connectPeer(peer);
|
||||
@@ -335,7 +335,7 @@ void PeerListWidget::banSelectedPeers()
|
||||
// Store selected rows first as selected peers may disconnect
|
||||
const QModelIndexList selectedIndexes = selectionModel()->selectedRows();
|
||||
|
||||
QVector<QString> selectedIPs;
|
||||
QList<QString> selectedIPs;
|
||||
selectedIPs.reserve(selectedIndexes.size());
|
||||
|
||||
for (const QModelIndex &index : selectedIndexes)
|
||||
@@ -405,7 +405,7 @@ void PeerListWidget::loadPeers(const BitTorrent::Torrent *torrent)
|
||||
return;
|
||||
|
||||
using TorrentPtr = QPointer<const BitTorrent::Torrent>;
|
||||
torrent->fetchPeerInfo([this, torrent = TorrentPtr(torrent)](const QVector<BitTorrent::PeerInfo> &peers)
|
||||
torrent->fetchPeerInfo([this, torrent = TorrentPtr(torrent)](const QList<BitTorrent::PeerInfo> &peers)
|
||||
{
|
||||
if (torrent != m_properties->getCurrentTorrent())
|
||||
return;
|
||||
|
||||
@@ -50,7 +50,7 @@ PeersAdditionDialog::~PeersAdditionDialog()
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
QVector<BitTorrent::PeerAddress> PeersAdditionDialog::askForPeers(QWidget *parent)
|
||||
QList<BitTorrent::PeerAddress> PeersAdditionDialog::askForPeers(QWidget *parent)
|
||||
{
|
||||
PeersAdditionDialog dlg(parent);
|
||||
dlg.exec();
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include <QVector>
|
||||
#include <QList>
|
||||
|
||||
#include "base/bittorrent/peerinfo.h"
|
||||
|
||||
@@ -47,12 +47,12 @@ public:
|
||||
PeersAdditionDialog(QWidget *parent);
|
||||
~PeersAdditionDialog();
|
||||
|
||||
static QVector<BitTorrent::PeerAddress> askForPeers(QWidget *parent);
|
||||
static QList<BitTorrent::PeerAddress> askForPeers(QWidget *parent);
|
||||
|
||||
protected slots:
|
||||
void validateInput();
|
||||
|
||||
private:
|
||||
Ui::PeersAdditionDialog *m_ui = nullptr;
|
||||
QVector<BitTorrent::PeerAddress> m_peersList;
|
||||
QList<BitTorrent::PeerAddress> m_peersList;
|
||||
};
|
||||
|
||||
@@ -40,9 +40,9 @@ PieceAvailabilityBar::PieceAvailabilityBar(QWidget *parent)
|
||||
{
|
||||
}
|
||||
|
||||
QVector<float> PieceAvailabilityBar::intToFloatVector(const QVector<int> &vecin, int reqSize)
|
||||
QList<float> PieceAvailabilityBar::intToFloatVector(const QList<int> &vecin, int reqSize)
|
||||
{
|
||||
QVector<float> result(reqSize, 0.0);
|
||||
QList<float> result(reqSize, 0.0);
|
||||
if (vecin.isEmpty()) return result;
|
||||
|
||||
const float ratio = static_cast<float>(vecin.size()) / reqSize;
|
||||
@@ -142,7 +142,7 @@ bool PieceAvailabilityBar::updateImage(QImage &image)
|
||||
return true;
|
||||
}
|
||||
|
||||
QVector<float> scaledPieces = intToFloatVector(m_pieces, image2.width());
|
||||
QList<float> scaledPieces = intToFloatVector(m_pieces, image2.width());
|
||||
|
||||
// filling image
|
||||
for (int x = 0; x < scaledPieces.size(); ++x)
|
||||
@@ -154,7 +154,7 @@ bool PieceAvailabilityBar::updateImage(QImage &image)
|
||||
return true;
|
||||
}
|
||||
|
||||
void PieceAvailabilityBar::setAvailability(const QVector<int> &avail)
|
||||
void PieceAvailabilityBar::setAvailability(const QList<int> &avail)
|
||||
{
|
||||
m_pieces = avail;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class PieceAvailabilityBar final : public PiecesBar
|
||||
public:
|
||||
PieceAvailabilityBar(QWidget *parent);
|
||||
|
||||
void setAvailability(const QVector<int> &avail);
|
||||
void setAvailability(const QList<int> &avail);
|
||||
|
||||
// PiecesBar interface
|
||||
void clear() override;
|
||||
@@ -51,8 +51,8 @@ private:
|
||||
|
||||
// last used int vector, uses to better resize redraw
|
||||
// TODO: make a diff pieces to new pieces and update only changed pixels, speedup when update > 20x faster
|
||||
QVector<int> m_pieces;
|
||||
QList<int> m_pieces;
|
||||
|
||||
// scale int vector to float vector
|
||||
QVector<float> intToFloatVector(const QVector<int> &vecin, int reqSize);
|
||||
QList<float> intToFloatVector(const QList<int> &vecin, int reqSize);
|
||||
};
|
||||
|
||||
@@ -222,7 +222,7 @@ QColor PiecesBar::colorBoxBorderColor() const
|
||||
return palette().color(QPalette::ToolTipText);
|
||||
}
|
||||
|
||||
const QVector<QRgb> &PiecesBar::pieceColors() const
|
||||
const QList<QRgb> &PiecesBar::pieceColors() const
|
||||
{
|
||||
return m_pieceColors;
|
||||
}
|
||||
@@ -261,7 +261,7 @@ void PiecesBar::showToolTip(const QHelpEvent *e)
|
||||
{
|
||||
const PieceIndexToImagePos transform {torrentInfo, m_image};
|
||||
const int pieceIndex = transform.pieceIndex(imagePos);
|
||||
const QVector<int> fileIndexes = torrentInfo.fileIndicesForPiece(pieceIndex);
|
||||
const QList<int> fileIndexes = torrentInfo.fileIndicesForPiece(pieceIndex);
|
||||
|
||||
QString tooltipTitle;
|
||||
if (fileIndexes.count() > 1)
|
||||
@@ -305,7 +305,7 @@ void PiecesBar::highlightFile(int imagePos)
|
||||
PieceIndexToImagePos transform {torrentInfo, m_image};
|
||||
|
||||
int pieceIndex = transform.pieceIndex(imagePos);
|
||||
QVector<int> fileIndices {torrentInfo.fileIndicesForPiece(pieceIndex)};
|
||||
QList<int> fileIndices {torrentInfo.fileIndicesForPiece(pieceIndex)};
|
||||
if (fileIndices.count() == 1)
|
||||
{
|
||||
BitTorrent::TorrentInfo::PieceRange filePieces = torrentInfo.filePieces(fileIndices.first());
|
||||
@@ -327,7 +327,7 @@ void PiecesBar::highlightFile(int imagePos)
|
||||
|
||||
void PiecesBar::updatePieceColors()
|
||||
{
|
||||
m_pieceColors = QVector<QRgb>(256);
|
||||
m_pieceColors = QList<QRgb>(256);
|
||||
for (int i = 0; i < 256; ++i)
|
||||
{
|
||||
float ratio = (i / 255.0);
|
||||
|
||||
@@ -70,7 +70,7 @@ protected:
|
||||
QColor borderColor() const;
|
||||
QColor pieceColor() const;
|
||||
QColor colorBoxBorderColor() const;
|
||||
const QVector<QRgb> &pieceColors() const;
|
||||
const QList<QRgb> &pieceColors() const;
|
||||
|
||||
// mix two colors by light model, ratio <0, 1>
|
||||
static QRgb mixTwoColors(QRgb rgb1, QRgb rgb2, float ratio);
|
||||
@@ -91,7 +91,7 @@ private:
|
||||
const BitTorrent::Torrent *m_torrent = nullptr;
|
||||
QImage m_image;
|
||||
// buffered 256 levels gradient from bg_color to piece_color
|
||||
QVector<QRgb> m_pieceColors;
|
||||
QList<QRgb> m_pieceColors;
|
||||
bool m_hovered = false;
|
||||
QRect m_highlightedRegion; // part of the bar can be highlighted; this rectangle is in the same frame as m_image
|
||||
};
|
||||
|
||||
@@ -471,7 +471,7 @@ void PropertiesWidget::loadDynamicData()
|
||||
{
|
||||
// Pieces availability
|
||||
showPiecesAvailability(true);
|
||||
m_torrent->fetchPieceAvailability([this, torrent = TorrentPtr(m_torrent)](const QVector<int> &pieceAvailability)
|
||||
m_torrent->fetchPieceAvailability([this, torrent = TorrentPtr(m_torrent)](const QList<int> &pieceAvailability)
|
||||
{
|
||||
if (torrent == m_torrent)
|
||||
m_piecesAvailability->setAvailability(pieceAvailability);
|
||||
@@ -517,7 +517,7 @@ void PropertiesWidget::loadUrlSeeds()
|
||||
return;
|
||||
|
||||
using TorrentPtr = QPointer<BitTorrent::Torrent>;
|
||||
m_torrent->fetchURLSeeds([this, torrent = TorrentPtr(m_torrent)](const QVector<QUrl> &urlSeeds)
|
||||
m_torrent->fetchURLSeeds([this, torrent = TorrentPtr(m_torrent)](const QList<QUrl> &urlSeeds)
|
||||
{
|
||||
if (torrent != m_torrent)
|
||||
return;
|
||||
@@ -620,7 +620,7 @@ void PropertiesWidget::deleteSelectedUrlSeeds()
|
||||
const QList<QListWidgetItem *> selectedItems = m_ui->listWebSeeds->selectedItems();
|
||||
if (selectedItems.isEmpty()) return;
|
||||
|
||||
QVector<QUrl> urlSeeds;
|
||||
QList<QUrl> urlSeeds;
|
||||
urlSeeds.reserve(selectedItems.size());
|
||||
|
||||
for (const QListWidgetItem *item : selectedItems)
|
||||
|
||||
@@ -292,7 +292,7 @@ void SpeedPlotView::paintEvent(QPaintEvent *)
|
||||
rect.adjust(0, fontMetrics.height(), 0, 0); // Add top padding for top speed text
|
||||
|
||||
// draw Y axis speed labels
|
||||
const QVector<QString> speedLabels =
|
||||
const QList<QString> speedLabels =
|
||||
{
|
||||
formatLabel(niceScale.arg, niceScale.unit),
|
||||
formatLabel((0.75 * niceScale.arg), niceScale.unit),
|
||||
@@ -358,7 +358,7 @@ void SpeedPlotView::paintEvent(QPaintEvent *)
|
||||
if (!m_properties[static_cast<GraphID>(id)].enable)
|
||||
continue;
|
||||
|
||||
QVector<QPoint> points;
|
||||
QList<QPoint> points;
|
||||
milliseconds duration {0};
|
||||
|
||||
for (int i = static_cast<int>(queue.size()) - 1; i >= 0; --i)
|
||||
|
||||
@@ -249,9 +249,9 @@ void PluginSelectDialog::setRowColor(const int row, const QString &color)
|
||||
}
|
||||
}
|
||||
|
||||
QVector<QTreeWidgetItem*> PluginSelectDialog::findItemsWithUrl(const QString &url)
|
||||
QList<QTreeWidgetItem*> PluginSelectDialog::findItemsWithUrl(const QString &url)
|
||||
{
|
||||
QVector<QTreeWidgetItem*> res;
|
||||
QList<QTreeWidgetItem*> res;
|
||||
res.reserve(m_ui->pluginsTree->topLevelItemCount());
|
||||
|
||||
for (int i = 0; i < m_ui->pluginsTree->topLevelItemCount(); ++i)
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
explicit PluginSelectDialog(SearchPluginManager *pluginManager, QWidget *parent = nullptr);
|
||||
~PluginSelectDialog() override;
|
||||
|
||||
QVector<QTreeWidgetItem*> findItemsWithUrl(const QString &url);
|
||||
QList<QTreeWidgetItem*> findItemsWithUrl(const QString &url);
|
||||
QTreeWidgetItem *findItemWithID(const QString &id);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -508,7 +508,7 @@ void SearchJobWidget::searchFailed()
|
||||
setStatus(Status::Error);
|
||||
}
|
||||
|
||||
void SearchJobWidget::appendSearchResults(const QVector<SearchResult> &results)
|
||||
void SearchJobWidget::appendSearchResults(const QList<SearchResult> &results)
|
||||
{
|
||||
for (const SearchResult &result : results)
|
||||
{
|
||||
|
||||
@@ -105,7 +105,7 @@ private:
|
||||
void onItemDoubleClicked(const QModelIndex &index);
|
||||
void searchFinished(bool cancelled);
|
||||
void searchFailed();
|
||||
void appendSearchResults(const QVector<SearchResult> &results);
|
||||
void appendSearchResults(const QList<SearchResult> &results);
|
||||
void updateResultsCount();
|
||||
void setStatus(Status value);
|
||||
void downloadTorrent(const QModelIndex &rowIndex, AddTorrentOption option = AddTorrentOption::Default);
|
||||
|
||||
@@ -40,13 +40,13 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QEvent>
|
||||
#include <QList>
|
||||
#include <QMessageBox>
|
||||
#include <QMenu>
|
||||
#include <QMouseEvent>
|
||||
#include <QObject>
|
||||
#include <QRegularExpression>
|
||||
#include <QShortcut>
|
||||
#include <QVector>
|
||||
|
||||
#include "base/global.h"
|
||||
#include "base/search/searchhandler.h"
|
||||
@@ -184,7 +184,7 @@ void SearchWidget::fillCatCombobox()
|
||||
m_ui->comboCategory->addItem(SearchPluginManager::categoryFullName(u"all"_s), u"all"_s);
|
||||
|
||||
using QStrPair = std::pair<QString, QString>;
|
||||
QVector<QStrPair> tmpList;
|
||||
QList<QStrPair> tmpList;
|
||||
for (const QString &cat : asConst(SearchPluginManager::instance()->getPluginCategories(selectedPlugin())))
|
||||
tmpList << std::make_pair(SearchPluginManager::categoryFullName(cat), cat);
|
||||
std::sort(tmpList.begin(), tmpList.end(), [](const QStrPair &l, const QStrPair &r) { return (QString::localeAwareCompare(l.first, r.first) < 0); });
|
||||
@@ -207,7 +207,7 @@ void SearchWidget::fillPluginComboBox()
|
||||
m_ui->selectPlugin->addItem(tr("Select..."), u"multi"_s);
|
||||
|
||||
using QStrPair = std::pair<QString, QString>;
|
||||
QVector<QStrPair> tmpList;
|
||||
QList<QStrPair> tmpList;
|
||||
for (const QString &name : asConst(SearchPluginManager::instance()->enabledPlugins()))
|
||||
tmpList << std::make_pair(SearchPluginManager::instance()->pluginFullName(name), name);
|
||||
std::sort(tmpList.begin(), tmpList.end(), [](const QStrPair &l, const QStrPair &r) { return (l.first < r.first); } );
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace
|
||||
|
||||
TorrentContentModel::TorrentContentModel(QObject *parent)
|
||||
: QAbstractItemModel(parent)
|
||||
, m_rootItem(new TorrentContentModelFolder(QVector<QString>({ tr("Name"), tr("Total Size"), tr("Progress"), tr("Download Priority"), tr("Remaining"), tr("Availability") })))
|
||||
, m_rootItem(new TorrentContentModelFolder(QList<QString>({ tr("Name"), tr("Total Size"), tr("Progress"), tr("Download Priority"), tr("Remaining"), tr("Availability") })))
|
||||
#if defined(Q_OS_WIN)
|
||||
, m_fileIconProvider {new QFileIconProvider}
|
||||
#elif defined(Q_OS_MACOS)
|
||||
@@ -185,7 +185,7 @@ void TorrentContentModel::updateFilesProgress()
|
||||
{
|
||||
Q_ASSERT(m_contentHandler && m_contentHandler->hasMetadata());
|
||||
|
||||
const QVector<qreal> &filesProgress = m_contentHandler->filesProgress();
|
||||
const QList<qreal> &filesProgress = m_contentHandler->filesProgress();
|
||||
Q_ASSERT(m_filesIndex.size() == filesProgress.size());
|
||||
// XXX: Why is this necessary?
|
||||
if (m_filesIndex.size() != filesProgress.size()) [[unlikely]]
|
||||
@@ -202,7 +202,7 @@ void TorrentContentModel::updateFilesPriorities()
|
||||
{
|
||||
Q_ASSERT(m_contentHandler && m_contentHandler->hasMetadata());
|
||||
|
||||
const QVector<BitTorrent::DownloadPriority> fprio = m_contentHandler->filePriorities();
|
||||
const QList<BitTorrent::DownloadPriority> fprio = m_contentHandler->filePriorities();
|
||||
Q_ASSERT(m_filesIndex.size() == fprio.size());
|
||||
// XXX: Why is this necessary?
|
||||
if (m_filesIndex.size() != fprio.size())
|
||||
@@ -217,7 +217,7 @@ void TorrentContentModel::updateFilesAvailability()
|
||||
Q_ASSERT(m_contentHandler && m_contentHandler->hasMetadata());
|
||||
|
||||
using HandlerPtr = QPointer<BitTorrent::TorrentContentHandler>;
|
||||
m_contentHandler->fetchAvailableFileFractions([this, handler = HandlerPtr(m_contentHandler)](const QVector<qreal> &availableFileFractions)
|
||||
m_contentHandler->fetchAvailableFileFractions([this, handler = HandlerPtr(m_contentHandler)](const QList<qreal> &availableFileFractions)
|
||||
{
|
||||
if (handler != m_contentHandler)
|
||||
return;
|
||||
@@ -250,7 +250,7 @@ bool TorrentContentModel::setItemPriority(const QModelIndex &index, BitTorrent::
|
||||
m_rootItem->recalculateProgress();
|
||||
m_rootItem->recalculateAvailability();
|
||||
|
||||
const QVector<ColumnInterval> columns =
|
||||
const QList<ColumnInterval> columns =
|
||||
{
|
||||
{TorrentContentModelItem::COL_NAME, TorrentContentModelItem::COL_NAME},
|
||||
{TorrentContentModelItem::COL_PRIO, TorrentContentModelItem::COL_PRIO}
|
||||
@@ -260,9 +260,9 @@ bool TorrentContentModel::setItemPriority(const QModelIndex &index, BitTorrent::
|
||||
return true;
|
||||
}
|
||||
|
||||
QVector<BitTorrent::DownloadPriority> TorrentContentModel::getFilePriorities() const
|
||||
QList<BitTorrent::DownloadPriority> TorrentContentModel::getFilePriorities() const
|
||||
{
|
||||
QVector<BitTorrent::DownloadPriority> prio;
|
||||
QList<BitTorrent::DownloadPriority> prio;
|
||||
prio.reserve(m_filesIndex.size());
|
||||
for (const TorrentContentModelFile *file : asConst(m_filesIndex))
|
||||
prio.push_back(file->priority());
|
||||
@@ -523,7 +523,7 @@ void TorrentContentModel::populate()
|
||||
m_filesIndex.reserve(filesCount);
|
||||
|
||||
QHash<TorrentContentModelFolder *, QHash<QString, TorrentContentModelFolder *>> folderMap;
|
||||
QVector<QString> lastParentPath;
|
||||
QList<QString> lastParentPath;
|
||||
TorrentContentModelFolder *lastParent = m_rootItem;
|
||||
// Iterate over files
|
||||
for (int i = 0; i < filesCount; ++i)
|
||||
@@ -602,7 +602,7 @@ void TorrentContentModel::refresh()
|
||||
updateFilesPriorities();
|
||||
updateFilesAvailability();
|
||||
|
||||
const QVector<ColumnInterval> columns =
|
||||
const QList<ColumnInterval> columns =
|
||||
{
|
||||
{TorrentContentModelItem::COL_NAME, TorrentContentModelItem::COL_NAME},
|
||||
{TorrentContentModelItem::COL_PROGRESS, TorrentContentModelItem::COL_PROGRESS},
|
||||
@@ -619,7 +619,7 @@ void TorrentContentModel::refresh()
|
||||
}
|
||||
}
|
||||
|
||||
void TorrentContentModel::notifySubtreeUpdated(const QModelIndex &index, const QVector<ColumnInterval> &columns)
|
||||
void TorrentContentModel::notifySubtreeUpdated(const QModelIndex &index, const QList<ColumnInterval> &columns)
|
||||
{
|
||||
// For best performance, `columns` entries should be arranged from left to right
|
||||
|
||||
@@ -639,7 +639,7 @@ void TorrentContentModel::notifySubtreeUpdated(const QModelIndex &index, const Q
|
||||
}
|
||||
|
||||
// propagate down the model
|
||||
QVector<QModelIndex> parentIndexes;
|
||||
QList<QModelIndex> parentIndexes;
|
||||
|
||||
if (hasChildren(index))
|
||||
parentIndexes.push_back(index);
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QVector>
|
||||
#include <QList>
|
||||
|
||||
#include "base/indexrange.h"
|
||||
#include "base/pathfwd.h"
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
|
||||
void refresh();
|
||||
|
||||
QVector<BitTorrent::DownloadPriority> getFilePriorities() const;
|
||||
QList<BitTorrent::DownloadPriority> getFilePriorities() const;
|
||||
TorrentContentModelItem::ItemType itemType(const QModelIndex &index) const;
|
||||
int getFileIndex(const QModelIndex &index) const;
|
||||
Path getItemPath(const QModelIndex &index) const;
|
||||
@@ -91,10 +91,10 @@ private:
|
||||
void updateFilesPriorities();
|
||||
void updateFilesAvailability();
|
||||
bool setItemPriority(const QModelIndex &index, BitTorrent::DownloadPriority priority);
|
||||
void notifySubtreeUpdated(const QModelIndex &index, const QVector<ColumnInterval> &columns);
|
||||
void notifySubtreeUpdated(const QModelIndex &index, const QList<ColumnInterval> &columns);
|
||||
|
||||
BitTorrent::TorrentContentHandler *m_contentHandler = nullptr;
|
||||
TorrentContentModelFolder *m_rootItem = nullptr;
|
||||
QVector<TorrentContentModelFile *> m_filesIndex;
|
||||
QList<TorrentContentModelFile *> m_filesIndex;
|
||||
QFileIconProvider *m_fileIconProvider = nullptr;
|
||||
};
|
||||
|
||||
@@ -39,7 +39,7 @@ TorrentContentModelFolder::TorrentContentModelFolder(const QString &name, Torren
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
TorrentContentModelFolder::TorrentContentModelFolder(const QVector<QString> &data)
|
||||
TorrentContentModelFolder::TorrentContentModelFolder(const QList<QString> &data)
|
||||
: TorrentContentModelItem(nullptr)
|
||||
{
|
||||
Q_ASSERT(data.size() == NB_COL);
|
||||
@@ -63,7 +63,7 @@ void TorrentContentModelFolder::deleteAllChildren()
|
||||
m_childItems.clear();
|
||||
}
|
||||
|
||||
const QVector<TorrentContentModelItem *> &TorrentContentModelFolder::children() const
|
||||
const QList<TorrentContentModelItem *> &TorrentContentModelFolder::children() const
|
||||
{
|
||||
return m_childItems;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
TorrentContentModelFolder(const QString &name, TorrentContentModelFolder *parent);
|
||||
|
||||
// Invisible root item constructor
|
||||
explicit TorrentContentModelFolder(const QVector<QString> &data);
|
||||
explicit TorrentContentModelFolder(const QList<QString> &data);
|
||||
|
||||
~TorrentContentModelFolder() override;
|
||||
|
||||
@@ -56,11 +56,11 @@ public:
|
||||
void setPriority(BitTorrent::DownloadPriority newPriority, bool updateParent = true) override;
|
||||
|
||||
void deleteAllChildren();
|
||||
const QVector<TorrentContentModelItem*> &children() const;
|
||||
const QList<TorrentContentModelItem*> &children() const;
|
||||
void appendChild(TorrentContentModelItem *item);
|
||||
TorrentContentModelItem *child(int row) const;
|
||||
int childCount() const;
|
||||
|
||||
private:
|
||||
QVector<TorrentContentModelItem *> m_childItems;
|
||||
QList<TorrentContentModelItem *> m_childItems;
|
||||
};
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QVector>
|
||||
#include <QList>
|
||||
|
||||
#include "base/bittorrent/downloadpriority.h"
|
||||
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
protected:
|
||||
TorrentContentModelFolder *m_parentItem = nullptr;
|
||||
// Root item members
|
||||
QVector<QString> m_itemData;
|
||||
QList<QString> m_itemData;
|
||||
// Non-root item members
|
||||
QString m_name;
|
||||
qulonglong m_size = 0;
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
TorrentOptionsDialog::TorrentOptionsDialog(QWidget *parent, const QVector<BitTorrent::Torrent *> &torrents)
|
||||
TorrentOptionsDialog::TorrentOptionsDialog(QWidget *parent, const QList<BitTorrent::Torrent *> &torrents)
|
||||
: QDialog {parent}
|
||||
, m_ui {new Ui::TorrentOptionsDialog}
|
||||
, m_storeDialogSize {SETTINGS_KEY(u"Size"_s)}
|
||||
|
||||
@@ -58,7 +58,7 @@ class TorrentOptionsDialog final : public QDialog
|
||||
Q_DISABLE_COPY_MOVE(TorrentOptionsDialog)
|
||||
|
||||
public:
|
||||
explicit TorrentOptionsDialog(QWidget *parent, const QVector<BitTorrent::Torrent *> &torrents);
|
||||
explicit TorrentOptionsDialog(QWidget *parent, const QList<BitTorrent::Torrent *> &torrents);
|
||||
~TorrentOptionsDialog() override;
|
||||
|
||||
public slots:
|
||||
@@ -73,7 +73,7 @@ private slots:
|
||||
void handleDownSpeedLimitChanged();
|
||||
|
||||
private:
|
||||
QVector<BitTorrent::TorrentID> m_torrentIDs;
|
||||
QList<BitTorrent::TorrentID> m_torrentIDs;
|
||||
Ui::TorrentOptionsDialog *m_ui = nullptr;
|
||||
SettingValue<QSize> m_storeDialogSize;
|
||||
QStringList m_categories;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include <QHash>
|
||||
#include <QVector>
|
||||
#include <QList>
|
||||
|
||||
#include "base/bittorrent/trackerentry.h"
|
||||
#include "ui_trackerentriesdialog.h"
|
||||
@@ -59,7 +59,7 @@ TrackerEntriesDialog::~TrackerEntriesDialog()
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void TrackerEntriesDialog::setTrackers(const QVector<BitTorrent::TrackerEntry> &trackers)
|
||||
void TrackerEntriesDialog::setTrackers(const QList<BitTorrent::TrackerEntry> &trackers)
|
||||
{
|
||||
int maxTier = -1;
|
||||
QHash<int, QString> tiers; // <tier, tracker URLs>
|
||||
@@ -78,7 +78,7 @@ void TrackerEntriesDialog::setTrackers(const QVector<BitTorrent::TrackerEntry> &
|
||||
m_ui->plainTextEdit->setPlainText(text);
|
||||
}
|
||||
|
||||
QVector<BitTorrent::TrackerEntry> TrackerEntriesDialog::trackers() const
|
||||
QList<BitTorrent::TrackerEntry> TrackerEntriesDialog::trackers() const
|
||||
{
|
||||
return BitTorrent::parseTrackerEntries(m_ui->plainTextEdit->toPlainText());
|
||||
}
|
||||
|
||||
@@ -52,8 +52,8 @@ public:
|
||||
explicit TrackerEntriesDialog(QWidget *parent);
|
||||
~TrackerEntriesDialog() override;
|
||||
|
||||
void setTrackers(const QVector<BitTorrent::TrackerEntry> &trackers);
|
||||
QVector<BitTorrent::TrackerEntry> trackers() const;
|
||||
void setTrackers(const QList<BitTorrent::TrackerEntry> &trackers);
|
||||
QList<BitTorrent::TrackerEntry> trackers() const;
|
||||
|
||||
private:
|
||||
void saveSettings();
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <QColor>
|
||||
#include <QDebug>
|
||||
#include <QHeaderView>
|
||||
#include <QList>
|
||||
#include <QLocale>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
@@ -42,7 +43,6 @@
|
||||
#include <QStringList>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QUrl>
|
||||
#include <QVector>
|
||||
#include <QWheelEvent>
|
||||
|
||||
#include "base/bittorrent/session.h"
|
||||
|
||||
@@ -29,10 +29,10 @@
|
||||
|
||||
#include "trackersadditiondialog.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QMessageBox>
|
||||
#include <QSize>
|
||||
#include <QStringView>
|
||||
#include <QVector>
|
||||
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/bittorrent/trackerentry.h"
|
||||
@@ -76,10 +76,10 @@ TrackersAdditionDialog::~TrackersAdditionDialog()
|
||||
|
||||
void TrackersAdditionDialog::onAccepted() const
|
||||
{
|
||||
const QVector<BitTorrent::TrackerEntryStatus> currentTrackers = m_torrent->trackers();
|
||||
const QList<BitTorrent::TrackerEntryStatus> currentTrackers = m_torrent->trackers();
|
||||
const int baseTier = !currentTrackers.isEmpty() ? (currentTrackers.last().tier + 1) : 0;
|
||||
|
||||
QVector<BitTorrent::TrackerEntry> entries = BitTorrent::parseTrackerEntries(m_ui->textEditTrackersList->toPlainText());
|
||||
QList<BitTorrent::TrackerEntry> entries = BitTorrent::parseTrackerEntries(m_ui->textEditTrackersList->toPlainText());
|
||||
for (BitTorrent::TrackerEntry &entry : entries)
|
||||
entry.tier = Utils::Number::clampingAdd(entry.tier, baseTier);
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public slots:
|
||||
private slots:
|
||||
virtual void showMenu() = 0;
|
||||
virtual void applyFilter(int row) = 0;
|
||||
virtual void handleTorrentsLoaded(const QVector<BitTorrent::Torrent *> &torrents) = 0;
|
||||
virtual void handleTorrentsLoaded(const QList<BitTorrent::Torrent *> &torrents) = 0;
|
||||
virtual void torrentAboutToBeDeleted(BitTorrent::Torrent *) = 0;
|
||||
|
||||
private:
|
||||
|
||||
@@ -350,7 +350,7 @@ void CategoryFilterModel::categoryRemoved(const QString &categoryName)
|
||||
}
|
||||
}
|
||||
|
||||
void CategoryFilterModel::torrentsLoaded(const QVector<BitTorrent::Torrent *> &torrents)
|
||||
void CategoryFilterModel::torrentsLoaded(const QList<BitTorrent::Torrent *> &torrents)
|
||||
{
|
||||
for (const BitTorrent::Torrent *torrent : torrents)
|
||||
{
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
private slots:
|
||||
void categoryAdded(const QString &categoryName);
|
||||
void categoryRemoved(const QString &categoryName);
|
||||
void torrentsLoaded(const QVector<BitTorrent::Torrent *> &torrents);
|
||||
void torrentsLoaded(const QList<BitTorrent::Torrent *> &torrents);
|
||||
void torrentAboutToBeRemoved(BitTorrent::Torrent *torrent);
|
||||
void torrentCategoryChanged(BitTorrent::Torrent *torrent, const QString &oldCategory);
|
||||
void subcategoriesSupportChanged();
|
||||
|
||||
@@ -86,7 +86,7 @@ StatusFilterWidget::StatusFilterWidget(QWidget *parent, TransferListWidget *tran
|
||||
errored->setData(Qt::DisplayRole, tr("Errored (0)"));
|
||||
errored->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"error"_s));
|
||||
|
||||
const QVector<BitTorrent::Torrent *> torrents = BitTorrent::Session::instance()->torrents();
|
||||
const QList<BitTorrent::Torrent *> torrents = BitTorrent::Session::instance()->torrents();
|
||||
update(torrents);
|
||||
connect(BitTorrent::Session::instance(), &BitTorrent::Session::torrentsUpdated
|
||||
, this, &StatusFilterWidget::update);
|
||||
@@ -199,7 +199,7 @@ void StatusFilterWidget::hideZeroItems()
|
||||
setCurrentRow(TorrentFilter::All, QItemSelectionModel::SelectCurrent);
|
||||
}
|
||||
|
||||
void StatusFilterWidget::update(const QVector<BitTorrent::Torrent *> &torrents)
|
||||
void StatusFilterWidget::update(const QList<BitTorrent::Torrent *> &torrents)
|
||||
{
|
||||
for (const BitTorrent::Torrent *torrent : torrents)
|
||||
updateTorrentStatus(torrent);
|
||||
@@ -233,7 +233,7 @@ void StatusFilterWidget::applyFilter(int row)
|
||||
transferList()->applyStatusFilter(row);
|
||||
}
|
||||
|
||||
void StatusFilterWidget::handleTorrentsLoaded(const QVector<BitTorrent::Torrent *> &torrents)
|
||||
void StatusFilterWidget::handleTorrentsLoaded(const QList<BitTorrent::Torrent *> &torrents)
|
||||
{
|
||||
for (const BitTorrent::Torrent *torrent : torrents)
|
||||
updateTorrentStatus(torrent);
|
||||
|
||||
@@ -53,12 +53,12 @@ private:
|
||||
// No need to redeclare them here as slots.
|
||||
void showMenu() override;
|
||||
void applyFilter(int row) override;
|
||||
void handleTorrentsLoaded(const QVector<BitTorrent::Torrent *> &torrents) override;
|
||||
void handleTorrentsLoaded(const QList<BitTorrent::Torrent *> &torrents) override;
|
||||
void torrentAboutToBeDeleted(BitTorrent::Torrent *) override;
|
||||
|
||||
void configure();
|
||||
|
||||
void update(const QVector<BitTorrent::Torrent *> &torrents);
|
||||
void update(const QList<BitTorrent::Torrent *> &torrents);
|
||||
void updateTorrentStatus(const BitTorrent::Torrent *torrent);
|
||||
void updateTexts();
|
||||
void hideZeroItems();
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "tagfiltermodel.h"
|
||||
|
||||
#include <QIcon>
|
||||
#include <QVector>
|
||||
#include <QList>
|
||||
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/global.h"
|
||||
@@ -236,13 +236,13 @@ void TagFilterModel::torrentTagRemoved(BitTorrent::Torrent *const torrent, const
|
||||
emit dataChanged(i, i);
|
||||
}
|
||||
|
||||
void TagFilterModel::torrentsLoaded(const QVector<BitTorrent::Torrent *> &torrents)
|
||||
void TagFilterModel::torrentsLoaded(const QList<BitTorrent::Torrent *> &torrents)
|
||||
{
|
||||
for (const BitTorrent::Torrent *torrent : torrents)
|
||||
{
|
||||
allTagsItem()->increaseTorrentsCount();
|
||||
|
||||
const QVector<TagModelItem *> items = findItems(torrent->tags());
|
||||
const QList<TagModelItem *> items = findItems(torrent->tags());
|
||||
if (items.isEmpty())
|
||||
untaggedItem()->increaseTorrentsCount();
|
||||
|
||||
@@ -339,9 +339,9 @@ TagModelItem *TagFilterModel::findItem(const Tag &tag)
|
||||
return &m_tagItems[row];
|
||||
}
|
||||
|
||||
QVector<TagModelItem *> TagFilterModel::findItems(const TagSet &tags)
|
||||
QList<TagModelItem *> TagFilterModel::findItems(const TagSet &tags)
|
||||
{
|
||||
QVector<TagModelItem *> items;
|
||||
QList<TagModelItem *> items;
|
||||
items.reserve(tags.count());
|
||||
for (const Tag &tag : tags)
|
||||
{
|
||||
|
||||
@@ -64,7 +64,7 @@ private slots:
|
||||
void tagRemoved(const Tag &tag);
|
||||
void torrentTagAdded(BitTorrent::Torrent *torrent, const Tag &tag);
|
||||
void torrentTagRemoved(BitTorrent::Torrent *, const Tag &tag);
|
||||
void torrentsLoaded(const QVector<BitTorrent::Torrent *> &torrents);
|
||||
void torrentsLoaded(const QList<BitTorrent::Torrent *> &torrents);
|
||||
void torrentAboutToBeRemoved(BitTorrent::Torrent *torrent);
|
||||
|
||||
private:
|
||||
@@ -74,7 +74,7 @@ private:
|
||||
bool isValidRow(int row) const;
|
||||
int findRow(const Tag &tag) const;
|
||||
TagModelItem *findItem(const Tag &tag);
|
||||
QVector<TagModelItem *> findItems(const TagSet &tags);
|
||||
QList<TagModelItem *> findItems(const TagSet &tags);
|
||||
TagModelItem *allTagsItem();
|
||||
TagModelItem *untaggedItem();
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ TrackersFilterWidget::~TrackersFilterWidget()
|
||||
Utils::Fs::removeFile(iconPath);
|
||||
}
|
||||
|
||||
void TrackersFilterWidget::addTrackers(const BitTorrent::Torrent *torrent, const QVector<BitTorrent::TrackerEntry> &trackers)
|
||||
void TrackersFilterWidget::addTrackers(const BitTorrent::Torrent *torrent, const QList<BitTorrent::TrackerEntry> &trackers)
|
||||
{
|
||||
const BitTorrent::TorrentID torrentID = torrent->id();
|
||||
|
||||
@@ -204,7 +204,7 @@ void TrackersFilterWidget::refreshTrackers(const BitTorrent::Torrent *torrent)
|
||||
return false;
|
||||
});
|
||||
|
||||
const QVector<BitTorrent::TrackerEntryStatus> trackers = torrent->trackers();
|
||||
const QList<BitTorrent::TrackerEntryStatus> trackers = torrent->trackers();
|
||||
if (trackers.isEmpty())
|
||||
{
|
||||
addItems(NULL_HOST, {torrentID});
|
||||
@@ -228,7 +228,7 @@ void TrackersFilterWidget::refreshTrackers(const BitTorrent::Torrent *torrent)
|
||||
updateGeometry();
|
||||
}
|
||||
|
||||
void TrackersFilterWidget::addItems(const QString &trackerURL, const QVector<BitTorrent::TorrentID> &torrents)
|
||||
void TrackersFilterWidget::addItems(const QString &trackerURL, const QList<BitTorrent::TorrentID> &torrents)
|
||||
{
|
||||
const QString host = getHost(trackerURL);
|
||||
auto trackersIt = m_trackers.find(host);
|
||||
@@ -587,13 +587,13 @@ void TrackersFilterWidget::applyFilter(const int row)
|
||||
transferList()->applyTrackerFilter(getTorrentIDs(row));
|
||||
}
|
||||
|
||||
void TrackersFilterWidget::handleTorrentsLoaded(const QVector<BitTorrent::Torrent *> &torrents)
|
||||
void TrackersFilterWidget::handleTorrentsLoaded(const QList<BitTorrent::Torrent *> &torrents)
|
||||
{
|
||||
QHash<QString, QVector<BitTorrent::TorrentID>> torrentsPerTracker;
|
||||
QHash<QString, QList<BitTorrent::TorrentID>> torrentsPerTracker;
|
||||
for (const BitTorrent::Torrent *torrent : torrents)
|
||||
{
|
||||
const BitTorrent::TorrentID torrentID = torrent->id();
|
||||
const QVector<BitTorrent::TrackerEntryStatus> trackers = torrent->trackers();
|
||||
const QList<BitTorrent::TrackerEntryStatus> trackers = torrent->trackers();
|
||||
for (const BitTorrent::TrackerEntryStatus &tracker : trackers)
|
||||
torrentsPerTracker[tracker.url].append(torrentID);
|
||||
|
||||
@@ -614,7 +614,7 @@ void TrackersFilterWidget::handleTorrentsLoaded(const QVector<BitTorrent::Torren
|
||||
void TrackersFilterWidget::torrentAboutToBeDeleted(BitTorrent::Torrent *const torrent)
|
||||
{
|
||||
const BitTorrent::TorrentID torrentID = torrent->id();
|
||||
const QVector<BitTorrent::TrackerEntryStatus> trackers = torrent->trackers();
|
||||
const QList<BitTorrent::TrackerEntryStatus> trackers = torrent->trackers();
|
||||
for (const BitTorrent::TrackerEntryStatus &tracker : trackers)
|
||||
removeItem(tracker.url, torrentID);
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
TrackersFilterWidget(QWidget *parent, TransferListWidget *transferList, bool downloadFavicon);
|
||||
~TrackersFilterWidget() override;
|
||||
|
||||
void addTrackers(const BitTorrent::Torrent *torrent, const QVector<BitTorrent::TrackerEntry> &trackers);
|
||||
void addTrackers(const BitTorrent::Torrent *torrent, const QList<BitTorrent::TrackerEntry> &trackers);
|
||||
void removeTrackers(const BitTorrent::Torrent *torrent, const QStringList &trackers);
|
||||
void refreshTrackers(const BitTorrent::Torrent *torrent);
|
||||
void handleTrackerStatusesUpdated(const BitTorrent::Torrent *torrent
|
||||
@@ -72,12 +72,12 @@ private:
|
||||
// No need to redeclare them here as slots.
|
||||
void showMenu() override;
|
||||
void applyFilter(int row) override;
|
||||
void handleTorrentsLoaded(const QVector<BitTorrent::Torrent *> &torrents) override;
|
||||
void handleTorrentsLoaded(const QList<BitTorrent::Torrent *> &torrents) override;
|
||||
void torrentAboutToBeDeleted(BitTorrent::Torrent *torrent) override;
|
||||
|
||||
void onRemoveTrackerTriggered();
|
||||
|
||||
void addItems(const QString &trackerURL, const QVector<BitTorrent::TorrentID> &torrents);
|
||||
void addItems(const QString &trackerURL, const QList<BitTorrent::TorrentID> &torrents);
|
||||
void removeItem(const QString &trackerURL, const BitTorrent::TorrentID &id);
|
||||
QString trackerFromRow(int row) const;
|
||||
int rowFromTracker(const QString &tracker) const;
|
||||
|
||||
@@ -176,7 +176,7 @@ void TransferListFiltersWidget::setDownloadTrackerFavicon(bool value)
|
||||
m_trackersFilterWidget->setDownloadTrackerFavicon(value);
|
||||
}
|
||||
|
||||
void TransferListFiltersWidget::addTrackers(const BitTorrent::Torrent *torrent, const QVector<BitTorrent::TrackerEntry> &trackers)
|
||||
void TransferListFiltersWidget::addTrackers(const BitTorrent::Torrent *torrent, const QList<BitTorrent::TrackerEntry> &trackers)
|
||||
{
|
||||
m_trackersFilterWidget->addTrackers(torrent, trackers);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
void setDownloadTrackerFavicon(bool value);
|
||||
|
||||
public slots:
|
||||
void addTrackers(const BitTorrent::Torrent *torrent, const QVector<BitTorrent::TrackerEntry> &trackers);
|
||||
void addTrackers(const BitTorrent::Torrent *torrent, const QList<BitTorrent::TrackerEntry> &trackers);
|
||||
void removeTrackers(const BitTorrent::Torrent *torrent, const QStringList &trackers);
|
||||
void refreshTrackers(const BitTorrent::Torrent *torrent);
|
||||
void trackerEntryStatusesUpdated(const BitTorrent::Torrent *torrent
|
||||
|
||||
@@ -611,7 +611,7 @@ bool TransferListModel::setData(const QModelIndex &index, const QVariant &value,
|
||||
return true;
|
||||
}
|
||||
|
||||
void TransferListModel::addTorrents(const QVector<BitTorrent::Torrent *> &torrents)
|
||||
void TransferListModel::addTorrents(const QList<BitTorrent::Torrent *> &torrents)
|
||||
{
|
||||
qsizetype row = m_torrentList.size();
|
||||
const qsizetype total = row + torrents.size();
|
||||
@@ -669,7 +669,7 @@ void TransferListModel::handleTorrentStatusUpdated(BitTorrent::Torrent *const to
|
||||
emit dataChanged(index(row, 0), index(row, columnCount() - 1));
|
||||
}
|
||||
|
||||
void TransferListModel::handleTorrentsUpdated(const QVector<BitTorrent::Torrent *> &torrents)
|
||||
void TransferListModel::handleTorrentsUpdated(const QList<BitTorrent::Torrent *> &torrents)
|
||||
{
|
||||
const int columns = (columnCount() - 1);
|
||||
|
||||
|
||||
@@ -108,10 +108,10 @@ public:
|
||||
BitTorrent::Torrent *torrentHandle(const QModelIndex &index) const;
|
||||
|
||||
private slots:
|
||||
void addTorrents(const QVector<BitTorrent::Torrent *> &torrents);
|
||||
void addTorrents(const QList<BitTorrent::Torrent *> &torrents);
|
||||
void handleTorrentAboutToBeRemoved(BitTorrent::Torrent *torrent);
|
||||
void handleTorrentStatusUpdated(BitTorrent::Torrent *torrent);
|
||||
void handleTorrentsUpdated(const QVector<BitTorrent::Torrent *> &torrents);
|
||||
void handleTorrentsUpdated(const QList<BitTorrent::Torrent *> &torrents);
|
||||
|
||||
private:
|
||||
void configure();
|
||||
|
||||
@@ -35,12 +35,12 @@
|
||||
#include <QDebug>
|
||||
#include <QFileDialog>
|
||||
#include <QHeaderView>
|
||||
#include <QList>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QRegularExpression>
|
||||
#include <QSet>
|
||||
#include <QShortcut>
|
||||
#include <QVector>
|
||||
#include <QWheelEvent>
|
||||
|
||||
#include "base/bittorrent/session.h"
|
||||
@@ -76,9 +76,9 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
QVector<BitTorrent::TorrentID> extractIDs(const QVector<BitTorrent::Torrent *> &torrents)
|
||||
QList<BitTorrent::TorrentID> extractIDs(const QList<BitTorrent::Torrent *> &torrents)
|
||||
{
|
||||
QVector<BitTorrent::TorrentID> torrentIDs;
|
||||
QList<BitTorrent::TorrentID> torrentIDs;
|
||||
torrentIDs.reserve(torrents.size());
|
||||
for (const BitTorrent::Torrent *torrent : torrents)
|
||||
torrentIDs << torrent->id();
|
||||
@@ -113,7 +113,7 @@ namespace
|
||||
#endif
|
||||
}
|
||||
|
||||
void removeTorrents(const QVector<BitTorrent::Torrent *> &torrents, const bool isDeleteFileSelected)
|
||||
void removeTorrents(const QList<BitTorrent::Torrent *> &torrents, const bool isDeleteFileSelected)
|
||||
{
|
||||
auto *session = BitTorrent::Session::instance();
|
||||
const BitTorrent::TorrentRemoveOption removeOption = isDeleteFileSelected
|
||||
@@ -323,22 +323,22 @@ void TransferListWidget::torrentDoubleClicked()
|
||||
}
|
||||
}
|
||||
|
||||
QVector<BitTorrent::Torrent *> TransferListWidget::getSelectedTorrents() const
|
||||
QList<BitTorrent::Torrent *> TransferListWidget::getSelectedTorrents() const
|
||||
{
|
||||
const QModelIndexList selectedRows = selectionModel()->selectedRows();
|
||||
|
||||
QVector<BitTorrent::Torrent *> torrents;
|
||||
QList<BitTorrent::Torrent *> torrents;
|
||||
torrents.reserve(selectedRows.size());
|
||||
for (const QModelIndex &index : selectedRows)
|
||||
torrents << m_listModel->torrentHandle(mapToSource(index));
|
||||
return torrents;
|
||||
}
|
||||
|
||||
QVector<BitTorrent::Torrent *> TransferListWidget::getVisibleTorrents() const
|
||||
QList<BitTorrent::Torrent *> TransferListWidget::getVisibleTorrents() const
|
||||
{
|
||||
const int visibleTorrentsCount = m_sortFilterModel->rowCount();
|
||||
|
||||
QVector<BitTorrent::Torrent *> torrents;
|
||||
QList<BitTorrent::Torrent *> torrents;
|
||||
torrents.reserve(visibleTorrentsCount);
|
||||
for (int i = 0; i < visibleTorrentsCount; ++i)
|
||||
torrents << m_listModel->torrentHandle(mapToSource(m_sortFilterModel->index(i, 0)));
|
||||
@@ -347,7 +347,7 @@ QVector<BitTorrent::Torrent *> TransferListWidget::getVisibleTorrents() const
|
||||
|
||||
void TransferListWidget::setSelectedTorrentsLocation()
|
||||
{
|
||||
const QVector<BitTorrent::Torrent *> torrents = getSelectedTorrents();
|
||||
const QList<BitTorrent::Torrent *> torrents = getSelectedTorrents();
|
||||
if (torrents.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -359,7 +359,7 @@ void TransferListWidget::setSelectedTorrentsLocation()
|
||||
fileDialog->setOptions(QFileDialog::DontConfirmOverwrite | QFileDialog::ShowDirsOnly | QFileDialog::HideNameFilterDetails);
|
||||
connect(fileDialog, &QDialog::accepted, this, [this, fileDialog]()
|
||||
{
|
||||
const QVector<BitTorrent::Torrent *> torrents = getSelectedTorrents();
|
||||
const QList<BitTorrent::Torrent *> torrents = getSelectedTorrents();
|
||||
if (torrents.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -432,7 +432,7 @@ void TransferListWidget::deleteSelectedTorrents(const bool deleteLocalFiles)
|
||||
{
|
||||
if (m_mainWindow->currentTabWidget() != this) return;
|
||||
|
||||
const QVector<BitTorrent::Torrent *> torrents = getSelectedTorrents();
|
||||
const QList<BitTorrent::Torrent *> torrents = getSelectedTorrents();
|
||||
if (torrents.empty()) return;
|
||||
|
||||
if (Preferences::instance()->confirmTorrentDeletion())
|
||||
@@ -455,7 +455,7 @@ void TransferListWidget::deleteSelectedTorrents(const bool deleteLocalFiles)
|
||||
|
||||
void TransferListWidget::deleteVisibleTorrents()
|
||||
{
|
||||
const QVector<BitTorrent::Torrent *> torrents = getVisibleTorrents();
|
||||
const QList<BitTorrent::Torrent *> torrents = getVisibleTorrents();
|
||||
if (torrents.empty()) return;
|
||||
|
||||
if (Preferences::instance()->confirmTorrentDeletion())
|
||||
@@ -624,7 +624,7 @@ void TransferListWidget::previewSelectedTorrents()
|
||||
|
||||
void TransferListWidget::setTorrentOptions()
|
||||
{
|
||||
const QVector<BitTorrent::Torrent *> selectedTorrents = getSelectedTorrents();
|
||||
const QList<BitTorrent::Torrent *> selectedTorrents = getSelectedTorrents();
|
||||
if (selectedTorrents.empty()) return;
|
||||
|
||||
auto *dialog = new TorrentOptionsDialog {this, selectedTorrents};
|
||||
@@ -761,8 +761,8 @@ void TransferListWidget::askAddTagsForSelection()
|
||||
|
||||
void TransferListWidget::editTorrentTrackers()
|
||||
{
|
||||
const QVector<BitTorrent::Torrent *> torrents = getSelectedTorrents();
|
||||
QVector<BitTorrent::TrackerEntry> commonTrackers;
|
||||
const QList<BitTorrent::Torrent *> torrents = getSelectedTorrents();
|
||||
QList<BitTorrent::TrackerEntry> commonTrackers;
|
||||
|
||||
if (!torrents.empty())
|
||||
{
|
||||
@@ -805,7 +805,7 @@ void TransferListWidget::exportTorrent()
|
||||
fileDialog->setOptions(QFileDialog::ShowDirsOnly);
|
||||
connect(fileDialog, &QFileDialog::fileSelected, this, [this](const QString &dir)
|
||||
{
|
||||
const QVector<BitTorrent::Torrent *> torrents = getSelectedTorrents();
|
||||
const QList<BitTorrent::Torrent *> torrents = getSelectedTorrents();
|
||||
if (torrents.isEmpty())
|
||||
return;
|
||||
|
||||
|
||||
@@ -124,14 +124,14 @@ private:
|
||||
QModelIndexList mapToSource(const QModelIndexList &indexes) const;
|
||||
QModelIndex mapFromSource(const QModelIndex &index) const;
|
||||
bool loadSettings();
|
||||
QVector<BitTorrent::Torrent *> getSelectedTorrents() const;
|
||||
QList<BitTorrent::Torrent *> getSelectedTorrents() const;
|
||||
void askAddTagsForSelection();
|
||||
void editTorrentTrackers();
|
||||
void exportTorrent();
|
||||
void confirmRemoveAllTagsForSelection();
|
||||
TagSet askTagsForSelection(const QString &dialogTitle);
|
||||
void applyToSelectedTorrents(const std::function<void (BitTorrent::Torrent *const)> &fn);
|
||||
QVector<BitTorrent::Torrent *> getVisibleTorrents() const;
|
||||
QList<BitTorrent::Torrent *> getVisibleTorrents() const;
|
||||
int visibleColumnsCount() const;
|
||||
|
||||
TransferListModel *m_listModel = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user