XNSim/XNMonitor/DebugWidget/DebugWidget.h

106 lines
1.7 KiB
C
Raw Normal View History

2025-04-28 12:25:20 +08:00
/**
* @file DebugWidget.h
* @author jinchao
* @brief
* @version 1.0
* @date 2025-03-10
*
*/
#pragma once
#include <QWidget>
#include <QTextEdit>
#include <QPushButton>
#include <QVBoxLayout>
#include <QCheckBox>
/**
* @brief
*/
class DebugWidget : public QWidget
{
Q_OBJECT
public:
/**
* @brief
* @param parent
*/
DebugWidget(QWidget *parent = nullptr);
/**
* @brief
*/
~DebugWidget();
/**
* @brief
* @param message
*/
void appendMessage(const QString &message);
/**
* @brief
* @param error
*/
void appendError(const QString &error);
/**
* @brief
* @param warning
*/
void appendWarning(const QString &warning);
public slots:
/**
* @brief
* @param type
* @param message
*/
void onSendDebugMessage(int type, const QString &message);
private slots:
/**
* @brief
*/
void clearLog();
/**
* @brief
*/
void saveLog();
private:
/**
* @brief UI
*/
void setupUI();
/**
* @brief
* @param type
* @return
*/
bool shouldShowMessageType(int type) const;
/**
* @brief
*/
QTextEdit *m_textEdit;
/**
* @brief
*/
QPushButton *m_clearButton;
/**
* @brief
*/
QPushButton *m_saveButton;
/**
* @brief
*/
QVBoxLayout *m_layout;
/**
* @brief
*/
QCheckBox *m_showInfoCheck;
/**
* @brief
*/
QCheckBox *m_showErrorCheck;
/**
* @brief
*/
QCheckBox *m_showWarningCheck;
};