QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
elementdata.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2024 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 ELEMENTDATA_H
19#define ELEMENTDATA_H
20
21#include "propertiesinterface.h"
22#include "../diagramcontext.h"
23#include "../NameList/nameslist.h"
24
32{
33 Q_GADGET
34
35 public:
45 Q_ENUM(Type)
46 Q_DECLARE_FLAGS(Types, Type)
47
53 Q_ENUM(MasterType)
54
62 Q_ENUM(SlaveType)
63
70 Q_ENUM(SlaveState)
71
79 Q_ENUM(TerminalType)
80
86 Q_ENUM(TerminalFunction)
87
89 ~ElementData() override {}
90
91 void toSettings(QSettings &settings, const QString prefix = QString()) const override;
92 void fromSettings(const QSettings &settings, const QString prefix = QString()) override;
93 QDomElement toXml(QDomDocument &xml_element) const override;
94 bool fromXml(const QDomElement &xml_element) override;
95 QDomElement kindInfoToXml(QDomDocument &document);
96
99
102
103 void setTerminalLED(bool led);
104 bool terminalLed() const;
106
107 bool operator==(const ElementData &data) const;
108 bool operator!=(const ElementData &data) const;
109
110 QString typeToString() const;
111 static QString typeToString(ElementData::Type type);
112 static ElementData::Type typeFromString(const QString &string);
113
114 QString masterTypeToString() const;
115 static QString masterTypeToString(ElementData::MasterType type);
116 static ElementData::MasterType masterTypeFromString(const QString &string);
117
118 static QString slaveTypeToString (ElementData::SlaveType type);
119 static ElementData::SlaveType slaveTypeFromString(const QString &string);
120
121 static QString slaveStateToString(ElementData::SlaveState type);
122 static ElementData::SlaveState slaveStateFromString(const QString &string);
123
125 static ElementData::TerminalType terminalTypeFromString(const QString &string);
127
129 static ElementData::TerminalFunction terminalFunctionFromString(const QString &string);
131
132 // must be public, because this class is a private member
133 // of Element/ element editor and they must access this data
135
137
140
143
148
149 private:
152
155
156 bool m_terminal_led = false;
159
160 private:
161 void kindInfoFromXml(const QDomElement &xml_element);
162};
163
164Q_DECLARE_OPERATORS_FOR_FLAGS(ElementData::Types)
165
166#endif // ELEMENTDATA_H
Definition diagramcontext.h:57
The ElementData class WARNING This class inherit from PropertiesInterface but only fromXml is actuall...
Definition elementdata.h:32
bool m_terminal_led_is_override
Definition elementdata.h:157
ElementData::TerminalFunction m_override_terminal_function
Definition elementdata.h:153
bool m_terminal_led
Definition elementdata.h:156
static ElementData::TerminalType terminalTypeFromString(const QString &string)
Definition elementdata.cpp:471
void kindInfoFromXml(const QDomElement &xml_element)
Definition elementdata.cpp:547
void fromSettings(const QSettings &settings, const QString prefix=QString()) override
fromSettings load properties to setting file.
Definition elementdata.cpp:27
QString m_drawing_information
Definition elementdata.h:147
bool operator!=(const ElementData &data) const
Definition elementdata.cpp:291
QDomElement toXml(QDomDocument &xml_element) const override
toXml Save properties to xml element
Definition elementdata.cpp:32
ElementData::Type m_type
Definition elementdata.h:134
static ElementData::Type typeFromString(const QString &string)
Definition elementdata.cpp:323
ElementData::SlaveType m_slave_type
Definition elementdata.h:138
void setTerminalType(ElementData::TerminalType t_type)
ElementData::setTerminalType Override the terminal type by t_type.
Definition elementdata.cpp:130
QString masterTypeToString() const
Definition elementdata.cpp:348
ElementData::MasterType m_master_type
Definition elementdata.h:136
bool terminalPropertiesIsOverrided() const
ElementData::terminalPropertiesIsOverrided.
Definition elementdata.cpp:207
TerminalType
Definition elementdata.h:72
@ TTSectional
Definition elementdata.h:75
@ TTGeneric
Definition elementdata.h:73
@ TTGround
Definition elementdata.h:77
@ TTFuse
Definition elementdata.h:74
@ TTDiode
Definition elementdata.h:76
NamesList m_names_list
Definition elementdata.h:146
QString typeToString() const
Definition elementdata.cpp:295
static QString terminalTypeToString(ElementData::TerminalType type)
Definition elementdata.cpp:454
Type
Definition elementdata.h:36
@ Terminale
Definition elementdata.h:43
@ PreviousReport
Definition elementdata.h:39
@ NextReport
Definition elementdata.h:38
@ Thumbnail
Definition elementdata.h:44
@ Simple
Definition elementdata.h:37
@ Master
Definition elementdata.h:41
@ Slave
Definition elementdata.h:42
@ AllReport
Definition elementdata.h:40
MasterType
Definition elementdata.h:48
@ Commutator
Definition elementdata.h:51
@ Coil
Definition elementdata.h:49
@ Protection
Definition elementdata.h:50
static ElementData::MasterType masterTypeFromString(const QString &string)
Definition elementdata.cpp:368
TerminalFunction
Definition elementdata.h:81
@ TFGeneric
Definition elementdata.h:82
@ TFNeutral
Definition elementdata.h:84
@ TFPhase
Definition elementdata.h:83
DiagramContext m_informations
Definition elementdata.h:145
static QString terminalFunctionToString(ElementData::TerminalFunction function)
Definition elementdata.cpp:508
SlaveState
Definition elementdata.h:64
@ SW
Definition elementdata.h:67
@ Other
Definition elementdata.h:68
@ NO
Definition elementdata.h:65
@ NC
Definition elementdata.h:66
~ElementData() override
Definition elementdata.h:89
void toSettings(QSettings &settings, const QString prefix=QString()) const override
toSettings Save properties to setting file.
Definition elementdata.cpp:22
ElementData::TerminalFunction m_terminal_function
Definition elementdata.h:142
bool terminalLed() const
ElementData::terminalLed.
Definition elementdata.cpp:196
static QString translatedTerminalFunction(ElementData::TerminalFunction function)
Definition elementdata.cpp:537
void setTerminalLED(bool led)
ElementData::setTerminalLED Override the terminal led by led.
Definition elementdata.cpp:182
ElementData::TerminalType terminalType() const
ElementData::terminalType.
Definition elementdata.cpp:144
ElementData::TerminalType m_terminal_type
Definition elementdata.h:141
static ElementData::TerminalFunction terminalFunctionFromString(const QString &string)
Definition elementdata.cpp:521
void setTerminalFunction(ElementData::TerminalFunction t_function)
ElementData::setTerminalFunction Override the terminal function by t_function.
Definition elementdata.cpp:156
int m_contact_count
Definition elementdata.h:144
ElementData::TerminalType m_override_terminal_type
Definition elementdata.h:150
bool m_terminal_function_is_override
Definition elementdata.h:154
bool operator==(const ElementData &data) const
Definition elementdata.cpp:218
static ElementData::SlaveState slaveStateFromString(const QString &string)
Definition elementdata.cpp:436
static QString translatedTerminalType(ElementData::TerminalType type)
Definition elementdata.cpp:491
QDomElement kindInfoToXml(QDomDocument &document)
Definition elementdata.cpp:66
ElementData::SlaveState m_slave_state
Definition elementdata.h:139
bool fromXml(const QDomElement &xml_element) override
ElementData::fromXml load properties from xml element. The tag name of xml_element must be definition...
Definition elementdata.cpp:45
static ElementData::SlaveType slaveTypeFromString(const QString &string)
Definition elementdata.cpp:401
SlaveType
Definition elementdata.h:55
@ Power
Definition elementdata.h:57
@ DelayOff
Definition elementdata.h:59
@ SSimple
Definition elementdata.h:56
@ DelayOn
Definition elementdata.h:58
@ delayOnOff
Definition elementdata.h:60
bool m_override_terminal_led
Definition elementdata.h:158
ElementData::TerminalFunction terminalFunction() const
ElementData::terminalFunction.
Definition elementdata.cpp:170
bool m_terminal_type_is_override
Definition elementdata.h:151
static QString slaveTypeToString(ElementData::SlaveType type)
Definition elementdata.cpp:384
static QString slaveStateToString(ElementData::SlaveState type)
Definition elementdata.cpp:421
Definition nameslist.h:31
The PropertiesInterface class This class is an interface for have common way to use properties in QEl...
Definition propertiesinterface.h:31