mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 12:34:19 +00:00
Use reference whenever possible
This commit is contained in:
parent
5b43782f58
commit
8c9b6e2f2d
@ -171,7 +171,7 @@ void CustomDiskIOThread::async_set_file_priority(lt::storage_index_t storage, lt
|
||||
, std::function<void (const lt::storage_error &, lt::aux::vector<lt::download_priority_t, lt::file_index_t>)> handler)
|
||||
{
|
||||
m_nativeDiskIO->async_set_file_priority(storage, priorities
|
||||
, [=, handler = std::move(handler)](const lt::storage_error &error, lt::aux::vector<lt::download_priority_t, lt::file_index_t> priorities)
|
||||
, [=, handler = std::move(handler)](const lt::storage_error &error, const lt::aux::vector<lt::download_priority_t, lt::file_index_t> &priorities)
|
||||
{
|
||||
m_storageData[storage].filePriorities = priorities;
|
||||
handler(error, priorities);
|
||||
|
@ -4986,7 +4986,7 @@ void SessionImpl::upgradeCategories()
|
||||
const auto legacyCategories = SettingValue<QVariantMap>(u"BitTorrent/Session/Categories"_qs).get();
|
||||
for (auto it = legacyCategories.cbegin(); it != legacyCategories.cend(); ++it)
|
||||
{
|
||||
const QString categoryName = it.key();
|
||||
const QString &categoryName = it.key();
|
||||
CategoryOptions categoryOptions;
|
||||
categoryOptions.savePath = Path(it.value().toString());
|
||||
m_categories[categoryName] = categoryOptions;
|
||||
|
@ -1632,7 +1632,7 @@ void TorrentImpl::endReceivedMetadataHandling(const Path &savePath, const PathLi
|
||||
{
|
||||
const auto nativeIndex = nativeIndexes.at(i);
|
||||
|
||||
const Path actualFilePath = fileNames.at(i);
|
||||
const Path &actualFilePath = fileNames.at(i);
|
||||
p.renamed_files[nativeIndex] = actualFilePath.toString().toStdString();
|
||||
|
||||
const Path filePath = actualFilePath.removedExtension(QB_EXT);
|
||||
|
@ -162,7 +162,7 @@ void Smtp::sendMail(const QString &from, const QString &to, const QString &subje
|
||||
|
||||
// Connect to SMTP server
|
||||
const QStringList serverEndpoint = pref->getMailNotificationSMTP().split(u':');
|
||||
const QString serverAddress = serverEndpoint[0];
|
||||
const QString &serverAddress = serverEndpoint[0];
|
||||
const std::optional<int> serverPort = Utils::String::parseInt(serverEndpoint.value(1));
|
||||
|
||||
#ifndef QT_NO_OPENSSL
|
||||
|
@ -382,13 +382,13 @@ void AutoDownloader::handleFeedURLChanged(Feed *feed, const QString &oldURL)
|
||||
}
|
||||
}
|
||||
|
||||
for (QSharedPointer<ProcessingJob> job : asConst(m_processingQueue))
|
||||
for (const QSharedPointer<ProcessingJob> &job : asConst(m_processingQueue))
|
||||
{
|
||||
if (job->feedURL == oldURL)
|
||||
job->feedURL = feed->url();
|
||||
}
|
||||
|
||||
for (QSharedPointer<ProcessingJob> job : asConst(m_waitingJobs))
|
||||
for (const QSharedPointer<ProcessingJob> &job : asConst(m_waitingJobs))
|
||||
{
|
||||
if (job->feedURL == oldURL)
|
||||
job->feedURL = feed->url();
|
||||
|
@ -541,7 +541,7 @@ namespace
|
||||
|
||||
const int PARSINGRESULT_TYPEID = qRegisterMetaType<RSS::Private::ParsingResult>();
|
||||
|
||||
RSS::Private::Parser::Parser(const QString lastBuildDate)
|
||||
RSS::Private::Parser::Parser(const QString &lastBuildDate)
|
||||
{
|
||||
m_result.lastBuildDate = lastBuildDate;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ namespace RSS::Private
|
||||
Q_DISABLE_COPY_MOVE(Parser)
|
||||
|
||||
public:
|
||||
explicit Parser(QString lastBuildDate);
|
||||
explicit Parser(const QString &lastBuildDate);
|
||||
void parse(const QByteArray &feedData);
|
||||
|
||||
signals:
|
||||
|
@ -609,7 +609,7 @@ void SearchPluginManager::parseVersionInfo(const QByteArray &info)
|
||||
}
|
||||
}
|
||||
|
||||
bool SearchPluginManager::isUpdateNeeded(const QString &pluginName, const PluginVersion newVersion) const
|
||||
bool SearchPluginManager::isUpdateNeeded(const QString &pluginName, const PluginVersion &newVersion) const
|
||||
{
|
||||
const PluginInfo *plugin = pluginInfo(pluginName);
|
||||
if (!plugin) return true;
|
||||
|
@ -109,7 +109,7 @@ private:
|
||||
void updateNova();
|
||||
void parseVersionInfo(const QByteArray &info);
|
||||
void installPlugin_impl(const QString &name, const Path &path);
|
||||
bool isUpdateNeeded(const QString &pluginName, PluginVersion newVersion) const;
|
||||
bool isUpdateNeeded(const QString &pluginName, const PluginVersion &newVersion) const;
|
||||
|
||||
void versionInfoDownloadFinished(const Net::DownloadResult &result);
|
||||
void pluginDownloadFinished(const Net::DownloadResult &result);
|
||||
|
@ -199,7 +199,7 @@ void StatusFilterWidget::hideZeroItems()
|
||||
setCurrentRow(TorrentFilter::All, QItemSelectionModel::SelectCurrent);
|
||||
}
|
||||
|
||||
void StatusFilterWidget::update(const QVector<BitTorrent::Torrent *> torrents)
|
||||
void StatusFilterWidget::update(const QVector<BitTorrent::Torrent *> &torrents)
|
||||
{
|
||||
for (const BitTorrent::Torrent *torrent : torrents)
|
||||
updateTorrentStatus(torrent);
|
||||
|
@ -58,7 +58,7 @@ private:
|
||||
|
||||
void configure();
|
||||
|
||||
void update(QVector<BitTorrent::Torrent *> torrents);
|
||||
void update(const QVector<BitTorrent::Torrent *> &torrents);
|
||||
void updateTorrentStatus(const BitTorrent::Torrent *torrent);
|
||||
void updateTexts();
|
||||
void hideZeroItems();
|
||||
|
@ -149,7 +149,7 @@ void AppController::preferencesAction()
|
||||
QJsonObject nativeDirs;
|
||||
for (auto i = watchedFolders.cbegin(); i != watchedFolders.cend(); ++i)
|
||||
{
|
||||
const Path watchedFolder = i.key();
|
||||
const Path &watchedFolder = i.key();
|
||||
const BitTorrent::AddTorrentParams params = i.value().addTorrentParams;
|
||||
if (params.savePath.isEmpty())
|
||||
nativeDirs.insert(watchedFolder.toString(), 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user