2018-04-07 08:44:39 +00:00
|
|
|
#include "logbrowser.h"
|
|
|
|
// Modified from https://wiki.qt.io/Browser_for_QDebug_output
|
|
|
|
#include <QMetaType>
|
2020-04-02 10:39:57 +00:00
|
|
|
#include <stdio.h>
|
2018-04-07 08:44:39 +00:00
|
|
|
#include "logbrowserdialog.h"
|
|
|
|
|
|
|
|
LogBrowser::LogBrowser(QObject *parent) :
|
|
|
|
QObject(parent)
|
|
|
|
{
|
|
|
|
qRegisterMetaType<QtMsgType>("QtMsgType");
|
|
|
|
m_browserDialog = new LogBrowserDialog;
|
2018-05-12 10:07:46 +00:00
|
|
|
connect(this, &LogBrowser::sendMessage, m_browserDialog, &LogBrowserDialog::outputMessage, Qt::QueuedConnection);
|
2018-04-07 08:44:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
LogBrowser::~LogBrowser()
|
|
|
|
{
|
|
|
|
delete m_browserDialog;
|
|
|
|
}
|
|
|
|
|
2018-04-10 07:59:20 +00:00
|
|
|
void LogBrowser::showDialog()
|
|
|
|
{
|
|
|
|
m_browserDialog->show();
|
|
|
|
m_browserDialog->activateWindow();
|
|
|
|
m_browserDialog->raise();
|
|
|
|
}
|
|
|
|
|
|
|
|
void LogBrowser::hideDialog()
|
|
|
|
{
|
|
|
|
m_browserDialog->hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool LogBrowser::isDialogVisible()
|
|
|
|
{
|
|
|
|
return m_browserDialog->isVisible();
|
|
|
|
}
|
|
|
|
|
2018-05-12 10:07:46 +00:00
|
|
|
void LogBrowser::outputMessage(QtMsgType type, const QString &msg, const QString &source, int line)
|
2018-04-07 08:44:39 +00:00
|
|
|
{
|
2018-05-12 10:07:46 +00:00
|
|
|
emit sendMessage(type, msg, source, line);
|
2018-04-07 08:44:39 +00:00
|
|
|
}
|