mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
WIP: Add Kabel to qet
This commit is contained in:
@@ -283,6 +283,8 @@ void ConductorProperties::toXml(QDomElement &e) const
|
||||
e.setAttribute("num", text);
|
||||
e.setAttribute("text_color", text_color.name());
|
||||
e.setAttribute("formula", m_formula);
|
||||
e.setAttribute("cable", m_cable);
|
||||
e.setAttribute("bus", m_bus);
|
||||
e.setAttribute("function", m_function);
|
||||
e.setAttribute("tension_protocol", m_tension_protocol);
|
||||
e.setAttribute("conductor_color", m_wire_color);
|
||||
@@ -340,6 +342,8 @@ void ConductorProperties::fromXml(QDomElement &e)
|
||||
QColor xml_text_color= QColor(e.attribute("text_color"));
|
||||
text_color = (xml_text_color.isValid()? xml_text_color : QColor(Qt::black));
|
||||
m_formula = e.attribute("formula");
|
||||
m_cable = e.attribute("cable");
|
||||
m_bus = e.attribute("bus");
|
||||
m_function = e.attribute("function");
|
||||
m_tension_protocol = e.attribute("tension_protocol");
|
||||
m_wire_color = e.attribute("conductor_color");
|
||||
@@ -389,6 +393,8 @@ void ConductorProperties::toSettings(QSettings &settings, const QString &prefix)
|
||||
settings.setValue(prefix + "text", text);
|
||||
settings.setValue(prefix + "text_color", text_color.name());
|
||||
settings.setValue(prefix + "formula", m_formula);
|
||||
settings.setValue(prefix + "cable", m_cable);
|
||||
settings.setValue(prefix + "bus", m_bus);
|
||||
settings.setValue(prefix + "function", m_function);
|
||||
settings.setValue(prefix + "tension_protocol", m_tension_protocol);
|
||||
settings.setValue(prefix + "conductor_color", m_wire_color);
|
||||
@@ -431,6 +437,8 @@ void ConductorProperties::fromSettings(QSettings &settings, const QString &prefi
|
||||
QColor settings_text_color = QColor(settings.value(prefix + "text_color").toString());
|
||||
text_color = (settings_text_color.isValid()? settings_text_color : QColor(Qt::black));
|
||||
m_formula = settings.value(prefix + "formula", "").toString();
|
||||
m_cable = settings.value(prefix + "cable", "").toString();
|
||||
m_bus = settings.value(prefix + "bus", "").toString();
|
||||
m_function = settings.value(prefix + "function", "").toString();
|
||||
m_tension_protocol = settings.value(prefix + "tension_protocol", "").toString();
|
||||
m_wire_color = settings.value(prefix + "conductor_color", "").toString();
|
||||
@@ -485,6 +493,8 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
||||
text = cp.text;
|
||||
text_color = cp.text_color;
|
||||
m_formula = cp.m_formula;
|
||||
m_cable = cp.m_cable;
|
||||
m_bus = cp.m_bus;
|
||||
m_function = cp.m_function;
|
||||
m_tension_protocol = cp.m_tension_protocol;
|
||||
m_wire_color = cp.m_wire_color;
|
||||
@@ -586,6 +596,28 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
||||
m_formula = s_value;
|
||||
equal = true;
|
||||
|
||||
//cable
|
||||
s_value = clist.first().m_cable;
|
||||
for(ConductorProperties cp : clist)
|
||||
{
|
||||
if (cp.m_cable != s_value)
|
||||
equal = false;
|
||||
}
|
||||
if (equal)
|
||||
m_cable = s_value;
|
||||
equal = true;
|
||||
|
||||
//bus
|
||||
s_value = clist.first().m_bus;
|
||||
for(ConductorProperties cp : clist)
|
||||
{
|
||||
if (cp.m_bus != s_value)
|
||||
equal = false;
|
||||
}
|
||||
if (equal)
|
||||
m_bus = s_value;
|
||||
equal = true;
|
||||
|
||||
//function
|
||||
s_value = clist.first().m_function;
|
||||
for(ConductorProperties cp : clist)
|
||||
@@ -751,6 +783,8 @@ bool ConductorProperties::operator==(const ConductorProperties &other) const
|
||||
other.text == text &&\
|
||||
other.text_color == text_color &&\
|
||||
other.m_formula == m_formula &&\
|
||||
other.m_cable == m_cable &&\
|
||||
other.m_bus == m_bus &&\
|
||||
other.m_function == m_function &&\
|
||||
other.m_tension_protocol == m_tension_protocol &&\
|
||||
other.m_wire_color == m_wire_color && \
|
||||
@@ -797,7 +831,7 @@ void ConductorProperties::readStyle(const QString &style_string) {
|
||||
QRegularExpression Rx("^(?<name>[a-z-]+): (?<value>[a-z-]+)$");
|
||||
if (!Rx.isValid())
|
||||
{
|
||||
qWarning() <<"this is an error in the code"
|
||||
qWarning() <<QObject::tr("this is an error in the code")
|
||||
<< Rx.errorString()
|
||||
<< Rx.patternErrorOffset();
|
||||
return;
|
||||
|
||||
@@ -82,29 +82,37 @@ class ConductorProperties
|
||||
//Attributes
|
||||
ConductorType type;
|
||||
|
||||
QColor color,
|
||||
QColor
|
||||
color,
|
||||
m_color_2,
|
||||
text_color;
|
||||
|
||||
QString text,
|
||||
QString
|
||||
text,
|
||||
m_function,
|
||||
m_tension_protocol,
|
||||
m_wire_color,
|
||||
m_wire_section,
|
||||
m_formula;
|
||||
m_formula,
|
||||
m_bus,
|
||||
m_cable;
|
||||
|
||||
int text_size,
|
||||
int
|
||||
text_size,
|
||||
m_dash_size = 1;
|
||||
|
||||
double cond_size,
|
||||
double
|
||||
cond_size,
|
||||
verti_rotate_text,
|
||||
horiz_rotate_text;
|
||||
|
||||
bool m_show_text,
|
||||
bool
|
||||
m_show_text,
|
||||
m_one_text_per_folio,
|
||||
m_bicolor = false;
|
||||
|
||||
Qt::Alignment m_horizontal_alignment = Qt::AlignBottom,
|
||||
Qt::Alignment
|
||||
m_horizontal_alignment = Qt::AlignBottom,
|
||||
m_vertical_alignment = Qt::AlignRight;
|
||||
|
||||
Qt::PenStyle style;
|
||||
|
||||
@@ -84,6 +84,8 @@ void ConductorPropertiesWidget::setProperties(
|
||||
ui->m_formula_le -> setText (m_properties.m_formula);
|
||||
ui->m_text_le -> setText (m_properties.text);
|
||||
ui->m_function_le -> setText (m_properties.m_function);
|
||||
ui->m_cable_le -> setText (m_properties.m_cable);
|
||||
ui->m_bus_le -> setText (m_properties.m_bus);
|
||||
ui->m_tension_protocol_le -> setText (m_properties.m_tension_protocol);
|
||||
ui->m_wire_color_le -> setText (m_properties.m_wire_color);
|
||||
ui->m_wire_section_le -> setText (m_properties.m_wire_section);
|
||||
@@ -128,6 +130,8 @@ ConductorProperties ConductorPropertiesWidget::properties() const
|
||||
properties_.text = ui -> m_text_le -> text();
|
||||
properties_.text_color = ui -> m_text_color_kpb->color();
|
||||
properties_.m_function = ui -> m_function_le->text();
|
||||
properties_.m_cable = ui -> m_cable_le->text();
|
||||
properties_.m_bus = ui -> m_bus_le->text();
|
||||
properties_.m_tension_protocol = ui -> m_tension_protocol_le->text();
|
||||
properties_.m_wire_color = ui -> m_wire_color_le->text();
|
||||
properties_.m_wire_section = ui -> m_wire_section_le->text();
|
||||
@@ -237,6 +241,12 @@ void ConductorPropertiesWidget::initWidget()
|
||||
connect(ui->m_formula_le, &QLineEdit::textChanged, [this](QString text) {this->ui->m_text_le->setEnabled(text.isEmpty());});
|
||||
ui->m_multiwires_gb->setChecked(true);
|
||||
ui->m_singlewire_gb->setChecked(true);
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO Add Kabel and Bus to qet")
|
||||
#else
|
||||
ui->m_cable_le->setDisabled(true);
|
||||
ui->m_bus_le->setDisabled(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -52,16 +52,50 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="m_formula_le"/>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Couleur du texte:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QLineEdit" name="m_function_le">
|
||||
<item row="3" column="3">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Couleur du conducteur</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QComboBox" name="m_available_autonum_cb"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="m_text_le">
|
||||
<property name="toolTip">
|
||||
<string>Texte</string>
|
||||
</property>
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Tension / Protocole :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="m_autonum_label">
|
||||
<property name="text">
|
||||
<string>Autonumérotation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="KColorButton" name="m_text_color_kpb"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="m_text_size_sb">
|
||||
<property name="toolTip">
|
||||
@@ -84,45 +118,17 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Texte :</string>
|
||||
<item row="2" column="4">
|
||||
<widget class="QLineEdit" name="m_tension_protocol_le">
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<item row="4" column="3">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Formule du texte :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QPushButton" name="m_edit_autonum_pb">
|
||||
<property name="toolTip">
|
||||
<string>éditer les numérotations</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/configure.png</normaloff>:/ico/16x16/configure.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Tension / Protocole :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Couleur du conducteur</string>
|
||||
<string>Section du conducteur</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -139,32 +145,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<layout class="QVBoxLayout" name="m_autonum_layout"/>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="m_available_autonum_cb"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="m_autonum_label">
|
||||
<property name="text">
|
||||
<string>Autonumérotation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="KColorButton" name="m_text_color_kpb"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Couleur du texte:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="4">
|
||||
<widget class="QLineEdit" name="m_wire_section_le"/>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="m_one_text_per_folio_cb">
|
||||
<property name="toolTip">
|
||||
@@ -175,10 +155,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="4">
|
||||
<widget class="QLineEdit" name="m_wire_color_le"/>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Fonction :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="5">
|
||||
<item row="8" column="0" colspan="5">
|
||||
<layout class="QGridLayout" name="m_text_angle_gl">
|
||||
<item row="1" column="0">
|
||||
<widget class="QComboBox" name="m_verti_cb">
|
||||
@@ -220,6 +204,19 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<layout class="QVBoxLayout" name="m_autonum_layout"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Texte :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="4">
|
||||
<widget class="QLineEdit" name="m_wire_color_le"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
@@ -227,37 +224,60 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Section du conducteur</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Fonction :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="4">
|
||||
<widget class="QLineEdit" name="m_tension_protocol_le">
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="m_text_le">
|
||||
<item row="6" column="2">
|
||||
<widget class="QPushButton" name="m_edit_autonum_pb">
|
||||
<property name="toolTip">
|
||||
<string>Texte</string>
|
||||
<string>éditer les numérotations</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/16x16/configure.png</normaloff>:/ico/16x16/configure.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QLineEdit" name="m_function_le">
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="4">
|
||||
<widget class="QLineEdit" name="m_wire_section_le"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Formule du texte :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="m_formula_le"/>
|
||||
</item>
|
||||
<item row="6" column="3">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>cable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="4">
|
||||
<widget class="QLineEdit" name="m_cable_le"/>
|
||||
</item>
|
||||
<item row="7" column="3">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>bus</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="4">
|
||||
<widget class="QLineEdit" name="m_bus_le"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user