initial port for Cevo game in C++ (libs)
This commit is contained in:
commit
8436242032
375 files changed
+46282
No files matched your search
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QList>
|
||||
#include <QMutex>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
namespace Cevo {
|
||||
|
||||
struct DebugLogItem {
|
||||
QDateTime time;
|
||||
QString group;
|
||||
QString text;
|
||||
};
|
||||
|
||||
// Equivalent of DebugLog.pas's TDebugLog: a thread-safe, capped, optionally
|
||||
// file-backed log.
|
||||
class DebugLog : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DebugLog(QObject *parent = nullptr);
|
||||
|
||||
void add(QString text, QString group = QString());
|
||||
void writeToFile(QString text) const;
|
||||
|
||||
QList<DebugLogItem> items() const;
|
||||
|
||||
int maxCount() const { return m_maxCount; }
|
||||
void setMaxCount(int value);
|
||||
|
||||
QString fileName = QStringLiteral("DebugLog.txt");
|
||||
bool writeToFileEnable = false;
|
||||
|
||||
signals:
|
||||
void newItem(const DebugLogItem &item);
|
||||
|
||||
private:
|
||||
mutable QMutex m_lock;
|
||||
QList<DebugLogItem> m_items;
|
||||
int m_maxCount = 100;
|
||||
};
|
||||
|
||||
} // namespace Cevo
|
||||
Reference in new issue
Block a user