mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 20:44:15 +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)
|
, 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
|
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;
|
m_storageData[storage].filePriorities = priorities;
|
||||||
handler(error, priorities);
|
handler(error, priorities);
|
||||||
|
@ -4986,7 +4986,7 @@ void SessionImpl::upgradeCategories()
|
|||||||
const auto legacyCategories = SettingValue<QVariantMap>(u"BitTorrent/Session/Categories"_qs).get();
|
const auto legacyCategories = SettingValue<QVariantMap>(u"BitTorrent/Session/Categories"_qs).get();
|
||||||
for (auto it = legacyCategories.cbegin(); it != legacyCategories.cend(); ++it)
|
for (auto it = legacyCategories.cbegin(); it != legacyCategories.cend(); ++it)
|
||||||
{
|
{
|
||||||
const QString categoryName = it.key();
|
const QString &categoryName = it.key();
|
||||||
CategoryOptions categoryOptions;
|
CategoryOptions categoryOptions;
|
||||||
categoryOptions.savePath = Path(it.value().toString());
|
categoryOptions.savePath = Path(it.value().toString());
|
||||||
m_categories[categoryName] = categoryOptions;
|
m_categories[categoryName] = categoryOptions;
|
||||||
|
@ -1632,7 +1632,7 @@ void TorrentImpl::endReceivedMetadataHandling(const Path &savePath, const PathLi
|
|||||||
{
|
{
|
||||||
const auto nativeIndex = nativeIndexes.at(i);
|
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();
|
p.renamed_files[nativeIndex] = actualFilePath.toString().toStdString();
|
||||||
|
|
||||||
const Path filePath = actualFilePath.removedExtension(QB_EXT);
|
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
|
// Connect to SMTP server
|
||||||
const QStringList serverEndpoint = pref->getMailNotificationSMTP().split(u':');
|
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));
|
const std::optional<int> serverPort = Utils::String::parseInt(serverEndpoint.value(1));
|
||||||
|
|
||||||
#ifndef QT_NO_OPENSSL
|
#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)
|
if (job->feedURL == oldURL)
|
||||||
job->feedURL = feed->url();
|
job->feedURL = feed->url();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (QSharedPointer<ProcessingJob> job : asConst(m_waitingJobs))
|
for (const QSharedPointer<ProcessingJob> &job : asConst(m_waitingJobs))
|
||||||
{
|
{
|
||||||
if (job->feedURL == oldURL)
|
if (job->feedURL == oldURL)
|
||||||
job->feedURL = feed->url();
|
job->feedURL = feed->url();
|
||||||
|
@ -541,7 +541,7 @@ namespace
|
|||||||
|
|
||||||
const int PARSINGRESULT_TYPEID = qRegisterMetaType<RSS::Private::ParsingResult>();
|
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;
|
m_result.lastBuildDate = lastBuildDate;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ namespace RSS::Private
|
|||||||
Q_DISABLE_COPY_MOVE(Parser)
|
Q_DISABLE_COPY_MOVE(Parser)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Parser(QString lastBuildDate);
|
explicit Parser(const QString &lastBuildDate);
|
||||||
void parse(const QByteArray &feedData);
|
void parse(const QByteArray &feedData);
|
||||||
|
|
||||||
signals:
|
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);
|
const PluginInfo *plugin = pluginInfo(pluginName);
|
||||||
if (!plugin) return true;
|
if (!plugin) return true;
|
||||||
|
@ -109,7 +109,7 @@ private:
|
|||||||
void updateNova();
|
void updateNova();
|
||||||
void parseVersionInfo(const QByteArray &info);
|
void parseVersionInfo(const QByteArray &info);
|
||||||
void installPlugin_impl(const QString &name, const Path &path);
|
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 versionInfoDownloadFinished(const Net::DownloadResult &result);
|
||||||
void pluginDownloadFinished(const Net::DownloadResult &result);
|
void pluginDownloadFinished(const Net::DownloadResult &result);
|
||||||
|
@ -199,7 +199,7 @@ void StatusFilterWidget::hideZeroItems()
|
|||||||
setCurrentRow(TorrentFilter::All, QItemSelectionModel::SelectCurrent);
|
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)
|
for (const BitTorrent::Torrent *torrent : torrents)
|
||||||
updateTorrentStatus(torrent);
|
updateTorrentStatus(torrent);
|
||||||
|
@ -58,7 +58,7 @@ private:
|
|||||||
|
|
||||||
void configure();
|
void configure();
|
||||||
|
|
||||||
void update(QVector<BitTorrent::Torrent *> torrents);
|
void update(const QVector<BitTorrent::Torrent *> &torrents);
|
||||||
void updateTorrentStatus(const BitTorrent::Torrent *torrent);
|
void updateTorrentStatus(const BitTorrent::Torrent *torrent);
|
||||||
void updateTexts();
|
void updateTexts();
|
||||||
void hideZeroItems();
|
void hideZeroItems();
|
||||||
|
@ -149,7 +149,7 @@ void AppController::preferencesAction()
|
|||||||
QJsonObject nativeDirs;
|
QJsonObject nativeDirs;
|
||||||
for (auto i = watchedFolders.cbegin(); i != watchedFolders.cend(); ++i)
|
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;
|
const BitTorrent::AddTorrentParams params = i.value().addTorrentParams;
|
||||||
if (params.savePath.isEmpty())
|
if (params.savePath.isEmpty())
|
||||||
nativeDirs.insert(watchedFolder.toString(), 1);
|
nativeDirs.insert(watchedFolder.toString(), 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user