logplus/DataMgr/src/ConsoleOutputWidget.h
2025-10-30 09:50:15 +08:00

57 lines
1.3 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @file ConsoleOutputWidget.h
* @brief 统一输出服务采用了singleton模式
* @date 2015-1-18
* @author: aiya
*/
#pragma once
#include <QDockWidget>
#include <QTextEdit>
enum Priority
{
PAI_FATAL = 1 << 4,
PAI_ERROR = 1 << 3,
PAI_WARN = 1 << 2,
PAI_INFO = 1 << 1,
PAI_DEBUG = 1 << 0,
PAI_BASE = 1,
PAI_FATAL_UP = PAI_FATAL,
PAI_ERROR_UP = PAI_ERROR | PAI_FATAL_UP,
PAI_WARN_UP = PAI_WARN | PAI_ERROR_UP,
PAI_INFO_UP = PAI_INFO | PAI_WARN_UP,
PAI_DEBUG_UP = PAI_DEBUG | PAI_INFO_UP,
PAI_ALL = PAI_DEBUG_UP,
PAI_DEFAULT = PAI_INFO_UP,
};
/**
* @class ConsoleOutputWidget
* @brief 统一输出服务,在界面输出的同时,调用了底层的日志写出程序
* @useage
AppendConsole(PAI_ERROR,"测试输出");
AppendConsole(PAI_INFO,"测试输出");
* @date 2015-1-18
* @author: aiya
*/
class ConsoleOutputWidget:public QDockWidget
{
Q_OBJECT
public:
ConsoleOutputWidget(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0);
~ConsoleOutputWidget();
/**
* @function AppendConsole
* @brief 输出日志
* @param priority 日志输出级别
* @param output 要输出的日志内容
*/
void AppendConsole(QColor c,const QString &output);
private:
QTextEdit * Console;
};
extern ConsoleOutputWidget* ConsoleOutService();