mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-10 12:23:58 -07:00
Pass log messages by const ref (#5914)
* Pass log messages by const ref * Rename method
This commit is contained in:
parent
bd8306bd33
commit
4a54412d47
4 changed files with 9 additions and 9 deletions
|
|
@ -28,7 +28,7 @@ DlgViewLog::DlgViewLog(QWidget *parent) : QDialog(parent)
|
||||||
resize(800, 500);
|
resize(800, 500);
|
||||||
|
|
||||||
loadInitialLogBuffer();
|
loadInitialLogBuffer();
|
||||||
connect(&Logger::getInstance(), &Logger::logEntryAdded, this, &DlgViewLog::logEntryAdded);
|
connect(&Logger::getInstance(), &Logger::logEntryAdded, this, &DlgViewLog::appendLogEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlgViewLog::actCheckBoxChanged(bool abNewValue)
|
void DlgViewLog::actCheckBoxChanged(bool abNewValue)
|
||||||
|
|
@ -40,10 +40,10 @@ void DlgViewLog::loadInitialLogBuffer()
|
||||||
{
|
{
|
||||||
QList<QString> logBuffer = Logger::getInstance().getLogBuffer();
|
QList<QString> logBuffer = Logger::getInstance().getLogBuffer();
|
||||||
for (const QString &message : logBuffer)
|
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");
|
static auto colorEscapeCodePattern = QRegularExpression("\033\\[\\d+m");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ private:
|
||||||
|
|
||||||
void loadInitialLogBuffer();
|
void loadInitialLogBuffer();
|
||||||
private slots:
|
private slots:
|
||||||
void logEntryAdded(QString message);
|
void appendLogEntry(const QString &message);
|
||||||
void actCheckBoxChanged(bool abNewValue);
|
void actCheckBoxChanged(bool abNewValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,12 +81,12 @@ void Logger::closeLogfileSession()
|
||||||
fileHandle.close();
|
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));
|
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);
|
QMutexLocker locker(&mutex);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void logToFile(bool enabled);
|
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 getClientVersion();
|
||||||
QString getClientOperatingSystem();
|
QString getClientOperatingSystem();
|
||||||
QString getSystemArchitecture();
|
QString getSystemArchitecture();
|
||||||
|
|
@ -57,10 +57,10 @@ protected:
|
||||||
void closeLogfileSession();
|
void closeLogfileSession();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void internalLog(QString message);
|
void internalLog(const QString &message);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void logEntryAdded(QString message);
|
void logEntryAdded(const QString &message);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue