mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-13 16:34:14 +02:00
Reapply "Add cable management: drawing, cores, numbering, cross-references and cable list"
This reverts commit 2bb3343d2d.
This commit is contained in:
@@ -0,0 +1,383 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
#include "cablenumberingdialog.h"
|
||||
|
||||
#include "../autoNum/ui/selectautonumw.h"
|
||||
#include "../cable/cablerenumber.h"
|
||||
#include "../cable/editcablecommand.h"
|
||||
#include "../qetproject.h"
|
||||
|
||||
#include <QAbstractButton>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QGroupBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#include <QRadioButton>
|
||||
#include <QUndoStack>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
/**
|
||||
@brief CableNumberingDialog::CableNumberingDialog
|
||||
Build the window around the numbering rule of the project: the rule
|
||||
itself, the axis the cables are laid out along when the whole
|
||||
project is numbered again, and the button which does that numbering.
|
||||
@param project the project whose cables are numbered
|
||||
@param parent
|
||||
*/
|
||||
CableNumberingDialog::CableNumberingDialog(QETProject *project, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
m_project(project)
|
||||
{
|
||||
setWindowTitle(tr("Cable numbering"));
|
||||
//The rule editor needs room to be read: this window opens with
|
||||
//the size it needs rather than with whatever its contents
|
||||
//happen to add up to, so nothing of the rule is cramped from
|
||||
//the first moment
|
||||
setMinimumSize(QSize(900, 620));
|
||||
|
||||
auto *layout = new QVBoxLayout(this);
|
||||
|
||||
auto *note = new QLabel(tr(
|
||||
"This window shows the automatic numbering rule for the cables "
|
||||
"of this project and edits it. A rule changed here is the one "
|
||||
"the project keeps: it is written into the project when you "
|
||||
"apply it."), this);
|
||||
note->setWordWrap(true);
|
||||
layout->addWidget(note);
|
||||
|
||||
m_rule = new SelectAutonumW(3, this);
|
||||
//One rule only, so the row which picks between several named
|
||||
//numberings is hidden: what is on show is the project's rule
|
||||
m_rule->setSingleRuleMode(true);
|
||||
layout->addWidget(m_rule);
|
||||
|
||||
auto *axis_group = new QGroupBox(tr("Axis priority"), this);
|
||||
auto *axis_layout = new QHBoxLayout(axis_group);
|
||||
m_axis_x = new QRadioButton(tr("Priority to the X axis (horizontal)"), axis_group);
|
||||
m_axis_y = new QRadioButton(tr("Priority to the Y axis (vertical)"), axis_group);
|
||||
axis_layout->addWidget(m_axis_x);
|
||||
axis_layout->addWidget(m_axis_y);
|
||||
layout->addWidget(axis_group);
|
||||
|
||||
auto *axis_note = new QLabel(tr(
|
||||
"The chosen axis decides the order in which the cables are "
|
||||
"renumbered: X numbers them from left to right, Y numbers them "
|
||||
"from top to bottom."), this);
|
||||
axis_note->setWordWrap(true);
|
||||
layout->addWidget(axis_note);
|
||||
|
||||
auto *actions = new QHBoxLayout();
|
||||
m_renumber_pb = new QPushButton(tr("Renumber all cables"), this);
|
||||
m_renumber_pb->setToolTip(tr(
|
||||
"Sets the number of each cable of the project again from the "
|
||||
"rule, starting at the beginning: a number left missing after "
|
||||
"a cable is deleted is filled in this way."));
|
||||
actions->addWidget(m_renumber_pb);
|
||||
actions->addStretch();
|
||||
|
||||
//No confirm button: this window is there to number the cables
|
||||
//again and to show the rule which does it. What the window
|
||||
//holds is written by the editor's own Apply button, and by the
|
||||
//numbering button which writes it before numbering -- so a
|
||||
//second button only saving and closing would say the same
|
||||
//thing twice.
|
||||
m_box = new QDialogButtonBox(this);
|
||||
m_box->addButton(QDialogButtonBox::Cancel);
|
||||
m_box->button(QDialogButtonBox::Cancel)->setText(tr("Cancel"));
|
||||
actions->addWidget(m_box);
|
||||
layout->addLayout(actions);
|
||||
|
||||
connect(m_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
connect(m_renumber_pb, &QPushButton::clicked, this, &CableNumberingDialog::renumber);
|
||||
//The editor's own buttons are wired the same way the project
|
||||
//properties wire them, so this window saves exactly what that
|
||||
//page would have saved
|
||||
connect(m_rule, &SelectAutonumW::applyPressed, this, &CableNumberingDialog::applyRule);
|
||||
connect(m_rule, &SelectAutonumW::removeClicked, this, &CableNumberingDialog::removeRule);
|
||||
//Filling a rule in lights the numbering button up as soon as
|
||||
//there is something to number with
|
||||
connect(m_rule, &SelectAutonumW::contextEdited, this,
|
||||
&CableNumberingDialog::updateEnabling);
|
||||
|
||||
if (m_project)
|
||||
{
|
||||
const QString key = m_project->cableCurrentAutoNum();
|
||||
const bool has_rule = !key.isEmpty()
|
||||
&& !m_project->cableAutoNum(key).isEmpty();
|
||||
m_rule->setContext(has_rule ? m_project->cableAutoNum(key)
|
||||
: NumerotationContext());
|
||||
//The button which takes the rule away is only worth showing
|
||||
//when there is one, and only while the project may be
|
||||
//written to
|
||||
m_rule->setRuleRemovable(has_rule && !m_project->isReadOnly());
|
||||
|
||||
m_axis_x->setChecked(m_project->cableXAxisFirst());
|
||||
m_axis_y->setChecked(!m_project->cableXAxisFirst());
|
||||
|
||||
if (m_project->isReadOnly())
|
||||
{
|
||||
m_rule->setEnabled(false);
|
||||
m_axis_x->setEnabled(false);
|
||||
m_axis_y->setEnabled(false);
|
||||
}
|
||||
}
|
||||
updateEnabling();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief CableNumberingDialog::applyRule
|
||||
What the editor's own Apply button does: write the rule into the
|
||||
project and leave the window open, the way that button behaves on
|
||||
the numbering pages of the settings.
|
||||
*/
|
||||
void CableNumberingDialog::applyRule()
|
||||
{
|
||||
save();
|
||||
updateEnabling();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief CableNumberingDialog::save
|
||||
Write the rule and the axis into the project. Nothing is written
|
||||
when nothing was changed, so confirming a window which was only
|
||||
ever looked at leaves the project exactly as it was.
|
||||
@return true when the window holds nothing which could not be written
|
||||
*/
|
||||
bool CableNumberingDialog::save()
|
||||
{
|
||||
if (!m_project || m_project->isReadOnly()) return false;
|
||||
|
||||
bool changed = false;
|
||||
|
||||
if (m_rule->isModified())
|
||||
{
|
||||
if (!m_rule->isValid())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Cable numbering"),
|
||||
tr("The rule is not complete yet: "
|
||||
"there is still an empty field in it."));
|
||||
return false;
|
||||
}
|
||||
|
||||
const QString title = QETProject::cableAutoNumRuleName();
|
||||
m_project->addCableAutoNum(title, m_rule->toNumContext());
|
||||
m_project->setCurrentCableAutoNum(title);
|
||||
//What was edited is written now, so there is nothing of it
|
||||
//left for a second save to write again
|
||||
m_rule->setContext(m_rule->toNumContext());
|
||||
m_rule->setRuleRemovable(true);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
const bool axis_first = m_axis_x->isChecked();
|
||||
if (m_project->cableXAxisFirst() != axis_first) changed = true;
|
||||
m_project->setCableXAxisFirst(axis_first);
|
||||
|
||||
if (changed) m_project->setModified(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief CableNumberingDialog::removeRule
|
||||
Take the cable numbering rule out of the project. The project then
|
||||
numbers its cables by no rule at all -- they are called W until one
|
||||
is defined again -- and the cable tool asks once more whether one
|
||||
should be defined.
|
||||
*/
|
||||
void CableNumberingDialog::removeRule()
|
||||
{
|
||||
if (!m_project || m_project->isReadOnly()) return;
|
||||
|
||||
const QString title = m_project->cableCurrentAutoNum();
|
||||
if (title.isEmpty()) return;
|
||||
|
||||
m_project->removeCableAutoNum(title);
|
||||
m_rule->setContext(NumerotationContext());
|
||||
//No rule left, so the button which takes one away goes too. And
|
||||
//having just taken the rule away means numbering cables by hand
|
||||
//again: the question of defining one comes back the next time a
|
||||
//cable is drawn, so it is not held back in this project any more.
|
||||
m_rule->setRuleRemovable(false);
|
||||
m_project->setCableAskNumbering(true);
|
||||
m_project->setModified(true);
|
||||
updateEnabling();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief CableNumberingDialog::updateEnabling
|
||||
Renumbering needs something to number with: a rule filled in well
|
||||
enough to be one, and a project which may be written to.
|
||||
*/
|
||||
void CableNumberingDialog::updateEnabling()
|
||||
{
|
||||
if (!m_project || m_project->isReadOnly() || !m_rule) {
|
||||
m_renumber_pb->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const QString key = m_project->cableCurrentAutoNum();
|
||||
const bool saved_rule = !key.isEmpty()
|
||||
&& !m_project->cableAutoNum(key).isEmpty();
|
||||
//A rule which is still being filled in counts as soon as it is
|
||||
//written, and the numbering writes it together with the numbers
|
||||
//it hands out
|
||||
const bool drawn_rule = m_rule->isModified() && m_rule->isValid()
|
||||
&& !m_rule->toNumContext().isEmpty();
|
||||
|
||||
m_renumber_pb->setEnabled((saved_rule || drawn_rule)
|
||||
&& m_rule->isValid()
|
||||
&& !m_rule->toNumContext().isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
@brief CableNumberingDialog::askAboutHandWritten
|
||||
Some cables carry a name he typed in himself rather than one the
|
||||
rule handed out. Taking such a name away is his to allow: yes and
|
||||
they are numbered like all the others, no and they keep their name
|
||||
while the rest is numbered around them, and cancelling leaves every
|
||||
cable exactly where it stands.
|
||||
@param count how many such names the project holds
|
||||
@return 1 to number them too, 0 to leave them alone, -1 for nothing
|
||||
*/
|
||||
int CableNumberingDialog::askAboutHandWritten(int count)
|
||||
{
|
||||
if (count <= 0) return 1;
|
||||
|
||||
QMessageBox box(QMessageBox::Question, tr("Cable numbering"),
|
||||
tr("%n cable(s) of this project were entered by "
|
||||
"hand.\n\n"
|
||||
"Do you want to renumber them too?", "", count),
|
||||
QMessageBox::NoButton, this);
|
||||
QPushButton *take = box.addButton(
|
||||
tr("Yes", "Les noms saisis à la main sont remplacés eux aussi."),
|
||||
QMessageBox::YesRole);
|
||||
QPushButton *leave = box.addButton(
|
||||
tr("No", "Les noms saisis à la main sont laissés tels quels."),
|
||||
QMessageBox::NoRole);
|
||||
QPushButton *cancel = box.addButton(
|
||||
tr("Cancel", "Ne renumérote rien du tout."),
|
||||
QMessageBox::RejectRole);
|
||||
//Keeping his own names is the safe answer under his finger
|
||||
box.setDefaultButton(leave);
|
||||
box.setEscapeButton(cancel);
|
||||
box.exec();
|
||||
|
||||
const QAbstractButton *clicked = box.clickedButton();
|
||||
if (clicked == take) return 1;
|
||||
if (clicked == leave) return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief CableNumberingDialog::renumber
|
||||
Number every cable of the project again with the rule on show,
|
||||
from the beginning of that rule and in the order the cables stand
|
||||
along the chosen axis. One single undo step takes it all back, and
|
||||
the window closes once the numbering has been written so that he
|
||||
can see what became of his cables.
|
||||
*/
|
||||
void CableNumberingDialog::renumber()
|
||||
{
|
||||
if (!m_project || m_project->isReadOnly()) return;
|
||||
|
||||
//A rule which is not complete yet is refused before anything is
|
||||
//worked out at all. What the window holds is written only together
|
||||
//with the numbering itself, so every way out coming before that
|
||||
//point -- a rule which does not fit, him saying no, nothing to
|
||||
//number -- leaves the project exactly as it stands.
|
||||
const NumerotationContext rule = m_rule->toNumContext();
|
||||
if (!m_rule->isValid() || rule.isEmpty())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Cable numbering"),
|
||||
tr("The rule is not complete yet."));
|
||||
return;
|
||||
}
|
||||
const bool axis_first = m_axis_x->isChecked();
|
||||
|
||||
//Whether he lets his own names be taken away or not, a project
|
||||
//with nothing to number with says so before he is asked
|
||||
//anything: the rule has to be one first
|
||||
CableRenumberPlan plan = CableRenumber::plan(m_project, rule, axis_first,
|
||||
true);
|
||||
if (!plan.ok())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Cable numbering"), plan.error);
|
||||
return;
|
||||
}
|
||||
|
||||
const int answer = askAboutHandWritten(CableRenumber::byHandCount(m_project));
|
||||
if (answer < 0) return;
|
||||
|
||||
//Leaving his own names alone means the numbering runs around
|
||||
//them, which can hand out a number somebody else keeps: that
|
||||
//is worked out again here and refused if it does not fit
|
||||
if (answer == 0)
|
||||
{
|
||||
plan = CableRenumber::plan(m_project, rule, axis_first, false);
|
||||
if (!plan.ok())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Cable numbering"), plan.error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (plan.cables.isEmpty())
|
||||
{
|
||||
QMessageBox::information(this, tr("Cable numbering"),
|
||||
tr("No cable to renumber in this project."));
|
||||
return;
|
||||
}
|
||||
|
||||
//Every cable already carries the number the rule says: there is
|
||||
//nothing to write, and an undo step which undoes nothing would
|
||||
//only be in the way
|
||||
bool changed = false;
|
||||
for (int i = 0; i < plan.cables.size(); ++i)
|
||||
{
|
||||
if (plan.cables.at(i)->designation() != plan.designations.at(i)
|
||||
|| plan.cables.at(i)->designationByHand()) {
|
||||
changed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!changed)
|
||||
{
|
||||
QMessageBox::information(this, tr("Cable numbering"),
|
||||
tr("All the cables already carry the number "
|
||||
"that the rule gives them."));
|
||||
return;
|
||||
}
|
||||
|
||||
//The rule on show is written now, right with the numbering it
|
||||
//belongs to, and the numbering then leaves the counters of that
|
||||
//rule where the last number was taken from: both go into the
|
||||
//project with the names, as one single act which undo takes
|
||||
//back together. Nothing was written before this point, which is
|
||||
//why he may still back out of here without the project having
|
||||
//been touched.
|
||||
if (!save()) return;
|
||||
|
||||
const QString num_key = QETProject::cableAutoNumRuleName();
|
||||
if (QUndoStack *stack = m_project->undoStack()) {
|
||||
stack->push(new RenumberCablesCommand(
|
||||
plan.cables, plan.designations, m_project, num_key,
|
||||
m_project->cableAutoNum(num_key), plan.after));
|
||||
}
|
||||
accept();
|
||||
}
|
||||
@@ -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 CABLENUMBERINGDIALOG_H
|
||||
#define CABLENUMBERINGDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class QDialogButtonBox;
|
||||
class QETProject;
|
||||
class QPushButton;
|
||||
class QRadioButton;
|
||||
class SelectAutonumW;
|
||||
|
||||
/**
|
||||
@brief The window behind the "Cable numbering" 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
|
||||
@@ -108,19 +108,26 @@ NewDiagramPage::NewDiagramPage(QETProject *project,
|
||||
auto saw_conductor = new SelectAutonumW(1);
|
||||
auto saw_element = new SelectAutonumW(0);
|
||||
auto saw_folio = new SelectAutonumW(2);
|
||||
auto saw_cable = new SelectAutonumW(3);
|
||||
//A cable is numbered by one rule and that is all there is:
|
||||
//the row which lists the available numberings is hidden.
|
||||
saw_cable->setSingleRuleMode(true);
|
||||
|
||||
initAutoNumTab(m_autonum_conductor, saw_conductor, QStringLiteral("autonum/conductor"));
|
||||
initAutoNumTab(m_autonum_element, saw_element, QStringLiteral("autonum/element"));
|
||||
initAutoNumTab(m_autonum_folio, saw_folio, QStringLiteral("autonum/folio"));
|
||||
initAutoNumTab(m_autonum_cable, saw_cable, QStringLiteral("autonum/cable"));
|
||||
m_autonum_cable.fixed_name = QETProject::cableAutoNumRuleName();
|
||||
|
||||
QSettings autonum_settings;
|
||||
loadAutoNumTab(m_autonum_conductor, autonum_settings);
|
||||
loadAutoNumTab(m_autonum_element, autonum_settings);
|
||||
loadAutoNumTab(m_autonum_folio, autonum_settings);
|
||||
loadAutoNumTab(m_autonum_cable, autonum_settings);
|
||||
|
||||
// Intercept Return key in the combo line edits so it doesn't
|
||||
// activate the dialog's default button (OK).
|
||||
for (auto *tab : {&m_autonum_conductor, &m_autonum_element, &m_autonum_folio}) {
|
||||
for (auto *tab : {&m_autonum_conductor, &m_autonum_element, &m_autonum_folio, &m_autonum_cable}) {
|
||||
if (QComboBox *combo = tab->widget->contextComboBox()) {
|
||||
if (combo->lineEdit()) {
|
||||
combo->lineEdit()->installEventFilter(this);
|
||||
@@ -169,6 +176,7 @@ NewDiagramPage::NewDiagramPage(QETProject *project,
|
||||
autonum_inner_tab->addTab(m_autonum_conductor.widget, tr("Conductors"));
|
||||
autonum_inner_tab->addTab(m_autonum_element.widget, tr("Elements"));
|
||||
autonum_inner_tab->addTab(m_autonum_folio.widget, tr("Sheets"));
|
||||
autonum_inner_tab->addTab(m_autonum_cable.widget, tr("Cables"));
|
||||
autonum_layout->addWidget(autonum_inner_tab);
|
||||
tab_widget -> addTab (autonum_widget, tr("Auto Numbering"));
|
||||
}
|
||||
@@ -280,6 +288,20 @@ void NewDiagramPage::applyConf()
|
||||
settings.endArray();
|
||||
|
||||
// save global auto-numbering defaults
|
||||
//
|
||||
// The cable rule is written here as well as by its own Apply
|
||||
// button. The cable tool asks a project for that rule the
|
||||
// moment he tries to draw a cable, and a project built out of
|
||||
// settings he has just filled in and confirmed must not turn
|
||||
// up without one -- which is what would happen if only the
|
||||
// Apply button of that one tab could save it. A rule nobody
|
||||
// has finished filling in is left alone, and a tab he has not
|
||||
// touched writes nothing at all.
|
||||
if (m_autonum_cable.widget
|
||||
&& m_autonum_cable.widget->isModified()
|
||||
&& m_autonum_cable.widget->isValid()) {
|
||||
saveAutoNumContext(m_autonum_cable);
|
||||
}
|
||||
persistAutonumSettings();
|
||||
}
|
||||
}
|
||||
@@ -393,6 +415,12 @@ void NewDiagramPage::loadAutoNumTab(AutoNumTab &tab, QSettings &settings)
|
||||
tab.widget->contextComboBox()->setCurrentText(data.second);
|
||||
tab.widget->setContext(tab.contexts.value(data.second));
|
||||
}
|
||||
//A tab which keeps one single rule can take it away again with
|
||||
//a button of its own -- the row the others delete from is
|
||||
//hidden here -- but only when there really is one to take away.
|
||||
if (!tab.fixed_name.isEmpty()) {
|
||||
tab.widget->setRuleRemovable(tab.contexts.contains(tab.fixed_name));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -402,15 +430,25 @@ void NewDiagramPage::loadAutoNumTab(AutoNumTab &tab, QSettings &settings)
|
||||
*/
|
||||
void NewDiagramPage::saveAutoNumContext(AutoNumTab &tab)
|
||||
{
|
||||
QString name = tab.widget->contextComboBox()->currentText().trimmed();
|
||||
if (name.isEmpty() || isPlaceholder(tab.widget->contextComboBox(), name)) {
|
||||
return;
|
||||
// A tab which keeps one single rule has no visible combo box to name
|
||||
// it with (the row is hidden): it saves under its fixed name.
|
||||
QString name = tab.fixed_name;
|
||||
if (name.isEmpty()) {
|
||||
name = tab.widget->contextComboBox()->currentText().trimmed();
|
||||
if (name.isEmpty() || isPlaceholder(tab.widget->contextComboBox(), name)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
tab.contexts.insert(name, tab.widget->toNumContext());
|
||||
if (tab.widget->contextComboBox()->findText(name) == -1) {
|
||||
tab.widget->contextComboBox()->addItem(name);
|
||||
}
|
||||
tab.widget->contextComboBox()->setCurrentText(name);
|
||||
persistAutonumSettings();
|
||||
//There is a rule now, so there is something to take away again.
|
||||
if (!tab.fixed_name.isEmpty()) {
|
||||
tab.widget->setRuleRemovable(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -419,17 +457,35 @@ void NewDiagramPage::saveAutoNumContext(AutoNumTab &tab)
|
||||
*/
|
||||
void NewDiagramPage::removeAutoNumContext(AutoNumTab &tab)
|
||||
{
|
||||
QString name = tab.widget->contextComboBox()->currentText().trimmed();
|
||||
if (name.isEmpty() || isPlaceholder(tab.widget->contextComboBox(), name)) {
|
||||
return;
|
||||
QString name = tab.fixed_name;
|
||||
if (name.isEmpty()) {
|
||||
name = tab.widget->contextComboBox()->currentText().trimmed();
|
||||
if (name.isEmpty() || isPlaceholder(tab.widget->contextComboBox(), name)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
int idx = tab.widget->contextComboBox()->findText(name);
|
||||
if (idx == -1) return;
|
||||
// A name which is not in the list was never saved, so there is
|
||||
// nothing to take out -- unless it is a single rule, which is
|
||||
// always under its fixed name whether the combo knows it or not.
|
||||
if (idx == -1 && tab.fixed_name.isEmpty()) return;
|
||||
if (idx != -1) {
|
||||
tab.widget->contextComboBox()->removeItem(idx);
|
||||
tab.widget->contextComboBox()->setCurrentText(QString());
|
||||
}
|
||||
tab.contexts.remove(name);
|
||||
tab.widget->contextComboBox()->removeItem(idx);
|
||||
tab.widget->contextComboBox()->setCurrentText(QString());
|
||||
tab.widget->setContext(NumerotationContext());
|
||||
persistAutonumSettings();
|
||||
|
||||
//A tab which keeps one single rule has no list to delete it
|
||||
//from, so this is where the button of its own goes away too.
|
||||
//And having just taken the rule away means numbering cables by
|
||||
//hand again: every project of its own asks once more whether
|
||||
//one should be defined -- that answer is kept per project, so
|
||||
//there is nothing to take back here.
|
||||
if (!tab.fixed_name.isEmpty()) {
|
||||
tab.widget->setRuleRemovable(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -439,12 +495,21 @@ void NewDiagramPage::removeAutoNumContext(AutoNumTab &tab)
|
||||
void NewDiagramPage::persistAutonumSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
for (auto *tab : {&m_autonum_conductor, &m_autonum_element, &m_autonum_folio}) {
|
||||
for (auto *tab : {&m_autonum_conductor, &m_autonum_element, &m_autonum_folio, &m_autonum_cable}) {
|
||||
QString current;
|
||||
QComboBox *combo = tab->widget->contextComboBox();
|
||||
if (!isPlaceholder(combo, combo->currentText().trimmed())
|
||||
&& tab->contexts.contains(combo->currentText().trimmed())) {
|
||||
current = combo->currentText().trimmed();
|
||||
if (!tab->fixed_name.isEmpty()) {
|
||||
// The one rule of a single-rule tab is in use as soon as
|
||||
// it exists: there is nothing to choose between.
|
||||
if (tab->contexts.contains(tab->fixed_name)) {
|
||||
current = tab->fixed_name;
|
||||
}
|
||||
}
|
||||
else {
|
||||
QComboBox *combo = tab->widget->contextComboBox();
|
||||
if (!isPlaceholder(combo, combo->currentText().trimmed())
|
||||
&& tab->contexts.contains(combo->currentText().trimmed())) {
|
||||
current = combo->currentText().trimmed();
|
||||
}
|
||||
}
|
||||
NumerotationContext::saveToSettings(tab->contexts, current,
|
||||
settings, tab->prefix);
|
||||
@@ -462,7 +527,7 @@ bool NewDiagramPage::eventFilter(QObject *obj, QEvent *event)
|
||||
auto *ke = static_cast<QKeyEvent *>(event);
|
||||
if ((ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter)) {
|
||||
// Check if this is a line edit inside one of our autonum combos
|
||||
for (auto *tab : {&m_autonum_conductor, &m_autonum_element, &m_autonum_folio}) {
|
||||
for (auto *tab : {&m_autonum_conductor, &m_autonum_element, &m_autonum_folio, &m_autonum_cable}) {
|
||||
if (QComboBox *combo = tab->widget->contextComboBox()) {
|
||||
if (combo->lineEdit() && combo->lineEdit() == obj) {
|
||||
return true; // eat the event
|
||||
|
||||
@@ -82,10 +82,16 @@ public slots:
|
||||
SelectAutonumW *widget = nullptr;
|
||||
QHash<QString, NumerotationContext> contexts;
|
||||
QString prefix;
|
||||
/// When set, this tab keeps one single rule, always saved
|
||||
/// and read under this name: there is no visible combo box
|
||||
/// to name a rule with (see SelectAutonumW::
|
||||
/// setSingleRuleMode). The cable numbering works that way.
|
||||
QString fixed_name;
|
||||
};
|
||||
AutoNumTab m_autonum_conductor;
|
||||
AutoNumTab m_autonum_element;
|
||||
AutoNumTab m_autonum_folio;
|
||||
AutoNumTab m_autonum_cable;
|
||||
|
||||
void initAutoNumTab(AutoNumTab &tab, SelectAutonumW *w, const QString &prefix);
|
||||
void loadAutoNumTab(AutoNumTab &tab, QSettings &settings);
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "../../qeticons.h"
|
||||
#include "ui_generalconfigurationpage.h"
|
||||
#include "../../materiallist/materiallist.h"
|
||||
#include "../../cablelist/cabletypelist.h"
|
||||
#include "../../utils/qetsettings.h"
|
||||
#include "../../utils/qetutils.h"
|
||||
#include "../../qetmessagebox.h"
|
||||
@@ -33,6 +34,7 @@
|
||||
#include "../../ElementsCollection/qetlabelsfile.h"
|
||||
#include "../prefixconfigurationdialog.h"
|
||||
#include "../nokde/kcolorbutton.h"
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
@@ -40,6 +42,35 @@
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
|
||||
#include "../../diagram.h"
|
||||
#include "../../qetproject.h"
|
||||
|
||||
namespace {
|
||||
/**
|
||||
@brief What one of those font buttons says: the family, the size
|
||||
and the style, the way it would read on the sheet.
|
||||
@param font the font that text is written with
|
||||
@return e.g. "Liberation Sans 8,1 (Regular)"
|
||||
*/
|
||||
QString fontButtonLabel(const QFont &font)
|
||||
{
|
||||
QString style = font.styleName();
|
||||
if (font.bold()) {
|
||||
style = font.italic()
|
||||
? QCoreApplication::translate("GeneralConfigurationPage",
|
||||
"Bold italic")
|
||||
: QCoreApplication::translate("GeneralConfigurationPage", "Bold");
|
||||
} else if (font.italic()) {
|
||||
style = QCoreApplication::translate("GeneralConfigurationPage", "Italic");
|
||||
} else if (style.isEmpty()) {
|
||||
style = QCoreApplication::translate("GeneralConfigurationPage", "Normal");
|
||||
}
|
||||
return font.family() + QLatin1Char(' ')
|
||||
+ QString::number(font.pointSizeF(), 'g', 3)
|
||||
+ QLatin1String(" (") + style + QLatin1Char(')');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief GeneralConfigurationPage::GeneralConfigurationPage
|
||||
@param parent
|
||||
@@ -192,6 +223,17 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
|
||||
font.styleName() + ")";
|
||||
ui->m_indi_text_font_pb->setText(fontInfos);
|
||||
} else { ui->m_indi_text_font_pb->setText("Liberation Sans 9 (Regular)"); }
|
||||
|
||||
//Cable texts: what every cable writes along its own line when
|
||||
//it has not been given a font of its own.
|
||||
ui->m_cable_text_font_pb->setText(fontButtonLabel(QETApp::cableTextsFont()));
|
||||
ui->m_cable_core_font_pb->setText(fontButtonLabel(QETApp::cableCoreFont()));
|
||||
|
||||
//Where those texts stop in relation to the beginning of their
|
||||
//own line, for the cables which say nothing about it themselves
|
||||
const int align_index = int(QETApp::cableTextAlignment()) == int(Qt::AlignLeft) ? 2
|
||||
: (int(QETApp::cableTextAlignment()) == int(Qt::AlignHCenter) ? 1 : 0);
|
||||
ui->m_cable_align_cb->setCurrentIndex(align_index);
|
||||
|
||||
ui->m_highlight_integrated_elements->setChecked(settings.value("diagrameditor/highlight-integrated-elements", true).toBool());
|
||||
ui->m_default_elements_info->setPlainText(settings.value("elementeditor/default-informations", "").toString());
|
||||
@@ -271,6 +313,17 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) :
|
||||
.arg(MaterialList::defaultPath()));
|
||||
}
|
||||
|
||||
//CABLE TYPE FILE
|
||||
path = CableTypeList::configuredPath();
|
||||
ui->m_cable_type_list_path_le->setText(path);
|
||||
if (path.isEmpty())
|
||||
{
|
||||
ui->m_cable_type_list_path_le->setPlaceholderText(
|
||||
tr("Not set (default: %1)",
|
||||
"hint shown in the cable type file field when no file is configured yet")
|
||||
.arg(CableTypeList::defaultPath()));
|
||||
}
|
||||
|
||||
fillLang();
|
||||
}
|
||||
|
||||
@@ -483,6 +536,30 @@ void GeneralConfigurationPage::applyConf()
|
||||
//kept as chosen even when it doesn't exist yet : the user may well
|
||||
//point QElectroTech at a file he intends to write later.
|
||||
MaterialList::setConfiguredPath(ui->m_material_list_path_le->text().trimmed());
|
||||
|
||||
//CABLE TYPE FILE
|
||||
//Same rule as the material file : it is a plain file, kept as
|
||||
//chosen even when it doesn't exist yet.
|
||||
CableTypeList::setConfiguredPath(ui->m_cable_type_list_path_le->text().trimmed());
|
||||
|
||||
//The way a cable lines up its texts at the beginning of its
|
||||
//line, for every cable which says nothing about it itself --
|
||||
//written now, so the sheets drawn again just below show it.
|
||||
const int align_index = ui->m_cable_align_cb->currentIndex();
|
||||
QETApp::setCableTextAlignment(align_index == 2 ? Qt::AlignLeft
|
||||
: (align_index == 1
|
||||
? Qt::AlignHCenter
|
||||
: Qt::AlignRight));
|
||||
|
||||
//Every folio is drawn again: the texts of the cables are written
|
||||
//from the settings, so that what he just picked reaches the
|
||||
//sheets without his having to touch anything on them first.
|
||||
for (QETProject *project : QETApp::registeredProjects())
|
||||
{
|
||||
for (Diagram *diagram : project->diagrams()) {
|
||||
diagram->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -601,6 +678,45 @@ void GeneralConfigurationPage::on_m_dyn_text_font_pb_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief GeneralConfigurationPage::on_m_cable_text_font_pb_clicked
|
||||
Let him pick the font the texts of a cable are written with by
|
||||
default: designation, type, installation, location and length.
|
||||
|
||||
Every cable which has not been given a font of its own follows it,
|
||||
from now on: one which has keeps the one it was given, which is why
|
||||
those are set on the cable itself rather than here.
|
||||
*/
|
||||
void GeneralConfigurationPage::on_m_cable_text_font_pb_clicked()
|
||||
{
|
||||
bool ok = false;
|
||||
const QFont font = QFontDialog::getFont(&ok, QETApp::cableTextsFont(), this,
|
||||
tr("Cable text font"));
|
||||
if (!ok) return;
|
||||
|
||||
QSettings settings;
|
||||
settings.setValue("cable-management/cable-text-font", QETUtils::fontToString(font));
|
||||
ui->m_cable_text_font_pb->setText(fontButtonLabel(QETApp::cableTextsFont()));
|
||||
}
|
||||
|
||||
/**
|
||||
@brief GeneralConfigurationPage::on_m_cable_core_font_pb_clicked
|
||||
Let him pick the font the colours of the cores are written with by
|
||||
default -- all of them together, the way they are drawn: one row of
|
||||
colours beside the line, never set apart from each other.
|
||||
*/
|
||||
void GeneralConfigurationPage::on_m_cable_core_font_pb_clicked()
|
||||
{
|
||||
bool ok = false;
|
||||
const QFont font = QFontDialog::getFont(&ok, QETApp::cableCoreFont(), this,
|
||||
tr("Core colors font"));
|
||||
if (!ok) return;
|
||||
|
||||
QSettings settings;
|
||||
settings.setValue("cable-management/cable-core-font", QETUtils::fontToString(font));
|
||||
ui->m_cable_core_font_pb->setText(fontButtonLabel(QETApp::cableCoreFont()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -838,6 +954,70 @@ void GeneralConfigurationPage::on_m_material_list_create_pb_clicked()
|
||||
ui->m_material_list_path_le->setText(path);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief GeneralConfigurationPage::on_m_cable_type_list_browse_pb_clicked
|
||||
Let the user pick an existing cable type file.
|
||||
*/
|
||||
void GeneralConfigurationPage::on_m_cable_type_list_browse_pb_clicked()
|
||||
{
|
||||
QString start_dir = ui->m_cable_type_list_path_le->text();
|
||||
start_dir = start_dir.isEmpty()
|
||||
? QETApp::documentDir()
|
||||
: QFileInfo(start_dir).absolutePath();
|
||||
|
||||
const QString path = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
tr("Select the cable types file"),
|
||||
start_dir,
|
||||
tr("CSV files (*.csv)"));
|
||||
|
||||
if (!path.isEmpty()) {
|
||||
ui->m_cable_type_list_path_le->setText(path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief GeneralConfigurationPage::on_m_cable_type_list_create_pb_clicked
|
||||
Create the cable type file with its header line, so the columns are
|
||||
known before the user fills them from his spreadsheet.
|
||||
*/
|
||||
void GeneralConfigurationPage::on_m_cable_type_list_create_pb_clicked()
|
||||
{
|
||||
QString path = ui->m_cable_type_list_path_le->text();
|
||||
path = path.isEmpty()
|
||||
? CableTypeList::defaultPath()
|
||||
: QFileInfo(path).absolutePath() + QLatin1Char('/') + CableTypeList::defaultFileName();
|
||||
|
||||
path = QFileDialog::getSaveFileName(
|
||||
this,
|
||||
tr("Create the cable types file"),
|
||||
path,
|
||||
tr("CSV files (*.csv)"));
|
||||
if (path.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
if (QFileInfo(path).suffix().isEmpty()) {
|
||||
path += QStringLiteral(".csv");
|
||||
}
|
||||
|
||||
//An existing file is kept as it is : this button creates the
|
||||
//header, it never overwrites a catalogue.
|
||||
if (CableTypeList::isEmptyFile(path))
|
||||
{
|
||||
QString error;
|
||||
if (!CableTypeList::createFile(path, &error))
|
||||
{
|
||||
QET::QetMessageBox::critical(this,
|
||||
tr("Cannot be created"),
|
||||
tr("Cannot create the file:\n%1\n%2")
|
||||
.arg(path, error));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ui->m_cable_type_list_path_le->setText(path);
|
||||
}
|
||||
|
||||
void GeneralConfigurationPage::on_m_indi_text_font_pb_clicked()
|
||||
{
|
||||
bool ok;
|
||||
|
||||
@@ -50,7 +50,11 @@ class GeneralConfigurationPage : public ConfigPage
|
||||
void on_m_prefix_pb_clicked();
|
||||
void on_m_material_list_browse_pb_clicked();
|
||||
void on_m_material_list_create_pb_clicked();
|
||||
void on_m_cable_type_list_browse_pb_clicked();
|
||||
void on_m_cable_type_list_create_pb_clicked();
|
||||
void on_m_indi_text_font_pb_clicked();
|
||||
void on_m_cable_text_font_pb_clicked();
|
||||
void on_m_cable_core_font_pb_clicked();
|
||||
void on_MaxPartsElementEditorList_sb_valueChanged(int value);
|
||||
void on_DiagramEditor_Grid_PointSize_min_sb_valueChanged(int value);
|
||||
void on_ElementEditor_Grid_PointSize_min_sb_valueChanged(int value);
|
||||
|
||||
@@ -600,6 +600,47 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="m_cable_type_list_label">
|
||||
<property name="text">
|
||||
<string>Cable type list file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<layout class="QHBoxLayout" name="m_cable_type_list_layout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="m_cable_type_list_path_le">
|
||||
<property name="toolTip">
|
||||
<string extracomment="tooltip of the cable type file path field">Directory of the cable types used to define a cable (number of cores, colors, cross-section)</string>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string extracomment="hint shown when no cable type file is configured yet">Not set</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_cable_type_list_browse_pb">
|
||||
<property name="text">
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_cable_type_list_create_pb">
|
||||
<property name="toolTip">
|
||||
<string extracomment="tooltip of the button creating the cable type file with its header line">Create the cable type list file with its header line</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -864,6 +905,113 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_cable_textes">
|
||||
<property name="title">
|
||||
<string>Cable texts</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_cable_textes">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_cable_textes">
|
||||
<property name="text">
|
||||
<string>Designation, type, plant, location, length :</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_cable_textes">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="m_cable_text_font_pb">
|
||||
<property name="toolTip">
|
||||
<string>Font of the texts written along the cable line; a cable which has its own keeps it.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_cable_core_textes">
|
||||
<property name="text">
|
||||
<string>Core colors (all of them) :</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<spacer name="horizontalSpacer_cable_core_textes">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="m_cable_core_font_pb">
|
||||
<property name="toolTip">
|
||||
<string>Font of the core colors written along the line; a cable which has its own keeps it.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_cable_align">
|
||||
<property name="text">
|
||||
<string>Text alignment :</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="m_cable_align_cb">
|
||||
<property name="toolTip">
|
||||
<string>Where the texts of a cable stop relative to the start of its line; a cable which has its own keeps it.</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Right aligned</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Centred</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Left aligned</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
|
||||
@@ -471,9 +471,20 @@ QIcon ProjectAutoNumConfigPage::icon() const
|
||||
|
||||
/**
|
||||
@brief ProjectAutoNumConfigPage::applyProjectConf
|
||||
Save what this page has to save when the window is confirmed.
|
||||
The cable rule is written from here as well as by its own Apply
|
||||
button: the cable tool asks the project for that rule the moment
|
||||
he tries to draw a cable, so filling it in and confirming this
|
||||
window only to be asked once more would be a surprise. A rule he
|
||||
has not finished filling in is left alone, and a page he has not
|
||||
touched leaves the project exactly as it was.
|
||||
*/
|
||||
void ProjectAutoNumConfigPage::applyProjectConf()
|
||||
{}
|
||||
{
|
||||
if (m_saw_cable && m_saw_cable->isModified() && m_saw_cable->isValid()) {
|
||||
saveContextCable();
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
/**
|
||||
@@ -555,6 +566,12 @@ void ProjectAutoNumConfigPage::initWidgets()
|
||||
m_saw_folio = new SelectAutonumW(2);
|
||||
m_saw_folio->setExplicitNaming();
|
||||
tab_widget->addTab(schemeTab(m_saw_folio, m_folio_users_box, m_folio_users), tr("Sheets"));
|
||||
|
||||
//Cable tab: one rule only, so the row which lists the available
|
||||
//numberings stays hidden and there is nothing to choose between.
|
||||
m_saw_cable = new SelectAutonumW(3);
|
||||
m_saw_cable->setSingleRuleMode(true);
|
||||
tab_widget->addTab(m_saw_cable, tr("Cables"));
|
||||
|
||||
//AutoNumbering Tab
|
||||
m_faw = new FolioAutonumberingW(project());
|
||||
@@ -589,6 +606,7 @@ void ProjectAutoNumConfigPage::readValuesFromProject()
|
||||
m_saw_conductor->contextComboBox()->clear();
|
||||
m_saw_element->contextComboBox()->clear();
|
||||
m_saw_folio->contextComboBox()->clear();
|
||||
m_saw_cable->contextComboBox()->clear();
|
||||
|
||||
//Conductor Tab
|
||||
refreshSchemes(SchemeKind::Conductor, m_project->conductorCurrentAutoNum());
|
||||
@@ -598,6 +616,25 @@ void ProjectAutoNumConfigPage::readValuesFromProject()
|
||||
|
||||
//Folio Tab
|
||||
refreshSchemes(SchemeKind::Folio, QString());
|
||||
|
||||
//Cable tab: the rule goes straight into the editor, since with the
|
||||
//row of available numberings hidden he can never pick it out of
|
||||
//the combo box himself. With no rule at all the editor shows an
|
||||
//empty one to fill in, exactly like a numbering which has just
|
||||
//been opened for the first time.
|
||||
const QStringList strlk(m_project->cableAutoNum().keys());
|
||||
m_saw_cable->contextComboBox()->addItems(strlk);
|
||||
const QString cable_rule = m_project->cableCurrentAutoNum();
|
||||
const bool cable_rule_ok = !cable_rule.isEmpty()
|
||||
&& !m_project->cableAutoNum(cable_rule).isEmpty();
|
||||
if (cable_rule_ok) {
|
||||
m_saw_cable->setContext(m_project->cableAutoNum(cable_rule));
|
||||
} else {
|
||||
m_saw_cable->setContext(NumerotationContext());
|
||||
}
|
||||
//The button which takes the rule away is only worth showing when
|
||||
//there is one, and only clickable when the project allows changes.
|
||||
m_saw_cable->setRuleRemovable(cable_rule_ok && !m_project->isReadOnly());
|
||||
|
||||
//Folio AutoNumbering Tab
|
||||
m_faw->setContext(m_project->folioAutoNum().keys());
|
||||
@@ -612,6 +649,15 @@ void ProjectAutoNumConfigPage::adjustReadOnly()
|
||||
if (m_import_pb && m_project) {
|
||||
m_import_pb->setDisabled(m_project->isReadOnly());
|
||||
}
|
||||
//The button which takes the cable numbering rule away does the
|
||||
//same thing as the import button: nothing while the project
|
||||
//cannot be written.
|
||||
if (m_saw_cable && m_project) {
|
||||
const QString title = m_project->cableCurrentAutoNum();
|
||||
m_saw_cable->setRuleRemovable(!m_project->isReadOnly()
|
||||
&& !title.isEmpty()
|
||||
&& !m_project->cableAutoNum(title).isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -644,6 +690,11 @@ void ProjectAutoNumConfigPage::buildConnections()
|
||||
connect(m_saw_folio, &SelectAutonumW::renameClicked, this, &ProjectAutoNumConfigPage::renameContextFolio);
|
||||
connect(m_saw_folio->contextComboBox(), &QComboBox::textActivated, this, &ProjectAutoNumConfigPage::updateContextFolio);
|
||||
|
||||
//Cable tab: one rule, so there is no name to pick in the hidden
|
||||
//combo box -- applying always writes the single rule.
|
||||
connect(m_saw_cable, &SelectAutonumW::applyPressed, this, &ProjectAutoNumConfigPage::saveContextCable);
|
||||
connect(m_saw_cable, &SelectAutonumW::removeClicked, this, &ProjectAutoNumConfigPage::removeContextCable);
|
||||
|
||||
// Auto Folio Numbering
|
||||
connect(m_faw, &FolioAutonumberingW::applyPressed, this, &ProjectAutoNumConfigPage::applyAutoNum);
|
||||
|
||||
@@ -1034,6 +1085,66 @@ void ProjectAutoNumConfigPage::saveContextElement()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ProjectAutoNumConfigPage::saveContextCable
|
||||
Save the cable numbering rule into the project.
|
||||
|
||||
There is one rule only, and it has no name the user could have typed
|
||||
(the row which holds those names is hidden): it always goes in under
|
||||
the fixed name, and it is the rule in use from the moment it exists.
|
||||
*/
|
||||
void ProjectAutoNumConfigPage::saveContextCable()
|
||||
{
|
||||
if (!m_project || m_project->isReadOnly()) return;
|
||||
|
||||
const QString title = QETProject::cableAutoNumRuleName();
|
||||
m_project->addCableAutoNum(title, m_saw_cable->toNumContext());
|
||||
m_project->setCurrentCableAutoNum(title);
|
||||
|
||||
//Keep the hidden combo box in step with what the project holds,
|
||||
//so the next reading of this page shows the rule just saved.
|
||||
if (m_saw_cable->contextComboBox()->findText(title) == -1) {
|
||||
m_saw_cable->contextComboBox()->addItem(title);
|
||||
}
|
||||
m_saw_cable->contextComboBox()->setCurrentText(title);
|
||||
//There is a rule now, so there is something to take away again.
|
||||
m_saw_cable->setRuleRemovable(true);
|
||||
//This is applied straight away rather than at the end of the
|
||||
//window, so the project has to say so itself: otherwise the rule
|
||||
//would be dropped by a Cancel which comes after it.
|
||||
m_project->setModified(true);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ProjectAutoNumConfigPage::removeContextCable
|
||||
Take the cable numbering rule out of the project. The project then
|
||||
numbers its cables by no rule at all -- they are called W until one
|
||||
is defined again -- and the cable tool asks once more whether one
|
||||
should be defined.
|
||||
*/
|
||||
void ProjectAutoNumConfigPage::removeContextCable()
|
||||
{
|
||||
if (!m_project || m_project->isReadOnly()) return;
|
||||
|
||||
const QString title = m_project->cableCurrentAutoNum();
|
||||
if (title.isEmpty()) return;
|
||||
|
||||
m_project->removeCableAutoNum(title);
|
||||
const int idx = m_saw_cable->contextComboBox()->findText(title);
|
||||
if (idx != -1) {
|
||||
m_saw_cable->contextComboBox()->removeItem(idx);
|
||||
}
|
||||
m_saw_cable->contextComboBox()->setCurrentText(QString());
|
||||
m_saw_cable->setContext(NumerotationContext());
|
||||
//No rule left, so the button which takes one away goes too. And
|
||||
//having just taken the rule away means numbering cables by hand
|
||||
//again: the question of defining one comes back the next time a
|
||||
//cable is drawn, so it is not held back in this project any more.
|
||||
m_saw_cable->setRuleRemovable(false);
|
||||
m_project->setCableAskNumbering(true);
|
||||
m_project->setModified(true);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ProjectAutoNumConfigPage::importFromProject
|
||||
Read the automatic numbering rules stored in another .qet project and
|
||||
@@ -1653,3 +1764,14 @@ void ProjectAutoNumConfigPage::changeToTab(int i)
|
||||
m_tab_widget->setCurrentIndex(i);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ProjectAutoNumConfigPage::changeToCableTab
|
||||
Show the cable tab -- the one the cable tool opens when it finds out
|
||||
that the project has no numbering rule yet.
|
||||
*/
|
||||
void ProjectAutoNumConfigPage::changeToCableTab()
|
||||
{
|
||||
//Tabs in order : Management, Conductors, Elements, Folios, Cables
|
||||
changeToTab(4);
|
||||
}
|
||||
|
||||
@@ -160,6 +160,9 @@ class ProjectAutoNumConfigPage : public ProjectConfigPage {
|
||||
QIcon icon() const override;
|
||||
void applyProjectConf() override;
|
||||
virtual void changeToTab(int);
|
||||
///Jump straight to the cable tab (used when the cable tool
|
||||
///asks whether a numbering rule should be defined)
|
||||
void changeToCableTab();
|
||||
protected:
|
||||
void initWidgets() override;
|
||||
void initLayout() override {}
|
||||
@@ -177,6 +180,8 @@ class ProjectAutoNumConfigPage : public ProjectConfigPage {
|
||||
void updateContextElement(const QString&);//element
|
||||
void saveContextElement();
|
||||
void removeContextElement();
|
||||
void saveContextCable(); //cable: one rule, no name to pick
|
||||
void removeContextCable();
|
||||
void newContextElement();
|
||||
void renameContextElement();
|
||||
void refreshElementSchemes(const QString &selected);
|
||||
@@ -219,6 +224,7 @@ class ProjectAutoNumConfigPage : public ProjectConfigPage {
|
||||
SelectAutonumW *m_saw_conductor;
|
||||
SelectAutonumW *m_saw_folio;
|
||||
SelectAutonumW *m_saw_element;
|
||||
SelectAutonumW *m_saw_cable;
|
||||
QTabWidget *m_tab_widget = nullptr;
|
||||
QGroupBox *m_conductor_users_box = nullptr;
|
||||
QTableWidget *m_conductor_users = nullptr;
|
||||
|
||||
@@ -94,6 +94,20 @@ void ProjectPropertiesDialog::changeToFolio()
|
||||
autoNumPage->changeToTab(3);
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ProjectPropertiesDialog::changeToCable
|
||||
Change the current displayed tab to the cable numbering tab.
|
||||
The caller is the cable tool, which opens this window when it finds
|
||||
that the project numbers its cables by no rule at all.
|
||||
*/
|
||||
void ProjectPropertiesDialog::changeToCable()
|
||||
{
|
||||
ProjectAutoNumConfigPage *autoNumPage =
|
||||
static_cast <ProjectAutoNumConfigPage*>(
|
||||
m_properties_dialog->pages.at(2));
|
||||
autoNumPage->changeToCableTab();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief ProjectPropertiesDialog::changeToElement
|
||||
Change the current displayed tab to the element numberings tab.
|
||||
|
||||
@@ -41,6 +41,8 @@ class ProjectPropertiesDialog : public QObject {
|
||||
void exec();
|
||||
void setCurrentPage(ProjectPropertiesDialog::Page);
|
||||
void changeToFolio();
|
||||
///Show the automatic numbering page with the cable tab on top
|
||||
void changeToCable();
|
||||
void changeToElement();
|
||||
|
||||
private:
|
||||
|
||||
@@ -17,12 +17,16 @@
|
||||
*/
|
||||
|
||||
#include <utility>
|
||||
#include <QFontDialog>
|
||||
#include <QHash>
|
||||
#include <QMetaEnum>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "xrefpropertieswidget.h"
|
||||
#include "ui_xrefpropertieswidget.h"
|
||||
#include "qdebug.h"
|
||||
#include "../qetapp.h"
|
||||
#include "../utils/qetutils.h"
|
||||
|
||||
/**
|
||||
@brief XRefPropertiesWidget::XRefPropertiesWidget
|
||||
@@ -37,10 +41,12 @@ XRefPropertiesWidget::XRefPropertiesWidget(QHash <QString, XRefProperties> prope
|
||||
{
|
||||
ui->setupUi(this);
|
||||
buildUi();
|
||||
fillMissingTypes();
|
||||
connect(ui->m_display_has_cross_rb, &QRadioButton::toggled, ui->m_cross_properties_gb, &QWidget::setEnabled);
|
||||
connect(ui->m_display_has_contacts_rb, &QRadioButton::toggled, ui->m_show_all_slaves_cb, &QWidget::setEnabled);
|
||||
connect(ui->m_type_cb, qOverload<int>(&QComboBox::currentIndexChanged), this, &XRefPropertiesWidget::typeChanged);
|
||||
connect(ui->m_snap_to_cb, qOverload<int>(&QComboBox::currentIndexChanged), this, &XRefPropertiesWidget::enableOffsetSB);
|
||||
connect(ui->m_font_pb, &QPushButton::clicked, this, &XRefPropertiesWidget::chooseXRefFont);
|
||||
updateDisplay();
|
||||
}
|
||||
|
||||
@@ -54,6 +60,7 @@ XRefPropertiesWidget::~XRefPropertiesWidget()
|
||||
disconnect(ui->m_display_has_contacts_rb, &QRadioButton::toggled, ui->m_show_all_slaves_cb, &QWidget::setEnabled);
|
||||
disconnect(ui->m_type_cb, qOverload<int>(&QComboBox::currentIndexChanged), this, &XRefPropertiesWidget::typeChanged);
|
||||
disconnect(ui->m_snap_to_cb, qOverload<int>(&QComboBox::currentIndexChanged), this, &XRefPropertiesWidget::enableOffsetSB);
|
||||
disconnect(ui->m_font_pb, &QPushButton::clicked, this, &XRefPropertiesWidget::chooseXRefFont);
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@@ -65,10 +72,33 @@ XRefPropertiesWidget::~XRefPropertiesWidget()
|
||||
void XRefPropertiesWidget::setProperties(const QHash <QString,
|
||||
XRefProperties> &properties) {
|
||||
m_properties = properties;
|
||||
fillMissingTypes();
|
||||
updateDisplay();
|
||||
m_previous_type_index = ui->m_type_cb->currentIndex();
|
||||
}
|
||||
|
||||
/**
|
||||
@brief XRefPropertiesWidget::fillMissingTypes
|
||||
Make sure every type the combo box offers has properties of its own.
|
||||
|
||||
A project built before a type existed does not hold that type, and
|
||||
neither does a settings file written before it. Without an entry the
|
||||
form would make one up out of thin air, and for a cable that would be
|
||||
the very default of the coil ("%f-%l%c"), which reads as a stray dash
|
||||
behind the folio number and two empty numbers after it.
|
||||
*/
|
||||
void XRefPropertiesWidget::fillMissingTypes()
|
||||
{
|
||||
const QHash<QString, XRefProperties> defaults = XRefProperties::defaultProperties();
|
||||
for (int i = 0; i < ui->m_type_cb->count(); ++i)
|
||||
{
|
||||
const QString type = ui->m_type_cb->itemData(i).toString();
|
||||
if (!m_properties.contains(type)) {
|
||||
m_properties.insert(type, defaults.value(type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief XRefPropertiesWidget::properties
|
||||
@return the properties edited by this widget
|
||||
@@ -88,6 +118,9 @@ void XRefPropertiesWidget::setReadOnly(bool ro) {
|
||||
ui->m_type_cb->setDisabled(ro);
|
||||
ui->m_display_gb->setDisabled(ro);
|
||||
ui->m_cross_properties_gb->setDisabled(ro);
|
||||
//The texts stand on their own since they are needed for a cable
|
||||
//too, and they are as much a setting as the rest.
|
||||
ui->m_labels_gb->setDisabled(ro);
|
||||
|
||||
if (!ro && ui->m_display_has_contacts_rb->isChecked()) {
|
||||
ui->m_cross_properties_gb->setDisabled(true);
|
||||
@@ -100,10 +133,16 @@ void XRefPropertiesWidget::setReadOnly(bool ro) {
|
||||
*/
|
||||
void XRefPropertiesWidget::buildUi()
|
||||
{
|
||||
//Wording of the master label as the .ui wrote it, kept to put it
|
||||
//back for every type which does not rename it.
|
||||
m_master_label_text = ui->label_6->text();
|
||||
ui -> m_type_cb -> addItem(tr("Coil"), "coil");
|
||||
ui -> m_type_cb -> addItem(tr("Organ of protection"), "protection");
|
||||
ui -> m_type_cb -> addItem(tr("Switch / button"), "commutator");
|
||||
ui -> m_type_cb -> addItem(tr("Programmable Logic Controller (PLC)"), "plc");
|
||||
//Not an element: the type of the cross references a cable writes
|
||||
//in its own label when it runs on several folios.
|
||||
ui -> m_type_cb -> addItem(tr("Cable"), "cable");
|
||||
|
||||
ui -> m_snap_to_cb -> addItem(tr("Footer"), "bottom");
|
||||
ui -> m_snap_to_cb -> addItem(tr("Under the label of the element"), "label");
|
||||
@@ -152,6 +191,7 @@ void XRefPropertiesWidget::saveProperties(int index) {
|
||||
xrp.setPrefix("switch", ui->m_switch_prefix_le->text());
|
||||
xrp.setMasterLabel(ui->m_master_le->text());
|
||||
xrp.setSlaveLabel(ui->m_slave_le->text());
|
||||
xrp.setFont(m_current_font);
|
||||
//The boxes cannot show a value below their minimum (the offset's
|
||||
//minimum is its "Default" entry, standing for the stored 0): keep
|
||||
//the stored value unless the box shows something else.
|
||||
@@ -185,6 +225,10 @@ void XRefPropertiesWidget::updateDisplay()
|
||||
QString master = xrp.masterLabel();
|
||||
ui->m_master_le->setText(master);
|
||||
|
||||
//Which font that type's reference is written with: the button
|
||||
//offers it for a cable alone, but every type carries its own.
|
||||
m_current_font = xrp.font();
|
||||
|
||||
QString slave = xrp.slaveLabel();
|
||||
ui->m_slave_le->setText(slave);
|
||||
|
||||
@@ -236,8 +280,42 @@ void XRefPropertiesWidget::updateDisplay()
|
||||
ui->m_display_has_cross_rb->setVisible(!is_plc);
|
||||
ui->m_show_terminal_name_cb->setVisible(!is_plc);
|
||||
ui->m_show_all_slaves_cb->setVisible(!is_plc);
|
||||
ui->m_stack_overlapping_cb->setVisible(!is_plc);
|
||||
ui->m_cross_properties_gb->setVisible(!is_plc);
|
||||
|
||||
//A cable is not an element: it draws no cross of its own and stands
|
||||
//at no place of the sheet to be pointed at. Its reference is a line
|
||||
//of the label of the cable itself, written once per other folio the
|
||||
//cable runs on, so the whole presentation (where a cross is put, how
|
||||
//it is drawn) and the text of the slave have no meaning for it: what
|
||||
//is left is the one text which is written into that line.
|
||||
const bool is_cable = type == QLatin1String("cable");
|
||||
ui->m_display_gb->setVisible(!is_cable);
|
||||
ui->label_7->setVisible(!is_cable);
|
||||
ui->m_slave_le->setVisible(!is_cable);
|
||||
//The wording of every type which is not a cable comes back from
|
||||
//the .ui, so the label cannot drift away from the designer one.
|
||||
ui->label_6->setText(is_cable ? tr("Text:") : m_master_label_text);
|
||||
|
||||
//Only a cable writes its reference into its own label, so only a
|
||||
//cable has a text whose font to choose here: the cross references
|
||||
//of the elements keep the font they have always been drawn with.
|
||||
ui->m_font_pb->setVisible(is_cable);
|
||||
if (m_current_font.isEmpty())
|
||||
{
|
||||
ui->m_font_pb->setToolTip(tr("Font and size: those of the cable texts"));
|
||||
}
|
||||
else
|
||||
{
|
||||
QFont font;
|
||||
if (QETUtils::fontFromString(font, m_current_font)) {
|
||||
ui->m_font_pb->setToolTip(tr("Font and size: %1, %2 pt")
|
||||
.arg(font.family()).arg(font.pointSizeF()));
|
||||
}
|
||||
}
|
||||
|
||||
//A cable stacks the lines of its references by itself, so the
|
||||
//option is only worth showing for the elements.
|
||||
ui->m_stack_overlapping_cb->setVisible(!is_plc && !is_cable);
|
||||
ui->m_cross_properties_gb->setVisible(!is_plc && !is_cable);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -267,3 +345,31 @@ void XRefPropertiesWidget::enableOffsetSB(int i){
|
||||
ui->m_offset_sb->setEnabled(true);
|
||||
ui->m_stack_overlapping_cb->setEnabled(ui->m_offset_sb->isEnabled());
|
||||
}
|
||||
|
||||
/**
|
||||
@brief XRefPropertiesWidget::chooseXRefFont
|
||||
Let him pick the font -- family, size and style, all three at once --
|
||||
the reference of a cable is written with.
|
||||
|
||||
The font is only kept when he presses OK: cancelling the dialog
|
||||
leaves the previous one standing. What he picked is written into the
|
||||
properties by saveProperties(), the way every other field of this
|
||||
form is, so leaving the type or pressing OK in the settings window
|
||||
is what really stores it.
|
||||
*/
|
||||
void XRefPropertiesWidget::chooseXRefFont()
|
||||
{
|
||||
QFont initial;
|
||||
if (m_current_font.isEmpty() || !QETUtils::fontFromString(initial, m_current_font)) {
|
||||
initial = QETApp::cableTextsFont();
|
||||
}
|
||||
|
||||
bool ok = false;
|
||||
const QFont font = QFontDialog::getFont(&ok, initial, this,
|
||||
tr("Font of the cross-reference text"));
|
||||
if (!ok) return;
|
||||
|
||||
m_current_font = QETUtils::fontToString(font);
|
||||
ui->m_font_pb->setToolTip(tr("Font and size: %1, %2 pt")
|
||||
.arg(font.family()).arg(font.pointSizeF()));
|
||||
}
|
||||
|
||||
@@ -46,7 +46,9 @@ class XRefPropertiesWidget : public QWidget
|
||||
|
||||
private:
|
||||
void buildUi();
|
||||
void fillMissingTypes();
|
||||
void saveProperties(int index);
|
||||
void chooseXRefFont();
|
||||
|
||||
private slots:
|
||||
void updateDisplay();
|
||||
@@ -58,6 +60,10 @@ class XRefPropertiesWidget : public QWidget
|
||||
Ui::XRefPropertiesWidget *ui;
|
||||
QHash <QString, XRefProperties> m_properties;
|
||||
int m_previous_type_index;
|
||||
///The font picked for the type shown, as the settings describe it
|
||||
QString m_current_font;
|
||||
///Wording of the master label, as the .ui gives it
|
||||
QString m_master_label_text;
|
||||
};
|
||||
|
||||
#endif // XREFPROPERTIESWIDGET_H
|
||||
|
||||
@@ -189,100 +189,110 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="m_labels_gb">
|
||||
<property name="title">
|
||||
<string>Label cross reference</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Label cross reference</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>48</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Master</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="m_master_le">
|
||||
<property name="inputMask">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>%f-%l%c</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>48</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Slave</string>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="m_slave_le">
|
||||
<property name="text">
|
||||
<string>(%f-%l%c)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Create your own text using the following variables:
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>48</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Master</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="m_master_le">
|
||||
<property name="inputMask">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>%f-%l%c</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_font_pb">
|
||||
<property name="toolTip">
|
||||
<string>Choose the font and size of the cable cross-reference text</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Font…</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="m_slave_row">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>48</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Slave</string>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="m_slave_le">
|
||||
<property name="text">
|
||||
<string>(%f-%l%c)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Create your own text using the following variables:
|
||||
%f: the sheet number
|
||||
%F: the sheet label
|
||||
%l: the row number
|
||||
%c: the column number
|
||||
%M: the installation
|
||||
%LM: the location</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="m_cross_properties_gb">
|
||||
|
||||
Reference in New Issue
Block a user