Displays whatever gets printed to (usually) stderr starting from the time the tab was opened.
tabs/unknownfilestab.cpp \
tabs/pendingrequesttab.cpp \
registertabs.cpp \
- tabs/databaselogtab.cpp
+ tabs/databaselogtab.cpp \
+ tabs/clientlogtab.cpp
HEADERS += mainwindow.h \
databaseconnectiondialog.h \
tabs/reportstab.h \
tabs/unknownfilestab.h \
tabs/pendingrequesttab.h \
- tabs/databaselogtab.h
+ tabs/databaselogtab.h \
+ tabs/clientlogtab.h
FORMS += mainwindow.ui \
databaseconnectiondialog.ui \
tabs/reportstab.ui \
tabs/unknownfilestab.ui \
tabs/pendingrequesttab.ui \
- tabs/databaselogtab.ui
+ tabs/databaselogtab.ui \
+ tabs/clientlogtab.ui
include(../localmylist.pri)
include(qtsingleapplication/qtsingleapplication.pri)
#include "tabs/unknownfilestab.h"
#include "tabs/pendingrequesttab.h"
#include "tabs/databaselogtab.h"
+#include "tabs/clientlogtab.h"
void registerTabs()
{
TabWidget::registerTab<UnknownFilesTab>();
TabWidget::registerTab<PendingRequestTab>();
TabWidget::registerTab<DatabaseLogTab>();
+ TabWidget::registerTab<ClientLogTab>();
}
--- /dev/null
+#include "clientlogtab.h"
+#include "ui_clientlogtab.h"
+
+#include <QDateTime>
+
+#include "mylist.h"
+
+ClientLogTab::ClientLogTab(QWidget *parent) :
+ AbstractTabBase(parent),
+ ui(new Ui::ClientLogTab)
+{
+ ui->setupUi(this);
+ setLabel(name());
+}
+
+ClientLogTab::~ClientLogTab()
+{
+ delete ui;
+}
+
+QString ClientLogTab::staticId()
+{
+ return "client_log";
+}
+
+QString ClientLogTab::name()
+{
+ return tr("Client Log");
+}
+
+void ClientLogTab::init()
+{
+ connect(LocalMyList::instance(), SIGNAL(debugMessage(QString)), this, SLOT(appendMessage(QString)));
+ QString message = tr("Logging started at %1.").arg(
+ QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz"));
+ ui->textBox->appendPlainText(message);
+}
+
+
+void ClientLogTab::appendMessage(const QString &message)
+{
+ ui->textBox->appendPlainText(message);
+}
--- /dev/null
+#ifndef CLIENTLOGTAB_H
+#define CLIENTLOGTAB_H
+
+#include "abstracttab.h"
+
+#include <QString>
+
+namespace Ui {
+class ClientLogTab;
+}
+
+class ClientLogTab : public AbstractTabBase<ClientLogTab>
+{
+ Q_OBJECT
+
+public:
+ explicit ClientLogTab(QWidget *parent = 0);
+ ~ClientLogTab();
+
+ static QString staticId();
+ static QString name();
+
+ void init();
+
+public slots:
+ void appendMessage(const QString &message);
+
+private:
+ Ui::ClientLogTab *ui;
+};
+
+#endif // CLIENTLOGTAB_H
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ClientLogTab</class>
+ <widget class="QWidget" name="ClientLogTab">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>559</width>
+ <height>382</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QPlainTextEdit" name="textBox">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
#include <QByteArray>
#include <QDateTime>
+#include "mylist.h"
+
namespace LocalMyList {
/*
}
}
+auto debugMessageSignal = [](const QString &message)
+{
+ emit MyList::instance()->debugMessage(message);
+};
+
/*
* messageHandler will try to format the debug message
* and use Qt's default handlerto print it.
ctx);
qtMessageHandler(type, context, message);
+
+ debugMessageSignal(message);
}
#else
void messageHandler(QtMsgType type, const char *msg)
// actually printing the message.
qt_message_output(type, buf.constData());
qInstallMsgHandler(messageHandler);
+
+ debugMessageSignal(message);
}
#endif
signals:
void taskCountChanged();
void allTasksFinished();
+ void debugMessage(const QString &message);
private:
DatabaseConnectionSettings dbs;