mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-25 14:04:23 +00:00
Replace QList by QVector
This commit is contained in:
parent
9e7f50517e
commit
8eabaf5eb2
@ -78,7 +78,7 @@ namespace
|
|||||||
{
|
{
|
||||||
using ToggleFn = std::function<void (Qt::CheckState)>;
|
using ToggleFn = std::function<void (Qt::CheckState)>;
|
||||||
|
|
||||||
QStringList extractHashes(const QList<BitTorrent::TorrentHandle *> &torrents)
|
QStringList extractHashes(const QVector<BitTorrent::TorrentHandle *> &torrents)
|
||||||
{
|
{
|
||||||
QStringList hashes;
|
QStringList hashes;
|
||||||
for (BitTorrent::TorrentHandle *const torrent : torrents)
|
for (BitTorrent::TorrentHandle *const torrent : torrents)
|
||||||
@ -400,9 +400,9 @@ void TransferListWidget::torrentDoubleClicked()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<BitTorrent::TorrentHandle *> TransferListWidget::getSelectedTorrents() const
|
QVector<BitTorrent::TorrentHandle *> TransferListWidget::getSelectedTorrents() const
|
||||||
{
|
{
|
||||||
QList<BitTorrent::TorrentHandle *> torrents;
|
QVector<BitTorrent::TorrentHandle *> torrents;
|
||||||
for (const QModelIndex &index : asConst(selectionModel()->selectedRows()))
|
for (const QModelIndex &index : asConst(selectionModel()->selectedRows()))
|
||||||
torrents << m_listModel->torrentHandle(mapToSource(index));
|
torrents << m_listModel->torrentHandle(mapToSource(index));
|
||||||
|
|
||||||
@ -411,7 +411,7 @@ QList<BitTorrent::TorrentHandle *> TransferListWidget::getSelectedTorrents() con
|
|||||||
|
|
||||||
void TransferListWidget::setSelectedTorrentsLocation()
|
void TransferListWidget::setSelectedTorrentsLocation()
|
||||||
{
|
{
|
||||||
const QList<BitTorrent::TorrentHandle *> torrents = getSelectedTorrents();
|
const QVector<BitTorrent::TorrentHandle *> torrents = getSelectedTorrents();
|
||||||
if (torrents.isEmpty()) return;
|
if (torrents.isEmpty()) return;
|
||||||
|
|
||||||
const QString oldLocation = torrents[0]->savePath();
|
const QString oldLocation = torrents[0]->savePath();
|
||||||
@ -494,7 +494,7 @@ void TransferListWidget::deleteSelectedTorrents(bool deleteLocalFiles)
|
|||||||
{
|
{
|
||||||
if (m_mainWindow->currentTabWidget() != this) return;
|
if (m_mainWindow->currentTabWidget() != this) return;
|
||||||
|
|
||||||
const QList<BitTorrent::TorrentHandle *> torrents = getSelectedTorrents();
|
const QVector<BitTorrent::TorrentHandle *> torrents = getSelectedTorrents();
|
||||||
if (torrents.empty()) return;
|
if (torrents.empty()) return;
|
||||||
|
|
||||||
if (Preferences::instance()->confirmTorrentDeletion()
|
if (Preferences::instance()->confirmTorrentDeletion()
|
||||||
@ -508,7 +508,7 @@ void TransferListWidget::deleteVisibleTorrents()
|
|||||||
{
|
{
|
||||||
if (m_sortFilterModel->rowCount() <= 0) return;
|
if (m_sortFilterModel->rowCount() <= 0) return;
|
||||||
|
|
||||||
QList<BitTorrent::TorrentHandle *> torrents;
|
QVector<BitTorrent::TorrentHandle *> torrents;
|
||||||
for (int i = 0; i < m_sortFilterModel->rowCount(); ++i)
|
for (int i = 0; i < m_sortFilterModel->rowCount(); ++i)
|
||||||
torrents << m_listModel->torrentHandle(mapToSource(m_sortFilterModel->index(i, 0)));
|
torrents << m_listModel->torrentHandle(mapToSource(m_sortFilterModel->index(i, 0)));
|
||||||
|
|
||||||
@ -622,7 +622,7 @@ void TransferListWidget::previewSelectedTorrents()
|
|||||||
|
|
||||||
void TransferListWidget::setDlLimitSelectedTorrents()
|
void TransferListWidget::setDlLimitSelectedTorrents()
|
||||||
{
|
{
|
||||||
QList<BitTorrent::TorrentHandle *> torrentsList;
|
QVector<BitTorrent::TorrentHandle *> torrentsList;
|
||||||
for (BitTorrent::TorrentHandle *const torrent : asConst(getSelectedTorrents())) {
|
for (BitTorrent::TorrentHandle *const torrent : asConst(getSelectedTorrents())) {
|
||||||
if (torrent->isSeed())
|
if (torrent->isSeed())
|
||||||
continue;
|
continue;
|
||||||
@ -652,7 +652,7 @@ void TransferListWidget::setDlLimitSelectedTorrents()
|
|||||||
|
|
||||||
void TransferListWidget::setUpLimitSelectedTorrents()
|
void TransferListWidget::setUpLimitSelectedTorrents()
|
||||||
{
|
{
|
||||||
QList<BitTorrent::TorrentHandle *> torrentsList = getSelectedTorrents();
|
QVector<BitTorrent::TorrentHandle *> torrentsList = getSelectedTorrents();
|
||||||
if (torrentsList.empty()) return;
|
if (torrentsList.empty()) return;
|
||||||
|
|
||||||
int oldLimit = torrentsList.first()->uploadLimit();
|
int oldLimit = torrentsList.first()->uploadLimit();
|
||||||
@ -677,7 +677,7 @@ void TransferListWidget::setUpLimitSelectedTorrents()
|
|||||||
|
|
||||||
void TransferListWidget::setMaxRatioSelectedTorrents()
|
void TransferListWidget::setMaxRatioSelectedTorrents()
|
||||||
{
|
{
|
||||||
const QList<BitTorrent::TorrentHandle *> torrents = getSelectedTorrents();
|
const QVector<BitTorrent::TorrentHandle *> torrents = getSelectedTorrents();
|
||||||
if (torrents.isEmpty()) return;
|
if (torrents.isEmpty()) return;
|
||||||
|
|
||||||
qreal currentMaxRatio = BitTorrent::Session::instance()->globalMaxRatio();
|
qreal currentMaxRatio = BitTorrent::Session::instance()->globalMaxRatio();
|
||||||
@ -814,8 +814,8 @@ void TransferListWidget::askAddTagsForSelection()
|
|||||||
|
|
||||||
void TransferListWidget::editTorrentTrackers()
|
void TransferListWidget::editTorrentTrackers()
|
||||||
{
|
{
|
||||||
const QList<BitTorrent::TorrentHandle *> torrents = getSelectedTorrents();
|
const QVector<BitTorrent::TorrentHandle *> torrents = getSelectedTorrents();
|
||||||
QList<BitTorrent::TrackerEntry> commonTrackers;
|
QVector<BitTorrent::TrackerEntry> commonTrackers;
|
||||||
|
|
||||||
if (!torrents.empty()) {
|
if (!torrents.empty()) {
|
||||||
commonTrackers = torrents[0]->trackers();
|
commonTrackers = torrents[0]->trackers();
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
|
#include <QVector>
|
||||||
|
|
||||||
namespace BitTorrent
|
namespace BitTorrent
|
||||||
{
|
{
|
||||||
@ -99,7 +100,7 @@ protected:
|
|||||||
QModelIndex mapToSource(const QModelIndex &index) const;
|
QModelIndex mapToSource(const QModelIndex &index) const;
|
||||||
QModelIndex mapFromSource(const QModelIndex &index) const;
|
QModelIndex mapFromSource(const QModelIndex &index) const;
|
||||||
bool loadSettings();
|
bool loadSettings();
|
||||||
QList<BitTorrent::TorrentHandle *> getSelectedTorrents() const;
|
QVector<BitTorrent::TorrentHandle *> getSelectedTorrents() const;
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void torrentDoubleClicked();
|
void torrentDoubleClicked();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user