const-reference large types

This commit is contained in:
Karol Kosek 2020-12-30 16:01:26 +01:00 committed by Felix Queißner
parent 07a4ddc230
commit 54c4fc7b36
12 changed files with 16 additions and 16 deletions

View File

@ -144,7 +144,7 @@ void BrowserTab::navigateTo(const QUrl &url, PushToHistory mode)
this->updateUI();
}
void BrowserTab::navigateBack(QModelIndex history_index)
void BrowserTab::navigateBack(const QModelIndex &history_index)
{
auto url = history.get(history_index);

View File

@ -53,7 +53,7 @@ public:
void navigateTo(QUrl const & url, PushToHistory mode);
void navigateBack(QModelIndex history_index);
void navigateBack(const QModelIndex &history_index);
void navOneBackback();

View File

@ -4,7 +4,7 @@
#include <openssl/x509.h>
#include <openssl/pem.h>
CryptoIdentity CertificateHelper::createNewIdentity(const QString &common_name, QDateTime expiry_date)
CryptoIdentity CertificateHelper::createNewIdentity(const QString &common_name, const QDateTime &expiry_date)
{
CryptoIdentity identity;

View File

@ -11,7 +11,7 @@ struct CertificateHelper
static CryptoIdentity createNewIdentity(
QString const & common_name,
QDateTime expiry_date);
QDateTime const & expiry_date);
};
#endif // CERTIFICATEHELPER_HPP

View File

@ -63,7 +63,7 @@ void CertificateSelectionDialog::on_use_temp_cert_48h_clicked()
acceptTemporaryWithTimeout(QDateTime::currentDateTime().addDays(2));
}
void CertificateSelectionDialog::acceptTemporaryWithTimeout(QDateTime timeout)
void CertificateSelectionDialog::acceptTemporaryWithTimeout(const QDateTime &timeout)
{
std::default_random_engine rng;
rng.seed(QDateTime::currentDateTime().toMSecsSinceEpoch());

View File

@ -41,7 +41,7 @@ private slots:
private:
//! Creates an anonymous identity with a randomly chosen name that
//! will time out on `timeout`, then accepts the dialog.
void acceptTemporaryWithTimeout(QDateTime timeout);
void acceptTemporaryWithTimeout(const QDateTime &timeout);
void on_currentChanged(const QModelIndex &current, const QModelIndex &previous);

View File

@ -105,7 +105,7 @@ void SettingsDialog::setGeminiStyle(DocumentStyle const &style)
this->ui->page_margin->setValue(this->current_style.margin);
auto setFontAndColor = [this](QLabel * label, QFont font, QColor color)
auto setFontAndColor = [this](QLabel * label, const QFont &font, QColor color)
{
label->setText(formatFont(font));
label->setStyleSheet(COLOR_STYLE

View File

@ -37,7 +37,7 @@ static QApplication * app;
#define SSTR(X) STR(X)
#define STR(X) #X
static QDir derive_dir(QDir const & parent, QString subdir)
static QDir derive_dir(QDir const & parent, QString const & subdir)
{
QDir child = parent;
if(not child.mkpath(subdir)) {

View File

@ -10,7 +10,7 @@
#include "textstyleinstance.hpp"
static QByteArray trim_whitespace(QByteArray items)
static QByteArray trim_whitespace(const QByteArray &items)
{
int start = 0;
while (start < items.size() and isspace(items.at(start)))

View File

@ -75,9 +75,9 @@ struct RenderState
}
};
static void renderNode(RenderState &state, cmark_node &node, QTextCharFormat current_format, QString &page_title, int listIndent = 1);
static void renderNode(RenderState &state, cmark_node &node, const QTextCharFormat &current_format, QString &page_title, int listIndent = 1);
static void renderChildren(RenderState &state, cmark_node & node, QTextCharFormat current_format, QString &page_title, int listIndent = 1)
static void renderChildren(RenderState &state, cmark_node & node, const QTextCharFormat &current_format, QString &page_title, int listIndent = 1)
{
for (auto child = cmark_node_first_child(&node); child != nullptr; child = cmark_node_next(child))
{
@ -102,7 +102,7 @@ static QString extractNodeText(cmark_node &node)
return QString::fromUtf8(data, strlen(data));
}
static void renderNode(RenderState &state, cmark_node & node, QTextCharFormat current_format, QString &page_title, int listIndent)
static void renderNode(RenderState &state, cmark_node & node, const QTextCharFormat &current_format, QString &page_title, int listIndent)
{
auto & cursor = state.cursor;

View File

@ -41,7 +41,7 @@ QUrl TabBrowsingHistory::get(const QModelIndex &index) const
return history.at(index.row());
}
QModelIndex TabBrowsingHistory::oneForward(QModelIndex index) const
QModelIndex TabBrowsingHistory::oneForward(const QModelIndex &index) const
{
if(not index.isValid())
return QModelIndex{};
@ -50,7 +50,7 @@ QModelIndex TabBrowsingHistory::oneForward(QModelIndex index) const
return createIndex(index.row() + 1, index.column());
}
QModelIndex TabBrowsingHistory::oneBackward(QModelIndex index) const
QModelIndex TabBrowsingHistory::oneBackward(const QModelIndex &index) const
{
if(not index.isValid())
return QModelIndex{};

View File

@ -20,9 +20,9 @@ public:
QUrl get(QModelIndex const & index) const;
QModelIndex oneForward(QModelIndex index) const;
QModelIndex oneForward(const QModelIndex &index) const;
QModelIndex oneBackward(QModelIndex index) const;
QModelIndex oneBackward(const QModelIndex &index) const;
public:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;