Browse Source

Replace QList by QVector

adaptive-webui-19844
Chocobo1 5 years ago
parent
commit
e90a2c00a5
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 3
      src/base/bittorrent/magneturi.cpp
  2. 5
      src/base/bittorrent/magneturi.h
  3. 5
      src/base/bittorrent/peerinfo.h
  4. 4
      src/base/bittorrent/session.cpp
  5. 6
      src/base/bittorrent/session.h
  6. 27
      src/base/bittorrent/torrenthandle.cpp
  7. 9
      src/base/bittorrent/torrenthandle.h
  8. 11
      src/base/bittorrent/torrentinfo.cpp
  9. 3
      src/base/bittorrent/torrentinfo.h
  10. 4
      src/base/filesystemwatcher.h
  11. 14
      src/base/preferences.cpp
  12. 2
      src/base/preferences.h
  13. 10
      src/base/search/searchhandler.cpp
  14. 3
      src/base/search/searchhandler.h
  15. 2
      src/base/utils/net.cpp
  16. 3
      src/base/utils/net.h
  17. 4
      src/gui/properties/peerlistwidget.cpp
  18. 2
      src/gui/properties/peersadditiondialog.cpp
  19. 6
      src/gui/properties/peersadditiondialog.h
  20. 12
      src/gui/properties/propertieswidget.cpp
  21. 5
      src/gui/search/pluginselectdialog.cpp
  22. 2
      src/gui/search/pluginselectdialog.h
  23. 2
      src/gui/search/searchjobwidget.cpp
  24. 2
      src/gui/search/searchjobwidget.h
  25. 2
      src/gui/torrentcontentmodel.cpp
  26. 4
      src/gui/torrentcontentmodelfolder.cpp
  27. 6
      src/gui/torrentcontentmodelfolder.h
  28. 4
      src/gui/torrentcontentmodelitem.h
  29. 3
      src/webui/api/synccontroller.cpp
  30. 2
      src/webui/webapplication.h

3
src/base/bittorrent/magneturi.cpp

@ -80,6 +80,7 @@ MagnetUri::MagnetUri(const QString &source) @@ -80,6 +80,7 @@ MagnetUri::MagnetUri(const QString &source)
for (const std::string &tracker : m_addTorrentParams.trackers)
m_trackers.append(lt::announce_entry {tracker});
m_urlSeeds.reserve(m_addTorrentParams.url_seeds.size());
for (const std::string &urlSeed : m_addTorrentParams.url_seeds)
m_urlSeeds.append(QUrl(QString::fromStdString(urlSeed)));
}
@ -104,7 +105,7 @@ QVector<TrackerEntry> MagnetUri::trackers() const @@ -104,7 +105,7 @@ QVector<TrackerEntry> MagnetUri::trackers() const
return m_trackers;
}
QList<QUrl> MagnetUri::urlSeeds() const
QVector<QUrl> MagnetUri::urlSeeds() const
{
return m_urlSeeds;
}

5
src/base/bittorrent/magneturi.h

@ -31,7 +31,6 @@ @@ -31,7 +31,6 @@
#include <libtorrent/add_torrent_params.hpp>
#include <QList>
#include <QString>
#include <QVector>
@ -51,7 +50,7 @@ namespace BitTorrent @@ -51,7 +50,7 @@ namespace BitTorrent
InfoHash hash() const;
QString name() const;
QVector<TrackerEntry> trackers() const;
QList<QUrl> urlSeeds() const;
QVector<QUrl> urlSeeds() const;
QString url() const;
lt::add_torrent_params addTorrentParams() const;
@ -62,7 +61,7 @@ namespace BitTorrent @@ -62,7 +61,7 @@ namespace BitTorrent
InfoHash m_hash;
QString m_name;
QVector<TrackerEntry> m_trackers;
QList<QUrl> m_urlSeeds;
QVector<QUrl> m_urlSeeds;
lt::add_torrent_params m_addTorrentParams;
};
}

5
src/base/bittorrent/peerinfo.h

