diff --git a/cockatrice/src/dialogs/dlg_view_log.cpp b/cockatrice/src/dialogs/dlg_view_log.cpp index 7b4e8c617..35accf80f 100644 --- a/cockatrice/src/dialogs/dlg_view_log.cpp +++ b/cockatrice/src/dialogs/dlg_view_log.cpp @@ -28,7 +28,7 @@ DlgViewLog::DlgViewLog(QWidget *parent) : QDialog(parent) resize(800, 500); loadInitialLogBuffer(); - connect(&Logger::getInstance(), &Logger::logEntryAdded, this, &DlgViewLog::logEntryAdded); + connect(&Logger::getInstance(), &Logger::logEntryAdded, this, &DlgViewLog::appendLogEntry); } void DlgViewLog::actCheckBoxChanged(bool abNewValue) @@ -40,10 +40,10 @@ void DlgViewLog::loadInitialLogBuffer() { QList logBuffer = Logger::getInstance().getLogBuffer(); for (const QString &message : logBuffer) - logEntryAdded(message); + appendLogEntry(message); } -void DlgViewLog::logEntryAdded(QString message) +void DlgViewLog::appendLogEntry(const QString &message) { static auto colorEscapeCodePattern = QRegularExpression("\033\\[\\d+m"); diff --git a/cockatrice/src/dialogs/dlg_view_log.h b/cockatrice/src/dialogs/dlg_view_log.h index 3845f0062..870c23fc5 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 appendLogEntry(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