mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-02-16 23:19:59 +01:00
Conductor Autonum now works with variables. Folio Autonumberings added to conductor autonum
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4674 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -153,7 +153,7 @@ void AutoNumberingDockWidget::setActive() {
|
||||
}
|
||||
|
||||
//Element
|
||||
QString element_formula = project_->elementAutoNumFormula();
|
||||
QString element_formula = project_->elementAutoNumCurrentFormula();
|
||||
QString active_element_autonum = project_->elementCurrentAutoNum();
|
||||
int el_index = ui->m_element_cb->findText(active_element_autonum);
|
||||
ui->m_element_cb->setCurrentIndex(el_index);
|
||||
@@ -191,7 +191,14 @@ void AutoNumberingDockWidget::conductorAutoNumChanged() {
|
||||
*/
|
||||
void AutoNumberingDockWidget::on_m_conductor_cb_activated(int) {
|
||||
QString current_autonum = ui->m_conductor_cb->currentText();
|
||||
QString current_formula = project_->conductorAutoNumFormula(current_autonum);
|
||||
if (current_autonum != "") {
|
||||
project_->setConductorAutoNumCurrentFormula(current_formula, current_autonum);
|
||||
}
|
||||
else
|
||||
project_->setConductorAutoNumCurrentFormula("","");
|
||||
projectview_->currentDiagram()->diagram()->setConductorsAutonumName(current_autonum);
|
||||
projectview_->currentDiagram()->diagram()->loadCndFolioSeq();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
#include "numparteditorw.h"
|
||||
#include <QMessageBox>
|
||||
#include "numerotationcontextcommands.h"
|
||||
#include "elementautonumberingw.h"
|
||||
#include "ui_elementautonumberingw.h"
|
||||
#include "formulaautonumberingw.h"
|
||||
#include "ui_formulaautonumberingw.h"
|
||||
#include "qdebug.h"
|
||||
#include "qetproject.h"
|
||||
#include "diagram.h"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>467</width>
|
||||
<width>524</width>
|
||||
<height>550</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -75,8 +75,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>448</width>
|
||||
<height>498</height>
|
||||
<width>504</width>
|
||||
<height>495</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@@ -110,7 +110,7 @@
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="m_to_cb">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -136,7 +136,7 @@
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="m_from_cb">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -149,7 +149,7 @@
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="m_new_tabs_sb">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "elementautonumberingw.h"
|
||||
#include "ui_elementautonumberingw.h"
|
||||
#include "formulaautonumberingw.h"
|
||||
#include "ui_formulaautonumberingw.h"
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#include <QtWidgets>
|
||||
@@ -24,9 +24,9 @@
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
ElementAutonumberingW::ElementAutonumberingW(QWidget *parent) :
|
||||
FormulaAutonumberingW::FormulaAutonumberingW(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::ElementAutonumberingW)
|
||||
ui(new Ui::FormulaAutonumberingW)
|
||||
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@@ -36,39 +36,39 @@ ElementAutonumberingW::ElementAutonumberingW(QWidget *parent) :
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
ElementAutonumberingW::~ElementAutonumberingW()
|
||||
FormulaAutonumberingW::~FormulaAutonumberingW()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementAutonumberingW::setContext
|
||||
* @brief FormulaAutonumberingW::setContext
|
||||
* @param formula to be inserted into context
|
||||
*/
|
||||
void ElementAutonumberingW::setContext(QString formula) {
|
||||
void FormulaAutonumberingW::setContext(QString formula) {
|
||||
ui->m_formula_le->insert(formula);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementAutonumberingW::clearContext
|
||||
* @brief FormulaAutonumberingW::clearContext
|
||||
* @param clear formula line edit text
|
||||
*/
|
||||
void ElementAutonumberingW::clearContext() {
|
||||
void FormulaAutonumberingW::clearContext() {
|
||||
ui->m_formula_le->clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementAutonumberingW::formula
|
||||
* @brief FormulaAutonumberingW::formula
|
||||
* @return formula to be stored into project
|
||||
*/
|
||||
QString ElementAutonumberingW::formula() {
|
||||
QString FormulaAutonumberingW::formula() {
|
||||
return ui->m_formula_le->text();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementAutonumberingW::on_m_formula_le_textChanged
|
||||
* @brief FormulaAutonumberingW::on_m_formula_le_textChanged
|
||||
* Update Apply Button
|
||||
*/
|
||||
void ElementAutonumberingW::on_m_formula_le_textChanged(QString text) {
|
||||
void FormulaAutonumberingW::on_m_formula_le_textChanged(QString text) {
|
||||
emit (textChanged(text));
|
||||
}
|
||||
@@ -15,15 +15,15 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef ELEMENTAUTONUMBERINGW_H
|
||||
#define ELEMENTAUTONUMBERINGW_H
|
||||
#ifndef FORMULAAUTONUMBERINGW_H
|
||||
#define FORMULAAUTONUMBERINGW_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QAbstractButton;
|
||||
|
||||
namespace Ui {
|
||||
class ElementAutonumberingW;
|
||||
class FormulaAutonumberingW;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,18 +32,18 @@ namespace Ui {
|
||||
the user to overwrite it with a new formula. Formula is added
|
||||
while parsing label in customelement.cpp
|
||||
*/
|
||||
class ElementAutonumberingW : public QWidget
|
||||
class FormulaAutonumberingW : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
//METHODS
|
||||
public:
|
||||
explicit ElementAutonumberingW(QWidget *parent = 0);
|
||||
~ElementAutonumberingW();
|
||||
explicit FormulaAutonumberingW(QWidget *parent = 0);
|
||||
~FormulaAutonumberingW();
|
||||
QString formula();
|
||||
void setContext(QString);
|
||||
void clearContext();
|
||||
Ui::ElementAutonumberingW *ui;
|
||||
Ui::FormulaAutonumberingW *ui;
|
||||
|
||||
private:
|
||||
|
||||
@@ -62,4 +62,4 @@ class ElementAutonumberingW : public QWidget
|
||||
|
||||
};
|
||||
|
||||
#endif // ELEMENTAUTONUMBERINGW_H
|
||||
#endif // FORMULAAUTONUMBERINGW_H
|
||||
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ElementAutonumberingW</class>
|
||||
<widget class="QWidget" name="ElementAutonumberingW">
|
||||
<class>FormulaAutonumberingW</class>
|
||||
<widget class="QWidget" name="FormulaAutonumberingW">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>383</width>
|
||||
<height>357</height>
|
||||
<width>370</width>
|
||||
<height>305</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@@ -44,7 +44,7 @@
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="m_formula_le">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -88,8 +88,6 @@
|
||||
-%c: Element Column
|
||||
-%F: Folio Name
|
||||
-%f or %id: Folio ID
|
||||
-%M: Machine
|
||||
-%LM: Location
|
||||
-%total: Total of folios
|
||||
You can also assign any other titleblock variable
|
||||
that you create. Text and number inputs are
|
||||
@@ -84,8 +84,8 @@ void NumPartEditorW::setVisibleItems() {
|
||||
<< tr("Texte");
|
||||
}
|
||||
else if (parentWidget()->parentWidget()->objectName()=="ConductorTab") {
|
||||
items << tr("Chiffre 1") << tr("Chiffre 01")
|
||||
<< tr("Chiffre 001")
|
||||
items << tr("Chiffre 1") << tr("Chiffre 1 - Folio") << tr("Chiffre 01")
|
||||
<< tr("Chiffre 01 - Folio") << tr("Chiffre 001") << tr("Chiffre 001 - Folio")
|
||||
<< tr("Texte") << tr("N° folio") << tr("Folio");
|
||||
}
|
||||
else
|
||||
|
||||
@@ -38,7 +38,7 @@ ProjectPropertiesDialog::ProjectPropertiesDialog(QETProject *project, QWidget *p
|
||||
connect(projectAutoNumConfigPage,SIGNAL(setAutoNum(QString)),newDiagramPage,SLOT(setFolioAutonum(QString)));
|
||||
connect(projectAutoNumConfigPage,SIGNAL(saveCurrentTbp()),newDiagramPage,SLOT(saveCurrentTbp()));
|
||||
connect(projectAutoNumConfigPage,SIGNAL(loadSavedTbp()),newDiagramPage,SLOT(loadSavedTbp()));
|
||||
m_properties_dialog->setMinimumHeight(690);
|
||||
m_properties_dialog->setMinimumHeight(690);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
#include "numparteditorw.h"
|
||||
#include <QMessageBox>
|
||||
#include "numerotationcontextcommands.h"
|
||||
#include "elementautonumberingw.h"
|
||||
#include "ui_elementautonumberingw.h"
|
||||
#include "formulaautonumberingw.h"
|
||||
#include "ui_formulaautonumberingw.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
/**
|
||||
@@ -34,8 +34,13 @@ SelectAutonumW::SelectAutonumW(QWidget *parent) :
|
||||
|
||||
ui->setupUi(this);
|
||||
if (this->parentWidget() -> objectName()=="ElementTab"){
|
||||
m_eaw = new ElementAutonumberingW();
|
||||
ui->scrollAreaWidgetContents->layout()->addWidget(m_eaw);
|
||||
m_feaw = new FormulaAutonumberingW();
|
||||
ui->scrollAreaWidgetContents->layout()->addWidget(m_feaw);
|
||||
}
|
||||
else if (this->parentWidget() -> objectName()=="ConductorTab"){
|
||||
m_fcaw = new FormulaAutonumberingW();
|
||||
m_fcaw->ui->label->setHidden(true);
|
||||
ui->scrollAreaWidgetContents->layout()->addWidget(m_fcaw);
|
||||
}
|
||||
setContext(NumerotationContext());
|
||||
}
|
||||
@@ -45,8 +50,13 @@ SelectAutonumW::SelectAutonumW(const NumerotationContext &context, QWidget *pare
|
||||
ui(new Ui::SelectAutonumW)
|
||||
{
|
||||
if (this->parentWidget() -> objectName()=="ElementTab"){
|
||||
m_eaw = new ElementAutonumberingW();
|
||||
ui->scrollAreaWidgetContents->layout()->addWidget(m_eaw);
|
||||
m_feaw = new FormulaAutonumberingW();
|
||||
ui->scrollAreaWidgetContents->layout()->addWidget(m_feaw);
|
||||
}
|
||||
else if (this->parentWidget() -> objectName()=="ConductorTab"){
|
||||
m_fcaw = new FormulaAutonumberingW();
|
||||
m_fcaw->ui->label->setHidden(true);
|
||||
ui->scrollAreaWidgetContents->layout()->addWidget(m_fcaw);
|
||||
}
|
||||
ui->setupUi(this);
|
||||
setContext(context);
|
||||
@@ -130,11 +140,15 @@ void SelectAutonumW::on_remove_button_clicked() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SelectAutonumW::elementFormula
|
||||
* @return element autonumbering widget formula
|
||||
* @brief SelectAutonumW::formula
|
||||
* @return autonumbering widget formula
|
||||
*/
|
||||
QString SelectAutonumW::elementFormula() {
|
||||
return m_eaw->formula();
|
||||
QString SelectAutonumW::formula() {
|
||||
if (this->parentWidget() -> objectName()=="ElementTab")
|
||||
return m_feaw->formula();
|
||||
else if (this->parentWidget() ->objectName()=="ConductorTab")
|
||||
return m_fcaw->formula();
|
||||
else return "";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -222,6 +236,8 @@ void SelectAutonumW::applyEnable(bool b) {
|
||||
}
|
||||
if (this->parentWidget() -> objectName()=="ElementTab")
|
||||
contextToFormula();
|
||||
if (this->parentWidget()->objectName()=="ConductorTab")
|
||||
contextToFormula();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -229,7 +245,12 @@ void SelectAutonumW::applyEnable(bool b) {
|
||||
* Apply formula to ElementAutonumbering Widget
|
||||
*/
|
||||
void SelectAutonumW::contextToFormula() {
|
||||
m_eaw->clearContext();
|
||||
FormulaAutonumberingW* m_faw;
|
||||
if (this->parentWidget() -> objectName()=="ElementTab")
|
||||
m_faw = m_feaw;
|
||||
if (this->parentWidget()->objectName()=="ConductorTab")
|
||||
m_faw = m_fcaw;
|
||||
m_faw->clearContext();
|
||||
int count_unit = 0;
|
||||
int count_unitf = 0;
|
||||
int count_ten = 0;
|
||||
@@ -239,54 +260,54 @@ void SelectAutonumW::contextToFormula() {
|
||||
foreach (NumPartEditorW *npe, num_part_list_) {
|
||||
if (npe->isValid()) {
|
||||
if (npe->type_ == NumPartEditorW::idfolio) {
|
||||
m_eaw->setContext("%id");
|
||||
m_faw->setContext("%id");
|
||||
}
|
||||
else if (npe->type_ == NumPartEditorW::folio) {
|
||||
m_eaw->setContext("%F");
|
||||
m_faw->setContext("%F");
|
||||
}
|
||||
else if (npe->type_ == NumPartEditorW::machine) {
|
||||
m_eaw->setContext("%M");
|
||||
m_faw->setContext("%M");
|
||||
}
|
||||
else if (npe->type_ == NumPartEditorW::locmach) {
|
||||
m_eaw->setContext("%LM");
|
||||
m_faw->setContext("%LM");
|
||||
}
|
||||
|
||||
|
||||
else if (npe->type_ == NumPartEditorW::elementcolumn) {
|
||||
m_eaw->setContext("%c");
|
||||
m_faw->setContext("%c");
|
||||
}
|
||||
else if (npe->type_ == NumPartEditorW::elementline) {
|
||||
m_eaw->setContext("%l");
|
||||
m_faw->setContext("%l");
|
||||
}
|
||||
else if (npe->type_ == NumPartEditorW::elementprefix) {
|
||||
m_eaw->setContext("%prefix");
|
||||
m_faw->setContext("%prefix");
|
||||
}
|
||||
else if (npe->type_ == NumPartEditorW::string) {
|
||||
m_eaw->setContext(npe->toNumContext().itemAt(0).at(1));
|
||||
m_faw->setContext(npe->toNumContext().itemAt(0).at(1));
|
||||
}
|
||||
else if (npe->type_ == NumPartEditorW::unit) {
|
||||
count_unit++;
|
||||
m_eaw->setContext("%sequ_"+QString::number(count_unit));
|
||||
m_faw->setContext("%sequ_"+QString::number(count_unit));
|
||||
}
|
||||
else if (npe->type_ == NumPartEditorW::unitfolio) {
|
||||
count_unitf++;
|
||||
m_eaw->setContext("%sequf_"+QString::number(count_unitf));
|
||||
m_faw->setContext("%sequf_"+QString::number(count_unitf));
|
||||
}
|
||||
else if (npe->type_ == NumPartEditorW::ten) {
|
||||
count_ten++;
|
||||
m_eaw->setContext("%seqt_"+QString::number(count_ten));
|
||||
m_faw->setContext("%seqt_"+QString::number(count_ten));
|
||||
}
|
||||
else if (npe->type_ == NumPartEditorW::tenfolio) {
|
||||
count_tenf++;
|
||||
m_eaw->setContext("%seqtf_"+QString::number(count_tenf));
|
||||
m_faw->setContext("%seqtf_"+QString::number(count_tenf));
|
||||
}
|
||||
else if (npe->type_ == NumPartEditorW::hundred) {
|
||||
count_hundred++;
|
||||
m_eaw->setContext("%seqh_"+QString::number(count_hundred));
|
||||
m_faw->setContext("%seqh_"+QString::number(count_hundred));
|
||||
}
|
||||
else if (npe->type_ == NumPartEditorW::hundredfolio) {
|
||||
count_hundredf++;
|
||||
m_eaw->setContext("%seqhf_"+QString::number(count_hundredf));
|
||||
m_faw->setContext("%seqhf_"+QString::number(count_hundredf));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,10 +20,11 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include "numerotationcontext.h"
|
||||
#include "elementautonumberingw.h"
|
||||
#include "formulaautonumberingw.h"
|
||||
|
||||
class NumPartEditorW;
|
||||
class QAbstractButton;
|
||||
class FormulaAutonumberingW;
|
||||
|
||||
namespace Ui {
|
||||
class SelectAutonumW;
|
||||
@@ -42,7 +43,7 @@ class SelectAutonumW : public QWidget
|
||||
void setContext (const NumerotationContext &context);
|
||||
NumerotationContext toNumContext() const;
|
||||
void contextToFormula ();
|
||||
QString elementFormula();
|
||||
QString formula();
|
||||
|
||||
signals:
|
||||
void applyPressed();
|
||||
@@ -65,7 +66,8 @@ class SelectAutonumW : public QWidget
|
||||
Ui::SelectAutonumW *ui;
|
||||
QList <NumPartEditorW *> num_part_list_;
|
||||
NumerotationContext m_context;
|
||||
ElementAutonumberingW *m_eaw;
|
||||
FormulaAutonumberingW *m_feaw;
|
||||
FormulaAutonumberingW *m_fcaw;
|
||||
};
|
||||
|
||||
#endif // SELECTAUTONUMW_H
|
||||
|
||||
@@ -224,7 +224,7 @@
|
||||
<string>Type</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -234,7 +234,7 @@
|
||||
<string>Valeur</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -250,7 +250,7 @@
|
||||
<string>Incrémentation</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user