2018-10-25 00:19:38 +00:00
|
|
|
#ifndef DUST3D_LOG_BROWSER_H
|
|
|
|
#define DUST3D_LOG_BROWSER_H
|
2018-04-07 08:44:39 +00:00
|
|
|
// Modified from https://wiki.qt.io/Browser_for_QDebug_output
|
|
|
|
#include <QObject>
|
2020-04-07 23:15:20 +00:00
|
|
|
#include <cstdio>
|
2018-04-07 08:44:39 +00:00
|
|
|
|
|
|
|
class LogBrowserDialog;
|
|
|
|
|
|
|
|
class LogBrowser : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2020-04-07 23:15:20 +00:00
|
|
|
explicit LogBrowser(QObject *parent=0);
|
2018-04-07 08:44:39 +00:00
|
|
|
~LogBrowser();
|
|
|
|
|
|
|
|
public slots:
|
2018-05-12 10:07:46 +00:00
|
|
|
void outputMessage(QtMsgType type, const QString &msg, const QString &source, int line);
|
2018-04-10 07:59:20 +00:00
|
|
|
void showDialog();
|
|
|
|
void hideDialog();
|
|
|
|
bool isDialogVisible();
|
2018-04-07 08:44:39 +00:00
|
|
|
|
|
|
|
signals:
|
2018-05-12 10:07:46 +00:00
|
|
|
void sendMessage(QtMsgType type, const QString &msg, const QString &source, int line);
|
2018-04-07 08:44:39 +00:00
|
|
|
|
|
|
|
private:
|
2020-04-07 23:15:20 +00:00
|
|
|
LogBrowserDialog *m_browserDialog = nullptr;
|
|
|
|
FILE *m_outputTo = nullptr;
|
|
|
|
static bool m_enableOutputToFile;
|
2018-04-07 08:44:39 +00:00
|
|
|
};
|
|
|
|
|
2018-04-10 07:59:20 +00:00
|
|
|
#endif // LOGBROWSER_H
|