Add const to a few pointer arguments

This commit is contained in:
thalieht 2019-02-22 04:24:22 +02:00
parent ce437817de
commit 77aea3c59e
10 changed files with 12 additions and 12 deletions

View File

@ -253,7 +253,7 @@ void Net::DownloadManager::applyProxySettings()
m_networkManager.setProxy(proxy); m_networkManager.setProxy(proxy);
} }
void Net::DownloadManager::handleReplyFinished(QNetworkReply *reply) void Net::DownloadManager::handleReplyFinished(const QNetworkReply *reply)
{ {
const ServiceID id = ServiceID::fromURL(reply->url()); const ServiceID id = ServiceID::fromURL(reply->url());
const auto waitingJobsIter = m_waitingJobs.find(id); const auto waitingJobsIter = m_waitingJobs.find(id);

View File

@ -115,7 +115,7 @@ namespace Net
explicit DownloadManager(QObject *parent = nullptr); explicit DownloadManager(QObject *parent = nullptr);
void applyProxySettings(); void applyProxySettings();
void handleReplyFinished(QNetworkReply *reply); void handleReplyFinished(const QNetworkReply *reply);
static DownloadManager *m_instance; static DownloadManager *m_instance;
QNetworkAccessManager m_networkManager; QNetworkAccessManager m_networkManager;

View File

@ -285,7 +285,7 @@ void Smtp::readyRead()
} }
} }
QByteArray Smtp::encodeMimeHeader(const QString &key, const QString &value, QTextCodec *latin1, const QByteArray &prefix) QByteArray Smtp::encodeMimeHeader(const QString &key, const QString &value, const QTextCodec *latin1, const QByteArray &prefix)
{ {
QByteArray rv = ""; QByteArray rv = "";
QByteArray line = key.toLatin1() + ": "; QByteArray line = key.toLatin1() + ": ";

View File

@ -90,7 +90,7 @@ namespace Net
AuthCramMD5 AuthCramMD5
}; };
QByteArray encodeMimeHeader(const QString &key, const QString &value, QTextCodec *latin1, const QByteArray &prefix = {}); QByteArray encodeMimeHeader(const QString &key, const QString &value, const QTextCodec *latin1, const QByteArray &prefix = {});
void ehlo(); void ehlo();
void helo(); void helo();
void parseEhloResponse(const QByteArray &code, bool continued, const QString &line); void parseEhloResponse(const QByteArray &code, bool continued, const QString &line);

View File

@ -142,7 +142,7 @@ QJsonObject Article::toJsonObject() const
return jsonObj; return jsonObj;
} }
bool Article::articleDateRecentThan(Article *article, const QDateTime &date) bool Article::articleDateRecentThan(const Article *article, const QDateTime &date)
{ {
return article->date() > date; return article->date() > date;
} }

View File

@ -74,7 +74,7 @@ namespace RSS
QJsonObject toJsonObject() const; QJsonObject toJsonObject() const;
static bool articleDateRecentThan(Article *article, const QDateTime &date); static bool articleDateRecentThan(const Article *article, const QDateTime &date);
signals: signals:
void read(Article *article = nullptr); void read(Article *article = nullptr);

View File

@ -347,7 +347,7 @@ void AutoDownloader::handleTorrentDownloadFailed(const QString &url)
// TODO: Re-schedule job here. // TODO: Re-schedule job here.
} }
void AutoDownloader::handleNewArticle(Article *article) void AutoDownloader::handleNewArticle(const Article *article)
{ {
if (!article->isRead() && !article->torrentUrl().isEmpty()) if (!article->isRead() && !article->torrentUrl().isEmpty())
addJobForArticle(article); addJobForArticle(article);
@ -358,7 +358,7 @@ void AutoDownloader::setRule_impl(const AutoDownloadRule &rule)
m_rules.insert(rule.name(), rule); m_rules.insert(rule.name(), rule);
} }
void AutoDownloader::addJobForArticle(Article *article) void AutoDownloader::addJobForArticle(const Article *article)
{ {
const QString torrentURL = article->torrentUrl(); const QString torrentURL = article->torrentUrl();
if (m_waitingJobs.contains(torrentURL)) return; if (m_waitingJobs.contains(torrentURL)) return;

View File

@ -110,14 +110,14 @@ namespace RSS
void process(); void process();
void handleTorrentDownloadFinished(const QString &url); void handleTorrentDownloadFinished(const QString &url);
void handleTorrentDownloadFailed(const QString &url); void handleTorrentDownloadFailed(const QString &url);
void handleNewArticle(Article *article); void handleNewArticle(const Article *article);
private: private:
void timerEvent(QTimerEvent *event) override; void timerEvent(QTimerEvent *event) override;
void setRule_impl(const AutoDownloadRule &rule); void setRule_impl(const AutoDownloadRule &rule);
void resetProcessingQueue(); void resetProcessingQueue();
void startProcessing(); void startProcessing();
void addJobForArticle(Article *article); void addJobForArticle(const Article *article);
void processJob(const QSharedPointer<ProcessingJob> &job); void processJob(const QSharedPointer<ProcessingJob> &job);
void load(); void load();
void loadRules(const QByteArray &data); void loadRules(const QByteArray &data);

View File

@ -118,7 +118,7 @@ PiecesBar::PiecesBar(QWidget *parent)
setMouseTracking(true); setMouseTracking(true);
} }
void PiecesBar::setTorrent(BitTorrent::TorrentHandle *torrent) void PiecesBar::setTorrent(const BitTorrent::TorrentHandle *torrent)
{ {
m_torrent = torrent; m_torrent = torrent;
if (!m_torrent) if (!m_torrent)

View File

@ -50,7 +50,7 @@ class PiecesBar : public QWidget
public: public:
explicit PiecesBar(QWidget *parent = nullptr); explicit PiecesBar(QWidget *parent = nullptr);
void setTorrent(BitTorrent::TorrentHandle *torrent); void setTorrent(const BitTorrent::TorrentHandle *torrent);
void setColors(const QColor &background, const QColor &border, const QColor &complete); void setColors(const QColor &background, const QColor &border, const QColor &complete);
virtual void clear(); virtual void clear();