@ -46,6 +46,7 @@ namespace BitTorrent @@ -46,6 +46,7 @@ namespace BitTorrent
Q_DECLARE_TR_FUNCTIONS(PeerInfo)
public:
PeerInfo() = default;
PeerInfo(const TorrentHandle *torrent, const lt::peer_info &nativeInfo);
bool fromDHT() const;
@ -98,8 +99,8 @@ namespace BitTorrent @@ -98,8 +99,8 @@ namespace BitTorrent
void calcRelevance(const TorrentHandle *torrent);
void determineFlags();
lt::peer_info m_nativeInfo;
qreal m_relevance;
lt::peer_info m_nativeInfo = {};
qreal m_relevance = 0;
QString m_flags;
QString m_flagsDescription;
};

4
src/base/bittorrent/session.cpp

@ -3409,14 +3409,14 @@ void Session::handleTorrentTrackersChanged(TorrentHandle *const torrent) @@ -3409,14 +3409,14 @@ void Session::handleTorrentTrackersChanged(TorrentHandle *const torrent)
emit trackersChanged(torrent);
}
void Session::handleTorrentUrlSeedsAdded(TorrentHandle *const torrent, const QList<QUrl> &newUrlSeeds)
void Session::handleTorrentUrlSeedsAdded(TorrentHandle *const torrent, const QVector<QUrl> &newUrlSeeds)
{
torrent->saveResumeData();
for (const QUrl &newUrlSeed : newUrlSeeds)
LogMsg(tr("URL seed '%1' was added to torrent '%2'").arg(newUrlSeed.toString(), torrent->name()));
}
void Session::handleTorrentUrlSeedsRemoved(TorrentHandle *const torrent, const QList<QUrl> &urlSeeds)
void Session::handleTorrentUrlSeedsRemoved(TorrentHandle *const torrent, const QVector<QUrl> &urlSeeds)
{
torrent->saveResumeData();
for (const QUrl &urlSeed : urlSeeds)

6
src/base/bittorrent/session.h

@ -36,10 +36,10 @@ @@ -36,10 +36,10 @@
#include <QFile>
#include <QHash>
#include <QList>
#include <QNetworkConfigurationManager>
#include <QPointer>
#include <QSet>
#include <QVector>
#include "base/settingvalue.h"
#include "base/types.h"
@ -439,8 +439,8 @@ namespace BitTorrent @@ -439,8 +439,8 @@ namespace BitTorrent
void handleTorrentTrackersAdded(TorrentHandle *const torrent, const QVector<TrackerEntry> &newTrackers);
void handleTorrentTrackersRemoved(TorrentHandle *const torrent, const QVector<TrackerEntry> &deletedTrackers);
void handleTorrentTrackersChanged(TorrentHandle *const torrent);
void handleTorrentUrlSeedsAdded(TorrentHandle *const torrent, const QList<QUrl> &newUrlSeeds);
void handleTorrentUrlSeedsRemoved(TorrentHandle *const torrent, const QList<QUrl> &urlSeeds);
void handleTorrentUrlSeedsAdded(TorrentHandle *const torrent, const QVector<QUrl> &newUrlSeeds);
void handleTorrentUrlSeedsRemoved(TorrentHandle *const torrent, const QVector<QUrl> &urlSeeds);
void handleTorrentResumeDataReady(TorrentHandle *const torrent, const lt::entry &data);
void handleTorrentResumeDataFailed(TorrentHandle *const torrent);
void handleTorrentTrackerReply(TorrentHandle *const torrent, const QString &trackerUrl);

27
src/base/bittorrent/torrenthandle.cpp

@ -475,20 +475,23 @@ void TorrentHandle::replaceTrackers(const QVector<TrackerEntry> &trackers) @@ -475,20 +475,23 @@ void TorrentHandle::replaceTrackers(const QVector<TrackerEntry> &trackers)
}
}
QList<QUrl> TorrentHandle::urlSeeds() const
QVector<QUrl> TorrentHandle::urlSeeds() const
{
QList<QUrl> urlSeeds;
const std::set<std::string> seeds = m_nativeHandle.url_seeds();
QVector<QUrl> urlSeeds;
urlSeeds.reserve(seeds.size());
for (const std::string &urlSeed : seeds)
urlSeeds.append(QUrl(urlSeed.c_str()));
return urlSeeds;
}
void TorrentHandle::addUrlSeeds(const QList<QUrl> &urlSeeds)
void TorrentHandle::addUrlSeeds(const QVector<QUrl> &urlSeeds)
{
QList<QUrl> addedUrlSeeds;
QVector<QUrl> addedUrlSeeds;
addedUrlSeeds.reserve(urlSeeds.size());
for (const QUrl &urlSeed : urlSeeds) {
if (addUrlSeed(urlSeed))
addedUrlSeeds << urlSeed;
@ -498,9 +501,10 @@ void TorrentHandle::addUrlSeeds(const QList<QUrl> &urlSeeds) @@ -498,9 +501,10 @@ void TorrentHandle::addUrlSeeds(const QList<QUrl> &urlSeeds)
m_session->handleTorrentUrlSeedsAdded(this, addedUrlSeeds);
}
void TorrentHandle::removeUrlSeeds(const QList<QUrl> &urlSeeds)
void TorrentHandle::removeUrlSeeds(const QVector<QUrl> &urlSeeds)
{
QList<QUrl> removedUrlSeeds;
QVector<QUrl> removedUrlSeeds;
removedUrlSeeds.reserve(urlSeeds.size());
for (const QUrl &urlSeed : urlSeeds) {
if (removeUrlSeed(urlSeed))
removedUrlSeeds << urlSeed;
@ -512,7 +516,7 @@ void TorrentHandle::removeUrlSeeds(const QList<QUrl> &urlSeeds) @@ -512,7 +516,7 @@ void TorrentHandle::removeUrlSeeds(const QList<QUrl> &urlSeeds)
bool TorrentHandle::addUrlSeed(const QUrl &urlSeed)
{
QList<QUrl> seeds = urlSeeds();
const QVector<QUrl> seeds = urlSeeds();
if (seeds.contains(urlSeed)) return false;
m_nativeHandle.add_url_seed(urlSeed.toString().toStdString());
@ -521,7 +525,7 @@ bool TorrentHandle::addUrlSeed(const QUrl &urlSeed) @@ -521,7 +525,7 @@ bool TorrentHandle::addUrlSeed(const QUrl &urlSeed)
bool TorrentHandle::removeUrlSeed(const QUrl &urlSeed)
{
QList<QUrl> seeds = urlSeeds();
const QVector<QUrl> seeds = urlSeeds();
if (!seeds.contains(urlSeed)) return false;
m_nativeHandle.remove_url_seed(urlSeed.toString().toStdString());
@ -1170,16 +1174,15 @@ bool TorrentHandle::superSeeding() const @@ -1170,16 +1174,15 @@ bool TorrentHandle::superSeeding() const
#endif
}
QList<PeerInfo> TorrentHandle::peers() const
QVector<PeerInfo> TorrentHandle::peers() const
{
QList<PeerInfo> peers;
std::vector<lt::peer_info> nativePeers;
m_nativeHandle.get_peer_info(nativePeers);
QVector<PeerInfo> peers;
peers.reserve(nativePeers.size());
for (const lt::peer_info &peer : nativePeers)
peers << PeerInfo(this, peer);
return peers;
}

9
src/base/bittorrent/torrenthandle.h

@ -37,7 +37,6 @@ @@ -37,7 +37,6 @@
#include <libtorrent/torrent_status.hpp>
#include <QHash>
#include <QList>
#include <QObject>
#include <QQueue>
#include <QSet>
@ -263,7 +262,7 @@ namespace BitTorrent @@ -263,7 +262,7 @@ namespace BitTorrent
int queuePosition() const;
QVector<TrackerEntry> trackers() const;
QHash<QString, TrackerInfo> trackerInfos() const;
QList<QUrl> urlSeeds() const;
QVector<QUrl> urlSeeds() const;
QString error() const;
qlonglong totalDownload() const;
qlonglong totalUpload() const;
@ -288,7 +287,7 @@ namespace BitTorrent @@ -288,7 +287,7 @@ namespace BitTorrent
int downloadLimit() const;
int uploadLimit() const;
bool superSeeding() const;
QList<PeerInfo> peers() const;
QVector<PeerInfo> peers() const;
QBitArray pieces() const;
QBitArray downloadingPieces() const;
QVector<int> pieceAvailability() const;
@ -326,8 +325,8 @@ namespace BitTorrent @@ -326,8 +325,8 @@ namespace BitTorrent
void flushCache();
void addTrackers(const QVector<TrackerEntry> &trackers);
void replaceTrackers(const QVector<TrackerEntry> &trackers);
void addUrlSeeds(const QList<QUrl> &urlSeeds);
void removeUrlSeeds(const QList<QUrl> &urlSeeds);
void addUrlSeeds(const QVector<QUrl> &urlSeeds);
void removeUrlSeeds(const QVector<QUrl> &urlSeeds);
bool connectPeer(const PeerAddress &peerAddress);
QString toMagnetUri() const;

11
src/base/bittorrent/torrentinfo.cpp

@ -278,14 +278,19 @@ QVector<TrackerEntry> TorrentInfo::trackers() const @@ -278,14 +278,19 @@ QVector<TrackerEntry> TorrentInfo::trackers() const
return ret;
}
QList<QUrl> TorrentInfo::urlSeeds() const
QVector<QUrl> TorrentInfo::urlSeeds() const
{
if (!isValid()) return {};
QList<QUrl> urlSeeds;
for (const lt::web_seed_entry &webSeed : m_nativeInfo->web_seeds())
const std::vector<lt::web_seed_entry> &nativeWebSeeds = m_nativeInfo->web_seeds();
QVector<QUrl> urlSeeds;
urlSeeds.reserve(nativeWebSeeds.size());
for (const lt::web_seed_entry &webSeed : nativeWebSeeds) {
if (webSeed.type == lt::web_seed_entry::url_seed)
urlSeeds.append(QUrl(webSeed.url.c_str()));
}
return urlSeeds;
}

3
src/base/bittorrent/torrentinfo.h

@ -33,7 +33,6 @@ @@ -33,7 +33,6 @@
#include <libtorrent/version.hpp>
#include <QCoreApplication>
#include <QList>
#include <QVector>
#include "base/indexrange.h"
@ -89,7 +88,7 @@ namespace BitTorrent @@ -89,7 +88,7 @@ namespace BitTorrent
qlonglong fileSize(int index) const;
qlonglong fileOffset(int index) const;
QVector<TrackerEntry> trackers() const;
QList<QUrl> urlSeeds() const;
QVector<QUrl> urlSeeds() const;
QByteArray metadata() const;
QStringList filesForPiece(int pieceIndex) const;
QVector<int> fileIndicesForPiece(int pieceIndex) const;

4
src/base/filesystemwatcher.h

@ -32,8 +32,8 @@ @@ -32,8 +32,8 @@
#include <QDir>
#include <QFileSystemWatcher>
#include <QHash>
#include <QList>
#include <QTimer>
#include <QVector>
class QStringList;
@ -67,7 +67,7 @@ private: @@ -67,7 +67,7 @@ private:
QHash<QString, int> m_partialTorrents;
QTimer m_partialTorrentTimer;
QList<QDir> m_watchedFolders;
QVector<QDir> m_watchedFolders;
QTimer m_watchTimer;
};

14
src/base/preferences.cpp

@ -528,17 +528,21 @@ void Preferences::setWebUiAuthSubnetWhitelistEnabled(const bool enabled) @@ -528,17 +528,21 @@ void Preferences::setWebUiAuthSubnetWhitelistEnabled(const bool enabled)
setValue("Preferences/WebUI/AuthSubnetWhitelistEnabled", enabled);
}
QList<Utils::Net::Subnet> Preferences::getWebUiAuthSubnetWhitelist() const
QVector<Utils::Net::Subnet> Preferences::getWebUiAuthSubnetWhitelist() const
{
QList<Utils::Net::Subnet> subnets;
for (const QString &rawSubnet : asConst(value("Preferences/WebUI/AuthSubnetWhitelist").toStringList())) {
const QStringList subnets = value("Preferences/WebUI/AuthSubnetWhitelist").toStringList();
QVector<Utils::Net::Subnet> ret;
ret.reserve(subnets.size());
for (const QString &rawSubnet : subnets) {
bool ok = false;
const Utils::Net::Subnet subnet = Utils::Net::parseSubnet(rawSubnet.trimmed(), &ok);
if (ok)
subnets.append(subnet);
ret.append(subnet);
}
return subnets;
return ret;
}
void Preferences::setWebUiAuthSubnetWhitelist(QStringList subnets)

2
src/base/preferences.h

@ -188,7 +188,7 @@ public: @@ -188,7 +188,7 @@ public:
void setWebUiLocalAuthEnabled(bool enabled);
bool isWebUiAuthSubnetWhitelistEnabled() const;
void setWebUiAuthSubnetWhitelistEnabled(bool enabled);
QList<Utils::Net::Subnet> getWebUiAuthSubnetWhitelist() const;
QVector<Utils::Net::Subnet> getWebUiAuthSubnetWhitelist() const;
void setWebUiAuthSubnetWhitelist(QStringList subnets);
QString getWebUiUsername() const;
void setWebUiUsername(const QString &username);

10
src/base/search/searchhandler.cpp

@ -127,13 +127,16 @@ void SearchHandler::processFinished(const int exitcode) @@ -127,13 +127,16 @@ void SearchHandler::processFinished(const int exitcode)
void SearchHandler::readSearchOutput()
{
QByteArray output = m_searchProcess->readAllStandardOutput();
output.replace("\r", "");
output.replace('\r', "");
QList<QByteArray> lines = output.split('\n');
if (!m_searchResultLineTruncated.isEmpty())
lines.prepend(m_searchResultLineTruncated + lines.takeFirst());
m_searchResultLineTruncated = lines.takeLast().trimmed();
QList<SearchResult> searchResultList;
QVector<SearchResult> searchResultList;
searchResultList.reserve(lines.size());
for (const QByteArray &line : asConst(lines)) {
SearchResult searchResult;
if (parseSearchResult(QString::fromUtf8(line), searchResult))
@ -141,7 +144,8 @@ void SearchHandler::readSearchOutput() @@ -141,7 +144,8 @@ void SearchHandler::readSearchOutput()
}
if (!searchResultList.isEmpty()) {
m_results.append(searchResultList);
for (const SearchResult &result : searchResultList)
m_results.append(result);
emit newSearchResults(searchResultList);
}
}

3
src/base/search/searchhandler.h

@ -33,6 +33,7 @@ @@ -33,6 +33,7 @@
#include <QList>
#include <QObject>
#include <QString>
#include <QVector>
class QProcess;
class QTimer;
@ -71,7 +72,7 @@ public: @@ -71,7 +72,7 @@ public:
signals:
void searchFinished(bool cancelled = false);
void searchFailed();
void newSearchResults(const QList<SearchResult> &results);
void newSearchResults(const QVector<SearchResult> &results);
private:
void readSearchOutput();

2
src/base/utils/net.cpp

@ -64,7 +64,7 @@ namespace Utils @@ -64,7 +64,7 @@ namespace Utils
|| (addr == QHostAddress(QLatin1String("::ffff:127.0.0.1")));
}
bool isIPInRange(const QHostAddress &addr, const QList<Subnet> &subnets)
bool isIPInRange(const QHostAddress &addr, const QVector<Subnet> &subnets)
{
QHostAddress protocolEquivalentAddress;
bool addrConversionOk = false;

3
src/base/utils/net.h

@ -32,6 +32,7 @@ @@ -32,6 +32,7 @@
#include <QHostAddress>
#include <QList>
#include <QPair>
#include <QVector>
class QSslCertificate;
class QSslKey;
@ -47,7 +48,7 @@ namespace Utils @@ -47,7 +48,7 @@ namespace Utils
Subnet parseSubnet(const QString &subnetStr, bool *ok = nullptr);
bool canParseSubnet(const QString &subnetStr);
bool isLoopbackAddress(const QHostAddress &addr);
bool isIPInRange(const QHostAddress &addr, const QList<Subnet> &subnets);
bool isIPInRange(const QHostAddress &addr, const QVector<Subnet> &subnets);
QString subnetToString(const Subnet &subnet);
const int MAX_SSL_FILE_SIZE = 1024 * 1024;

4
src/gui/properties/peerlistwidget.cpp

@ -239,7 +239,7 @@ void PeerListWidget::showPeerListMenu(const QPoint &) @@ -239,7 +239,7 @@ void PeerListWidget::showPeerListMenu(const QPoint &)
const QAction *addPeerAct = menu->addAction(UIThemeManager::instance()->getIcon("user-group-new"), tr("Add a new peer..."));
connect(addPeerAct, &QAction::triggered, this, [this, torrent]()
{
const QList<BitTorrent::PeerAddress> peersList = PeersAdditionDialog::askForPeers(this);
const QVector<BitTorrent::PeerAddress> peersList = PeersAdditionDialog::askForPeers(this);
int peerCount = 0;
for (const BitTorrent::PeerAddress &addr : peersList) {
if (torrent->connectPeer(addr)) {
@ -336,7 +336,7 @@ void PeerListWidget::loadPeers(BitTorrent::TorrentHandle *const torrent, bool fo @@ -336,7 +336,7 @@ void PeerListWidget::loadPeers(BitTorrent::TorrentHandle *const torrent, bool fo
{
if (!torrent) return;
const QList<BitTorrent::PeerInfo> peers = torrent->peers();
const QVector<BitTorrent::PeerInfo> peers = torrent->peers();
QSet<QString> oldPeersSet = m_peerItems.keys().toSet();
for (const BitTorrent::PeerInfo &peer : peers) {

2
src/gui/properties/peersadditiondialog.cpp

@ -48,7 +48,7 @@ PeersAdditionDialog::~PeersAdditionDialog() @@ -48,7 +48,7 @@ PeersAdditionDialog::~PeersAdditionDialog()
delete m_ui;
}
QList<BitTorrent::PeerAddress> PeersAdditionDialog::askForPeers(QWidget *parent)
QVector<BitTorrent::PeerAddress> PeersAdditionDialog::askForPeers(QWidget *parent)
{
PeersAdditionDialog dlg(parent);
dlg.exec();

6
src/gui/properties/peersadditiondialog.h

@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
#define PEERADDITION_H
#include <QDialog>
#include <QList>
#include <QVector>
#include "base/bittorrent/peerinfo.h"
@ -47,14 +47,14 @@ public: @@ -47,14 +47,14 @@ public:
PeersAdditionDialog(QWidget *parent);
~PeersAdditionDialog();
static QList<BitTorrent::PeerAddress> askForPeers(QWidget *parent);
static QVector<BitTorrent::PeerAddress> askForPeers(QWidget *parent);
protected slots:
void validateInput();
private:
Ui::PeersAdditionDialog *m_ui;
QList<BitTorrent::PeerAddress> m_peersList;
QVector<BitTorrent::PeerAddress> m_peersList;
};
#endif // PEERADDITION_H

12
src/gui/properties/propertieswidget.cpp

@ -495,7 +495,7 @@ void PropertiesWidget::loadUrlSeeds() @@ -495,7 +495,7 @@ void PropertiesWidget::loadUrlSeeds()
{
m_ui->listWebSeeds->clear();
qDebug("Loading URL seeds");
const QList<QUrl> hcSeeds = m_torrent->urlSeeds();
const QVector<QUrl> hcSeeds = m_torrent->urlSeeds();
// Add url seeds
for (const QUrl &hcSeed : hcSeeds) {
qDebug("Loading URL seed: %s", qUtf8Printable(hcSeed.toString()));
@ -715,7 +715,7 @@ void PropertiesWidget::askWebSeed() @@ -715,7 +715,7 @@ void PropertiesWidget::askWebSeed()
return;
}
if (m_torrent)
m_torrent->addUrlSeeds(QList<QUrl>() << urlSeed);
m_torrent->addUrlSeeds({urlSeed});
// Refresh the seeds list
loadUrlSeeds();
}
@ -725,7 +725,9 @@ void PropertiesWidget::deleteSelectedUrlSeeds() @@ -725,7 +725,9 @@ void PropertiesWidget::deleteSelectedUrlSeeds()
const QList<QListWidgetItem *> selectedItems = m_ui->listWebSeeds->selectedItems();
if (selectedItems.isEmpty()) return;
QList<QUrl> urlSeeds;
QVector<QUrl> urlSeeds;
urlSeeds.reserve(selectedItems.size());
for (const QListWidgetItem *item : selectedItems)
urlSeeds << item->text();
@ -766,8 +768,8 @@ void PropertiesWidget::editWebSeed() @@ -766,8 +768,8 @@ void PropertiesWidget::editWebSeed()
return;
}
m_torrent->removeUrlSeeds(QList<QUrl>() << oldSeed);
m_torrent->addUrlSeeds(QList<QUrl>() << newSeed);
m_torrent->removeUrlSeeds({oldSeed});
m_torrent->addUrlSeeds({newSeed});
loadUrlSeeds();
}

5
src/gui/search/pluginselectdialog.cpp

@ -238,9 +238,10 @@ void PluginSelectDialog::setRowColor(const int row, const QString &color) @@ -238,9 +238,10 @@ void PluginSelectDialog::setRowColor(const int row, const QString &color)
}
}
QList<QTreeWidgetItem*> PluginSelectDialog::findItemsWithUrl(const QString &url)
QVector<QTreeWidgetItem*> PluginSelectDialog::findItemsWithUrl(const QString &url)
{
QList<QTreeWidgetItem*> res;
QVector<QTreeWidgetItem*> res;
res.reserve(m_ui->pluginsTree->topLevelItemCount());
for (int i = 0; i < m_ui->pluginsTree->topLevelItemCount(); ++i) {
QTreeWidgetItem *item = m_ui->pluginsTree->topLevelItem(i);

2
src/gui/search/pluginselectdialog.h

@ -57,7 +57,7 @@ public: @@ -57,7 +57,7 @@ public:
explicit PluginSelectDialog(SearchPluginManager *pluginManager, QWidget *parent = nullptr);
~PluginSelectDialog() override;
QList<QTreeWidgetItem*> findItemsWithUrl(const QString &url);
QVector<QTreeWidgetItem*> findItemsWithUrl(const QString &url);
QTreeWidgetItem *findItemWithID(const QString &id);
protected:

2
src/gui/search/searchjobwidget.cpp

@ -506,7 +506,7 @@ void SearchJobWidget::searchFailed() @@ -506,7 +506,7 @@ void SearchJobWidget::searchFailed()
setStatus(Status::Error);
}
void SearchJobWidget::appendSearchResults(const QList<SearchResult> &results)
void SearchJobWidget::appendSearchResults(const QVector<SearchResult> &results)
{
for (const SearchResult &result : results) {
// Add item to search result list

2
src/gui/search/searchjobwidget.h

@ -100,7 +100,7 @@ private: @@ -100,7 +100,7 @@ private:
void onItemDoubleClicked(const QModelIndex &index);
void searchFinished(bool cancelled);
void searchFailed();
void appendSearchResults(const QList<SearchResult> &results);
void appendSearchResults(const QVector<SearchResult> &results);
void updateResultsCount();
void setStatus(Status value);
void downloadTorrent(const QModelIndex &rowIndex);

2
src/gui/torrentcontentmodel.cpp

@ -198,7 +198,7 @@ namespace @@ -198,7 +198,7 @@ namespace
TorrentContentModel::TorrentContentModel(QObject *parent)
: QAbstractItemModel(parent)
, m_rootItem(new TorrentContentModelFolder(QList<QVariant>({ tr("Name"), tr("Size"), tr("Progress"), tr("Download Priority"), tr("Remaining"), tr("Availability") })))
, m_rootItem(new TorrentContentModelFolder(QVector<QVariant>({ tr("Name"), tr("Size"), tr("Progress"), tr("Download Priority"), tr("Remaining"), tr("Availability") })))
{
#if defined(Q_OS_WIN)
m_fileIconProvider = new WinShellFileIconProvider();

4
src/gui/torrentcontentmodelfolder.cpp

@ -43,7 +43,7 @@ TorrentContentModelFolder::TorrentContentModelFolder(const QString &name, Torren @@ -43,7 +43,7 @@ TorrentContentModelFolder::TorrentContentModelFolder(const QString &name, Torren
m_name.chop(4);
}
TorrentContentModelFolder::TorrentContentModelFolder(const QList<QVariant> &data)
TorrentContentModelFolder::TorrentContentModelFolder(const QVector<QVariant> &data)
: TorrentContentModelItem(nullptr)
{
Q_ASSERT(data.size() == NB_COL);
@ -67,7 +67,7 @@ void TorrentContentModelFolder::deleteAllChildren() @@ -67,7 +67,7 @@ void TorrentContentModelFolder::deleteAllChildren()
m_childItems.clear();
}
const QList<TorrentContentModelItem *> &TorrentContentModelFolder::children() const
const QVector<TorrentContentModelItem *> &TorrentContentModelFolder::children() const
{
return m_childItems;
}

6
src/gui/torrentcontentmodelfolder.h

@ -43,7 +43,7 @@ public: @@ -43,7 +43,7 @@ public:
TorrentContentModelFolder(const QString &name, TorrentContentModelFolder *parent);
// Invisible root item constructor
explicit TorrentContentModelFolder(const QList<QVariant> &data);
explicit TorrentContentModelFolder(const QVector<QVariant> &data);
~TorrentContentModelFolder() override;
@ -57,14 +57,14 @@ public: @@ -57,14 +57,14 @@ public:
void setPriority(BitTorrent::DownloadPriority newPriority, bool updateParent = true) override;
void deleteAllChildren();
const QList<TorrentContentModelItem*> &children() const;
const QVector<TorrentContentModelItem*> &children() const;
void appendChild(TorrentContentModelItem *item);
TorrentContentModelItem *child(int row) const;
TorrentContentModelFolder *childFolderWithName(const QString &name) const;
int childCount() const;
private:
QList<TorrentContentModelItem*> m_childItems;
QVector<TorrentContentModelItem*> m_childItems;
};
#endif // TORRENTCONTENTMODELFOLDER_H

4
src/gui/torrentcontentmodelitem.h

@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
#ifndef TORRENTCONTENTMODELITEM_H
#define TORRENTCONTENTMODELITEM_H
#include <QList>
#include <QVector>
#include "base/bittorrent/downloadpriority.h"
@ -83,7 +83,7 @@ public: @@ -83,7 +83,7 @@ public:
protected:
TorrentContentModelFolder *m_parentItem;
// Root item members
QList<QVariant> m_itemData;
QVector<QVariant> m_itemData;
// Non-root item members
QString m_name;
qulonglong m_size;

3
src/webui/api/synccontroller.cpp

@ -490,7 +490,8 @@ void SyncController::torrentPeersAction() @@ -490,7 +490,8 @@ void SyncController::torrentPeersAction()
QVariantMap data;
QVariantHash peers;
const QList<BitTorrent::PeerInfo> peersList = torrent->peers();
const QVector<BitTorrent::PeerInfo> peersList = torrent->peers();
#ifndef DISABLE_COUNTRIES_RESOLUTION
bool resolvePeerCountries = Preferences::instance()->resolvePeerCountries();

2
src/webui/webapplication.h

@ -145,7 +145,7 @@ private: @@ -145,7 +145,7 @@ private:
bool m_isLocalAuthEnabled;
bool m_isAuthSubnetWhitelistEnabled;
QList<Utils::Net::Subnet> m_authSubnetWhitelist;
QVector<Utils::Net::Subnet> m_authSubnetWhitelist;
int m_sessionTimeout;
// security related

Loading…
Cancel
Save