20#ifndef LIBREPCB_EDITOR_RULECHECKLISTWIDGET_H
21#define LIBREPCB_EDITOR_RULECHECKLISTWIDGET_H
27#include <optional/tl/optional.hpp>
47 std::shared_ptr<const RuleCheckMessage> msg)
noexcept = 0;
49 std::shared_ptr<const RuleCheckMessage> msg)
noexcept = 0;
51 std::shared_ptr<const RuleCheckMessage> msg)
noexcept = 0;
53 std::shared_ptr<const RuleCheckMessage> msg,
bool approve)
noexcept = 0;
55 std::shared_ptr<const RuleCheckMessage> msg)
noexcept = 0;
57 std::shared_ptr<const RuleCheckMessage> msg)
noexcept = 0;
79 QWidget* parent =
nullptr) noexcept
85 QHBoxLayout* layout =
new QHBoxLayout(
this);
86 layout->setContentsMargins(0, 0, 0, 0);
87 layout->setSpacing(0);
91 mIconLabel->setPixmap(msg->getSeverityIcon().pixmap(
92 48, approved ? QIcon::Disabled : QIcon::Normal));
94 layout->addSpacing(3);
97 QLabel* lblMsg =
new QLabel(msg->getMessage(),
this);
98 lblMsg->setToolTip(msg->getMessage());
100 QFont font = lblMsg->font();
101 font.setItalic(
true);
102 font.setStrikeOut(
true);
103 lblMsg->setFont(font);
105 layout->addWidget(lblMsg);
106 layout->addSpacing(3);
107 layout->setStretch(1, 100);
111 QToolButton* btnFix =
new QToolButton(
this);
112 btnFix->setText(tr(
"Fix"));
113 btnFix->setToolTip(tr(
"Fix Problem"));
114 btnFix->setStatusTip(
115 tr(
"Automatically apply a modification to fix this message"));
116 connect(btnFix, &QToolButton::clicked,
this,
118 layout->addWidget(btnFix);
122 QToolButton* btnApprove =
new QToolButton(
this);
123 btnApprove->setText(
"✔");
124 btnApprove->setToolTip(tr(
"Approve/Disapprove"));
125 btnApprove->setStatusTip(tr(
"Mark/unmark this message as approved"));
126 btnApprove->setCheckable(
true);
127 btnApprove->setChecked(approved);
128 connect(btnApprove, &QToolButton::clicked,
this, [
this, msg](
bool checked) {
131 layout->addWidget(btnApprove);
134 QToolButton* btnDetails =
new QToolButton(
this);
135 btnDetails->setText(
"?");
136 btnDetails->setToolTip(tr(
"Details"));
137 btnDetails->setStatusTip(tr(
"Show more information about this message"));
138 connect(btnDetails, &QToolButton::clicked,
this,
140 layout->addWidget(btnDetails);
151 QWidget::resizeEvent(event);
185 void setMessages(
const tl::optional<RuleCheckMessageList>& messages)
noexcept;
186 void setApprovals(
const QSet<SExpression>& approvals)
noexcept;
194 QListWidgetItem* previous) noexcept;
203 bool approve) noexcept override;
The RuleCheckMessage class.
Definition: rulecheckmessage.h:45
The SExpression class.
Definition: sexpression.h:69
Definition: rulechecklistwidget.h:44
virtual void ruleCheckApproveRequested(std::shared_ptr< const RuleCheckMessage > msg, bool approve) noexcept=0
virtual void ruleCheckFixRequested(std::shared_ptr< const RuleCheckMessage > msg) noexcept=0
virtual void ruleCheckMessageDoubleClicked(std::shared_ptr< const RuleCheckMessage > msg) noexcept=0
virtual ~IF_RuleCheckHandler() noexcept
Definition: rulechecklistwidget.h:62
virtual void ruleCheckMessageSelected(std::shared_ptr< const RuleCheckMessage > msg) noexcept=0
virtual bool ruleCheckFixAvailable(std::shared_ptr< const RuleCheckMessage > msg) noexcept=0
virtual void ruleCheckDescriptionRequested(std::shared_ptr< const RuleCheckMessage > msg) noexcept=0
IF_RuleCheckHandler() noexcept
Definition: rulechecklistwidget.h:60
IF_RuleCheckHandler(const IF_RuleCheckHandler &) noexcept
Definition: rulechecklistwidget.h:61
Definition: occmodel.cpp:77
QVector< std::shared_ptr< const RuleCheckMessage > > RuleCheckMessageList
Definition: rulecheckmessage.h:104