mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-11 14:44:15 +02:00
bf9b34398d
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.
87 lines
2.9 KiB
C++
87 lines
2.9 KiB
C++
/*
|
|
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 CABLENUMBERINGDIALOG_H
|
|
#define CABLENUMBERINGDIALOG_H
|
|
|
|
#include <QDialog>
|
|
|
|
class QDialogButtonBox;
|
|
class QETProject;
|
|
class QPushButton;
|
|
class QRadioButton;
|
|
class SelectAutonumW;
|
|
|
|
/**
|
|
@brief The window behind the "Numérotation des câbles" entry of the
|
|
numbering menu: the one numbering rule the project numbers its
|
|
cables with, the axis those cables are laid out along when the whole
|
|
project is numbered again, and the button which does that numbering.
|
|
|
|
The rule is the very editor the project properties hold on their
|
|
cable tab, read from the project when the window opens and written
|
|
back into the project by that editor's own Apply button -- and by
|
|
the numbering button, which writes what the window holds before it
|
|
numbers, so numbering always happens with the rule on show: a rule
|
|
which is changed here is the rule the project keeps, not a rule of
|
|
its own. There is no confirm button of this window's own: what the
|
|
window holds is either applied by hand or left behind when it is
|
|
closed.
|
|
|
|
Renumbering works every cable of the project out from the beginning
|
|
of that rule, so the hole a deleted cable leaves in the numbering
|
|
closes -- and it only happens when he asks for it.
|
|
*/
|
|
class CableNumberingDialog : public QDialog
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit CableNumberingDialog(QETProject *project, QWidget *parent = nullptr);
|
|
|
|
private slots:
|
|
///Put the rule and the axis into the project
|
|
void applyRule();
|
|
///Take the cable numbering rule out of the project
|
|
void removeRule();
|
|
///Number every cable of the project with the rule on show
|
|
void renumber();
|
|
///Let the button say whether there is a rule to number with
|
|
void updateEnabling();
|
|
|
|
private:
|
|
///Write what the window holds into the project
|
|
bool save();
|
|
/**
|
|
Ask what to do with the names he typed in himself.
|
|
@param count how many such names the project holds
|
|
@return 1 to number them too, 0 to leave them alone,
|
|
-1 to do nothing at all
|
|
*/
|
|
int askAboutHandWritten(int count);
|
|
|
|
private:
|
|
QETProject *m_project = nullptr;
|
|
SelectAutonumW *m_rule = nullptr;
|
|
QRadioButton *m_axis_x = nullptr;
|
|
QRadioButton *m_axis_y = nullptr;
|
|
QPushButton *m_renumber_pb = nullptr;
|
|
QDialogButtonBox *m_box = nullptr;
|
|
};
|
|
|
|
#endif // CABLENUMBERINGDIALOG_H
|