From d49e4f889ade68603ea439560a39e07a381f35d4 Mon Sep 17 00:00:00 2001 From: RickyRister Date: Sun, 4 May 2025 23:28:51 -0700 Subject: [PATCH] Pass log messages by const ref --- cockatrice/src/dialogs/dlg_view_log.cpp | 2 +- cockatrice/src/dialogs/dlg_view_log.h | 2 +- cockatrice/src/utility/logger.cpp | 4 ++-- cockatrice/src/utility/logger.h | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cockatrice/src/dialogs/dlg_view_log.cpp b/cockatrice/src/dialogs/dlg_view_log.cpp index dc569c92c..0cd34c9e4 100644 --- a/cockatrice/src/dialogs/dlg_view_log.cpp +++ b/cockatrice/src/dialogs/dlg_view_log.cpp @@ -42,7 +42,7 @@ void DlgViewLog::loadInitialLogBuffer() logEntryAdded(message); } -void DlgViewLog::logEntryAdded(QString message) +void DlgViewLog::logEntryAdded(const QString &message) { logArea->appendPlainText(message); } diff --git a/cockatrice/src/dialogs/dlg_view_log.h b/cockatrice/src/dialogs/dlg_view_log.h index 3845f0062..6f571ff77 100644 --- a/cockatrice/src/dialogs/dlg_view_log.h +++ b/cockatrice/src/dialogs/dlg_view_log.h @@ -22,7 +22,7 @@ private: void loadInitialLogBuffer(); private slots: - void logEntryAdded(QString message); + void logEntryAdded(const QString &message); void actCheckBoxChanged(bool abNewValue); }; diff --git a/cockatrice/src/utility/logger.cpp b/cockatrice/src/utility/logger.cpp index 74ed90597..0184146ae 100644 --- a/cockatrice/src/utility/logger.cpp +++ b/cockatrice/src/utility/logger.cpp @@ -81,12 +81,12 @@ void Logger::closeLogfileSession() fileHandle.close(); } -void Logger::log(QtMsgType /* type */, const QMessageLogContext & /* ctx */, const QString message) +void Logger::log(QtMsgType /* type */, const QMessageLogContext & /* ctx */, const QString &message) { QMetaObject::invokeMethod(this, "internalLog", Qt::QueuedConnection, Q_ARG(const QString &, message)); } -void Logger::internalLog(QString message) +void Logger::internalLog(const QString &message) { QMutexLocker locker(&mutex); diff --git a/cockatrice/src/utility/logger.h b/cockatrice/src/utility/logger.h index 246e9204a..b90644b36 100644 --- a/cockatrice/src/utility/logger.h +++ b/cockatrice/src/utility/logger.h @@ -28,7 +28,7 @@ public: } void logToFile(bool enabled); - void log(QtMsgType type, const QMessageLogContext &ctx, QString message); + void log(QtMsgType type, const QMessageLogContext &ctx, const QString &message); QString getClientVersion(); QString getClientOperatingSystem(); QString getSystemArchitecture(); @@ -57,10 +57,10 @@ protected: void closeLogfileSession(); protected slots: - void internalLog(QString message); + void internalLog(const QString &message); signals: - void logEntryAdded(QString message); + void logEntryAdded(const QString &message); }; #endif