36 lines
815 B
C
36 lines
815 B
C
|
#ifndef LogWindowUIFunction_H
|
||
|
#define LogWindowUIFunction_H
|
||
|
|
||
|
#include <QString>
|
||
|
#include <QMap>
|
||
|
#include <QObject>
|
||
|
#include "UIFunctionBase.h"
|
||
|
#include <thread>
|
||
|
#include <atomic>
|
||
|
class LogWindowUIFunction : public UIFunctionBase
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
public:
|
||
|
LogWindowUIFunction();
|
||
|
~LogWindowUIFunction();
|
||
|
|
||
|
void from(const json& j);
|
||
|
void to(json);
|
||
|
|
||
|
void out_log(const QString message);
|
||
|
void logFunction();
|
||
|
void stopThread();
|
||
|
public slots:
|
||
|
// 定义槽
|
||
|
void onLogMessageReceived(const QString message);
|
||
|
signals:
|
||
|
// 定义信号
|
||
|
void logMessageReceived(const QString message); // 这是你可以发出的信号
|
||
|
|
||
|
private:
|
||
|
std::atomic<bool> m_running; // 控制线程是否继续运行的标志
|
||
|
|
||
|
std::thread m_logThread; // 子线程
|
||
|
};
|
||
|
#endif // LogWindowUIFunction_H
|