mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 19:08:58 +03:00
InputBar: apply clang-tidy const reference suggestions
All suggested by: Clang-Tidy: The parameter 'X' is copied for each invocation but only used as a const reference; consider making it a const reference
This commit is contained in:
parent
abf4b3a0a3
commit
6d8d38490a
2 changed files with 17 additions and 17 deletions
|
@ -155,7 +155,7 @@ InputBar::updateAtRoom(const QString &t)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
InputBar::setText(QString newText)
|
InputBar::setText(const QString& newText)
|
||||||
{
|
{
|
||||||
if (history_.empty())
|
if (history_.empty())
|
||||||
history_.push_front(newText);
|
history_.push_front(newText);
|
||||||
|
@ -170,7 +170,7 @@ InputBar::setText(QString newText)
|
||||||
emit textChanged(newText);
|
emit textChanged(newText);
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
InputBar::updateState(int selectionStart_, int selectionEnd_, int cursorPosition_, QString text_)
|
InputBar::updateState(int selectionStart_, int selectionEnd_, int cursorPosition_, const QString& text_)
|
||||||
{
|
{
|
||||||
if (text_.isEmpty())
|
if (text_.isEmpty())
|
||||||
stopTyping();
|
stopTyping();
|
||||||
|
@ -288,7 +288,7 @@ InputBar::openFileSelection()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
InputBar::message(QString msg, MarkdownOverride useMarkdown, bool rainbowify)
|
InputBar::message(const QString& msg, MarkdownOverride useMarkdown, bool rainbowify)
|
||||||
{
|
{
|
||||||
mtx::events::msg::Text text = {};
|
mtx::events::msg::Text text = {};
|
||||||
text.body = msg.trimmed().toStdString();
|
text.body = msg.trimmed().toStdString();
|
||||||
|
@ -352,7 +352,7 @@ InputBar::message(QString msg, MarkdownOverride useMarkdown, bool rainbowify)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
InputBar::emote(QString msg, bool rainbowify)
|
InputBar::emote(const QString& msg, bool rainbowify)
|
||||||
{
|
{
|
||||||
auto html = utils::markdownToHtml(msg, rainbowify);
|
auto html = utils::markdownToHtml(msg, rainbowify);
|
||||||
|
|
||||||
|
@ -380,7 +380,7 @@ InputBar::emote(QString msg, bool rainbowify)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
InputBar::notice(QString msg, bool rainbowify)
|
InputBar::notice(const QString& msg, bool rainbowify)
|
||||||
{
|
{
|
||||||
auto html = utils::markdownToHtml(msg, rainbowify);
|
auto html = utils::markdownToHtml(msg, rainbowify);
|
||||||
|
|
||||||
|
@ -562,7 +562,7 @@ InputBar::sticker(CombinedImagePackModel *model, int row)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
InputBar::command(QString command, QString args)
|
InputBar::command(const QString& command, QString args)
|
||||||
{
|
{
|
||||||
if (command == "me") {
|
if (command == "me") {
|
||||||
emote(args, false);
|
emote(args, false);
|
||||||
|
@ -594,7 +594,7 @@ InputBar::command(QString command, QString args)
|
||||||
http::client()->send_state_event(room->roomId().toStdString(),
|
http::client()->send_state_event(room->roomId().toStdString(),
|
||||||
http::client()->user_id().to_string(),
|
http::client()->user_id().to_string(),
|
||||||
member,
|
member,
|
||||||
[](mtx::responses::EventId, mtx::http::RequestErr err) {
|
[](const mtx::responses::EventId&, mtx::http::RequestErr err) {
|
||||||
if (err)
|
if (err)
|
||||||
nhlog::net()->error(
|
nhlog::net()->error(
|
||||||
"Failed to set room displayname: {}",
|
"Failed to set room displayname: {}",
|
||||||
|
@ -650,7 +650,7 @@ InputBar::command(QString command, QString args)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
InputBar::showPreview(const QMimeData &source, QString path, const QStringList &formats)
|
InputBar::showPreview(const QMimeData &source, const QString& path, const QStringList &formats)
|
||||||
{
|
{
|
||||||
dialogs::PreviewUploadOverlay *previewDialog_ =
|
dialogs::PreviewUploadOverlay *previewDialog_ =
|
||||||
new dialogs::PreviewUploadOverlay(ChatPage::instance());
|
new dialogs::PreviewUploadOverlay(ChatPage::instance());
|
||||||
|
@ -668,7 +668,7 @@ InputBar::showPreview(const QMimeData &source, QString path, const QStringList &
|
||||||
} else if (!path.isEmpty())
|
} else if (!path.isEmpty())
|
||||||
previewDialog_->setPreview(path);
|
previewDialog_->setPreview(path);
|
||||||
else if (!formats.isEmpty()) {
|
else if (!formats.isEmpty()) {
|
||||||
auto mime = formats.first();
|
const auto& mime = formats.first();
|
||||||
previewDialog_->setPreview(source.data(mime), mime);
|
previewDialog_->setPreview(source.data(mime), mime);
|
||||||
} else {
|
} else {
|
||||||
setUploading(false);
|
setUploading(false);
|
||||||
|
@ -684,7 +684,7 @@ InputBar::showPreview(const QMimeData &source, QString path, const QStringList &
|
||||||
previewDialog_,
|
previewDialog_,
|
||||||
&dialogs::PreviewUploadOverlay::confirmUpload,
|
&dialogs::PreviewUploadOverlay::confirmUpload,
|
||||||
this,
|
this,
|
||||||
[this](const QByteArray data, const QString &mime, const QString &fn) {
|
[this](const QByteArray& data, const QString &mime, const QString &fn) {
|
||||||
if (!data.size()) {
|
if (!data.size()) {
|
||||||
nhlog::ui()->warn("Attempted to upload zero-byte file?! Mimetype {}, filename {}",
|
nhlog::ui()->warn("Attempted to upload zero-byte file?! Mimetype {}, filename {}",
|
||||||
mime.toStdString(),
|
mime.toStdString(),
|
||||||
|
|
|
@ -48,17 +48,17 @@ public slots:
|
||||||
QString text() const;
|
QString text() const;
|
||||||
QString previousText();
|
QString previousText();
|
||||||
QString nextText();
|
QString nextText();
|
||||||
void setText(QString newText);
|
void setText(const QString& newText);
|
||||||
|
|
||||||
bool containsAtRoom() const { return containsAtRoom_; }
|
bool containsAtRoom() const { return containsAtRoom_; }
|
||||||
|
|
||||||
void send();
|
void send();
|
||||||
void paste(bool fromMouse);
|
void paste(bool fromMouse);
|
||||||
void insertMimeData(const QMimeData *data);
|
void insertMimeData(const QMimeData *data);
|
||||||
void updateState(int selectionStart, int selectionEnd, int cursorPosition, QString text);
|
void updateState(int selectionStart, int selectionEnd, int cursorPosition, const QString& text);
|
||||||
void openFileSelection();
|
void openFileSelection();
|
||||||
bool uploading() const { return uploading_; }
|
bool uploading() const { return uploading_; }
|
||||||
void message(QString body,
|
void message(const QString& body,
|
||||||
MarkdownOverride useMarkdown = MarkdownOverride::NOT_SPECIFIED,
|
MarkdownOverride useMarkdown = MarkdownOverride::NOT_SPECIFIED,
|
||||||
bool rainbowify = false);
|
bool rainbowify = false);
|
||||||
void reaction(const QString &reactedEvent, const QString &reactionKey);
|
void reaction(const QString &reactedEvent, const QString &reactionKey);
|
||||||
|
@ -75,9 +75,9 @@ signals:
|
||||||
void containsAtRoomChanged();
|
void containsAtRoomChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void emote(QString body, bool rainbowify);
|
void emote(const QString& body, bool rainbowify);
|
||||||
void notice(QString body, bool rainbowify);
|
void notice(const QString& body, bool rainbowify);
|
||||||
void command(QString name, QString args);
|
void command(const QString& name, QString args);
|
||||||
void image(const QString &filename,
|
void image(const QString &filename,
|
||||||
const std::optional<mtx::crypto::EncryptedFile> &file,
|
const std::optional<mtx::crypto::EncryptedFile> &file,
|
||||||
const QString &url,
|
const QString &url,
|
||||||
|
@ -101,7 +101,7 @@ private:
|
||||||
const QString &mime,
|
const QString &mime,
|
||||||
uint64_t dsize);
|
uint64_t dsize);
|
||||||
|
|
||||||
void showPreview(const QMimeData &source, QString path, const QStringList &formats);
|
void showPreview(const QMimeData &source, const QString& path, const QStringList &formats);
|
||||||
void setUploading(bool value)
|
void setUploading(bool value)
|
||||||
{
|
{
|
||||||
if (value != uploading_) {
|
if (value != uploading_) {
|
||||||
|
|
Loading…
Reference in a new issue