ui: log tab
This commit is contained in:
@@ -285,6 +285,7 @@ add_files(
|
||||
utility/messaging/type/MessageLoadProject.h
|
||||
utility/messaging/type/MessageMoveIDECursor.h
|
||||
utility/messaging/type/MessageNewErrors.h
|
||||
utility/messaging/type/MessageNewLog.h
|
||||
utility/messaging/type/MessagePluginPortChange.h
|
||||
utility/messaging/type/MessageProjectEdit.h
|
||||
utility/messaging/type/MessageProjectNew.h
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "component/view/UndoRedoView.h"
|
||||
#include "component/view/ViewFactory.h"
|
||||
|
||||
#include "utility/logging/LogManager.h"
|
||||
|
||||
std::shared_ptr<ComponentFactory> ComponentFactory::create(ViewFactory* viewFactory, StorageAccess* storageAccess)
|
||||
{
|
||||
std::shared_ptr<ComponentFactory> ptr(new ComponentFactory());
|
||||
@@ -63,7 +65,9 @@ std::shared_ptr<Component> ComponentFactory::createErrorComponent(ViewLayout* vi
|
||||
std::shared_ptr<Component> ComponentFactory::createLogComponent(ViewLayout* viewLayout)
|
||||
{
|
||||
std::shared_ptr<LogView> view = m_viewFactory->createLogView(viewLayout);
|
||||
std::shared_ptr<LogController> controller = std::make_shared<LogController>(m_storageAccess);
|
||||
std::shared_ptr<LogController> controller = std::make_shared<LogController>();
|
||||
|
||||
LogManager::getInstance()->addLogger(controller);
|
||||
|
||||
return std::make_shared<Component>(view, controller);
|
||||
}
|
||||
|
||||
@@ -63,8 +63,8 @@ void ComponentManager::setup(ViewLayout* viewLayout)
|
||||
std::shared_ptr<Component> errorComponent = m_componentFactory->createErrorComponent(tabbedView.get());
|
||||
m_components.push_back(errorComponent);
|
||||
|
||||
//std::shared_ptr<Component> logComponent = m_componentFactory->createLogComponent(tabbedView.get());
|
||||
//m_components.push_back(logComponent);
|
||||
std::shared_ptr<Component> logComponent = m_componentFactory->createLogComponent(tabbedView.get());
|
||||
m_components.push_back(logComponent);
|
||||
}
|
||||
|
||||
void ComponentManager::clearComponents()
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#include "component/controller/LogController.h"
|
||||
|
||||
#include "data/access/StorageAccess.h"
|
||||
#include "utility/logging/LogManager.h"
|
||||
|
||||
LogController::LogController(StorageAccess* storageAccess)
|
||||
: m_storageAccess(storageAccess)
|
||||
LogController::LogController()
|
||||
: Logger("WindowLogger")
|
||||
{
|
||||
}
|
||||
|
||||
@@ -20,3 +21,29 @@ void LogController::clear()
|
||||
{
|
||||
getView()->clear();
|
||||
}
|
||||
|
||||
void LogController::logInfo(const LogMessage& message )
|
||||
{
|
||||
addLog(LOG_INFOS, message);
|
||||
}
|
||||
|
||||
void LogController::logError(const LogMessage& message )
|
||||
{
|
||||
addLog(LOG_ERRORS, message);
|
||||
}
|
||||
|
||||
void LogController::logWarning(const LogMessage& message )
|
||||
{
|
||||
addLog(LOG_WARNINGS, message);
|
||||
}
|
||||
|
||||
void LogController::addLog(Logger::LogLevel type, const LogMessage& message)
|
||||
{
|
||||
MessageNewLog(type,message).dispatch();
|
||||
}
|
||||
|
||||
void LogController::handleMessage(MessageNewLog* message)
|
||||
{
|
||||
getView()->addLog(message->type, message->message);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,21 +4,33 @@
|
||||
#include "component/controller/Controller.h"
|
||||
#include "component/view/LogView.h"
|
||||
|
||||
#include "utility/logging/Logger.h"
|
||||
#include "utility/logging/LogMessage.h"
|
||||
#include "utility/messaging/type/MessageNewLog.h"
|
||||
#include "utility/messaging/MessageListener.h"
|
||||
|
||||
class StorageAccess;
|
||||
|
||||
class LogController
|
||||
: public Controller
|
||||
, public Logger
|
||||
, public MessageListener<MessageNewLog>
|
||||
{
|
||||
public:
|
||||
LogController(StorageAccess* storageAccess);
|
||||
LogController();
|
||||
~LogController();
|
||||
|
||||
private:
|
||||
LogView* getView() const;
|
||||
|
||||
virtual void handleMessage(MessageNewLog* message);
|
||||
virtual void clear();
|
||||
|
||||
StorageAccess* m_storageAccess;
|
||||
virtual void logInfo(const LogMessage& message);
|
||||
virtual void logWarning(const LogMessage& message);
|
||||
virtual void logError(const LogMessage& message);
|
||||
|
||||
void addLog(Logger::LogLevel type, const LogMessage& message);
|
||||
};
|
||||
|
||||
#endif // LOG_CONTROLLER_H
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
|
||||
#include "component/view/View.h"
|
||||
|
||||
#include "utility/logging/LogMessage.h"
|
||||
#include "utility/logging/Logger.h"
|
||||
|
||||
class LogView
|
||||
: public View
|
||||
{
|
||||
@@ -13,6 +16,7 @@ public:
|
||||
virtual std::string getName() const;
|
||||
|
||||
virtual void clear() = 0;
|
||||
virtual void addLog(Logger::LogLevel type, const LogMessage& message) = 0;
|
||||
};
|
||||
|
||||
#endif // LOG_VIEW_H
|
||||
|
||||
@@ -18,7 +18,7 @@ ColorScheme::~ColorScheme()
|
||||
|
||||
std::string ColorScheme::getColor(const std::string& key) const
|
||||
{
|
||||
return getValue<std::string>(key, "");
|
||||
return getValue<std::string>(key, "#FF1493");
|
||||
}
|
||||
|
||||
std::string ColorScheme::getColor(const std::string& key, const std::string& defaultColor) const
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef MESSAGE_NEW_LOG_H
|
||||
#define MESSAGE_NEW_LOG_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
class MessageNewLog
|
||||
: public Message<MessageNewLog>
|
||||
{
|
||||
public:
|
||||
MessageNewLog(const Logger::LogLevel type, const LogMessage& message)
|
||||
: type(type)
|
||||
, message(message)
|
||||
{
|
||||
setSendAsTask(false);
|
||||
setIsLogged(false);
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageNewLog";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
{
|
||||
os << "Log: " << message.message;
|
||||
}
|
||||
|
||||
const Logger::LogLevel type;
|
||||
const LogMessage message;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_NEW_LOG_H
|
||||
@@ -46,6 +46,8 @@ namespace utility
|
||||
|
||||
template<typename T>
|
||||
std::vector<std::string> toStrings(const std::vector<T>& d);
|
||||
template<>
|
||||
std::vector<std::string> toStrings(const std::vector<FilePath>& d);
|
||||
|
||||
template<typename T>
|
||||
bool isPermutation(const std::vector<T>& a, const std::vector<T>& b)
|
||||
|
||||
@@ -5,9 +5,31 @@
|
||||
#include <QHeaderView>
|
||||
#include <QResizeEvent>
|
||||
#include <QScrollBar>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QLineEdit>
|
||||
|
||||
#include "settings/ApplicationSettings.h"
|
||||
|
||||
class SelectableCellDelegate : public QStyledItemDelegate
|
||||
{
|
||||
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
};
|
||||
|
||||
|
||||
QWidget* SelectableCellDelegate::createEditor(
|
||||
QWidget* parent,
|
||||
const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
QWidget* editor = QStyledItemDelegate::createEditor(parent, option, index);
|
||||
QLineEdit* lineEdit = dynamic_cast<QLineEdit*>(editor);
|
||||
if (lineEdit != nullptr)
|
||||
{
|
||||
lineEdit->setReadOnly(true);
|
||||
}
|
||||
return editor;
|
||||
}
|
||||
|
||||
QtTable::QtTable(QWidget* parent)
|
||||
: QTableView(parent)
|
||||
, m_rowsToFill(0)
|
||||
@@ -15,6 +37,8 @@ QtTable::QtTable(QWidget* parent)
|
||||
setAlternatingRowColors(true);
|
||||
setShowGrid(false);
|
||||
|
||||
this->setItemDelegate(new SelectableCellDelegate());
|
||||
|
||||
verticalHeader()->sectionResizeMode(QHeaderView::Fixed);
|
||||
verticalHeader()->setDefaultAlignment(Qt::AlignRight);
|
||||
|
||||
|
||||
@@ -184,9 +184,8 @@ void QtErrorView::setStyleSheet() const
|
||||
QWidget* widget = QtViewWidgetWrapper::getWidgetOfView(this);
|
||||
utility::setWidgetBackgroundColor(widget, ColorScheme::getInstance()->getColor("error/background"));
|
||||
|
||||
|
||||
QPalette palette(m_showErrors->palette());
|
||||
palette.setColor(QPalette::WindowText, QColor(ColorScheme::getInstance()->getColor("error/text/normal").c_str()));
|
||||
palette.setColor(QPalette::WindowText, QColor(ColorScheme::getInstance()->getColor("table/text/normal").c_str()));
|
||||
//palette.setColor(QPalette::Text, QColor(ColorScheme::getInstance()->getColor("error/text/normal").c_str()));
|
||||
//palette.setColor(QPalette::ButtonText, QColor(ColorScheme::getInstance()->getColor("error/text/normal").c_str()));
|
||||
|
||||
@@ -196,9 +195,9 @@ void QtErrorView::setStyleSheet() const
|
||||
m_showNonIndexedErrors->setPalette(palette);
|
||||
m_showNonIndexedFatals->setPalette(palette);
|
||||
|
||||
widget->setStyleSheet(
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath() + "error_view/error_view.css").c_str()
|
||||
);
|
||||
//widget->setStyleSheet(
|
||||
//utility::getStyleSheet(ResourcePaths::getGuiPath() + "error_view/error_view.css").c_str()
|
||||
//);
|
||||
|
||||
m_table->updateRows();
|
||||
}
|
||||
@@ -241,10 +240,10 @@ QCheckBox* QtErrorView::createFilterCheckbox(const QString& name, bool checked,
|
||||
m_table->selectionModel()->clearSelection();
|
||||
|
||||
ErrorFilter filter;
|
||||
filter.error = m_showErrors->checkState() == Qt::Checked;
|
||||
filter.fatal = m_showFatals->checkState() == Qt::Checked;
|
||||
filter.unindexedError = m_showNonIndexedErrors->checkState() == Qt::Checked;
|
||||
filter.unindexedFatal = m_showNonIndexedFatals->checkState() == Qt::Checked;
|
||||
filter.error = m_showErrors->isChecked();
|
||||
filter.fatal = m_showFatals->isChecked();
|
||||
filter.unindexedError = m_showNonIndexedErrors->isChecked();
|
||||
filter.unindexedFatal = m_showNonIndexedFatals->isChecked();
|
||||
|
||||
MessageErrorFilterChanged(filter).dispatch();
|
||||
}
|
||||
@@ -258,19 +257,19 @@ QCheckBox* QtErrorView::createFilterCheckbox(const QString& name, bool checked,
|
||||
|
||||
bool QtErrorView::isShownError(const ErrorInfo& error)
|
||||
{
|
||||
if (!error.fatal && error.indexed && m_showErrors->checkState() == Qt::Checked)
|
||||
if (!error.fatal && error.indexed && m_showErrors->isChecked())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (error.fatal && error.indexed && m_showFatals->checkState() == Qt::Checked)
|
||||
if (error.fatal && error.indexed && m_showFatals->isChecked())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (!error.fatal && !error.indexed && m_showNonIndexedErrors->checkState() == Qt::Checked)
|
||||
if (!error.fatal && !error.indexed && m_showNonIndexedErrors->isChecked())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (error.fatal && !error.indexed && m_showNonIndexedFatals->checkState() == Qt::Checked)
|
||||
if (error.fatal && !error.indexed && m_showNonIndexedFatals->isChecked())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3,11 +3,21 @@
|
||||
#include <QBoxLayout>
|
||||
#include <QFrame>
|
||||
#include <QLabel>
|
||||
#include <QCheckBox>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "settings/ColorScheme.h"
|
||||
#include "qt/view/QtViewWidgetWrapper.h"
|
||||
#include "utility/messaging/type/MessageRefresh.h"
|
||||
#include "utility/ResourcePaths.h"
|
||||
#include "qt/utility/utilityQt.h"
|
||||
#include "qt/element/QtTable.h"
|
||||
|
||||
|
||||
QtLogView::QtLogView(ViewLayout* viewLayout)
|
||||
: LogView(viewLayout)
|
||||
, m_addLogFunctor(std::bind(&QtLogView::doAddLog, this, std::placeholders::_1, std::placeholders::_2))
|
||||
, m_clearFunctor(std::bind(&QtLogView::doClear, this))
|
||||
, m_refreshFunctor(std::bind(&QtLogView::doRefreshView, this))
|
||||
{
|
||||
@@ -27,17 +37,107 @@ void QtLogView::initView()
|
||||
QWidget* widget = QtViewWidgetWrapper::getWidgetOfView(this);
|
||||
|
||||
QBoxLayout* layout = new QBoxLayout(QBoxLayout::TopToBottom);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setContentsMargins(0, 10, 0, 5);
|
||||
layout->setSpacing(0);
|
||||
widget->setLayout(layout);
|
||||
|
||||
QLabel* label = new QLabel("test log view");
|
||||
QHBoxLayout* headerLayout = new QHBoxLayout();
|
||||
headerLayout->addSpacing(10);
|
||||
|
||||
widget->layout()->addWidget(label);
|
||||
m_viewEnabled = new QCheckBox("Enable");
|
||||
m_viewEnabled->setChecked(ApplicationSettings::getInstance()->getLoggingEnabled());
|
||||
connect(m_viewEnabled, &QCheckBox::stateChanged,
|
||||
[=](int){
|
||||
setLoggingEnabled(m_viewEnabled->isChecked());
|
||||
}
|
||||
);
|
||||
headerLayout->addWidget(m_viewEnabled);
|
||||
headerLayout->addSpacing(25);
|
||||
m_showAstLogging = new QCheckBox("Ast");
|
||||
m_showAstLogging->setEnabled(m_viewEnabled->isChecked());
|
||||
m_showAstLogging->setChecked(ApplicationSettings::getInstance()->getVerboseIndexerLoggingEnabled());
|
||||
connect(m_showAstLogging, &QCheckBox::stateChanged,
|
||||
[=](int){
|
||||
setAstLoggingEnabled(m_showAstLogging->isChecked());
|
||||
}
|
||||
);
|
||||
headerLayout->addWidget(m_showAstLogging);
|
||||
headerLayout->addStretch();
|
||||
|
||||
layout->addLayout(headerLayout);
|
||||
|
||||
m_table = new QtTable(this);
|
||||
m_model = new QStandardItemModel(this);
|
||||
m_table->setModel(m_model);
|
||||
|
||||
m_model->setColumnCount(3);
|
||||
m_table->setColumnWidth(LOGVIEW_COLUMN::TYPE, 100);
|
||||
m_table->setColumnWidth(LOGVIEW_COLUMN::TIMESTAMP, 150);
|
||||
m_table->setColumnWidth(LOGVIEW_COLUMN::TYPE, 100);
|
||||
|
||||
QStringList headers;
|
||||
headers << "Type" << "Timestamp" << "Message";
|
||||
m_model->setHorizontalHeaderLabels(headers);
|
||||
|
||||
layout->addWidget(m_table);
|
||||
|
||||
QHBoxLayout* filters = new QHBoxLayout();
|
||||
filters->addSpacing(15);
|
||||
|
||||
m_showErrors = createFilterCheckbox("error", filters, true);
|
||||
m_showWarnings = createFilterCheckbox("warnings", filters, true);
|
||||
m_showInfo = createFilterCheckbox("info", filters);
|
||||
|
||||
filters->addStretch();
|
||||
updateMask();
|
||||
|
||||
layout->addLayout(filters);
|
||||
|
||||
doRefreshView();
|
||||
}
|
||||
|
||||
QCheckBox* QtLogView::createFilterCheckbox(const QString& name, QBoxLayout* layout, bool checked)
|
||||
{
|
||||
QCheckBox* checkbox = new QCheckBox(name);
|
||||
checkbox->setChecked(checked);
|
||||
|
||||
connect(checkbox, &QCheckBox::stateChanged,
|
||||
[=](int)
|
||||
{
|
||||
m_table->selectionModel()->clearSelection();
|
||||
updateMask();
|
||||
updateTable();
|
||||
}
|
||||
);
|
||||
|
||||
layout->addWidget(checkbox);
|
||||
layout->addSpacing(25);
|
||||
|
||||
return checkbox;
|
||||
}
|
||||
|
||||
void QtLogView::setLoggingEnabled(bool enabled)
|
||||
{
|
||||
m_showAstLogging->setEnabled(enabled);
|
||||
|
||||
ApplicationSettings::getInstance()->setLoggingEnabled(enabled);
|
||||
ApplicationSettings::getInstance()->save();
|
||||
MessageRefresh msg;
|
||||
msg.reloadSettings = true;
|
||||
msg.uiOnly = true;
|
||||
msg.dispatchImmediately();
|
||||
}
|
||||
|
||||
void QtLogView::setAstLoggingEnabled(bool enabled)
|
||||
{
|
||||
ApplicationSettings::getInstance()->setVerboseIndexerLoggingEnabled(enabled);
|
||||
ApplicationSettings::getInstance()->save();
|
||||
MessageRefresh msg;
|
||||
msg.reloadSettings = true;
|
||||
msg.uiOnly = true;
|
||||
msg.dispatchImmediately();
|
||||
}
|
||||
|
||||
void QtLogView::refreshView()
|
||||
{
|
||||
m_refreshFunctor();
|
||||
@@ -48,10 +148,111 @@ void QtLogView::clear()
|
||||
m_clearFunctor();
|
||||
}
|
||||
|
||||
void QtLogView::addLog(Logger::LogLevel type, const LogMessage& message)
|
||||
{
|
||||
m_addLogFunctor(type, message);
|
||||
}
|
||||
|
||||
void QtLogView::doClear()
|
||||
{
|
||||
}
|
||||
|
||||
void QtLogView::doRefreshView()
|
||||
{
|
||||
setStyleSheet();
|
||||
}
|
||||
|
||||
void QtLogView::setStyleSheet() const
|
||||
{
|
||||
QWidget* widget = QtViewWidgetWrapper::getWidgetOfView(this);
|
||||
utility::setWidgetBackgroundColor(widget, ColorScheme::getInstance()->getColor("error/background"));
|
||||
|
||||
QPalette palette(m_showErrors->palette());
|
||||
palette.setColor(QPalette::WindowText, QColor(ColorScheme::getInstance()->getColor("error/text/normal").c_str()));
|
||||
//palette.setColor(QPalette::Text, QColor(ColorScheme::getInstance()->getColor("error/text/normal").c_str()));
|
||||
//palette.setColor(QPalette::ButtonText, QColor(ColorScheme::getInstance()->getColor("error/text/normal").c_str()));
|
||||
|
||||
//m_showErrors->setAutoFillBackground(true);
|
||||
//m_showErrors->setPalette(palette);
|
||||
//m_showFatals->setPalette(palette);
|
||||
//m_showNonIndexedErrors->setPalette(palette);
|
||||
//m_showNonIndexedFatals->setPalette(palette);
|
||||
|
||||
widget->setStyleSheet(
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath() + "error_view/error_view.css").c_str()
|
||||
);
|
||||
|
||||
m_table->updateRows();
|
||||
}
|
||||
|
||||
const char* QtLogView::getLogType(Logger::LogLevel type) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case Logger::LOG_INFOS:
|
||||
return "INFO";
|
||||
case Logger::LOG_WARNINGS:
|
||||
return "WARNING";
|
||||
case Logger::LOG_ERRORS:
|
||||
return "ERROR";
|
||||
case Logger::LOG_ALL:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
bool QtLogView::isCheckedType(const Logger::LogLevel type) const
|
||||
{
|
||||
return m_mask & type;
|
||||
}
|
||||
|
||||
void QtLogView::updateTable()
|
||||
{
|
||||
if (!m_model->index(0, 0).data(Qt::DisplayRole).toString().isEmpty())
|
||||
{
|
||||
m_model->removeRows(0, m_model->rowCount());
|
||||
}
|
||||
|
||||
for ( Log log : m_logs )
|
||||
{
|
||||
if (log.type & m_mask)
|
||||
{
|
||||
addLogToTable(log);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QtLogView::updateMask()
|
||||
{
|
||||
m_mask =
|
||||
(m_showInfo->isChecked() ? Logger::LOG_INFOS : 0) +
|
||||
(m_showWarnings->isChecked() ? Logger::LOG_WARNINGS : 0) +
|
||||
(m_showErrors->isChecked() ? Logger::LOG_ERRORS : 0);
|
||||
}
|
||||
|
||||
void QtLogView::addLogToTable(Log log)
|
||||
{
|
||||
const int rowNumber = m_table->getFilledRowCount();
|
||||
if (rowNumber < m_model->rowCount())
|
||||
{
|
||||
m_model->insertRow(rowNumber);
|
||||
}
|
||||
|
||||
m_model->setItem(rowNumber, LOGVIEW_COLUMN::TYPE, new QStandardItem(getLogType(log.type)));
|
||||
m_model->setItem(rowNumber, LOGVIEW_COLUMN::TIMESTAMP, new QStandardItem(log.timestamp.c_str()));
|
||||
m_model->setItem(rowNumber, LOGVIEW_COLUMN::MESSAGE, new QStandardItem(log.message.c_str()));
|
||||
m_table->updateRows();
|
||||
}
|
||||
|
||||
void QtLogView::doAddLog(Logger::LogLevel type, const LogMessage& message)
|
||||
{
|
||||
if (m_viewEnabled->isChecked() && isCheckedType(type))
|
||||
{
|
||||
Log log(
|
||||
type,
|
||||
(message.getFileName().empty() ? "" : message.getFileName() + ": ") + message.message,
|
||||
message.getTimeString("%H:%M:%S"));
|
||||
m_logs.push_back(log);
|
||||
addLogToTable(log);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
#ifndef QT_LOG_VIEW_H
|
||||
#define QT_LOG_VIEW_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "component/view/LogView.h"
|
||||
#include "qt/utility/QtThreadedFunctor.h"
|
||||
#include "utility/logging/Logger.h"
|
||||
|
||||
class QBoxLayout;
|
||||
class QCheckBox;
|
||||
class QPalette;
|
||||
class QStandardItemModel;
|
||||
class QtTable;
|
||||
|
||||
class QtLogView
|
||||
: public LogView
|
||||
, public QWidget
|
||||
{
|
||||
public:
|
||||
QtLogView(ViewLayout* viewLayout);
|
||||
@@ -16,12 +26,59 @@ public:
|
||||
virtual void initView();
|
||||
virtual void refreshView();
|
||||
|
||||
// Log View Implementation
|
||||
virtual void clear();
|
||||
virtual void addLog(Logger::LogLevel type, const LogMessage& message);
|
||||
|
||||
private:
|
||||
enum LOGVIEW_COLUMN
|
||||
{
|
||||
TYPE = 0,
|
||||
TIMESTAMP = 1,
|
||||
MESSAGE = 2,
|
||||
};
|
||||
|
||||
struct Log
|
||||
{
|
||||
Log(const Logger::LogLevel type, const std::string message, const std::string timestamp)
|
||||
: type(type)
|
||||
, message(message)
|
||||
, timestamp(timestamp){}
|
||||
const Logger::LogLevel type;
|
||||
const std::string message;
|
||||
const std::string timestamp;
|
||||
};
|
||||
void doClear();
|
||||
void doRefreshView();
|
||||
void doAddLog(Logger::LogLevel type, const LogMessage& message);
|
||||
|
||||
std::vector<Log> m_logs;
|
||||
const char* getLogType(Logger::LogLevel type) const;
|
||||
void addLogToTable(Log log);
|
||||
|
||||
bool isCheckedType(const Logger::LogLevel type) const;
|
||||
QCheckBox* createFilterCheckbox(const QString& name, QBoxLayout* layout, bool checked = false);
|
||||
|
||||
void setStyleSheet() const;
|
||||
|
||||
void setLoggingEnabled(bool enabled);
|
||||
void setAstLoggingEnabled(bool enabled);
|
||||
|
||||
void updateMask();
|
||||
void updateTable();
|
||||
|
||||
int m_mask;
|
||||
QtTable* m_table;
|
||||
QStandardItemModel* m_model;
|
||||
|
||||
QCheckBox* m_viewEnabled;
|
||||
QCheckBox* m_showAstLogging;
|
||||
|
||||
QCheckBox* m_showErrors;
|
||||
QCheckBox* m_showWarnings;
|
||||
QCheckBox* m_showInfo;
|
||||
|
||||
QtThreadedFunctor<Logger::LogLevel, const LogMessage&> m_addLogFunctor;
|
||||
QtThreadedFunctor<void> m_clearFunctor;
|
||||
QtThreadedFunctor<void> m_refreshFunctor;
|
||||
};
|
||||
|
||||
@@ -226,7 +226,7 @@ void QtIndexingDialog::handleClose()
|
||||
|
||||
if (m_type == DIALOG_INDEXING)
|
||||
{
|
||||
MessageInterruptTasks().dispatch();
|
||||
MessageInterruptTasks().dispatchImmediately();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user