mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02:00
fixed indentations of the remaining *.cpp/*.h files
This commit is contained in:
parent
e9448be986
commit
b3ac3c82af
@ -83,8 +83,8 @@ class TerminalStripLayoutPattern
|
||||
int m_bridge_point_d{5};
|
||||
QVector<int> m_bridge_point_y_offset{50,70,90,110};
|
||||
|
||||
QUuid m_uuid{QUuid::createUuid()};
|
||||
QString m_name;
|
||||
QUuid m_uuid{QUuid::createUuid()};
|
||||
QString m_name;
|
||||
|
||||
private:
|
||||
void updateHeaderTextOption();
|
||||
|
@ -26,9 +26,9 @@ namespace TerminalStripDrawer {
|
||||
* @param pattern
|
||||
*/
|
||||
TerminalStripDrawer::TerminalStripDrawer(QSharedPointer<AbstractTerminalStripInterface> strip,
|
||||
QSharedPointer<TerminalStripLayoutPattern> layout) :
|
||||
m_strip { strip },
|
||||
m_pattern { layout }
|
||||
QSharedPointer<TerminalStripLayoutPattern> layout) :
|
||||
m_strip { strip },
|
||||
m_pattern { layout }
|
||||
{}
|
||||
|
||||
void TerminalStripDrawer::setStrip(QSharedPointer<AbstractTerminalStripInterface> strip)
|
||||
@ -42,248 +42,248 @@ void TerminalStripDrawer::setStrip(QSharedPointer<AbstractTerminalStripInterface
|
||||
*/
|
||||
void TerminalStripDrawer::paint(QPainter *painter)
|
||||
{
|
||||
if (m_strip && m_pattern)
|
||||
{
|
||||
//To draw text, QPainter need a Qrect. Instead of create an instance
|
||||
//for each text, we re-use the same instance of QRect.
|
||||
QRect text_rect;
|
||||
painter->save();
|
||||
if (m_strip && m_pattern)
|
||||
{
|
||||
//To draw text, QPainter need a Qrect. Instead of create an instance
|
||||
//for each text, we re-use the same instance of QRect.
|
||||
QRect text_rect;
|
||||
painter->save();
|
||||
|
||||
auto pen_{painter->pen()};
|
||||
pen_.setColor(Qt::black);
|
||||
pen_.setWidth(1);
|
||||
auto pen_{painter->pen()};
|
||||
pen_.setColor(Qt::black);
|
||||
pen_.setWidth(1);
|
||||
|
||||
auto brush_ = painter->brush();
|
||||
brush_.setColor(Qt::white);
|
||||
auto brush_ = painter->brush();
|
||||
brush_.setColor(Qt::white);
|
||||
|
||||
painter->setPen(pen_);
|
||||
painter->setBrush(brush_);
|
||||
painter->setPen(pen_);
|
||||
painter->setBrush(brush_);
|
||||
|
||||
if (m_preview_draw)
|
||||
{
|
||||
painter->save();
|
||||
painter->setPen(Qt::blue);
|
||||
painter->drawRect(boundingRect());
|
||||
painter->restore();
|
||||
}
|
||||
if (m_preview_draw)
|
||||
{
|
||||
painter->save();
|
||||
painter->setPen(Qt::blue);
|
||||
painter->drawRect(boundingRect());
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
//Draw header
|
||||
painter->drawRect(m_pattern->m_header_rect);
|
||||
//Draw header
|
||||
painter->drawRect(m_pattern->m_header_rect);
|
||||
|
||||
//Draw the header text
|
||||
painter->save();
|
||||
//Draw the header text
|
||||
painter->save();
|
||||
|
||||
if (m_pattern->m_header_text_orientation == Qt::Horizontal)
|
||||
{
|
||||
text_rect.setRect(0,m_pattern->m_header_rect.y(),m_pattern->m_header_rect.width(),m_pattern->m_header_rect.height());
|
||||
}
|
||||
else
|
||||
{
|
||||
painter->translate(m_pattern->m_header_rect.bottomLeft());
|
||||
painter->rotate(270);
|
||||
text_rect.setRect(0,0,m_pattern->m_header_rect.height(),m_pattern->m_header_rect.width());
|
||||
}
|
||||
if (m_pattern->m_header_text_orientation == Qt::Horizontal)
|
||||
{
|
||||
text_rect.setRect(0,m_pattern->m_header_rect.y(),m_pattern->m_header_rect.width(),m_pattern->m_header_rect.height());
|
||||
}
|
||||
else
|
||||
{
|
||||
painter->translate(m_pattern->m_header_rect.bottomLeft());
|
||||
painter->rotate(270);
|
||||
text_rect.setRect(0,0,m_pattern->m_header_rect.height(),m_pattern->m_header_rect.width());
|
||||
}
|
||||
|
||||
const auto text_{m_strip->installation() + " " + m_strip->location() + " " + m_strip->name()};
|
||||
painter->drawText(text_rect, text_, m_pattern->headerTextOption());
|
||||
painter->restore();
|
||||
const auto text_{m_strip->installation() + " " + m_strip->location() + " " + m_strip->name()};
|
||||
painter->drawText(text_rect, text_, m_pattern->headerTextOption());
|
||||
painter->restore();
|
||||
|
||||
//Move painter pos to next drawing
|
||||
painter->translate(m_pattern->m_header_rect.width(),0);
|
||||
//Move painter pos to next drawing
|
||||
painter->translate(m_pattern->m_header_rect.width(),0);
|
||||
|
||||
int x_offset{m_pattern->m_header_rect.width()};
|
||||
int x_offset{m_pattern->m_header_rect.width()};
|
||||
|
||||
//Draw spacer
|
||||
painter->drawRect(m_pattern->m_spacer_rect);
|
||||
//Move painter pos to next drawing
|
||||
painter->translate(m_pattern->m_spacer_rect.width(),0);
|
||||
x_offset += m_pattern->m_spacer_rect.width();
|
||||
//Draw spacer
|
||||
painter->drawRect(m_pattern->m_spacer_rect);
|
||||
//Move painter pos to next drawing
|
||||
painter->translate(m_pattern->m_spacer_rect.width(),0);
|
||||
x_offset += m_pattern->m_spacer_rect.width();
|
||||
|
||||
|
||||
//Draw terminals
|
||||
const auto terminals_text_rect{m_pattern->m_terminals_text_rect};
|
||||
const auto terminals_text_orientation{m_pattern->m_terminals_text_orientation};
|
||||
const auto terminals_text_option{m_pattern->terminalsTextOption()};
|
||||
QRect terminal_rect;
|
||||
//Draw terminals
|
||||
const auto terminals_text_rect{m_pattern->m_terminals_text_rect};
|
||||
const auto terminals_text_orientation{m_pattern->m_terminals_text_orientation};
|
||||
const auto terminals_text_option{m_pattern->terminalsTextOption()};
|
||||
QRect terminal_rect;
|
||||
|
||||
QHash<QUuid, QVector<QPointF>> bridges_anchor_points;
|
||||
QHash<QUuid, QVector<QPointF>> bridges_anchor_points;
|
||||
|
||||
//Loop over physical terminals
|
||||
for (const auto &physical_t : m_strip->physicalTerminal())
|
||||
{
|
||||
//Get the good offset according to how many level have the current physical terminal
|
||||
const QVector<QSharedPointer<AbstractRealTerminalInterface>> real_terminal_vector{physical_t->realTerminals()};
|
||||
const auto real_t_count{real_terminal_vector.size()};
|
||||
const auto offset_{4 - real_t_count};
|
||||
//Loop over physical terminals
|
||||
for (const auto &physical_t : m_strip->physicalTerminal())
|
||||
{
|
||||
//Get the good offset according to how many level have the current physical terminal
|
||||
const QVector<QSharedPointer<AbstractRealTerminalInterface>> real_terminal_vector{physical_t->realTerminals()};
|
||||
const auto real_t_count{real_terminal_vector.size()};
|
||||
const auto offset_{4 - real_t_count};
|
||||
|
||||
//Loop over real terminals
|
||||
for (auto i=0 ; i<real_t_count ; ++i)
|
||||
{
|
||||
const auto index_ = offset_ + i;
|
||||
if (index_ >= 4) {
|
||||
break;
|
||||
}
|
||||
//Loop over real terminals
|
||||
for (auto i=0 ; i<real_t_count ; ++i)
|
||||
{
|
||||
const auto index_ = offset_ + i;
|
||||
if (index_ >= 4) {
|
||||
break;
|
||||
}
|
||||
|
||||
terminal_rect = m_pattern->m_terminal_rect[index_];
|
||||
//Draw terminal rect
|
||||
painter->drawRect(terminal_rect);
|
||||
//Draw a stronger line if the current terminal have level
|
||||
//and the current level is the first
|
||||
if (real_t_count > 1 && i == 0)
|
||||
{
|
||||
painter->save();
|
||||
pen_ = painter->pen();
|
||||
pen_.setWidth(4);
|
||||
pen_.setCapStyle(Qt::FlatCap);
|
||||
painter->setPen(pen_);
|
||||
const auto p1 { terminal_rect.topLeft() };
|
||||
//We can't use terminal_rect.bottomLeft for p2 because
|
||||
//the returned value deviate from the true value
|
||||
//(see Qt documentation about QRect)
|
||||
const QPoint p2 { p1.x(), p1.y() + terminal_rect.height() };
|
||||
painter->drawLine(p1, p2);
|
||||
painter->restore();
|
||||
}
|
||||
terminal_rect = m_pattern->m_terminal_rect[index_];
|
||||
//Draw terminal rect
|
||||
painter->drawRect(terminal_rect);
|
||||
//Draw a stronger line if the current terminal have level
|
||||
//and the current level is the first
|
||||
if (real_t_count > 1 && i == 0)
|
||||
{
|
||||
painter->save();
|
||||
pen_ = painter->pen();
|
||||
pen_.setWidth(4);
|
||||
pen_.setCapStyle(Qt::FlatCap);
|
||||
painter->setPen(pen_);
|
||||
const auto p1 { terminal_rect.topLeft() };
|
||||
//We can't use terminal_rect.bottomLeft for p2 because
|
||||
//the returned value deviate from the true value
|
||||
//(see Qt documentation about QRect)
|
||||
const QPoint p2 { p1.x(), p1.y() + terminal_rect.height() };
|
||||
painter->drawLine(p1, p2);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
//Draw text
|
||||
painter->save();
|
||||
if (terminals_text_orientation[index_] == Qt::Horizontal)
|
||||
{
|
||||
text_rect = terminals_text_rect[index_];
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto rect_{terminals_text_rect[index_]};
|
||||
painter->translate(rect_.bottomLeft());
|
||||
painter->rotate(270);
|
||||
text_rect.setRect(0, 0, rect_.height(), terminal_rect.width());
|
||||
}
|
||||
//Draw text
|
||||
painter->save();
|
||||
if (terminals_text_orientation[index_] == Qt::Horizontal)
|
||||
{
|
||||
text_rect = terminals_text_rect[index_];
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto rect_{terminals_text_rect[index_]};
|
||||
painter->translate(rect_.bottomLeft());
|
||||
painter->rotate(270);
|
||||
text_rect.setRect(0, 0, rect_.height(), terminal_rect.width());
|
||||
}
|
||||
|
||||
const auto shared_real_terminal{real_terminal_vector[i]};
|
||||
painter->drawText(text_rect,
|
||||
shared_real_terminal ? shared_real_terminal->label() : QLatin1String(),
|
||||
terminals_text_option[index_]);
|
||||
const auto shared_real_terminal{real_terminal_vector[i]};
|
||||
painter->drawText(text_rect,
|
||||
shared_real_terminal ? shared_real_terminal->label() : QLatin1String(),
|
||||
terminals_text_option[index_]);
|
||||
|
||||
if (m_preview_draw)
|
||||
{
|
||||
painter->setPen(Qt::blue);
|
||||
painter->drawRect(text_rect);
|
||||
}
|
||||
if (m_preview_draw)
|
||||
{
|
||||
painter->setPen(Qt::blue);
|
||||
painter->drawRect(text_rect);
|
||||
}
|
||||
|
||||
painter->restore();
|
||||
painter->restore();
|
||||
|
||||
//Add bridge anchor
|
||||
if (shared_real_terminal->isBridged())
|
||||
{
|
||||
painter->save();
|
||||
if (QScopedPointer<AbstractBridgeInterface> bridge_ {
|
||||
shared_real_terminal->bridge() })
|
||||
{
|
||||
const auto x_anchor{terminal_rect.width()/2};
|
||||
const auto y_anchor {m_pattern->m_bridge_point_y_offset[index_]};
|
||||
const auto radius_anchor{m_pattern->m_bridge_point_d/2};
|
||||
//Add bridge anchor
|
||||
if (shared_real_terminal->isBridged())
|
||||
{
|
||||
painter->save();
|
||||
if (QScopedPointer<AbstractBridgeInterface> bridge_ {
|
||||
shared_real_terminal->bridge() })
|
||||
{
|
||||
const auto x_anchor{terminal_rect.width()/2};
|
||||
const auto y_anchor {m_pattern->m_bridge_point_y_offset[index_]};
|
||||
const auto radius_anchor{m_pattern->m_bridge_point_d/2};
|
||||
|
||||
painter->setBrush(Qt::SolidPattern);
|
||||
painter->drawEllipse(QPointF(x_anchor, y_anchor),
|
||||
radius_anchor, radius_anchor);
|
||||
painter->setBrush(Qt::SolidPattern);
|
||||
painter->drawEllipse(QPointF(x_anchor, y_anchor),
|
||||
radius_anchor, radius_anchor);
|
||||
|
||||
auto anchor_points{bridges_anchor_points.value(bridge_->uuid())};
|
||||
anchor_points.append(QPointF(x_offset + x_anchor, y_anchor));
|
||||
bridges_anchor_points.insert(bridge_->uuid(), anchor_points);
|
||||
}
|
||||
painter->restore();
|
||||
}
|
||||
auto anchor_points{bridges_anchor_points.value(bridge_->uuid())};
|
||||
anchor_points.append(QPointF(x_offset + x_anchor, y_anchor));
|
||||
bridges_anchor_points.insert(bridge_->uuid(), anchor_points);
|
||||
}
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
//Move painter pos to next drawing
|
||||
painter->translate(terminal_rect.width(),0);
|
||||
x_offset += terminal_rect.width();
|
||||
}
|
||||
}
|
||||
painter->restore();
|
||||
//Move painter pos to next drawing
|
||||
painter->translate(terminal_rect.width(),0);
|
||||
x_offset += terminal_rect.width();
|
||||
}
|
||||
}
|
||||
painter->restore();
|
||||
|
||||
//Draw the bridges
|
||||
for (const auto &points_ : qAsConst(bridges_anchor_points))
|
||||
{
|
||||
painter->save();
|
||||
auto pen_{painter->pen()};
|
||||
pen_.setWidth(2);
|
||||
painter->setPen(pen_);
|
||||
painter->drawPolyline(QPolygonF{points_});
|
||||
painter->restore();
|
||||
}
|
||||
}
|
||||
//Draw the bridges
|
||||
for (const auto &points_ : qAsConst(bridges_anchor_points))
|
||||
{
|
||||
painter->save();
|
||||
auto pen_{painter->pen()};
|
||||
pen_.setWidth(2);
|
||||
painter->setPen(pen_);
|
||||
painter->drawPolyline(QPolygonF{points_});
|
||||
painter->restore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QRectF TerminalStripDrawer::boundingRect() const
|
||||
{
|
||||
return QRect{0, 0, width(), height()};;
|
||||
return QRect{0, 0, width(), height()};;
|
||||
}
|
||||
|
||||
void TerminalStripDrawer::setLayout(QSharedPointer<TerminalStripLayoutPattern> layout)
|
||||
{
|
||||
m_pattern = layout;
|
||||
m_pattern = layout;
|
||||
}
|
||||
|
||||
bool TerminalStripDrawer::haveLayout() const
|
||||
{
|
||||
return !m_pattern.isNull();
|
||||
return !m_pattern.isNull();
|
||||
}
|
||||
|
||||
void TerminalStripDrawer::setPreviewDraw(bool draw) {
|
||||
m_preview_draw = draw;
|
||||
m_preview_draw = draw;
|
||||
}
|
||||
|
||||
int TerminalStripDrawer::height() const
|
||||
{
|
||||
if (m_pattern)
|
||||
{
|
||||
auto height_{m_pattern->m_header_rect.y() + m_pattern->m_header_rect.height()};
|
||||
if (m_pattern)
|
||||
{
|
||||
auto height_{m_pattern->m_header_rect.y() + m_pattern->m_header_rect.height()};
|
||||
|
||||
height_ = std::max(height_, m_pattern->m_spacer_rect.y() + m_pattern->m_spacer_rect.height());
|
||||
height_ = std::max(height_, m_pattern->m_spacer_rect.y() + m_pattern->m_spacer_rect.height());
|
||||
|
||||
for (const auto &rect : m_pattern->m_terminal_rect) {
|
||||
height_ = std::max(height_, rect.y() + rect.height());
|
||||
}
|
||||
for (const auto &rect : m_pattern->m_terminal_rect) {
|
||||
height_ = std::max(height_, rect.y() + rect.height());
|
||||
}
|
||||
|
||||
return height_;
|
||||
}
|
||||
return height_;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TerminalStripDrawer::width() const
|
||||
{
|
||||
if (m_pattern)
|
||||
{
|
||||
int width_{m_pattern->m_header_rect.width() + m_pattern->m_spacer_rect.width()};
|
||||
if (m_pattern)
|
||||
{
|
||||
int width_{m_pattern->m_header_rect.width() + m_pattern->m_spacer_rect.width()};
|
||||
|
||||
if (m_strip)
|
||||
{
|
||||
//Loop over physical terminals
|
||||
for (const auto &physical_t : m_strip->physicalTerminal())
|
||||
{
|
||||
//Get the good offset according to how many level have the current physical terminal
|
||||
const QVector<QSharedPointer<AbstractRealTerminalInterface>> real_terminal_vector{physical_t->realTerminals()};
|
||||
const auto real_t_count{real_terminal_vector.size()};
|
||||
const auto offset_{4 - real_t_count};
|
||||
if (m_strip)
|
||||
{
|
||||
//Loop over physical terminals
|
||||
for (const auto &physical_t : m_strip->physicalTerminal())
|
||||
{
|
||||
//Get the good offset according to how many level have the current physical terminal
|
||||
const QVector<QSharedPointer<AbstractRealTerminalInterface>> real_terminal_vector{physical_t->realTerminals()};
|
||||
const auto real_t_count{real_terminal_vector.size()};
|
||||
const auto offset_{4 - real_t_count};
|
||||
|
||||
//Loop over real terminals
|
||||
for (auto i=0 ; i<real_t_count ; ++i)
|
||||
{
|
||||
const auto index_ = offset_ + i;
|
||||
if (index_ >= 4) {
|
||||
break;
|
||||
}
|
||||
//Loop over real terminals
|
||||
for (auto i=0 ; i<real_t_count ; ++i)
|
||||
{
|
||||
const auto index_ = offset_ + i;
|
||||
if (index_ >= 4) {
|
||||
break;
|
||||
}
|
||||
|
||||
width_ += m_pattern->m_terminal_rect[index_].width();
|
||||
}
|
||||
}
|
||||
}
|
||||
width_ += m_pattern->m_terminal_rect[index_].width();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return width_;
|
||||
}
|
||||
return width_;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
} //End namespace TerminalStripDrawer
|
||||
|
@ -26,35 +26,35 @@
|
||||
#include "trueterminalstrip.h"
|
||||
|
||||
TerminalStripItem::TerminalStripItem(QPointer<TerminalStrip> strip,
|
||||
QGraphicsItem *parent) :
|
||||
QetGraphicsItem { parent },
|
||||
m_strip { strip },
|
||||
m_drawer { QSharedPointer<TerminalStripDrawer::TrueTerminalStrip> {
|
||||
QGraphicsItem *parent) :
|
||||
QetGraphicsItem { parent },
|
||||
m_strip { strip },
|
||||
m_drawer { QSharedPointer<TerminalStripDrawer::TrueTerminalStrip> {
|
||||
new TerminalStripDrawer::TrueTerminalStrip { strip }}
|
||||
}
|
||||
{
|
||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||
setAcceptHoverEvents(true);
|
||||
setDefaultLayout();
|
||||
setAcceptHoverEvents(true);
|
||||
setDefaultLayout();
|
||||
}
|
||||
|
||||
TerminalStripItem::TerminalStripItem(QGraphicsItem *parent) :
|
||||
QetGraphicsItem { parent }
|
||||
QetGraphicsItem { parent }
|
||||
{
|
||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||
setAcceptHoverEvents(true);
|
||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||
setAcceptHoverEvents(true);
|
||||
}
|
||||
|
||||
void TerminalStripItem::setTerminalStrip(TerminalStrip *strip)
|
||||
{
|
||||
m_strip = strip;
|
||||
m_drawer.setStrip(QSharedPointer<TerminalStripDrawer::TrueTerminalStrip> {
|
||||
new TerminalStripDrawer::TrueTerminalStrip { strip }});
|
||||
m_pending_strip_uuid = QUuid();
|
||||
m_strip = strip;
|
||||
m_drawer.setStrip(QSharedPointer<TerminalStripDrawer::TrueTerminalStrip> {
|
||||
new TerminalStripDrawer::TrueTerminalStrip { strip }});
|
||||
m_pending_strip_uuid = QUuid();
|
||||
|
||||
if (!m_drawer.haveLayout()) {
|
||||
setDefaultLayout();
|
||||
}
|
||||
if (!m_drawer.haveLayout()) {
|
||||
setDefaultLayout();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -62,7 +62,7 @@ void TerminalStripItem::setTerminalStrip(TerminalStrip *strip)
|
||||
* @return The strip drawed by this item
|
||||
*/
|
||||
QPointer<TerminalStrip> TerminalStripItem::terminalStrip() const {
|
||||
return m_strip;
|
||||
return m_strip;
|
||||
}
|
||||
|
||||
void TerminalStripItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
@ -91,42 +91,42 @@ QRectF TerminalStripItem::boundingRect() const
|
||||
* @return usual name of this item
|
||||
*/
|
||||
QString TerminalStripItem::name() const {
|
||||
return tr("plan de bornes");
|
||||
return tr("plan de bornes");
|
||||
}
|
||||
|
||||
void TerminalStripItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED (event);
|
||||
Q_UNUSED (event);
|
||||
|
||||
if (m_strip) {
|
||||
TerminalStripEditorWindow::edit(m_strip);
|
||||
}
|
||||
if (m_strip) {
|
||||
TerminalStripEditorWindow::edit(m_strip);
|
||||
}
|
||||
}
|
||||
|
||||
void TerminalStripItem::refreshPending()
|
||||
{
|
||||
if (!m_pending_strip_uuid.isNull()
|
||||
&& diagram()
|
||||
&& diagram()->project())
|
||||
{
|
||||
for (const auto &strip_ : diagram()->project()->terminalStrip()) {
|
||||
if (strip_->uuid() == m_pending_strip_uuid) {
|
||||
setTerminalStrip(strip_);
|
||||
m_pending_strip_uuid = QUuid();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!m_pending_strip_uuid.isNull()
|
||||
&& diagram()
|
||||
&& diagram()->project())
|
||||
{
|
||||
for (const auto &strip_ : diagram()->project()->terminalStrip()) {
|
||||
if (strip_->uuid() == m_pending_strip_uuid) {
|
||||
setTerminalStrip(strip_);
|
||||
m_pending_strip_uuid = QUuid();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TerminalStripItem::setLayout(QSharedPointer<TerminalStripLayoutPattern> layout)
|
||||
{
|
||||
m_drawer.setLayout(layout);
|
||||
m_drawer.setLayout(layout);
|
||||
}
|
||||
|
||||
void TerminalStripItem::setDefaultLayout()
|
||||
{
|
||||
if (m_strip && m_strip->project()) {
|
||||
m_drawer.setLayout(m_strip->project()->projectPropertiesHandler().terminalStripLayoutHandler().defaultLayout());
|
||||
}
|
||||
if (m_strip && m_strip->project()) {
|
||||
m_drawer.setLayout(m_strip->project()->projectPropertiesHandler().terminalStripLayoutHandler().defaultLayout());
|
||||
}
|
||||
}
|
||||
|
@ -28,16 +28,16 @@ class TerminalStrip;
|
||||
|
||||
class TerminalStripItem : public QetGraphicsItem
|
||||
{
|
||||
friend class TerminalStripItemXml;
|
||||
friend class TerminalStripItemXml;
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TerminalStripItem(QPointer<TerminalStrip> strip, QGraphicsItem *parent = nullptr);
|
||||
TerminalStripItem(QGraphicsItem *parent = nullptr);
|
||||
TerminalStripItem(QGraphicsItem *parent = nullptr);
|
||||
|
||||
void setTerminalStrip(TerminalStrip *strip);
|
||||
QPointer<TerminalStrip> terminalStrip() const;
|
||||
void setTerminalStrip(TerminalStrip *strip);
|
||||
QPointer<TerminalStrip> terminalStrip() const;
|
||||
|
||||
enum {Type = UserType + 1011};
|
||||
int type() const override {return Type;}
|
||||
@ -46,17 +46,17 @@ class TerminalStripItem : public QetGraphicsItem
|
||||
QRectF boundingRect() const override;
|
||||
QString name() const override;
|
||||
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
void refreshPending();
|
||||
void setLayout(QSharedPointer<TerminalStripLayoutPattern> layout);
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
void refreshPending();
|
||||
void setLayout(QSharedPointer<TerminalStripLayoutPattern> layout);
|
||||
|
||||
private:
|
||||
void setDefaultLayout();
|
||||
private:
|
||||
void setDefaultLayout();
|
||||
|
||||
private:
|
||||
QPointer<TerminalStrip> m_strip;
|
||||
TerminalStripDrawer::TerminalStripDrawer m_drawer;
|
||||
QUuid m_pending_strip_uuid;
|
||||
TerminalStripDrawer::TerminalStripDrawer m_drawer;
|
||||
QUuid m_pending_strip_uuid;
|
||||
|
||||
};
|
||||
|
||||
|
@ -25,109 +25,109 @@
|
||||
|
||||
namespace TerminalStripDrawer
|
||||
{
|
||||
/**
|
||||
* @brief TrueTerminalStrip::TrueTerminalStrip
|
||||
* Constructor, this class don't take ownership of @a strip
|
||||
* @param strip
|
||||
*/
|
||||
TrueTerminalStrip::TrueTerminalStrip(TerminalStrip *strip) :
|
||||
m_strip { strip }
|
||||
{}
|
||||
/**
|
||||
* @brief TrueTerminalStrip::TrueTerminalStrip
|
||||
* Constructor, this class don't take ownership of @a strip
|
||||
* @param strip
|
||||
*/
|
||||
TrueTerminalStrip::TrueTerminalStrip(TerminalStrip *strip) :
|
||||
m_strip { strip }
|
||||
{}
|
||||
|
||||
|
||||
QString TrueTerminalStrip::installation() const
|
||||
{
|
||||
if (m_strip) {
|
||||
return m_strip->installation();
|
||||
} else {
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
QString TrueTerminalStrip::installation() const
|
||||
{
|
||||
if (m_strip) {
|
||||
return m_strip->installation();
|
||||
} else {
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
QString TrueTerminalStrip::location() const
|
||||
{
|
||||
if (m_strip) {
|
||||
return m_strip->location();
|
||||
} else {
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
QString TrueTerminalStrip::location() const
|
||||
{
|
||||
if (m_strip) {
|
||||
return m_strip->location();
|
||||
} else {
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
QString TrueTerminalStrip::name() const
|
||||
{
|
||||
if (m_strip) {
|
||||
return m_strip->name();
|
||||
} else {
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
QString TrueTerminalStrip::name() const
|
||||
{
|
||||
if (m_strip) {
|
||||
return m_strip->name();
|
||||
} else {
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
QVector<QSharedPointer<AbstractPhysicalTerminalInterface>> TrueTerminalStrip::physicalTerminal() const
|
||||
{
|
||||
QVector<QSharedPointer<AbstractPhysicalTerminalInterface>> vector_;
|
||||
if (m_strip) {
|
||||
for (const auto &phy : m_strip->physicalTerminal()) {
|
||||
vector_.append(QSharedPointer<AbstractPhysicalTerminalInterface>{ new TruePhysicalTerminal(phy) });
|
||||
}
|
||||
}
|
||||
QVector<QSharedPointer<AbstractPhysicalTerminalInterface>> TrueTerminalStrip::physicalTerminal() const
|
||||
{
|
||||
QVector<QSharedPointer<AbstractPhysicalTerminalInterface>> vector_;
|
||||
if (m_strip) {
|
||||
for (const auto &phy : m_strip->physicalTerminal()) {
|
||||
vector_.append(QSharedPointer<AbstractPhysicalTerminalInterface>{ new TruePhysicalTerminal(phy) });
|
||||
}
|
||||
}
|
||||
|
||||
return vector_;
|
||||
}
|
||||
return vector_;
|
||||
}
|
||||
|
||||
TruePhysicalTerminal::TruePhysicalTerminal(QSharedPointer<PhysicalTerminal> physical) :
|
||||
m_physical { physical }
|
||||
{}
|
||||
TruePhysicalTerminal::TruePhysicalTerminal(QSharedPointer<PhysicalTerminal> physical) :
|
||||
m_physical { physical }
|
||||
{}
|
||||
|
||||
QVector<QSharedPointer<AbstractRealTerminalInterface>> TruePhysicalTerminal::realTerminals() const
|
||||
{
|
||||
QVector<QSharedPointer<AbstractRealTerminalInterface>> vector_;
|
||||
if (m_physical) {
|
||||
for (const auto &real_ : m_physical->realTerminals()) {
|
||||
vector_.append(QSharedPointer<AbstractRealTerminalInterface> { new TrueRealTerminal{ real_ }});
|
||||
}
|
||||
}
|
||||
QVector<QSharedPointer<AbstractRealTerminalInterface>> TruePhysicalTerminal::realTerminals() const
|
||||
{
|
||||
QVector<QSharedPointer<AbstractRealTerminalInterface>> vector_;
|
||||
if (m_physical) {
|
||||
for (const auto &real_ : m_physical->realTerminals()) {
|
||||
vector_.append(QSharedPointer<AbstractRealTerminalInterface> { new TrueRealTerminal{ real_ }});
|
||||
}
|
||||
}
|
||||
|
||||
return vector_;
|
||||
}
|
||||
return vector_;
|
||||
}
|
||||
|
||||
TrueRealTerminal::TrueRealTerminal(QSharedPointer<RealTerminal> real) :
|
||||
m_real { real }
|
||||
{}
|
||||
TrueRealTerminal::TrueRealTerminal(QSharedPointer<RealTerminal> real) :
|
||||
m_real { real }
|
||||
{}
|
||||
|
||||
QString TrueRealTerminal::label() const
|
||||
{
|
||||
if (m_real) {
|
||||
return m_real->label();
|
||||
} else {
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
QString TrueRealTerminal::label() const
|
||||
{
|
||||
if (m_real) {
|
||||
return m_real->label();
|
||||
} else {
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
bool TrueRealTerminal::isBridged() const
|
||||
{
|
||||
if (m_real) {
|
||||
return m_real->isBridged();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
bool TrueRealTerminal::isBridged() const
|
||||
{
|
||||
if (m_real) {
|
||||
return m_real->isBridged();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Return a raw pointer, the pointer is not managed by this class
|
||||
AbstractBridgeInterface* TrueRealTerminal::bridge() const
|
||||
{
|
||||
return new TrueBridge(m_real->bridge());
|
||||
}
|
||||
//Return a raw pointer, the pointer is not managed by this class
|
||||
AbstractBridgeInterface* TrueRealTerminal::bridge() const
|
||||
{
|
||||
return new TrueBridge(m_real->bridge());
|
||||
}
|
||||
|
||||
TrueBridge::TrueBridge(QSharedPointer<TerminalStripBridge> bridge) :
|
||||
m_bridge { bridge }
|
||||
{}
|
||||
TrueBridge::TrueBridge(QSharedPointer<TerminalStripBridge> bridge) :
|
||||
m_bridge { bridge }
|
||||
{}
|
||||
|
||||
QUuid TrueBridge::uuid() const
|
||||
{
|
||||
if (m_bridge) {
|
||||
return m_bridge->uuid();
|
||||
} else {
|
||||
return QUuid();
|
||||
}
|
||||
}
|
||||
QUuid TrueBridge::uuid() const
|
||||
{
|
||||
if (m_bridge) {
|
||||
return m_bridge->uuid();
|
||||
} else {
|
||||
return QUuid();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "addterminalstripcommand.h"
|
||||
#include "../../qetproject.h"
|
||||
@ -35,22 +35,22 @@ AddTerminalStripCommand::AddTerminalStripCommand(TerminalStrip *strip,
|
||||
m_strip(strip),
|
||||
m_project(project)
|
||||
{
|
||||
setText(QObject::tr("Ajouter un groupe de bornes"));
|
||||
setText(QObject::tr("Ajouter un groupe de bornes"));
|
||||
}
|
||||
|
||||
AddTerminalStripCommand::~AddTerminalStripCommand()
|
||||
{}
|
||||
|
||||
void AddTerminalStripCommand::undo() {
|
||||
if (m_project && m_strip) {
|
||||
m_project->removeTerminalStrip(m_strip);
|
||||
}
|
||||
if (m_project && m_strip) {
|
||||
m_project->removeTerminalStrip(m_strip);
|
||||
}
|
||||
}
|
||||
|
||||
void AddTerminalStripCommand::redo() {
|
||||
if (m_project && m_strip) {
|
||||
m_project->addTerminalStrip(m_strip);
|
||||
}
|
||||
if (m_project && m_strip) {
|
||||
m_project->addTerminalStrip(m_strip);
|
||||
}
|
||||
}
|
||||
|
||||
RemoveTerminalStripCommand::RemoveTerminalStripCommand(TerminalStrip *strip,
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef ADDTERMINALSTRIPCOMMAND_H
|
||||
#define ADDTERMINALSTRIPCOMMAND_H
|
||||
@ -28,16 +28,16 @@ class Element;
|
||||
|
||||
class AddTerminalStripCommand : public QUndoCommand
|
||||
{
|
||||
public:
|
||||
public:
|
||||
AddTerminalStripCommand(TerminalStrip *strip, QETProject *project, QUndoCommand *parent = nullptr);
|
||||
~AddTerminalStripCommand() override;
|
||||
~AddTerminalStripCommand() override;
|
||||
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
|
||||
private:
|
||||
QPointer<TerminalStrip> m_strip;
|
||||
QPointer<QETProject> m_project;
|
||||
private:
|
||||
QPointer<TerminalStrip> m_strip;
|
||||
QPointer<QETProject> m_project;
|
||||
};
|
||||
|
||||
class RemoveTerminalStripCommand : public QUndoCommand
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "addterminaltostripcommand.h"
|
||||
#include "../../qetgraphicsitem/terminalelement.h"
|
||||
@ -72,7 +72,7 @@ void AddTerminalToStripCommand::undo()
|
||||
{
|
||||
if (m_new_strip) {
|
||||
m_new_strip->removeTerminals(m_terminal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -83,7 +83,7 @@ void AddTerminalToStripCommand::redo()
|
||||
{
|
||||
if (m_new_strip) {
|
||||
m_new_strip->addTerminals(m_terminal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef ADDTERMINALTOSTRIPCOMMAND_H
|
||||
#define ADDTERMINALTOSTRIPCOMMAND_H
|
||||
@ -36,17 +36,17 @@ class PhysicalTerminal;
|
||||
*/
|
||||
class AddTerminalToStripCommand : public QUndoCommand
|
||||
{
|
||||
public:
|
||||
public:
|
||||
AddTerminalToStripCommand(QSharedPointer<RealTerminal> terminal, TerminalStrip *strip, QUndoCommand *parent = nullptr);
|
||||
AddTerminalToStripCommand(QVector<QSharedPointer<RealTerminal>> terminals, TerminalStrip *strip, QUndoCommand *parent = nullptr);
|
||||
~AddTerminalToStripCommand() override;
|
||||
~AddTerminalToStripCommand() override;
|
||||
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
|
||||
private:
|
||||
private:
|
||||
QVector<QSharedPointer<RealTerminal>> m_terminal;
|
||||
QPointer<TerminalStrip> m_new_strip;
|
||||
QPointer<TerminalStrip> m_new_strip;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "bridgeterminalscommand.h"
|
||||
#include "../terminalstripbridge.h"
|
||||
@ -58,18 +58,18 @@ UnBridgeTerminalsCommand::UnBridgeTerminalsCommand(TerminalStrip *strip,
|
||||
|
||||
if (strip->canUnBridge(real_terminal))
|
||||
{
|
||||
m_bridge = strip->isBridged(real_terminal.first());
|
||||
m_bridge = strip->isBridged(real_terminal.first());
|
||||
|
||||
//If bridge have one more terminals than @real_terminal
|
||||
//that mean every terminals of the bridge must be unbridged by this undo command,
|
||||
//else the single terminal who's not umbridged by this undo command
|
||||
//continue to have a bridge (to nothing) and this nowhere bridge is visible
|
||||
//in the terminal strip graphic item and terminal strip editor dialog.
|
||||
if (m_bridge->realTerminals().size() == real_terminal.size() + 1) {
|
||||
m_terminals = m_bridge->realTerminals();
|
||||
} else {
|
||||
m_terminals = real_terminal;
|
||||
}
|
||||
//If bridge have one more terminals than @real_terminal
|
||||
//that mean every terminals of the bridge must be unbridged by this undo command,
|
||||
//else the single terminal who's not umbridged by this undo command
|
||||
//continue to have a bridge (to nothing) and this nowhere bridge is visible
|
||||
//in the terminal strip graphic item and terminal strip editor dialog.
|
||||
if (m_bridge->realTerminals().size() == real_terminal.size() + 1) {
|
||||
m_terminals = m_bridge->realTerminals();
|
||||
} else {
|
||||
m_terminals = real_terminal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef BRIDGETERMINALSCOMMAND_H
|
||||
#define BRIDGETERMINALSCOMMAND_H
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "changeterminallevel.h"
|
||||
#include "../realterminal.h"
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef CHANGETERMINALLEVEL_H
|
||||
#define CHANGETERMINALLEVEL_H
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "changeterminalstripcolor.h"
|
||||
#include "../terminalstripbridge.h"
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef CHANGETERMINALSTRIPCOLOR_H
|
||||
#define CHANGETERMINALSTRIPCOLOR_H
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "changeterminalstripdata.h"
|
||||
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef CHANGETERMINALSTRIPDATA_H
|
||||
#define CHANGETERMINALSTRIPDATA_H
|
||||
@ -27,15 +27,15 @@
|
||||
*/
|
||||
class ChangeTerminalStripData : public QUndoCommand
|
||||
{
|
||||
public:
|
||||
ChangeTerminalStripData(TerminalStrip *strip, const TerminalStripData &data, QUndoCommand *parent = nullptr);
|
||||
public:
|
||||
ChangeTerminalStripData(TerminalStrip *strip, const TerminalStripData &data, QUndoCommand *parent = nullptr);
|
||||
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
|
||||
private:
|
||||
QPointer<TerminalStrip> m_strip;
|
||||
TerminalStripData m_old_data, m_new_data;
|
||||
private:
|
||||
QPointer<TerminalStrip> m_strip;
|
||||
TerminalStripData m_old_data, m_new_data;
|
||||
};
|
||||
|
||||
#endif // CHANGETERMINALSTRIPDATA_H
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "groupterminalscommand.h"
|
||||
#include "../physicalterminal.h"
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef GROUPTERMINALSCOMMAND_H
|
||||
#define GROUPTERMINALSCOMMAND_H
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "sortterminalstripcommand.h"
|
||||
#include "../terminalstrip.h"
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef SORTTERMINALSTRIPCOMMAND_H
|
||||
#define SORTTERMINALSTRIPCOMMAND_H
|
||||
|
@ -976,7 +976,7 @@ QDomElement TerminalStrip::toXml(QDomDocument &parent_document)
|
||||
root_elmt.appendChild(m_data.toXml(parent_document));
|
||||
|
||||
//Undrawed terminals
|
||||
auto xml_layout = parent_document.createElement(QStringLiteral("layout"));
|
||||
auto xml_layout = parent_document.createElement(QStringLiteral("layout"));
|
||||
|
||||
for (auto &phy_t : m_physical_terminals) {
|
||||
xml_layout.appendChild(phy_t->toXml(parent_document));
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "terminalstripdata.h"
|
||||
#include "../qetxml.h"
|
||||
@ -34,7 +34,7 @@ QDomElement TerminalStripData::toXml(QDomDocument &xml_document) const
|
||||
|
||||
root_elmt.setAttribute(QStringLiteral("uuid"), m_uuid.toString());
|
||||
|
||||
auto info_elmt = xml_document.createElement(QStringLiteral("informations"));
|
||||
auto info_elmt = xml_document.createElement(QStringLiteral("informations"));
|
||||
root_elmt.appendChild(info_elmt);
|
||||
|
||||
if (!m_installation.isEmpty()) {
|
||||
@ -65,23 +65,23 @@ bool TerminalStripData::fromXml(const QDomElement &xml_element)
|
||||
return false;
|
||||
}
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
m_uuid = QUuid::fromString(xml_element.attribute(QStringLiteral("uuid")));
|
||||
m_uuid = QUuid::fromString(xml_element.attribute(QStringLiteral("uuid")));
|
||||
#else
|
||||
m_uuid = QUuid(xml_element.attribute(QStringLiteral("uuid")));
|
||||
#endif
|
||||
|
||||
for (auto &xml_info :
|
||||
QETXML::findInDomElement(xml_element.firstChildElement(QStringLiteral("informations")),
|
||||
QStringLiteral("information")))
|
||||
QETXML::findInDomElement(xml_element.firstChildElement(QStringLiteral("informations")),
|
||||
QStringLiteral("information")))
|
||||
{
|
||||
auto name = xml_info.attribute(QStringLiteral("name"));
|
||||
auto name = xml_info.attribute(QStringLiteral("name"));
|
||||
auto value = xml_info.text();
|
||||
|
||||
if (name == QLatin1String("installation")) { m_installation = value;}
|
||||
else if (name == QLatin1String("location")) {m_location = value;}
|
||||
else if (name == QLatin1String("name")) {m_name = value;}
|
||||
else if (name == QLatin1String("comment")) {m_comment = value;}
|
||||
else if (name == QLatin1String("description")) {m_description = value;}
|
||||
if (name == QLatin1String("installation")) { m_installation = value;}
|
||||
else if (name == QLatin1String("location")) {m_location = value;}
|
||||
else if (name == QLatin1String("name")) {m_name = value;}
|
||||
else if (name == QLatin1String("comment")) {m_comment = value;}
|
||||
else if (name == QLatin1String("description")) {m_description = value;}
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -101,7 +101,7 @@ TerminalStripData &TerminalStripData::operator=(const TerminalStripData &other)
|
||||
|
||||
QDomElement TerminalStripData::infoToXml(QDomDocument &xml_doc, const QString &name, const QString &value)
|
||||
{
|
||||
auto xml_elmt = xml_doc.createElement(QStringLiteral("information"));
|
||||
auto xml_elmt = xml_doc.createElement(QStringLiteral("information"));
|
||||
xml_elmt.setAttribute(QStringLiteral("name"), name);
|
||||
xml_elmt.appendChild(xml_doc.createTextNode(value));
|
||||
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef TERMINALSTRIPDATA_H
|
||||
#define TERMINALSTRIPDATA_H
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "terminalstripprojectconfigpage.h"
|
||||
#include "../../../qeticons.h"
|
||||
@ -23,26 +23,26 @@
|
||||
#include <QVBoxLayout>
|
||||
|
||||
TerminalStripProjectConfigPage::TerminalStripProjectConfigPage(QETProject *project,
|
||||
QWidget *parent) :
|
||||
ProjectConfigPage { project, parent }
|
||||
QWidget *parent) :
|
||||
ProjectConfigPage { project, parent }
|
||||
{
|
||||
initWidgets();
|
||||
initWidgets();
|
||||
}
|
||||
|
||||
QString TerminalStripProjectConfigPage::title() const {
|
||||
return tr("Plan de bornes");
|
||||
return tr("Plan de bornes");
|
||||
}
|
||||
|
||||
QIcon TerminalStripProjectConfigPage::icon() const {
|
||||
return QET::Icons::TerminalStrip;
|
||||
return QET::Icons::TerminalStrip;
|
||||
}
|
||||
|
||||
void TerminalStripProjectConfigPage::initWidgets()
|
||||
{
|
||||
m_layout_editor = new TerminalStripLayoutEditor{ project()->projectPropertiesHandler().terminalStripLayoutHandler().defaultLayout(),
|
||||
this };
|
||||
m_layout_editor = new TerminalStripLayoutEditor{ project()->projectPropertiesHandler().terminalStripLayoutHandler().defaultLayout(),
|
||||
this };
|
||||
|
||||
auto v_layout = new QVBoxLayout { this };
|
||||
v_layout->addWidget(m_layout_editor);
|
||||
setLayout(v_layout);
|
||||
auto v_layout = new QVBoxLayout { this };
|
||||
v_layout->addWidget(m_layout_editor);
|
||||
setLayout(v_layout);
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef TERMINALSTRIPPROJECTCONFIGPAGE_H
|
||||
#define TERMINALSTRIPPROJECTCONFIGPAGE_H
|
||||
@ -24,23 +24,23 @@ class TerminalStripLayoutEditor;
|
||||
|
||||
class TerminalStripProjectConfigPage : public ProjectConfigPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TerminalStripProjectConfigPage(QETProject *project, QWidget *parent = nullptr);
|
||||
Q_OBJECT
|
||||
public:
|
||||
TerminalStripProjectConfigPage(QETProject *project, QWidget *parent = nullptr);
|
||||
|
||||
QString title() const override;
|
||||
QIcon icon() const override;
|
||||
QString title() const override;
|
||||
QIcon icon() const override;
|
||||
|
||||
void applyProjectConf() override {}
|
||||
void applyProjectConf() override {}
|
||||
|
||||
protected:
|
||||
void initWidgets() override;
|
||||
void initLayout() override{}
|
||||
void readValuesFromProject() override {}
|
||||
void adjustReadOnly() override {}
|
||||
protected:
|
||||
void initWidgets() override;
|
||||
void initLayout() override{}
|
||||
void readValuesFromProject() override {}
|
||||
void adjustReadOnly() override {}
|
||||
|
||||
private:
|
||||
TerminalStripLayoutEditor *m_layout_editor { nullptr };
|
||||
private:
|
||||
TerminalStripLayoutEditor *m_layout_editor { nullptr };
|
||||
};
|
||||
|
||||
#endif // TERMINALSTRIPPROJECTCONFIGPAGE_H
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "freeterminaleditor.h"
|
||||
#include "ui_freeterminaleditor.h"
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef FREETERMINALEDITOR_H
|
||||
#define FREETERMINALEDITOR_H
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <QComboBox>
|
||||
|
||||
@ -333,7 +333,7 @@ QWidget *FreeTerminalModelDelegate::createEditor(QWidget *parent, const QStyleOp
|
||||
{
|
||||
if (index.column() == TYPE_CELL) {
|
||||
auto qcb = new QComboBox(parent);
|
||||
qcb->setObjectName(QStringLiteral("terminal_type"));
|
||||
qcb->setObjectName(QStringLiteral("terminal_type"));
|
||||
qcb->addItem(ElementData::translatedTerminalType(ElementData::TTGeneric), ElementData::TTGeneric);
|
||||
qcb->addItem(ElementData::translatedTerminalType(ElementData::TTFuse), ElementData::TTFuse);
|
||||
qcb->addItem(ElementData::translatedTerminalType(ElementData::TTSectional), ElementData::TTSectional);
|
||||
@ -344,7 +344,7 @@ QWidget *FreeTerminalModelDelegate::createEditor(QWidget *parent, const QStyleOp
|
||||
}
|
||||
if (index.column() == FUNCTION_CELL) {
|
||||
auto qcb = new QComboBox(parent);
|
||||
qcb->setObjectName(QStringLiteral("terminal_function"));
|
||||
qcb->setObjectName(QStringLiteral("terminal_function"));
|
||||
qcb->addItem(ElementData::translatedTerminalFunction(ElementData::TFGeneric), ElementData::TFGeneric);
|
||||
qcb->addItem(ElementData::translatedTerminalFunction(ElementData::TFPhase), ElementData::TFPhase);
|
||||
qcb->addItem(ElementData::translatedTerminalFunction(ElementData::TFNeutral), ElementData::TFNeutral);
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef FREETERMINALMODEL_H
|
||||
#define FREETERMINALMODEL_H
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef MODELTERMINALDATA_H
|
||||
#define MODELTERMINALDATA_H
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "terminalstripcreatordialog.h"
|
||||
#include "ui_terminalstripcreatordialog.h"
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef TERMINALSTRIPCREATORDIALOG_H
|
||||
#define TERMINALSTRIPCREATORDIALOG_H
|
||||
@ -33,9 +33,9 @@ namespace Ui {
|
||||
*/
|
||||
class TerminalStripCreatorDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
public:
|
||||
explicit TerminalStripCreatorDialog(QETProject *project, QWidget *parent = nullptr);
|
||||
~TerminalStripCreatorDialog() override;
|
||||
|
||||
@ -46,8 +46,8 @@ class TerminalStripCreatorDialog : public QDialog
|
||||
private:
|
||||
void setCursorToEmptyLine();
|
||||
|
||||
private:
|
||||
Ui::TerminalStripCreatorDialog *ui;
|
||||
private:
|
||||
Ui::TerminalStripCreatorDialog *ui;
|
||||
QETProject *m_project = nullptr;
|
||||
};
|
||||
|
||||
|
@ -180,7 +180,7 @@ void TerminalStripEditor::reload()
|
||||
if (m_model)
|
||||
{
|
||||
m_model->reload();
|
||||
spanMultiLevelTerminals();
|
||||
spanMultiLevelTerminals();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,12 +41,12 @@ static const int TERMINAL_STRIP_PAGE = 2;
|
||||
*/
|
||||
void TerminalStripEditorWindow::edit(TerminalStrip *strip)
|
||||
{
|
||||
if (const auto project_ = strip->project())
|
||||
{
|
||||
auto editor_ = TerminalStripEditorWindow::instance(project_, QETApp::diagramEditor(project_));
|
||||
editor_->setCurrentStrip(strip);
|
||||
editor_->show();
|
||||
}
|
||||
if (const auto project_ = strip->project())
|
||||
{
|
||||
auto editor_ = TerminalStripEditorWindow::instance(project_, QETApp::diagramEditor(project_));
|
||||
editor_->setCurrentStrip(strip);
|
||||
editor_->show();
|
||||
}
|
||||
}
|
||||
|
||||
TerminalStripEditorWindow::TerminalStripEditorWindow(QETProject *project, QWidget *parent) :
|
||||
@ -73,11 +73,11 @@ TerminalStripEditorWindow::TerminalStripEditorWindow(QETProject *project, QWidge
|
||||
*/
|
||||
TerminalStripEditorWindow::~TerminalStripEditorWindow()
|
||||
{
|
||||
delete ui;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void TerminalStripEditorWindow::setCurrentStrip(TerminalStrip *strip) {
|
||||
m_tree_dock->setSelectedStrip(strip);
|
||||
m_tree_dock->setSelectedStrip(strip);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -37,41 +37,41 @@ class TerminalStripEditorWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
//We need to use a QPointer instead of a raw pointer because when window_
|
||||
//have got a parent widget, the parent widget can delete the window_
|
||||
//instance in her destrucor and then window_ become a dangling pointer.
|
||||
static QPointer<TerminalStripEditorWindow> window_;
|
||||
private:
|
||||
//We need to use a QPointer instead of a raw pointer because when window_
|
||||
//have got a parent widget, the parent widget can delete the window_
|
||||
//instance in her destrucor and then window_ become a dangling pointer.
|
||||
static QPointer<TerminalStripEditorWindow> window_;
|
||||
|
||||
public:
|
||||
static TerminalStripEditorWindow* instance(QETProject *project, QWidget *parent = nullptr) {
|
||||
static QMutex mutex_;
|
||||
if (!window_) {
|
||||
mutex_.lock();
|
||||
if (!window_)
|
||||
window_ = new TerminalStripEditorWindow{project, parent};
|
||||
mutex_.unlock();
|
||||
}
|
||||
return window_;
|
||||
}
|
||||
public:
|
||||
static TerminalStripEditorWindow* instance(QETProject *project, QWidget *parent = nullptr) {
|
||||
static QMutex mutex_;
|
||||
if (!window_) {
|
||||
mutex_.lock();
|
||||
if (!window_)
|
||||
window_ = new TerminalStripEditorWindow{project, parent};
|
||||
mutex_.unlock();
|
||||
}
|
||||
return window_;
|
||||
}
|
||||
|
||||
static void dropInstance () {
|
||||
static QMutex mutex;
|
||||
if (window_) {
|
||||
mutex.lock();
|
||||
window_->deleteLater();
|
||||
window_.clear();
|
||||
mutex.unlock();
|
||||
}
|
||||
}
|
||||
static void dropInstance () {
|
||||
static QMutex mutex;
|
||||
if (window_) {
|
||||
mutex.lock();
|
||||
window_->deleteLater();
|
||||
window_.clear();
|
||||
mutex.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
static void edit(TerminalStrip *strip);
|
||||
static void edit(TerminalStrip *strip);
|
||||
|
||||
public:
|
||||
public:
|
||||
explicit TerminalStripEditorWindow(QETProject *project, QWidget *parent = nullptr);
|
||||
~TerminalStripEditorWindow();
|
||||
|
||||
void setCurrentStrip(TerminalStrip *strip);
|
||||
void setCurrentStrip(TerminalStrip *strip);
|
||||
|
||||
private slots:
|
||||
void on_m_add_terminal_strip_triggered();
|
||||
|
@ -1,34 +1,34 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "terminalstriplayouteditor.h"
|
||||
#include "ui_terminalstriplayouteditor.h"
|
||||
#include "../GraphicsItem/properties/terminalstriplayoutpattern.h"
|
||||
|
||||
TerminalStripLayoutEditor::TerminalStripLayoutEditor(QSharedPointer<TerminalStripLayoutPattern> layout,
|
||||
QWidget *parent) :
|
||||
QWidget{ parent },
|
||||
ui{ new Ui::TerminalStripLayoutEditor },
|
||||
QWidget *parent) :
|
||||
QWidget{ parent },
|
||||
ui{ new Ui::TerminalStripLayoutEditor },
|
||||
m_layout{ layout }
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->setupUi(this);
|
||||
ui->m_graphics_view->setScene(new QGraphicsScene{ this });
|
||||
ui->m_graphics_view->scene()->addItem(&m_preview_strip_item);
|
||||
updateUi();
|
||||
updateUi();
|
||||
}
|
||||
|
||||
TerminalStripLayoutEditor::~TerminalStripLayoutEditor()
|
||||
@ -50,87 +50,87 @@ void TerminalStripLayoutEditor::showEvent(QShowEvent *event)
|
||||
|
||||
void TerminalStripLayoutEditor::valueEdited()
|
||||
{
|
||||
if (!m_layout || m_ui_updating) {
|
||||
return;
|
||||
}
|
||||
if (!m_layout || m_ui_updating) {
|
||||
return;
|
||||
}
|
||||
|
||||
//auto *data_ = m_layout.data();
|
||||
//auto *data_ = m_layout.data();
|
||||
|
||||
m_layout.data()->m_header_rect.setRect(0,
|
||||
ui->m_y_header_sb->value(),
|
||||
ui->m_width_header_sb->value(),
|
||||
ui->m_height_header_sb->value());
|
||||
m_layout.data()->m_header_rect.setRect(0,
|
||||
ui->m_y_header_sb->value(),
|
||||
ui->m_width_header_sb->value(),
|
||||
ui->m_height_header_sb->value());
|
||||
|
||||
m_layout.data()->m_spacer_rect.setRect(0,
|
||||
ui->m_y_spacer_sb->value(),
|
||||
ui->m_width_spacer_sb->value(),
|
||||
ui->m_height_spacer_sb->value());
|
||||
m_layout.data()->m_spacer_rect.setRect(0,
|
||||
ui->m_y_spacer_sb->value(),
|
||||
ui->m_width_spacer_sb->value(),
|
||||
ui->m_height_spacer_sb->value());
|
||||
|
||||
m_layout.data()->m_terminal_rect[0].setRect(0,
|
||||
ui->m_y_terminal_0_sb->value(),
|
||||
ui->m_width_terminal_0_sb->value(),
|
||||
ui->m_height_terminal_0_sb->value());
|
||||
m_layout.data()->m_terminal_rect[0].setRect(0,
|
||||
ui->m_y_terminal_0_sb->value(),
|
||||
ui->m_width_terminal_0_sb->value(),
|
||||
ui->m_height_terminal_0_sb->value());
|
||||
|
||||
m_layout.data()->m_terminal_rect[1].setRect(0,
|
||||
ui->m_y_terminal_1_sb->value(),
|
||||
ui->m_width_terminal_1_sb->value(),
|
||||
ui->m_height_terminal_1_sb->value());
|
||||
m_layout.data()->m_terminal_rect[1].setRect(0,
|
||||
ui->m_y_terminal_1_sb->value(),
|
||||
ui->m_width_terminal_1_sb->value(),
|
||||
ui->m_height_terminal_1_sb->value());
|
||||
|
||||
m_layout.data()->m_terminal_rect[2].setRect(0,
|
||||
ui->m_y_terminal_2_sb->value(),
|
||||
ui->m_width_terminal_2_sb->value(),
|
||||
ui->m_height_terminal_2_sb->value());
|
||||
m_layout.data()->m_terminal_rect[2].setRect(0,
|
||||
ui->m_y_terminal_2_sb->value(),
|
||||
ui->m_width_terminal_2_sb->value(),
|
||||
ui->m_height_terminal_2_sb->value());
|
||||
|
||||
m_layout.data()->m_terminal_rect[3].setRect(0,
|
||||
ui->m_y_terminal_3_sb->value(),
|
||||
ui->m_width_terminal_3_sb->value(),
|
||||
ui->m_height_terminal_3_sb->value());
|
||||
m_layout.data()->m_terminal_rect[3].setRect(0,
|
||||
ui->m_y_terminal_3_sb->value(),
|
||||
ui->m_width_terminal_3_sb->value(),
|
||||
ui->m_height_terminal_3_sb->value());
|
||||
|
||||
m_layout.data()->m_bridge_point_y_offset[0] = ui->m_bridge_point_0_sb->value();
|
||||
m_layout.data()->m_bridge_point_y_offset[1] = ui->m_bridge_point_1_sb->value();
|
||||
m_layout.data()->m_bridge_point_y_offset[2] = ui->m_bridge_point_2_sb->value();
|
||||
m_layout.data()->m_bridge_point_y_offset[3] = ui->m_bridge_point_3_sb->value();
|
||||
m_layout.data()->m_bridge_point_y_offset[0] = ui->m_bridge_point_0_sb->value();
|
||||
m_layout.data()->m_bridge_point_y_offset[1] = ui->m_bridge_point_1_sb->value();
|
||||
m_layout.data()->m_bridge_point_y_offset[2] = ui->m_bridge_point_2_sb->value();
|
||||
m_layout.data()->m_bridge_point_y_offset[3] = ui->m_bridge_point_3_sb->value();
|
||||
|
||||
m_layout.data()->m_header_text_orientation = ui->m_header_text_orientation_cb->currentIndex() == 0 ?
|
||||
Qt::Horizontal :
|
||||
Qt::Vertical;
|
||||
m_layout.data()->m_header_text_orientation = ui->m_header_text_orientation_cb->currentIndex() == 0 ?
|
||||
Qt::Horizontal :
|
||||
Qt::Vertical;
|
||||
|
||||
switch (ui->m_header_text_alignment_cb->currentIndex()) {
|
||||
case 0:
|
||||
m_layout.data()->setHeaderTextAlignment(Qt::AlignLeft | Qt::AlignVCenter); break;
|
||||
case 1:
|
||||
m_layout.data()->setHeaderTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); break;
|
||||
default:
|
||||
m_layout.data()->setHeaderTextAlignment(Qt::AlignRight | Qt::AlignVCenter); break;
|
||||
}
|
||||
switch (ui->m_header_text_alignment_cb->currentIndex()) {
|
||||
case 0:
|
||||
m_layout.data()->setHeaderTextAlignment(Qt::AlignLeft | Qt::AlignVCenter); break;
|
||||
case 1:
|
||||
m_layout.data()->setHeaderTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); break;
|
||||
default:
|
||||
m_layout.data()->setHeaderTextAlignment(Qt::AlignRight | Qt::AlignVCenter); break;
|
||||
}
|
||||
|
||||
m_layout.data()->m_terminals_text_orientation[0] = ui->m_terminal_text_orientation_cb->currentIndex() == 0 ?
|
||||
Qt::Horizontal :
|
||||
Qt::Vertical;
|
||||
m_layout.data()->m_terminals_text_orientation[0] = ui->m_terminal_text_orientation_cb->currentIndex() == 0 ?
|
||||
Qt::Horizontal :
|
||||
Qt::Vertical;
|
||||
|
||||
switch (ui->m_terminal_text_alignment_cb->currentIndex()) {
|
||||
case 0:
|
||||
m_layout.data()->setTerminalsTextAlignment(
|
||||
QVector<Qt::Alignment> { Qt::AlignLeft | Qt::AlignVCenter,
|
||||
Qt::AlignLeft | Qt::AlignVCenter,
|
||||
Qt::AlignLeft | Qt::AlignVCenter,
|
||||
Qt::AlignLeft | Qt::AlignVCenter });
|
||||
break;
|
||||
case 1:
|
||||
m_layout.data()->setTerminalsTextAlignment(
|
||||
QVector<Qt::Alignment> { Qt::AlignHCenter | Qt::AlignVCenter,
|
||||
Qt::AlignHCenter | Qt::AlignVCenter,
|
||||
Qt::AlignHCenter | Qt::AlignVCenter,
|
||||
Qt::AlignHCenter | Qt::AlignVCenter });
|
||||
break;
|
||||
default:
|
||||
m_layout.data()->setTerminalsTextAlignment(
|
||||
QVector<Qt::Alignment> { Qt::AlignRight | Qt::AlignVCenter,
|
||||
Qt::AlignRight | Qt::AlignVCenter,
|
||||
Qt::AlignRight | Qt::AlignVCenter,
|
||||
Qt::AlignRight | Qt::AlignVCenter });
|
||||
break;
|
||||
}
|
||||
switch (ui->m_terminal_text_alignment_cb->currentIndex()) {
|
||||
case 0:
|
||||
m_layout.data()->setTerminalsTextAlignment(
|
||||
QVector<Qt::Alignment> { Qt::AlignLeft | Qt::AlignVCenter,
|
||||
Qt::AlignLeft | Qt::AlignVCenter,
|
||||
Qt::AlignLeft | Qt::AlignVCenter,
|
||||
Qt::AlignLeft | Qt::AlignVCenter });
|
||||
break;
|
||||
case 1:
|
||||
m_layout.data()->setTerminalsTextAlignment(
|
||||
QVector<Qt::Alignment> { Qt::AlignHCenter | Qt::AlignVCenter,
|
||||
Qt::AlignHCenter | Qt::AlignVCenter,
|
||||
Qt::AlignHCenter | Qt::AlignVCenter,
|
||||
Qt::AlignHCenter | Qt::AlignVCenter });
|
||||
break;
|
||||
default:
|
||||
m_layout.data()->setTerminalsTextAlignment(
|
||||
QVector<Qt::Alignment> { Qt::AlignRight | Qt::AlignVCenter,
|
||||
Qt::AlignRight | Qt::AlignVCenter,
|
||||
Qt::AlignRight | Qt::AlignVCenter,
|
||||
Qt::AlignRight | Qt::AlignVCenter });
|
||||
break;
|
||||
}
|
||||
|
||||
updateUi();
|
||||
m_preview_strip_item.update();
|
||||
@ -138,76 +138,76 @@ void TerminalStripLayoutEditor::valueEdited()
|
||||
|
||||
void TerminalStripLayoutEditor::updateUi()
|
||||
{
|
||||
if (!m_layout) {
|
||||
return;
|
||||
}
|
||||
if (!m_layout) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto data = m_layout.data();
|
||||
const auto data = m_layout.data();
|
||||
|
||||
m_ui_updating = true;
|
||||
m_ui_updating = true;
|
||||
|
||||
ui->m_y_header_sb->setValue(data->m_header_rect.y());
|
||||
ui->m_width_header_sb->setValue(data->m_header_rect.width());
|
||||
ui->m_height_header_sb->setValue(data->m_header_rect.height());
|
||||
ui->m_y_header_sb->setValue(data->m_header_rect.y());
|
||||
ui->m_width_header_sb->setValue(data->m_header_rect.width());
|
||||
ui->m_height_header_sb->setValue(data->m_header_rect.height());
|
||||
|
||||
ui->m_y_spacer_sb->setValue(data->m_spacer_rect.y());
|
||||
ui->m_width_spacer_sb->setValue(data->m_spacer_rect.width());
|
||||
ui->m_height_spacer_sb->setValue(data->m_spacer_rect.height());
|
||||
ui->m_y_spacer_sb->setValue(data->m_spacer_rect.y());
|
||||
ui->m_width_spacer_sb->setValue(data->m_spacer_rect.width());
|
||||
ui->m_height_spacer_sb->setValue(data->m_spacer_rect.height());
|
||||
|
||||
const auto terminal_0 = data->m_terminal_rect[0];
|
||||
ui->m_y_terminal_0_sb->setValue(terminal_0.y());
|
||||
ui->m_height_terminal_0_sb->setValue(terminal_0.height());
|
||||
ui->m_width_terminal_0_sb->setValue(terminal_0.width());
|
||||
const auto terminal_0 = data->m_terminal_rect[0];
|
||||
ui->m_y_terminal_0_sb->setValue(terminal_0.y());
|
||||
ui->m_height_terminal_0_sb->setValue(terminal_0.height());
|
||||
ui->m_width_terminal_0_sb->setValue(terminal_0.width());
|
||||
|
||||
const auto terminal_1 = data->m_terminal_rect[1];
|
||||
ui->m_y_terminal_1_sb->setValue(terminal_1.y());
|
||||
ui->m_height_terminal_1_sb->setValue(terminal_1.height());
|
||||
ui->m_width_terminal_1_sb->setValue(terminal_1.width());
|
||||
const auto terminal_1 = data->m_terminal_rect[1];
|
||||
ui->m_y_terminal_1_sb->setValue(terminal_1.y());
|
||||
ui->m_height_terminal_1_sb->setValue(terminal_1.height());
|
||||
ui->m_width_terminal_1_sb->setValue(terminal_1.width());
|
||||
|
||||
const auto terminal_2 = data->m_terminal_rect[2];
|
||||
ui->m_y_terminal_2_sb->setValue(terminal_2.y());
|
||||
ui->m_height_terminal_2_sb->setValue(terminal_2.height());
|
||||
ui->m_width_terminal_2_sb->setValue(terminal_2.width());
|
||||
const auto terminal_2 = data->m_terminal_rect[2];
|
||||
ui->m_y_terminal_2_sb->setValue(terminal_2.y());
|
||||
ui->m_height_terminal_2_sb->setValue(terminal_2.height());
|
||||
ui->m_width_terminal_2_sb->setValue(terminal_2.width());
|
||||
|
||||
const auto terminal_3 = data->m_terminal_rect[3];
|
||||
ui->m_y_terminal_3_sb->setValue(terminal_3.y());
|
||||
ui->m_height_terminal_3_sb->setValue(terminal_3.height());
|
||||
ui->m_width_terminal_3_sb->setValue(terminal_3.width());
|
||||
const auto terminal_3 = data->m_terminal_rect[3];
|
||||
ui->m_y_terminal_3_sb->setValue(terminal_3.y());
|
||||
ui->m_height_terminal_3_sb->setValue(terminal_3.height());
|
||||
ui->m_width_terminal_3_sb->setValue(terminal_3.width());
|
||||
|
||||
const auto bridge_point = data->m_bridge_point_y_offset;
|
||||
ui->m_bridge_point_0_sb->setValue(bridge_point[0]);
|
||||
ui->m_bridge_point_1_sb->setValue(bridge_point[1]);
|
||||
ui->m_bridge_point_2_sb->setValue(bridge_point[2]);
|
||||
ui->m_bridge_point_3_sb->setValue(bridge_point[3]);
|
||||
const auto bridge_point = data->m_bridge_point_y_offset;
|
||||
ui->m_bridge_point_0_sb->setValue(bridge_point[0]);
|
||||
ui->m_bridge_point_1_sb->setValue(bridge_point[1]);
|
||||
ui->m_bridge_point_2_sb->setValue(bridge_point[2]);
|
||||
ui->m_bridge_point_3_sb->setValue(bridge_point[3]);
|
||||
|
||||
if (data->m_header_text_orientation == Qt::Horizontal) {
|
||||
ui->m_header_text_orientation_cb->setCurrentIndex(0);
|
||||
} else {
|
||||
ui->m_header_text_orientation_cb->setCurrentIndex(1);
|
||||
}
|
||||
if (data->m_header_text_orientation == Qt::Horizontal) {
|
||||
ui->m_header_text_orientation_cb->setCurrentIndex(0);
|
||||
} else {
|
||||
ui->m_header_text_orientation_cb->setCurrentIndex(1);
|
||||
}
|
||||
|
||||
if (data->m_terminals_text_orientation[0] == Qt::Horizontal) {
|
||||
ui->m_terminal_text_orientation_cb->setCurrentIndex(0);
|
||||
} else {
|
||||
ui->m_terminal_text_orientation_cb->setCurrentIndex(1);
|
||||
}
|
||||
if (data->m_terminals_text_orientation[0] == Qt::Horizontal) {
|
||||
ui->m_terminal_text_orientation_cb->setCurrentIndex(0);
|
||||
} else {
|
||||
ui->m_terminal_text_orientation_cb->setCurrentIndex(1);
|
||||
}
|
||||
|
||||
const auto header_alignment = data->headerTextAlignment();
|
||||
if (header_alignment &Qt::AlignLeft) {
|
||||
ui->m_header_text_alignment_cb->setCurrentIndex(0);
|
||||
} else if (header_alignment &Qt::AlignHCenter) {
|
||||
ui->m_header_text_alignment_cb->setCurrentIndex(1);
|
||||
} else if (header_alignment &Qt::AlignRight) {
|
||||
ui->m_header_text_alignment_cb->setCurrentIndex(2);
|
||||
}
|
||||
const auto header_alignment = data->headerTextAlignment();
|
||||
if (header_alignment &Qt::AlignLeft) {
|
||||
ui->m_header_text_alignment_cb->setCurrentIndex(0);
|
||||
} else if (header_alignment &Qt::AlignHCenter) {
|
||||
ui->m_header_text_alignment_cb->setCurrentIndex(1);
|
||||
} else if (header_alignment &Qt::AlignRight) {
|
||||
ui->m_header_text_alignment_cb->setCurrentIndex(2);
|
||||
}
|
||||
|
||||
const auto terminal_alignment = data->terminalsTextAlignment().at(0);
|
||||
if (terminal_alignment &Qt::AlignLeft) {
|
||||
ui->m_terminal_text_alignment_cb->setCurrentIndex(0);
|
||||
} else if (terminal_alignment &Qt::AlignHCenter) {
|
||||
ui->m_terminal_text_alignment_cb->setCurrentIndex(1);
|
||||
} else if (terminal_alignment &Qt::AlignRight) {
|
||||
ui->m_terminal_text_alignment_cb->setCurrentIndex(2);
|
||||
const auto terminal_alignment = data->terminalsTextAlignment().at(0);
|
||||
if (terminal_alignment &Qt::AlignLeft) {
|
||||
ui->m_terminal_text_alignment_cb->setCurrentIndex(0);
|
||||
} else if (terminal_alignment &Qt::AlignHCenter) {
|
||||
ui->m_terminal_text_alignment_cb->setCurrentIndex(1);
|
||||
} else if (terminal_alignment &Qt::AlignRight) {
|
||||
ui->m_terminal_text_alignment_cb->setCurrentIndex(2);
|
||||
}
|
||||
|
||||
m_ui_updating = false;
|
||||
@ -222,7 +222,7 @@ void TerminalStripLayoutEditor::updatePreview()
|
||||
|
||||
void TerminalStripLayoutEditor::on_m_display_preview_help_clicked(bool checked)
|
||||
{
|
||||
m_preview_strip_item.m_drawer.setPreviewDraw(checked);
|
||||
m_preview_strip_item.update();
|
||||
m_preview_strip_item.m_drawer.setPreviewDraw(checked);
|
||||
m_preview_strip_item.update();
|
||||
}
|
||||
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef TERMINALSTRIPLAYOUTEDITOR_H
|
||||
#define TERMINALSTRIPLAYOUTEDITOR_H
|
||||
@ -27,35 +27,35 @@
|
||||
class TerminalStripLayoutPattern;
|
||||
|
||||
namespace Ui {
|
||||
class TerminalStripLayoutEditor;
|
||||
class TerminalStripLayoutEditor;
|
||||
}
|
||||
|
||||
class PreviewStripItem : public QGraphicsItem
|
||||
{
|
||||
friend class TerminalStripLayoutEditor;
|
||||
friend class TerminalStripLayoutEditor;
|
||||
|
||||
public:
|
||||
PreviewStripItem (QSharedPointer<TerminalStripLayoutPattern> layout) :
|
||||
m_drawer {QSharedPointer<TerminalStripDrawer::DemoTerminalStrip>{new TerminalStripDrawer::DemoTerminalStrip},
|
||||
layout}
|
||||
{}
|
||||
public:
|
||||
PreviewStripItem (QSharedPointer<TerminalStripLayoutPattern> layout) :
|
||||
m_drawer {QSharedPointer<TerminalStripDrawer::DemoTerminalStrip>{new TerminalStripDrawer::DemoTerminalStrip},
|
||||
layout}
|
||||
{}
|
||||
|
||||
QRectF boundingRect() const override {
|
||||
return m_drawer.boundingRect();
|
||||
}
|
||||
QRectF boundingRect() const override {
|
||||
return m_drawer.boundingRect();
|
||||
}
|
||||
|
||||
protected:
|
||||
void paint(QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget = nullptr) override
|
||||
{
|
||||
Q_UNUSED (option); Q_UNUSED (widget);
|
||||
m_drawer.paint(painter);
|
||||
}
|
||||
protected:
|
||||
void paint(QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget = nullptr) override
|
||||
{
|
||||
Q_UNUSED (option); Q_UNUSED (widget);
|
||||
m_drawer.paint(painter);
|
||||
}
|
||||
|
||||
private:
|
||||
TerminalStripDrawer::TerminalStripDrawer m_drawer;
|
||||
};
|
||||
private:
|
||||
TerminalStripDrawer::TerminalStripDrawer m_drawer;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The TerminalStripLayoutEditor class
|
||||
@ -63,30 +63,30 @@ class PreviewStripItem : public QGraphicsItem
|
||||
*/
|
||||
class TerminalStripLayoutEditor : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TerminalStripLayoutEditor(QSharedPointer<TerminalStripLayoutPattern> layout,
|
||||
QWidget *parent = nullptr);
|
||||
~TerminalStripLayoutEditor();
|
||||
public:
|
||||
explicit TerminalStripLayoutEditor(QSharedPointer<TerminalStripLayoutPattern> layout,
|
||||
QWidget *parent = nullptr);
|
||||
~TerminalStripLayoutEditor();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
void showEvent(QShowEvent *event) override;
|
||||
|
||||
private slots:
|
||||
void valueEdited();
|
||||
private slots:
|
||||
void valueEdited();
|
||||
|
||||
void on_m_display_preview_help_clicked(bool checked);
|
||||
void on_m_display_preview_help_clicked(bool checked);
|
||||
|
||||
private:
|
||||
private:
|
||||
void updateUi();
|
||||
void updatePreview();
|
||||
|
||||
private:
|
||||
Ui::TerminalStripLayoutEditor *ui;
|
||||
QSharedPointer<TerminalStripLayoutPattern> m_layout;
|
||||
bool m_ui_updating { false } ;
|
||||
private:
|
||||
Ui::TerminalStripLayoutEditor *ui;
|
||||
QSharedPointer<TerminalStripLayoutPattern> m_layout;
|
||||
bool m_ui_updating { false } ;
|
||||
PreviewStripItem m_preview_strip_item {m_layout};
|
||||
};
|
||||
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "terminalstripmodel.h"
|
||||
#include "../terminalstrip.h"
|
||||
@ -105,8 +105,8 @@ TerminalStripModel::Column TerminalStripModel::columnTypeForIndex(const QModelIn
|
||||
* @param parent
|
||||
*/
|
||||
TerminalStripModel::TerminalStripModel(TerminalStrip *terminal_strip, QObject *parent) :
|
||||
QAbstractTableModel(parent),
|
||||
m_terminal_strip(terminal_strip)
|
||||
QAbstractTableModel(parent),
|
||||
m_terminal_strip(terminal_strip)
|
||||
{
|
||||
fillPhysicalTerminalData();
|
||||
|
||||
@ -129,11 +129,11 @@ void TerminalStripModel::setTerminalStrip(TerminalStrip *terminal_strip)
|
||||
|
||||
int TerminalStripModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent)
|
||||
Q_UNUSED(parent)
|
||||
|
||||
if (!m_terminal_strip) {
|
||||
return 0;
|
||||
}
|
||||
if (!m_terminal_strip) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto count = 0;
|
||||
for (const auto &mptd : m_physical_data) {
|
||||
@ -145,7 +145,7 @@ int TerminalStripModel::rowCount(const QModelIndex &parent) const
|
||||
|
||||
int TerminalStripModel::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent)
|
||||
Q_UNUSED(parent)
|
||||
return COLUMN_COUNT;
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ QVariant TerminalStripModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
return mrtd.led_ ? Qt::Checked : Qt::Unchecked;
|
||||
}
|
||||
else if (role == Qt::BackgroundRole && index.column() < COLUMN_COUNT )
|
||||
else if (role == Qt::BackgroundRole && index.column() < COLUMN_COUNT )
|
||||
{
|
||||
if (m_modified_cell.contains(mrtd.element_) &&
|
||||
m_modified_cell.value(mrtd.element_).at(index.column()))
|
||||
@ -794,7 +794,7 @@ QWidget *TerminalStripModelDelegate::createEditor(QWidget *parent, const QStyleO
|
||||
{
|
||||
if (index.column() == TYPE_CELL) {
|
||||
auto qcb = new QComboBox(parent);
|
||||
qcb->setObjectName(QStringLiteral("terminal_type"));
|
||||
qcb->setObjectName(QStringLiteral("terminal_type"));
|
||||
qcb->addItem(ElementData::translatedTerminalType(ElementData::TTGeneric), ElementData::TTGeneric);
|
||||
qcb->addItem(ElementData::translatedTerminalType(ElementData::TTFuse), ElementData::TTFuse);
|
||||
qcb->addItem(ElementData::translatedTerminalType(ElementData::TTSectional), ElementData::TTSectional);
|
||||
@ -805,7 +805,7 @@ QWidget *TerminalStripModelDelegate::createEditor(QWidget *parent, const QStyleO
|
||||
}
|
||||
if (index.column() == FUNCTION_CELL) {
|
||||
auto qcb = new QComboBox(parent);
|
||||
qcb->setObjectName(QStringLiteral("terminal_function"));
|
||||
qcb->setObjectName(QStringLiteral("terminal_function"));
|
||||
qcb->addItem(ElementData::translatedTerminalFunction(ElementData::TFGeneric), ElementData::TFGeneric);
|
||||
qcb->addItem(ElementData::translatedTerminalFunction(ElementData::TFPhase), ElementData::TFPhase);
|
||||
qcb->addItem(ElementData::translatedTerminalFunction(ElementData::TFNeutral), ElementData::TFNeutral);
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef TERMINALSTRIPMODEL_H
|
||||
#define TERMINALSTRIPMODEL_H
|
||||
@ -67,14 +67,14 @@ class TerminalStripModel : public QAbstractTableModel
|
||||
static int levelForColumn(TerminalStripModel::Column column);
|
||||
static TerminalStripModel::Column columnTypeForIndex(const QModelIndex &index);
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
TerminalStripModel(TerminalStrip *terminal_strip, QObject *parent = nullptr);
|
||||
Q_OBJECT
|
||||
public:
|
||||
TerminalStripModel(TerminalStrip *terminal_strip, QObject *parent = nullptr);
|
||||
void setTerminalStrip(TerminalStrip *terminal_strip);
|
||||
|
||||
virtual int rowCount (const QModelIndex &parent = QModelIndex()) const override;
|
||||
virtual int columnCount (const QModelIndex &parent = QModelIndex()) const override;
|
||||
virtual QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
virtual int rowCount (const QModelIndex &parent = QModelIndex()) const override;
|
||||
virtual int columnCount (const QModelIndex &parent = QModelIndex()) const override;
|
||||
virtual QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
virtual bool setData (const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||
virtual QVariant headerData (int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
virtual Qt::ItemFlags flags (const QModelIndex &index) const override;
|
||||
@ -96,8 +96,8 @@ class TerminalStripModel : public QAbstractTableModel
|
||||
modelRealTerminalData realDataAtIndex(int index) const;
|
||||
QPixmap bridgePixmapFor(const QModelIndex &index) const;
|
||||
|
||||
private:
|
||||
QPointer<TerminalStrip> m_terminal_strip;
|
||||
private:
|
||||
QPointer<TerminalStrip> m_terminal_strip;
|
||||
QHash<QPointer<Element>, QVector<bool>> m_modified_cell;
|
||||
QVector<modelPhysicalTerminalData> m_physical_data;
|
||||
struct BridgePixmap
|
||||
|
@ -5,16 +5,16 @@
|
||||
|
||||
class mytest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
mytest();
|
||||
~mytest();
|
||||
mytest();
|
||||
~mytest();
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
void test_case1();
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
void test_case1();
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user