Revert "Merge branch 'XMLPropertiesNew'"

**Break a lot of thing.**

This reverts commit 1db1800572, reversing
changes made to 4c563821e8.
This commit is contained in:
joshua
2021-03-11 19:52:50 +01:00
parent 83b69253dc
commit 11b8ef927b
88 changed files with 1587 additions and 2778 deletions

View File

@@ -21,9 +21,6 @@
#include <QtWidgets>
#include <QtXml>
#include "../qet.h"
#include "../properties/propertiesinterface.h"
class Conductor;
class Diagram;
class Element;
@@ -35,7 +32,7 @@ class TerminalData;
plug point for conductors.
This class handles all mouse events for connecting conductors
*/
class Terminal : public QGraphicsObject, public PropertiesInterface
class Terminal : public QGraphicsObject
{
Q_OBJECT
@@ -45,11 +42,7 @@ class Terminal : public QGraphicsObject, public PropertiesInterface
// constructors, destructor
public:
Terminal(QPointF, Qet::Orientation, Element * = nullptr);
Terminal(qreal, qreal, Qet::Orientation, Element * = nullptr);
Terminal(TerminalData* data, Element *e = nullptr);
Terminal(QPointF, Qet::Orientation, QString number,
QString name, bool hiddenName, Element * = nullptr);
~Terminal() override;
private:
@@ -70,25 +63,17 @@ class Terminal : public QGraphicsObject, public PropertiesInterface
const QStyleOptionGraphicsItem *,
QWidget *) override;
void drawHelpLine (bool draw = true);
QLineF HelpLine () const;
QLineF HelpLine () const;
QRectF boundingRect () const override;
// methods to manage conductors attached to the terminal
Terminal* alignedWithTerminal () const;
bool addConductor (Conductor *conductor);
void removeConductor (Conductor *conductor);
int conductorsCount () const;
Diagram *diagram () const;
Element *parentElement () const;
QUuid uuid () const;
int ID() const;
QPointF dockPos();
QPointF originPos();
QString number() const;
void setNumber(QString number);
void setName(QString name, bool hiddenName);
QString name() const;
bool addConductor (Conductor *conductor);
void removeConductor (Conductor *conductor);
int conductorsCount () const;
Diagram *diagram () const;
Element *parentElement () const;
QUuid uuid () const;
QList<Conductor *> conductors() const;
Qet::Orientation orientation() const;
@@ -96,15 +81,11 @@ class Terminal : public QGraphicsObject, public PropertiesInterface
void updateConductor();
bool isLinkedTo(Terminal *);
bool canBeLinkedTo(Terminal *);
void setID(int id);
// methods related to XML import/export
static bool valideXml(const QDomElement &);
bool fromXmlPriv (const QDomElement &) override;
void toXmlPriv(QDomElement &) const override;
void toSettings(QSettings &,const QString & = QString()) const override {/*TODO: implement*/}
void fromSettings(QSettings &,const QString & = QString()) override{/*TODO: implement*/}
static bool valideXml(QDomElement &);
bool fromXml (QDomElement &);
QDomElement toXml (QDomDocument &) const;
protected:
// methods related to events management
@@ -122,7 +103,6 @@ class Terminal : public QGraphicsObject, public PropertiesInterface
static const qreal terminalSize;
static const qreal Z;
// Various static colors used for hover effects
// The assignement is in the cpp file
/// default color
static QColor neutralColor;
/// color for legal actions
@@ -133,12 +113,12 @@ class Terminal : public QGraphicsObject, public PropertiesInterface
static QColor forbiddenColor;
private:
bool m_draw_help_line{false};
bool m_draw_help_line{false};
QGraphicsLineItem *m_help_line{nullptr};
QGraphicsLineItem *m_help_line_a{nullptr};
TerminalData* d{nullptr};
TerminalData* d;
/// Parent electrical element
Element *parent_element_{nullptr};
@@ -147,29 +127,18 @@ class Terminal : public QGraphicsObject, public PropertiesInterface
QPointF dock_elmt_;
private:
/// List of conductors attached to the terminal
QList<Conductor *> m_conductors_list;
/**
Pointer to a rectangle representing the terminal bounding rect;
used to calculate the bounding rect once only;
used a pointer because boundingRect() is supposed to be const.
*/
QRectF m_br;
/// Last terminal seen through an attached conductor
Terminal *m_previous_terminal{nullptr};
/// Whether the mouse pointer is hovering the terminal
bool m_hovered{false};
/// Color used for the hover effect
QColor m_hovered_color{Terminal::neutralColor};
/// Number of Terminal
QString number_terminal_;
bool name_terminal_hidden{true};
/// legacy id used by the conductor to find the terminal. From 0.8x on the uuid is used instead.
int m_id{-1};
QList<Conductor *> m_conductors_list;
QRectF m_br;
/// Last terminal seen through an attached conductor
Terminal *m_previous_terminal = nullptr;
/// Whether the mouse pointer is hovering the terminal
bool m_hovered = false;
/// Color used for the hover effect
QColor m_hovered_color = Terminal::neutralColor;
private:
void init(QString number, QString name, bool hiddenName);
void init(QPointF pf, Qet::Orientation o,QString number, QString name, bool hiddenName);
void init();
void init(QPointF pf, Qet::Orientation o);
};
/**
@@ -178,19 +147,9 @@ class Terminal : public QGraphicsObject, public PropertiesInterface
*/
inline int Terminal::conductorsCount() const
{
return(m_conductors_list.size());
return(m_conductors_list.size());
}
/**
@brief Terminal::number
@return the number of terminal.
*/
inline QString Terminal::number() const
{
return(number_terminal_);
}
QList<Terminal *> relatedPotentialTerminal (const Terminal *terminal,
const bool all_diagram = true);