src: applied clang-format
This commit is contained in:
@@ -1,21 +1,20 @@
|
||||
#include "QtStatusView.h"
|
||||
|
||||
#include <QBoxLayout>
|
||||
#include <QFrame>
|
||||
#include <QCheckBox>
|
||||
#include <QFrame>
|
||||
#include <QPushButton>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
#include "QtTable.h"
|
||||
#include "utilityQt.h"
|
||||
#include "QtViewWidgetWrapper.h"
|
||||
#include "ApplicationSettings.h"
|
||||
#include "ColorScheme.h"
|
||||
#include "MessageClearStatusView.h"
|
||||
#include "MessageStatusFilterChanged.h"
|
||||
#include "QtTable.h"
|
||||
#include "QtViewWidgetWrapper.h"
|
||||
#include "utilityQt.h"
|
||||
|
||||
QtStatusView::QtStatusView(ViewLayout* viewLayout)
|
||||
: StatusView(viewLayout)
|
||||
QtStatusView::QtStatusView(ViewLayout* viewLayout): StatusView(viewLayout)
|
||||
{
|
||||
setWidgetWrapper(std::make_shared<QtViewWidgetWrapper>(new QFrame()));
|
||||
|
||||
@@ -32,10 +31,11 @@ QtStatusView::QtStatusView(ViewLayout* viewLayout)
|
||||
|
||||
m_model->setColumnCount(2);
|
||||
m_table->setColumnWidth(STATUSVIEW_COLUMN::TYPE, 100);
|
||||
//m_table->setColumnWidth(STATUSVIEW_COLUMN::STATUS, 150);
|
||||
// m_table->setColumnWidth(STATUSVIEW_COLUMN::STATUS, 150);
|
||||
|
||||
QStringList headers;
|
||||
headers << "Type" << "Message";
|
||||
headers << "Type"
|
||||
<< "Message";
|
||||
m_model->setHorizontalHeaderLabels(headers);
|
||||
|
||||
layout->addWidget(m_table);
|
||||
@@ -53,12 +53,7 @@ QtStatusView::QtStatusView(ViewLayout* viewLayout)
|
||||
|
||||
QPushButton* clearButton = new QPushButton("Clear Table");
|
||||
clearButton->setObjectName("screen_button");
|
||||
connect(clearButton, &QPushButton::clicked,
|
||||
[=]()
|
||||
{
|
||||
MessageClearStatusView().dispatch();
|
||||
}
|
||||
);
|
||||
connect(clearButton, &QPushButton::clicked, [=]() { MessageClearStatusView().dispatch(); });
|
||||
|
||||
filters->addWidget(clearButton);
|
||||
filters->addSpacing(10);
|
||||
@@ -66,19 +61,19 @@ QtStatusView::QtStatusView(ViewLayout* viewLayout)
|
||||
layout->addLayout(filters);
|
||||
}
|
||||
|
||||
void QtStatusView::createWidgetWrapper()
|
||||
{
|
||||
}
|
||||
void QtStatusView::createWidgetWrapper() {}
|
||||
|
||||
void QtStatusView::refreshView()
|
||||
{
|
||||
m_onQtThread([this]()
|
||||
{
|
||||
m_onQtThread([this]() {
|
||||
QWidget* widget = QtViewWidgetWrapper::getWidgetOfView(this);
|
||||
utility::setWidgetBackgroundColor(widget, ColorScheme::getInstance()->getColor("error/background"));
|
||||
utility::setWidgetBackgroundColor(
|
||||
widget, ColorScheme::getInstance()->getColor("error/background"));
|
||||
|
||||
QPalette palette(m_showErrors->palette());
|
||||
palette.setColor(QPalette::WindowText, QColor(ColorScheme::getInstance()->getColor("table/text/normal").c_str()));
|
||||
palette.setColor(
|
||||
QPalette::WindowText,
|
||||
QColor(ColorScheme::getInstance()->getColor("table/text/normal").c_str()));
|
||||
|
||||
m_showErrors->setPalette(palette);
|
||||
m_showInfo->setPalette(palette);
|
||||
@@ -89,8 +84,7 @@ void QtStatusView::refreshView()
|
||||
|
||||
void QtStatusView::clear()
|
||||
{
|
||||
m_onQtThread([this]()
|
||||
{
|
||||
m_onQtThread([this]() {
|
||||
if (!m_model->index(0, 0).data(Qt::DisplayRole).toString().isEmpty())
|
||||
{
|
||||
m_model->removeRows(0, m_model->rowCount());
|
||||
@@ -104,9 +98,8 @@ void QtStatusView::clear()
|
||||
|
||||
void QtStatusView::addStatus(const std::vector<Status>& status)
|
||||
{
|
||||
m_onQtThread([=]()
|
||||
{
|
||||
for (const Status& s : status)
|
||||
m_onQtThread([=]() {
|
||||
for (const Status& s: status)
|
||||
{
|
||||
const int rowNumber = m_table->getFilledRowCount();
|
||||
if (rowNumber < m_model->rowCount())
|
||||
@@ -116,7 +109,10 @@ void QtStatusView::addStatus(const std::vector<Status>& status)
|
||||
|
||||
QString statusType = (s.type == StatusType::STATUS_ERROR ? "ERROR" : "INFO");
|
||||
m_model->setItem(rowNumber, STATUSVIEW_COLUMN::TYPE, new QStandardItem(statusType));
|
||||
m_model->setItem(rowNumber, STATUSVIEW_COLUMN::STATUS, new QStandardItem(QString::fromStdWString(s.message)));
|
||||
m_model->setItem(
|
||||
rowNumber,
|
||||
STATUSVIEW_COLUMN::STATUS,
|
||||
new QStandardItem(QString::fromStdWString(s.message)));
|
||||
|
||||
if (s.type == StatusType::STATUS_ERROR)
|
||||
{
|
||||
@@ -138,18 +134,14 @@ QCheckBox* QtStatusView::createFilterCheckbox(const QString& name, QBoxLayout* l
|
||||
QCheckBox* checkbox = new QCheckBox(name);
|
||||
checkbox->setChecked(checked);
|
||||
|
||||
connect(checkbox, &QCheckBox::stateChanged,
|
||||
[=](int)
|
||||
{
|
||||
m_table->selectionModel()->clearSelection();
|
||||
connect(checkbox, &QCheckBox::stateChanged, [=](int) {
|
||||
m_table->selectionModel()->clearSelection();
|
||||
|
||||
const StatusFilter statusMask =
|
||||
(m_showInfo->isChecked() ? StatusType::STATUS_INFO : 0) +
|
||||
(m_showErrors->isChecked() ? StatusType::STATUS_ERROR : 0);
|
||||
const StatusFilter statusMask = (m_showInfo->isChecked() ? StatusType::STATUS_INFO : 0) +
|
||||
(m_showErrors->isChecked() ? StatusType::STATUS_ERROR : 0);
|
||||
|
||||
MessageStatusFilterChanged(statusMask).dispatch();
|
||||
}
|
||||
);
|
||||
MessageStatusFilterChanged(statusMask).dispatch();
|
||||
});
|
||||
|
||||
layout->addWidget(checkbox);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user