65 lines
1.5 KiB
C++
65 lines
1.5 KiB
C++
#ifndef FELOG_H
|
|
#define FELOG_H
|
|
|
|
#if (FE_LOG_VERSION)
|
|
|
|
#include <QWidget>
|
|
#include <QDialog>
|
|
#include <QPushButton>
|
|
//#include <QDebug>
|
|
|
|
#define FE_LOG_FL qInfo()//"[" << __FUNCTION__ << __LINE__ << "]"
|
|
|
|
class FELogHandler : public QObject
|
|
{
|
|
Q_OBJECT
|
|
private:
|
|
FELogHandler(QObject* parent = nullptr) : QObject(parent){}
|
|
|
|
public:
|
|
static void messageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg);
|
|
static QVector<QString> buffer;
|
|
static void printDebug(QString msg);
|
|
|
|
static FELogHandler* instance()
|
|
{
|
|
static FELogHandler _instance;
|
|
return &_instance;
|
|
}
|
|
//static void myMessageHandler(QtMsgType, const QMessageLogContext &, const QString &);
|
|
signals:
|
|
void appended(QString msg);
|
|
};
|
|
|
|
|
|
class QPlainTextEdit;
|
|
class QVBoxLayout;
|
|
|
|
class FELogDialog : public QDialog
|
|
{
|
|
Q_OBJECT
|
|
private:
|
|
explicit FELogDialog(QWidget *parent = nullptr,Qt::WindowFlags f= Qt::WindowTitleHint | Qt::Dialog | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint);
|
|
QWidget* _toolbar;
|
|
QPlainTextEdit* _text;
|
|
QVBoxLayout* _layout;
|
|
void _addSystemInfo();
|
|
QPushButton* button(QWidget* parent,QLayout* layout,QString title);
|
|
|
|
protected:
|
|
void showEvent( QShowEvent* event );
|
|
public:
|
|
static FELogDialog* instance(QWidget* parent = nullptr);
|
|
bool isHiddenReal();
|
|
void onClose();
|
|
signals:
|
|
public slots:
|
|
void onAppended(QString msg);
|
|
void onButton();
|
|
|
|
};
|
|
|
|
|
|
#endif // FE_LOG_VERSION
|
|
#endif // FELOG_H
|