From b3ac3c82af7a4f9ed4000f45980ce01b1b0702a7 Mon Sep 17 00:00:00 2001 From: plc-user <74435298+plc-user@users.noreply.github.com> Date: Thu, 2 May 2024 08:39:27 +0200 Subject: [PATCH] fixed indentations of the remaining *.cpp/*.h files --- .../properties/terminalstriplayoutpattern.h | 4 +- .../GraphicsItem/terminalstripdrawer.cpp | 374 +++++++++--------- .../GraphicsItem/terminalstripitem.cpp | 76 ++-- .../GraphicsItem/terminalstripitem.h | 22 +- .../GraphicsItem/trueterminalstrip.cpp | 180 ++++----- .../UndoCommand/addterminalstripcommand.cpp | 38 +- .../UndoCommand/addterminalstripcommand.h | 34 +- .../UndoCommand/addterminaltostripcommand.cpp | 28 +- .../UndoCommand/addterminaltostripcommand.h | 36 +- .../UndoCommand/bridgeterminalscommand.cpp | 46 +-- .../UndoCommand/bridgeterminalscommand.h | 24 +- .../UndoCommand/changeterminallevel.cpp | 24 +- .../UndoCommand/changeterminallevel.h | 24 +- .../UndoCommand/changeterminalstripcolor.cpp | 24 +- .../UndoCommand/changeterminalstripcolor.h | 24 +- .../UndoCommand/changeterminalstripdata.cpp | 24 +- .../UndoCommand/changeterminalstripdata.h | 38 +- .../UndoCommand/groupterminalscommand.cpp | 24 +- .../UndoCommand/groupterminalscommand.h | 24 +- .../UndoCommand/sortterminalstripcommand.cpp | 24 +- .../UndoCommand/sortterminalstripcommand.h | 24 +- sources/TerminalStrip/terminalstrip.cpp | 2 +- sources/TerminalStrip/terminalstripdata.cpp | 46 +-- sources/TerminalStrip/terminalstripdata.h | 24 +- .../terminalstripprojectconfigpage.cpp | 44 +-- .../terminalstripprojectconfigpage.h | 50 +-- .../TerminalStrip/ui/freeterminaleditor.cpp | 24 +- sources/TerminalStrip/ui/freeterminaleditor.h | 24 +- .../TerminalStrip/ui/freeterminalmodel.cpp | 28 +- sources/TerminalStrip/ui/freeterminalmodel.h | 24 +- sources/TerminalStrip/ui/modelTerminalData.h | 24 +- .../ui/terminalstripcreatordialog.cpp | 24 +- .../ui/terminalstripcreatordialog.h | 32 +- .../TerminalStrip/ui/terminalstripeditor.cpp | 2 +- .../ui/terminalstripeditorwindow.cpp | 16 +- .../ui/terminalstripeditorwindow.h | 56 +-- .../ui/terminalstriplayouteditor.cpp | 290 +++++++------- .../ui/terminalstriplayouteditor.h | 92 ++--- .../TerminalStrip/ui/terminalstripmodel.cpp | 44 +-- sources/TerminalStrip/ui/terminalstripmodel.h | 40 +- tests/qttest/tst_mytest.cpp | 12 +- 41 files changed, 1007 insertions(+), 1007 deletions(-) diff --git a/sources/TerminalStrip/GraphicsItem/properties/terminalstriplayoutpattern.h b/sources/TerminalStrip/GraphicsItem/properties/terminalstriplayoutpattern.h index ac8aac7e1..7acfc0298 100644 --- a/sources/TerminalStrip/GraphicsItem/properties/terminalstriplayoutpattern.h +++ b/sources/TerminalStrip/GraphicsItem/properties/terminalstriplayoutpattern.h @@ -83,8 +83,8 @@ class TerminalStripLayoutPattern int m_bridge_point_d{5}; QVector 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(); diff --git a/sources/TerminalStrip/GraphicsItem/terminalstripdrawer.cpp b/sources/TerminalStrip/GraphicsItem/terminalstripdrawer.cpp index dd9483432..4512a4f7f 100644 --- a/sources/TerminalStrip/GraphicsItem/terminalstripdrawer.cpp +++ b/sources/TerminalStrip/GraphicsItem/terminalstripdrawer.cpp @@ -26,9 +26,9 @@ namespace TerminalStripDrawer { * @param pattern */ TerminalStripDrawer::TerminalStripDrawer(QSharedPointer strip, - QSharedPointer layout) : - m_strip { strip }, - m_pattern { layout } + QSharedPointer layout) : + m_strip { strip }, + m_pattern { layout } {} void TerminalStripDrawer::setStrip(QSharedPointer strip) @@ -42,248 +42,248 @@ void TerminalStripDrawer::setStrip(QSharedPointersave(); + 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> bridges_anchor_points; + QHash> 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> 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> 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= 4) { - break; - } + //Loop over real terminals + for (auto i=0 ; i= 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 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 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 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> 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> 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= 4) { - break; - } + //Loop over real terminals + for (auto i=0 ; i= 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 diff --git a/sources/TerminalStrip/GraphicsItem/terminalstripitem.cpp b/sources/TerminalStrip/GraphicsItem/terminalstripitem.cpp index 9811cd2f2..48650a629 100644 --- a/sources/TerminalStrip/GraphicsItem/terminalstripitem.cpp +++ b/sources/TerminalStrip/GraphicsItem/terminalstripitem.cpp @@ -26,35 +26,35 @@ #include "trueterminalstrip.h" TerminalStripItem::TerminalStripItem(QPointer strip, - QGraphicsItem *parent) : - QetGraphicsItem { parent }, - m_strip { strip }, - m_drawer { QSharedPointer { + QGraphicsItem *parent) : + QetGraphicsItem { parent }, + m_strip { strip }, + m_drawer { QSharedPointer { 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 { - new TerminalStripDrawer::TrueTerminalStrip { strip }}); - m_pending_strip_uuid = QUuid(); + m_strip = strip; + m_drawer.setStrip(QSharedPointer { + 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 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 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()); + } } diff --git a/sources/TerminalStrip/GraphicsItem/terminalstripitem.h b/sources/TerminalStrip/GraphicsItem/terminalstripitem.h index b26a6dd8b..60eff199e 100644 --- a/sources/TerminalStrip/GraphicsItem/terminalstripitem.h +++ b/sources/TerminalStrip/GraphicsItem/terminalstripitem.h @@ -28,16 +28,16 @@ class TerminalStrip; class TerminalStripItem : public QetGraphicsItem { - friend class TerminalStripItemXml; + friend class TerminalStripItemXml; Q_OBJECT public: TerminalStripItem(QPointer strip, QGraphicsItem *parent = nullptr); - TerminalStripItem(QGraphicsItem *parent = nullptr); + TerminalStripItem(QGraphicsItem *parent = nullptr); - void setTerminalStrip(TerminalStrip *strip); - QPointer terminalStrip() const; + void setTerminalStrip(TerminalStrip *strip); + QPointer 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 layout); + void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override; + void refreshPending(); + void setLayout(QSharedPointer layout); - private: - void setDefaultLayout(); + private: + void setDefaultLayout(); private: QPointer m_strip; - TerminalStripDrawer::TerminalStripDrawer m_drawer; - QUuid m_pending_strip_uuid; + TerminalStripDrawer::TerminalStripDrawer m_drawer; + QUuid m_pending_strip_uuid; }; diff --git a/sources/TerminalStrip/GraphicsItem/trueterminalstrip.cpp b/sources/TerminalStrip/GraphicsItem/trueterminalstrip.cpp index be243a2af..25472099b 100644 --- a/sources/TerminalStrip/GraphicsItem/trueterminalstrip.cpp +++ b/sources/TerminalStrip/GraphicsItem/trueterminalstrip.cpp @@ -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> TrueTerminalStrip::physicalTerminal() const - { - QVector> vector_; - if (m_strip) { - for (const auto &phy : m_strip->physicalTerminal()) { - vector_.append(QSharedPointer{ new TruePhysicalTerminal(phy) }); - } - } + QVector> TrueTerminalStrip::physicalTerminal() const + { + QVector> vector_; + if (m_strip) { + for (const auto &phy : m_strip->physicalTerminal()) { + vector_.append(QSharedPointer{ new TruePhysicalTerminal(phy) }); + } + } - return vector_; - } + return vector_; + } - TruePhysicalTerminal::TruePhysicalTerminal(QSharedPointer physical) : - m_physical { physical } - {} + TruePhysicalTerminal::TruePhysicalTerminal(QSharedPointer physical) : + m_physical { physical } + {} - QVector> TruePhysicalTerminal::realTerminals() const - { - QVector> vector_; - if (m_physical) { - for (const auto &real_ : m_physical->realTerminals()) { - vector_.append(QSharedPointer { new TrueRealTerminal{ real_ }}); - } - } + QVector> TruePhysicalTerminal::realTerminals() const + { + QVector> vector_; + if (m_physical) { + for (const auto &real_ : m_physical->realTerminals()) { + vector_.append(QSharedPointer { new TrueRealTerminal{ real_ }}); + } + } - return vector_; - } + return vector_; + } - TrueRealTerminal::TrueRealTerminal(QSharedPointer real) : - m_real { real } - {} + TrueRealTerminal::TrueRealTerminal(QSharedPointer 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 bridge) : - m_bridge { bridge } - {} + TrueBridge::TrueBridge(QSharedPointer 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(); + } + } } diff --git a/sources/TerminalStrip/UndoCommand/addterminalstripcommand.cpp b/sources/TerminalStrip/UndoCommand/addterminalstripcommand.cpp index 32e5459da..62c8c1c0a 100644 --- a/sources/TerminalStrip/UndoCommand/addterminalstripcommand.cpp +++ b/sources/TerminalStrip/UndoCommand/addterminalstripcommand.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #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, diff --git a/sources/TerminalStrip/UndoCommand/addterminalstripcommand.h b/sources/TerminalStrip/UndoCommand/addterminalstripcommand.h index 58450e51d..221f2c212 100644 --- a/sources/TerminalStrip/UndoCommand/addterminalstripcommand.h +++ b/sources/TerminalStrip/UndoCommand/addterminalstripcommand.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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #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 m_strip; - QPointer m_project; + private: + QPointer m_strip; + QPointer m_project; }; class RemoveTerminalStripCommand : public QUndoCommand diff --git a/sources/TerminalStrip/UndoCommand/addterminaltostripcommand.cpp b/sources/TerminalStrip/UndoCommand/addterminaltostripcommand.cpp index a98a5d7ed..79a981502 100644 --- a/sources/TerminalStrip/UndoCommand/addterminaltostripcommand.cpp +++ b/sources/TerminalStrip/UndoCommand/addterminaltostripcommand.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #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); - } + } } /** diff --git a/sources/TerminalStrip/UndoCommand/addterminaltostripcommand.h b/sources/TerminalStrip/UndoCommand/addterminaltostripcommand.h index 8d06c42bd..b522adf88 100644 --- a/sources/TerminalStrip/UndoCommand/addterminaltostripcommand.h +++ b/sources/TerminalStrip/UndoCommand/addterminaltostripcommand.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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #ifndef ADDTERMINALTOSTRIPCOMMAND_H #define ADDTERMINALTOSTRIPCOMMAND_H @@ -36,17 +36,17 @@ class PhysicalTerminal; */ class AddTerminalToStripCommand : public QUndoCommand { - public: + public: AddTerminalToStripCommand(QSharedPointer terminal, TerminalStrip *strip, QUndoCommand *parent = nullptr); AddTerminalToStripCommand(QVector> 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> m_terminal; - QPointer m_new_strip; + QPointer m_new_strip; }; /** diff --git a/sources/TerminalStrip/UndoCommand/bridgeterminalscommand.cpp b/sources/TerminalStrip/UndoCommand/bridgeterminalscommand.cpp index 0fe52f3ae..241f7d32e 100644 --- a/sources/TerminalStrip/UndoCommand/bridgeterminalscommand.cpp +++ b/sources/TerminalStrip/UndoCommand/bridgeterminalscommand.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #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; + } } } diff --git a/sources/TerminalStrip/UndoCommand/bridgeterminalscommand.h b/sources/TerminalStrip/UndoCommand/bridgeterminalscommand.h index 728e3ef67..664ffd164 100644 --- a/sources/TerminalStrip/UndoCommand/bridgeterminalscommand.h +++ b/sources/TerminalStrip/UndoCommand/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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #ifndef BRIDGETERMINALSCOMMAND_H #define BRIDGETERMINALSCOMMAND_H diff --git a/sources/TerminalStrip/UndoCommand/changeterminallevel.cpp b/sources/TerminalStrip/UndoCommand/changeterminallevel.cpp index dc46723b3..d55e10b68 100644 --- a/sources/TerminalStrip/UndoCommand/changeterminallevel.cpp +++ b/sources/TerminalStrip/UndoCommand/changeterminallevel.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #include "changeterminallevel.h" #include "../realterminal.h" diff --git a/sources/TerminalStrip/UndoCommand/changeterminallevel.h b/sources/TerminalStrip/UndoCommand/changeterminallevel.h index b9939ea52..a7c2f1f9d 100644 --- a/sources/TerminalStrip/UndoCommand/changeterminallevel.h +++ b/sources/TerminalStrip/UndoCommand/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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #ifndef CHANGETERMINALLEVEL_H #define CHANGETERMINALLEVEL_H diff --git a/sources/TerminalStrip/UndoCommand/changeterminalstripcolor.cpp b/sources/TerminalStrip/UndoCommand/changeterminalstripcolor.cpp index 6a915cba6..e09bdbe90 100644 --- a/sources/TerminalStrip/UndoCommand/changeterminalstripcolor.cpp +++ b/sources/TerminalStrip/UndoCommand/changeterminalstripcolor.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #include "changeterminalstripcolor.h" #include "../terminalstripbridge.h" diff --git a/sources/TerminalStrip/UndoCommand/changeterminalstripcolor.h b/sources/TerminalStrip/UndoCommand/changeterminalstripcolor.h index 63cd3b181..e70f7eab0 100644 --- a/sources/TerminalStrip/UndoCommand/changeterminalstripcolor.h +++ b/sources/TerminalStrip/UndoCommand/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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #ifndef CHANGETERMINALSTRIPCOLOR_H #define CHANGETERMINALSTRIPCOLOR_H diff --git a/sources/TerminalStrip/UndoCommand/changeterminalstripdata.cpp b/sources/TerminalStrip/UndoCommand/changeterminalstripdata.cpp index ee1fd5aee..265704923 100644 --- a/sources/TerminalStrip/UndoCommand/changeterminalstripdata.cpp +++ b/sources/TerminalStrip/UndoCommand/changeterminalstripdata.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #include "changeterminalstripdata.h" diff --git a/sources/TerminalStrip/UndoCommand/changeterminalstripdata.h b/sources/TerminalStrip/UndoCommand/changeterminalstripdata.h index b5a7d554a..f8b3524ff 100644 --- a/sources/TerminalStrip/UndoCommand/changeterminalstripdata.h +++ b/sources/TerminalStrip/UndoCommand/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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #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 m_strip; - TerminalStripData m_old_data, m_new_data; + private: + QPointer m_strip; + TerminalStripData m_old_data, m_new_data; }; #endif // CHANGETERMINALSTRIPDATA_H diff --git a/sources/TerminalStrip/UndoCommand/groupterminalscommand.cpp b/sources/TerminalStrip/UndoCommand/groupterminalscommand.cpp index 76add7e36..cfb4100dc 100644 --- a/sources/TerminalStrip/UndoCommand/groupterminalscommand.cpp +++ b/sources/TerminalStrip/UndoCommand/groupterminalscommand.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #include "groupterminalscommand.h" #include "../physicalterminal.h" diff --git a/sources/TerminalStrip/UndoCommand/groupterminalscommand.h b/sources/TerminalStrip/UndoCommand/groupterminalscommand.h index 6b9cf6c2d..b095bd722 100644 --- a/sources/TerminalStrip/UndoCommand/groupterminalscommand.h +++ b/sources/TerminalStrip/UndoCommand/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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #ifndef GROUPTERMINALSCOMMAND_H #define GROUPTERMINALSCOMMAND_H diff --git a/sources/TerminalStrip/UndoCommand/sortterminalstripcommand.cpp b/sources/TerminalStrip/UndoCommand/sortterminalstripcommand.cpp index b10653267..32acf6222 100644 --- a/sources/TerminalStrip/UndoCommand/sortterminalstripcommand.cpp +++ b/sources/TerminalStrip/UndoCommand/sortterminalstripcommand.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #include "sortterminalstripcommand.h" #include "../terminalstrip.h" diff --git a/sources/TerminalStrip/UndoCommand/sortterminalstripcommand.h b/sources/TerminalStrip/UndoCommand/sortterminalstripcommand.h index e1928d699..ef4c38ebe 100644 --- a/sources/TerminalStrip/UndoCommand/sortterminalstripcommand.h +++ b/sources/TerminalStrip/UndoCommand/sortterminalstripcommand.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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #ifndef SORTTERMINALSTRIPCOMMAND_H #define SORTTERMINALSTRIPCOMMAND_H diff --git a/sources/TerminalStrip/terminalstrip.cpp b/sources/TerminalStrip/terminalstrip.cpp index e92ff1130..dcbddea94 100644 --- a/sources/TerminalStrip/terminalstrip.cpp +++ b/sources/TerminalStrip/terminalstrip.cpp @@ -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)); diff --git a/sources/TerminalStrip/terminalstripdata.cpp b/sources/TerminalStrip/terminalstripdata.cpp index 9640e0faa..a32a23f6d 100644 --- a/sources/TerminalStrip/terminalstripdata.cpp +++ b/sources/TerminalStrip/terminalstripdata.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #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)); diff --git a/sources/TerminalStrip/terminalstripdata.h b/sources/TerminalStrip/terminalstripdata.h index 31e63b869..30a3e97a1 100644 --- a/sources/TerminalStrip/terminalstripdata.h +++ b/sources/TerminalStrip/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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #ifndef TERMINALSTRIPDATA_H #define TERMINALSTRIPDATA_H diff --git a/sources/TerminalStrip/ui/ConfigPage/terminalstripprojectconfigpage.cpp b/sources/TerminalStrip/ui/ConfigPage/terminalstripprojectconfigpage.cpp index 146e62ab0..77338b449 100644 --- a/sources/TerminalStrip/ui/ConfigPage/terminalstripprojectconfigpage.cpp +++ b/sources/TerminalStrip/ui/ConfigPage/terminalstripprojectconfigpage.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #include "terminalstripprojectconfigpage.h" #include "../../../qeticons.h" @@ -23,26 +23,26 @@ #include 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); } diff --git a/sources/TerminalStrip/ui/ConfigPage/terminalstripprojectconfigpage.h b/sources/TerminalStrip/ui/ConfigPage/terminalstripprojectconfigpage.h index 6573c0778..d64e0592d 100644 --- a/sources/TerminalStrip/ui/ConfigPage/terminalstripprojectconfigpage.h +++ b/sources/TerminalStrip/ui/ConfigPage/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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #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 diff --git a/sources/TerminalStrip/ui/freeterminaleditor.cpp b/sources/TerminalStrip/ui/freeterminaleditor.cpp index 5f368fd42..0aa1984b6 100644 --- a/sources/TerminalStrip/ui/freeterminaleditor.cpp +++ b/sources/TerminalStrip/ui/freeterminaleditor.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #include "freeterminaleditor.h" #include "ui_freeterminaleditor.h" diff --git a/sources/TerminalStrip/ui/freeterminaleditor.h b/sources/TerminalStrip/ui/freeterminaleditor.h index d9ff37574..ca4161afb 100644 --- a/sources/TerminalStrip/ui/freeterminaleditor.h +++ b/sources/TerminalStrip/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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #ifndef FREETERMINALEDITOR_H #define FREETERMINALEDITOR_H diff --git a/sources/TerminalStrip/ui/freeterminalmodel.cpp b/sources/TerminalStrip/ui/freeterminalmodel.cpp index 1f5fec2aa..0811104de 100644 --- a/sources/TerminalStrip/ui/freeterminalmodel.cpp +++ b/sources/TerminalStrip/ui/freeterminalmodel.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #include @@ -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); diff --git a/sources/TerminalStrip/ui/freeterminalmodel.h b/sources/TerminalStrip/ui/freeterminalmodel.h index b8ab2e497..febb48ea6 100644 --- a/sources/TerminalStrip/ui/freeterminalmodel.h +++ b/sources/TerminalStrip/ui/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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #ifndef FREETERMINALMODEL_H #define FREETERMINALMODEL_H diff --git a/sources/TerminalStrip/ui/modelTerminalData.h b/sources/TerminalStrip/ui/modelTerminalData.h index f21da7854..6ae12879c 100644 --- a/sources/TerminalStrip/ui/modelTerminalData.h +++ b/sources/TerminalStrip/ui/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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #ifndef MODELTERMINALDATA_H #define MODELTERMINALDATA_H diff --git a/sources/TerminalStrip/ui/terminalstripcreatordialog.cpp b/sources/TerminalStrip/ui/terminalstripcreatordialog.cpp index 26b61869c..a3d50fad5 100644 --- a/sources/TerminalStrip/ui/terminalstripcreatordialog.cpp +++ b/sources/TerminalStrip/ui/terminalstripcreatordialog.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #include "terminalstripcreatordialog.h" #include "ui_terminalstripcreatordialog.h" diff --git a/sources/TerminalStrip/ui/terminalstripcreatordialog.h b/sources/TerminalStrip/ui/terminalstripcreatordialog.h index 13b0d32dc..5325bb34b 100644 --- a/sources/TerminalStrip/ui/terminalstripcreatordialog.h +++ b/sources/TerminalStrip/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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #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; }; diff --git a/sources/TerminalStrip/ui/terminalstripeditor.cpp b/sources/TerminalStrip/ui/terminalstripeditor.cpp index c8e01b045..a464d4ee4 100644 --- a/sources/TerminalStrip/ui/terminalstripeditor.cpp +++ b/sources/TerminalStrip/ui/terminalstripeditor.cpp @@ -180,7 +180,7 @@ void TerminalStripEditor::reload() if (m_model) { m_model->reload(); - spanMultiLevelTerminals(); + spanMultiLevelTerminals(); } } diff --git a/sources/TerminalStrip/ui/terminalstripeditorwindow.cpp b/sources/TerminalStrip/ui/terminalstripeditorwindow.cpp index 533a98bc7..6602e0061 100644 --- a/sources/TerminalStrip/ui/terminalstripeditorwindow.cpp +++ b/sources/TerminalStrip/ui/terminalstripeditorwindow.cpp @@ -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); } /** diff --git a/sources/TerminalStrip/ui/terminalstripeditorwindow.h b/sources/TerminalStrip/ui/terminalstripeditorwindow.h index d85d8ece3..ec41b621e 100644 --- a/sources/TerminalStrip/ui/terminalstripeditorwindow.h +++ b/sources/TerminalStrip/ui/terminalstripeditorwindow.h @@ -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 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 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(); diff --git a/sources/TerminalStrip/ui/terminalstriplayouteditor.cpp b/sources/TerminalStrip/ui/terminalstriplayouteditor.cpp index 9b1b980a5..ebfbe4464 100644 --- a/sources/TerminalStrip/ui/terminalstriplayouteditor.cpp +++ b/sources/TerminalStrip/ui/terminalstriplayouteditor.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #include "terminalstriplayouteditor.h" #include "ui_terminalstriplayouteditor.h" #include "../GraphicsItem/properties/terminalstriplayoutpattern.h" TerminalStripLayoutEditor::TerminalStripLayoutEditor(QSharedPointer 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::AlignLeft | Qt::AlignVCenter, - Qt::AlignLeft | Qt::AlignVCenter, - Qt::AlignLeft | Qt::AlignVCenter, - Qt::AlignLeft | Qt::AlignVCenter }); - break; - case 1: - m_layout.data()->setTerminalsTextAlignment( - QVector { Qt::AlignHCenter | Qt::AlignVCenter, - Qt::AlignHCenter | Qt::AlignVCenter, - Qt::AlignHCenter | Qt::AlignVCenter, - Qt::AlignHCenter | Qt::AlignVCenter }); - break; - default: - m_layout.data()->setTerminalsTextAlignment( - QVector { 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::AlignLeft | Qt::AlignVCenter, + Qt::AlignLeft | Qt::AlignVCenter, + Qt::AlignLeft | Qt::AlignVCenter, + Qt::AlignLeft | Qt::AlignVCenter }); + break; + case 1: + m_layout.data()->setTerminalsTextAlignment( + QVector { Qt::AlignHCenter | Qt::AlignVCenter, + Qt::AlignHCenter | Qt::AlignVCenter, + Qt::AlignHCenter | Qt::AlignVCenter, + Qt::AlignHCenter | Qt::AlignVCenter }); + break; + default: + m_layout.data()->setTerminalsTextAlignment( + QVector { 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(); } diff --git a/sources/TerminalStrip/ui/terminalstriplayouteditor.h b/sources/TerminalStrip/ui/terminalstriplayouteditor.h index c54339c47..0c4789714 100644 --- a/sources/TerminalStrip/ui/terminalstriplayouteditor.h +++ b/sources/TerminalStrip/ui/terminalstriplayouteditor.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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #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 layout) : - m_drawer {QSharedPointer{new TerminalStripDrawer::DemoTerminalStrip}, - layout} - {} + public: + PreviewStripItem (QSharedPointer layout) : + m_drawer {QSharedPointer{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 layout, - QWidget *parent = nullptr); - ~TerminalStripLayoutEditor(); + public: + explicit TerminalStripLayoutEditor(QSharedPointer 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 m_layout; - bool m_ui_updating { false } ; + private: + Ui::TerminalStripLayoutEditor *ui; + QSharedPointer m_layout; + bool m_ui_updating { false } ; PreviewStripItem m_preview_strip_item {m_layout}; }; diff --git a/sources/TerminalStrip/ui/terminalstripmodel.cpp b/sources/TerminalStrip/ui/terminalstripmodel.cpp index 4eb37737e..122b4b186 100644 --- a/sources/TerminalStrip/ui/terminalstripmodel.cpp +++ b/sources/TerminalStrip/ui/terminalstripmodel.cpp @@ -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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #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); diff --git a/sources/TerminalStrip/ui/terminalstripmodel.h b/sources/TerminalStrip/ui/terminalstripmodel.h index 68f0c383c..1438a2f39 100644 --- a/sources/TerminalStrip/ui/terminalstripmodel.h +++ b/sources/TerminalStrip/ui/terminalstripmodel.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 . + You should have received a copy of the GNU General Public License + along with QElectroTech. If not, see . */ #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 m_terminal_strip; + private: + QPointer m_terminal_strip; QHash, QVector> m_modified_cell; QVector m_physical_data; struct BridgePixmap diff --git a/tests/qttest/tst_mytest.cpp b/tests/qttest/tst_mytest.cpp index 0a8fa62b4..85a8434f1 100644 --- a/tests/qttest/tst_mytest.cpp +++ b/tests/qttest/tst_mytest.cpp @@ -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(); };