QElectroTech  0.70
qet.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2019 The QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef _QET_H
19 #define _QET_H
20 #include <QtXml>
21 #include <QObject>
22 
23 class QActionGroup;
28 namespace QET {
30  const QString version = "0.70";
32  const QString displayedVersion = "0.70";
33  QString license();
34 
35  //Describe the current state of a graphic item
37  GIOK,
40  };
41 
43  enum DepthOption {
48  };
49 
60  };
61 
65  RotateArea = -3,
66  MoveArea = -2,
76  };
77 
83  };
84 
87  Horizontal = 1,
88  Vertical = 2,
89  Both = 3
90  };
91 
92 
97  enum ItemType {
98  Element = 1,
106  Diagram = 32,
107  Project = 64,
108  All = 127
109  };
110 
114  enum Filtering {
118  };
119 
125  enum Action {
132  };
133 
137  enum DiagramArea {
140  };
141 
147  };
148 
154  };
155 
156  QString qetCollectionToString (const QetCollection &c);
157  QetCollection qetCollectionFromString (const QString &str);
158 
159  bool lineContainsPoint(const QLineF &, const QPointF &);
160  bool orthogonalProjection(const QPointF &, const QLineF &, QPointF * = nullptr);
161  bool attributeIsAnInteger(const QDomElement &, const QString& , int * = nullptr);
162  bool attributeIsAReal(const QDomElement &, const QString& , qreal * = nullptr);
163  QString ElementsAndConductorsSentence(int, int, int = 0, int = 0, int = 0, int = 0);
164  QList<QDomElement> findInDomElement(const QDomElement &, const QString &);
165  QList<QDomElement> findInDomElement(const QDomElement &, const QString &, const QString &);
166  QList<QChar> forbiddenCharacters();
167  QString stringToFileName(const QString &);
168  QString escapeSpaces(const QString &);
169  QString unescapeSpaces(const QString &);
170  QString joinWithSpaces(const QStringList &);
171  QStringList splitWithSpaces(const QString &);
172  QString diagramAreaToString(const QET::DiagramArea &);
173  QET::DiagramArea diagramAreaFromString(const QString &);
174  qreal round(qreal, qreal);
175  qreal correctAngle(const qreal &);
176  bool compareCanonicalFilePaths(const QString &, const QString &);
177  bool writeXmlFile(QDomDocument &xml_doc, const QString &filepath, QString * error_message= nullptr);
178  bool writeToFile (QDomDocument &xml_doc, QFile *file, QString *error_message = nullptr);
179  bool eachStrIsEqual (const QStringList &qsl);
180  QActionGroup *depthActionGroup(QObject *parent = nullptr);
181 }
182 
184 
185 class Qet : public QObject
186 {
187  Q_OBJECT
188 
189  public:
191  enum EndType {
196  Diamond
197  };
198  Q_ENUM (EndType)
199 
200  static QString endTypeToString(const Qet::EndType &);
201  static Qet::EndType endTypeFromString(const QString &);
202 
208  Q_ENUM (Orientation)
209 
210  static Qet::Orientation nextOrientation(Qet::Orientation);
211  static Qet::Orientation previousOrientation(Qet::Orientation);
212 
213  static Qet::Orientation orientationFromString (const QString &);
214  static QString orientationToString (Qet::Orientation);
215 
216  static bool surLeMemeAxe (Qet::Orientation, Qet::Orientation);
217  static bool isOpposed (Qet::Orientation a, Qet::Orientation b);
218  static bool isHorizontal (Qet::Orientation);
219  static bool isVertical (Qet::Orientation);
220 };
221 
222 #endif
abort the whole operation, ignoring the curent item
Definition: qet.h:129
EndType
This enum lists the various available endings for line primitives when drawing an electrical element...
Definition: qet.h:191
bool attributeIsAnInteger(const QDomElement &, const QString &, int *=nullptr)
Definition: qet.cpp:200
Item is currently building from a xml description (element)
Definition: qet.h:38
the length is just a fraction of the length that is still available when other types of lengths have ...
Definition: qet.h:146
QET::DiagramArea diagramAreaFromString(const QString &)
Definition: qet.cpp:488
snap the point used to define the new bounding rectangle to the grid
Definition: qet.h:81
Send item one layer below their current one; zValues are decremented.
Definition: qet.h:46
Action
Definition: qet.h:125
QStringList splitWithSpaces(const QString &)
Definition: qet.cpp:434
From an embedded collection (a project for exemple)
Definition: qet.h:153
Raise item one layer above their current one; zValues are incremented.
Definition: qet.h:45
From user collection.
Definition: qet.h:152
Circle.
Definition: qet.h:195
QIcon West
Definition: qeticons.cpp:174
the length is absolute and should be applied as is
Definition: qet.h:144
Regular line.
Definition: qet.h:192
DiagramArea
Definition: qet.h:137
Definition: qet.h:28
TitleBlockColumnLength
enum used to specify the type of a length
Definition: qet.h:143
QString license()
Definition: qet.cpp:338
QString joinWithSpaces(const QStringList &)
Definition: qet.cpp:417
bool compareCanonicalFilePaths(const QString &, const QString &)
Definition: qet.cpp:519
const QString displayedVersion
QElectroTech displayed version.
Definition: qet.h:32
bool orthogonalProjection(const QPointF &, const QLineF &, QPointF *=nullptr)
Definition: qet.cpp:165
QetCollection
Enum used to specify the origin of a collection of thing (title block, element etc...)
Definition: qet.h:150
QString diagramAreaToString(const QET::DiagramArea &)
Definition: qet.cpp:478
Bring item to the foreground so they have the highest zValue.
Definition: qet.h:44
ConductorSegmentType
Known kinds of conductor segments.
Definition: qet.h:86
QString qetCollectionToString(const QetCollection &c)
QET::qetCollectionToString.
Definition: qet.cpp:597
the target has to be renamed
Definition: qet.h:131
Erase the target content.
Definition: qet.h:128
const QString version
QElectroTech version (as string, used to mark projects and elements XML documents) ...
Definition: qet.h:30
QetCollection qetCollectionFromString(const QString &str)
QET::qetCollectionFromString.
Definition: qet.cpp:618
QIcon North
Definition: qeticons.cpp:122
qreal correctAngle(const qreal &)
Definition: qet.cpp:505
Definition: qet.h:108
OperationAreas
List areas related to some common operations.
Definition: qet.h:63
qreal round(qreal, qreal)
Definition: qet.cpp:497
QString ElementsAndConductorsSentence(int, int, int=0, int=0, int=0, int=0)
Definition: qet.cpp:240
Vertical segment.
Definition: qet.h:88
adjust the scaling movement so that the induced scaling ratios are rounded
Definition: qet.h:82
Export the content of the diagram only.
Definition: qet.h:139
the length is just a fraction of the total available length
Definition: qet.h:145
bool writeToFile(QDomDocument &xml_doc, QFile *file, QString *error_message=nullptr)
Definition: qet.cpp:663
QList< QDomElement > findInDomElement(const QDomElement &, const QString &)
Definition: qet.cpp:300
bool writeXmlFile(QDomDocument &xml_doc, const QString &filepath, QString *error_message=nullptr)
Definition: qet.cpp:544
DepthOption
List the various kind of changes for the zValue.
Definition: qet.h:43
General state.
Definition: qet.h:37
Invalid segment.
Definition: qet.h:89
Triangle.
Definition: qet.h:194
Definition: qet.h:205
ScalingMethod
Supported types of interactive scaling, typically for a single element primitive. ...
Definition: qet.h:79
do not interfer with the default scaling process
Definition: qet.h:80
QString stringToFileName(const QString &)
Definition: qet.cpp:379
bool attributeIsAReal(const QDomElement &, const QString &, qreal *=nullptr)
Definition: qet.cpp:219
QString escapeSpaces(const QString &)
Definition: qet.cpp:398
Skip the current item.
Definition: qet.h:127
Base-less triangle.
Definition: qet.h:193
GraphicsItemState
Definition: qet.h:36
ItemType
Definition: qet.h:97
bool lineContainsPoint(const QLineF &, const QPointF &)
Definition: qet.cpp:149
QString unescapeSpaces(const QString &)
Definition: qet.cpp:407
Send item to the background so they have the lowest zValue.
Definition: qet.h:47
Item is loading her properties from a xml description.
Definition: qet.h:39
Q_DECLARE_METATYPE(NamesList)
the current item was handled by the Strategy object: do not treat it and continue ...
Definition: qet.h:130
From common collection.
Definition: qet.h:151
Export the diagram along with its border and title block.
Definition: qet.h:138
QActionGroup * depthActionGroup(QObject *parent=nullptr)
QET::depthActionGroup.
Definition: qet.cpp:636
OrientedMovement
Oriented movements.
Definition: qet.h:51
Horizontal segment.
Definition: qet.h:87
Filtering
Definition: qet.h:114
Definition: qet.h:185
QList< QChar > forbiddenCharacters()
Definition: qet.cpp:366
Orientation
Orientation (used for electrical elements and their terminals)
Definition: qet.h:204
The operation must be tried again.
Definition: qet.h:126
bool eachStrIsEqual(const QStringList &qsl)
QET::eachStrIsEqual.
Definition: qet.cpp:584