mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-11 22:54:12 +02:00
Add cable management: drawing, cores, numbering, cross-references and cable list
Cables are drawn line objects (toolbar button next to the auto break/reconnect button, click-move-click, right click cancels), not components. The type comes from a CSV catalog following the material list pattern (designation, cores, core colours, editable through the entry dialog with "Nouvelle entrée" / "Modifier l'entrée"). Each core is bound to the wire its colour label stands on, and the cable reference is generated per core and written into the Conductor entry via Conductor::setCableReference(label, cable uuid, slot). The conductor entry is where it has to live because the terminal strip plan (Klemmenplan) consumes it in the next step. Numbering: "Cables" rule under Programmeinstellungen/Neues Projekt/Nummerierung auto (mirrored in project properties), literal "W" fallback without a rule, French gate dialog when no rule exists, Nummerierung menu with the renumber dialog (preferred axis, per-folio counter, rule and counter state written back, hand-typed names ask, whole-project scope). Also included: label block and under-line texts with per-text font and alignment plus the material-list cell margins, free-core placement and right-click removal, claim questions for wires of other cables, multi-selection drag as one undo step, type change with confirmation, cross-references for type "Cable" (%f-%l%c, own font, clickable links in exported PDFs), report propagation of the cable definition, Listes menu (table of contents, material list, terminal strip manager, terminal generator plugin, cable list), cable list with freely selectable columns (installation/localisation of cable, start and end, Blatt start/end, length, used cores...), CSV export dialog with column pick and preview in the Projekt menu, script API (addTable kind "cable_list", exportCableList) and a unit test for the type catalog.
This commit is contained in:
@@ -36,6 +36,7 @@ XRefProperties::XRefProperties()
|
||||
m_prefix_keys << "power" << "delay" << "switch";
|
||||
m_master_label = "%f-%l%c";
|
||||
m_slave_label = "(%f-%l%c)";
|
||||
m_font = QString();
|
||||
m_offset = 0;
|
||||
m_slave_offset = 0;
|
||||
m_xref_pos = Qt::AlignBottom;
|
||||
@@ -65,6 +66,7 @@ void XRefProperties::toSettings(QSettings &settings,
|
||||
settings.setValue(prefix % "master_label", master_label);
|
||||
QString slave_label = m_slave_label;
|
||||
settings.setValue(prefix % "slave_label", slave_label);
|
||||
settings.setValue(prefix % "font", m_font);
|
||||
|
||||
|
||||
QMetaEnum var = QMetaEnum::fromType<Qt::Alignment>();
|
||||
@@ -95,6 +97,7 @@ void XRefProperties::fromSettings(const QSettings &settings,
|
||||
m_slave_offset = settings.value(prefix % "slave_offset", "0").toInt();
|
||||
m_master_label = settings.value(prefix % "master_label", "%f-%l%c").toString();
|
||||
m_slave_label = settings.value(prefix % "slave_label", "(%f-%l%c)").toString();
|
||||
m_font = settings.value(prefix % "font").toString();
|
||||
|
||||
QMetaEnum var = QMetaEnum::fromType<Qt::Alignment>();
|
||||
m_xref_pos = Qt::AlignmentFlag(var.keyToValue((settings.value(prefix % "xrefpos", "AlignBottom").toString()).toStdString().data()));
|
||||
@@ -136,6 +139,7 @@ QDomElement XRefProperties::toXml(QDomDocument &xml_document) const
|
||||
xml_element.setAttribute("master_label", master_label);
|
||||
QString slave_label = m_slave_label;
|
||||
xml_element.setAttribute("slave_label", slave_label);
|
||||
xml_element.setAttribute("font", m_font);
|
||||
foreach (QString key, m_prefix.keys()) {
|
||||
xml_element.setAttribute(key % "prefix", m_prefix.value(key));
|
||||
}
|
||||
@@ -170,6 +174,7 @@ bool XRefProperties::fromXml(const QDomElement &xml_element) {
|
||||
m_slave_offset = xml_element.attribute("slave_offset", "0").toInt();
|
||||
m_master_label = xml_element.attribute("master_label", "%f-%l%c");
|
||||
m_slave_label = xml_element.attribute("slave_label","(%f-%l%c)");
|
||||
m_font = xml_element.attribute("font");
|
||||
foreach (QString key, m_prefix_keys) {
|
||||
m_prefix.insert(key, xml_element.attribute(key % "prefix"));
|
||||
}
|
||||
@@ -179,15 +184,17 @@ bool XRefProperties::fromXml(const QDomElement &xml_element) {
|
||||
/**
|
||||
@brief XRefProperties::defaultProperties
|
||||
@return the default properties stored in the setting file
|
||||
For the xref, there are 2 properties.
|
||||
For coil, stored with the string "coil" in the returned QHash.
|
||||
For protection, stored with the string "protection" in the returned QHash.
|
||||
One entry per kind of element which shows a cross reference, stored
|
||||
under its own key: "coil", "protection", "commutator", "plc" -- and
|
||||
"cable", which is not an element at all: it is the reference a cable
|
||||
writes in the label of each of its sections when the cable runs on
|
||||
several folios.
|
||||
*/
|
||||
QHash<QString, XRefProperties> XRefProperties::defaultProperties()
|
||||
{
|
||||
QHash <QString, XRefProperties> hash;
|
||||
QStringList keys;
|
||||
keys << "coil" << "protection" << "commutator" << "plc";
|
||||
keys << "coil" << "protection" << "commutator" << "plc" << "cable";
|
||||
|
||||
QSettings settings;
|
||||
|
||||
@@ -196,6 +203,13 @@ QHash<QString, XRefProperties> XRefProperties::defaultProperties()
|
||||
XRefProperties properties;
|
||||
QString str("diagrameditor/defaultxref");
|
||||
properties.fromSettings(settings, str += key);
|
||||
|
||||
//A cable takes the very same default text as a relay master
|
||||
//and the other types, "%f-%l%c": what it names is then the
|
||||
//other section of the cable -- the folio it stands on and
|
||||
//the place it stands at there, which is what an element
|
||||
//points at as well. No default of its own, so that setting
|
||||
//the five of them apart needs no thought at all.
|
||||
hash.insert(key, properties);
|
||||
}
|
||||
|
||||
@@ -213,7 +227,8 @@ bool XRefProperties::operator ==(const XRefProperties &xrp) const{
|
||||
&& m_offset == xrp.m_offset
|
||||
&& m_slave_offset== xrp.m_slave_offset
|
||||
&& m_xref_pos == xrp.m_xref_pos
|
||||
&& m_slave_label == xrp.m_slave_label);
|
||||
&& m_slave_label == xrp.m_slave_label
|
||||
&& m_font == xrp.m_font);
|
||||
}
|
||||
|
||||
bool XRefProperties::operator !=(const XRefProperties &xrp) const
|
||||
|
||||
Reference in New Issue
Block a user