mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-11 06:34:14 +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:
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
Copyright 2006-2026 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef ADDCABLECOMMAND_H
|
||||
#define ADDCABLECOMMAND_H
|
||||
|
||||
#include "cable.h"
|
||||
|
||||
#include "../autoNum/numerotationcontext.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QPointer>
|
||||
#include <QUndoCommand>
|
||||
|
||||
class CablePart;
|
||||
class Diagram;
|
||||
class QETProject;
|
||||
|
||||
/**
|
||||
@brief Puts a drawn cable line on the folio, or takes it back off.
|
||||
|
||||
Both halves are one single step, because a cable line without its
|
||||
cable is of no use to anybody: undoing has to take the line away and
|
||||
leave nothing behind, and redoing has to put both back exactly as
|
||||
they were.
|
||||
*/
|
||||
class AddCableCommand : public QUndoCommand
|
||||
{
|
||||
public:
|
||||
AddCableCommand(Cable *cable,
|
||||
CablePart *part,
|
||||
Diagram *diagram,
|
||||
bool own_cable,
|
||||
const QList<CableCoreTaken> &taken = QList<CableCoreTaken>());
|
||||
~AddCableCommand() override;
|
||||
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
|
||||
private:
|
||||
QETProject *project() const;
|
||||
|
||||
private:
|
||||
///The cable the line belongs to
|
||||
Cable *m_cable = nullptr;
|
||||
///The line itself, owned by the folio once it is drawn
|
||||
QPointer<CablePart> m_part;
|
||||
QPointer<Diagram> m_diagram;
|
||||
///Which section of the cable this line is
|
||||
CablePartData m_part_data;
|
||||
///The cores the line was giving to the cable, put back by redo
|
||||
QList<CableCore> m_cores;
|
||||
///The cores this line took away from other cables: redo takes
|
||||
///them again, undo gives them back
|
||||
QList<CableCoreTaken> m_taken;
|
||||
///True when this command brought the cable into existence, so it
|
||||
///is the one which has to take it away again
|
||||
bool m_own_cable = false;
|
||||
/**
|
||||
When this cable took a number out of the project's numbering
|
||||
rule, the rule as it was before it did and as it was after:
|
||||
an empty key means the project numbers its cables by no rule
|
||||
and nothing here applies. Handing the number out is part of
|
||||
bringing the cable into being, so undo has to hand it back --
|
||||
otherwise undoing a cable and drawing it once more would
|
||||
leave a gap in the numbering for good.
|
||||
*/
|
||||
QString m_num_key;
|
||||
NumerotationContext m_num_before;
|
||||
};
|
||||
|
||||
#endif // ADDCABLECOMMAND_H
|
||||
Reference in New Issue
Block a user