first commit
This commit is contained in:
64
project/fm_viewer/tester/fe_log.h
Normal file
64
project/fm_viewer/tester/fe_log.h
Normal file
@@ -0,0 +1,64 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user