mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +01:00
New fields titleblock properties %machine and %locmach can now be called
in the element rules autonum git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4628 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -99,7 +99,7 @@ QStringList NumerotationContext::itemAt(const int i) const {
|
|||||||
* @return all type use to numerotation
|
* @return all type use to numerotation
|
||||||
*/
|
*/
|
||||||
QString NumerotationContext::validRegExpNum () const {
|
QString NumerotationContext::validRegExpNum () const {
|
||||||
return ("unit|unitfolio|ten|hundred|string|idfolio|folio|elementline|elementcolumn|elementprefix");
|
return ("unit|unitfolio|ten|hundred|string|idfolio|folio|machine|locmach|elementline|elementcolumn|elementprefix");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -124,6 +124,14 @@ void NumerotationContextCommands::setNumStrategy(const QString &str) {
|
|||||||
strategy_ = new FolioNum (diagram_);
|
strategy_ = new FolioNum (diagram_);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (str=="machine"){
|
||||||
|
strategy_ = new MachineNum (diagram_);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (str=="locmach"){
|
||||||
|
strategy_ = new LocmachNum (diagram_);
|
||||||
|
return;
|
||||||
|
}
|
||||||
else if (str=="elementline"){
|
else if (str=="elementline"){
|
||||||
strategy_ = new ElementLineNum (diagram_);
|
strategy_ = new ElementLineNum (diagram_);
|
||||||
return;
|
return;
|
||||||
@@ -488,6 +496,72 @@ NumerotationContext FolioNum::previous(const NumerotationContext &nc, const int
|
|||||||
return (nextString(nc, i));
|
return (nextString(nc, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
MachineNum::MachineNum (Diagram *d):
|
||||||
|
NumStrategy (d)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief MachineNum::toRepresentedString
|
||||||
|
* @return the represented string of folio
|
||||||
|
*/
|
||||||
|
QString MachineNum::toRepresentedString(const QString str) const {
|
||||||
|
Q_UNUSED(str);
|
||||||
|
return "%M";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief MachineNum::next
|
||||||
|
* @return the next NumerotationContext nc at position i
|
||||||
|
*/
|
||||||
|
NumerotationContext MachineNum::next (const NumerotationContext &nc, const int i) const {
|
||||||
|
return (nextString(nc, i));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief MachineNum::previous
|
||||||
|
* @return the previous NumerotationContext nc at posiiton i
|
||||||
|
*/
|
||||||
|
NumerotationContext MachineNum::previous(const NumerotationContext &nc, const int i) const {
|
||||||
|
return (nextString(nc, i));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
LocmachNum::LocmachNum (Diagram *d):
|
||||||
|
NumStrategy (d)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief LocmachNum::toRepresentedString
|
||||||
|
* @return the represented string of folio
|
||||||
|
*/
|
||||||
|
QString LocmachNum::toRepresentedString(const QString str) const {
|
||||||
|
Q_UNUSED(str);
|
||||||
|
return "%LM";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief LocmachNum::next
|
||||||
|
* @return the next NumerotationContext nc at position i
|
||||||
|
*/
|
||||||
|
NumerotationContext LocmachNum::next (const NumerotationContext &nc, const int i) const {
|
||||||
|
return (nextString(nc, i));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief LocmachNum::previous
|
||||||
|
* @return the previous NumerotationContext nc at posiiton i
|
||||||
|
*/
|
||||||
|
NumerotationContext LocmachNum::previous(const NumerotationContext &nc, const int i) const {
|
||||||
|
return (nextString(nc, i));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -141,6 +141,25 @@ class FolioNum: public NumStrategy
|
|||||||
NumerotationContext previous (const NumerotationContext &, const int) const;
|
NumerotationContext previous (const NumerotationContext &, const int) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MachineNum: public NumStrategy
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MachineNum (Diagram *);
|
||||||
|
QString toRepresentedString(const QString) const;
|
||||||
|
NumerotationContext next (const NumerotationContext &, const int) const;
|
||||||
|
NumerotationContext previous (const NumerotationContext &, const int) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
class LocmachNum: public NumStrategy
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LocmachNum (Diagram *);
|
||||||
|
QString toRepresentedString(const QString) const;
|
||||||
|
NumerotationContext next (const NumerotationContext &, const int) const;
|
||||||
|
NumerotationContext previous (const NumerotationContext &, const int) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class ElementLineNum: public NumStrategy
|
class ElementLineNum: public NumStrategy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -754,6 +754,8 @@ QString Element::assignVariables(QString label, Element *elmt){
|
|||||||
//Default Variables
|
//Default Variables
|
||||||
label.replace("%f", QString::number(elmt->diagram()->folioIndex()+1));
|
label.replace("%f", QString::number(elmt->diagram()->folioIndex()+1));
|
||||||
label.replace("%F", elmt->diagram() -> border_and_titleblock.folio());
|
label.replace("%F", elmt->diagram() -> border_and_titleblock.folio());
|
||||||
|
label.replace("%M", elmt->diagram() -> border_and_titleblock.machine());
|
||||||
|
label.replace("%LM", elmt->diagram() -> border_and_titleblock.locmach());
|
||||||
label.replace("%c", QString::number(elmt->diagram() -> convertPosition(elmt -> scenePos()).number()));
|
label.replace("%c", QString::number(elmt->diagram() -> convertPosition(elmt -> scenePos()).number()));
|
||||||
label.replace("%l", elmt->diagram() -> convertPosition(elmt -> scenePos()).letter());
|
label.replace("%l", elmt->diagram() -> convertPosition(elmt -> scenePos()).letter());
|
||||||
label.replace("%id", QString::number(elmt->diagram()->folioIndex()+1));
|
label.replace("%id", QString::number(elmt->diagram()->folioIndex()+1));
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>383</width>
|
<width>383</width>
|
||||||
<height>305</height>
|
<height>357</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@@ -88,6 +88,8 @@
|
|||||||
-%c: Element Column
|
-%c: Element Column
|
||||||
-%F: Folio Name
|
-%F: Folio Name
|
||||||
-%f or %id: Folio ID
|
-%f or %id: Folio ID
|
||||||
|
-%M: Machine (Plant)
|
||||||
|
-%LM: Location
|
||||||
-%total: Total of folios
|
-%total: Total of folios
|
||||||
You can also assign any other titleblock variable
|
You can also assign any other titleblock variable
|
||||||
that you create. Text and number inputs are
|
that you create. Text and number inputs are
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ NumPartEditorW::NumPartEditorW (NumerotationContext &context, int i, QWidget *pa
|
|||||||
else if (strl.at(0)=="string") setType(NumPartEditorW::string);
|
else if (strl.at(0)=="string") setType(NumPartEditorW::string);
|
||||||
else if (strl.at(0)=="idfolio") setType(NumPartEditorW::idfolio);
|
else if (strl.at(0)=="idfolio") setType(NumPartEditorW::idfolio);
|
||||||
else if (strl.at(0)=="folio") setType(NumPartEditorW::folio);
|
else if (strl.at(0)=="folio") setType(NumPartEditorW::folio);
|
||||||
|
else if (strl.at(0)=="machine") setType(NumPartEditorW::machine);
|
||||||
|
else if (strl.at(0)=="locmach") setType(NumPartEditorW::locmach);
|
||||||
else if (strl.at(0)=="elementline") setType(NumPartEditorW::elementline);
|
else if (strl.at(0)=="elementline") setType(NumPartEditorW::elementline);
|
||||||
else if (strl.at(0)=="elementcolumn") setType(NumPartEditorW::elementcolumn);
|
else if (strl.at(0)=="elementcolumn") setType(NumPartEditorW::elementcolumn);
|
||||||
else if (strl.at(0)=="elementprefix") setType(NumPartEditorW::elementprefix);
|
else if (strl.at(0)=="elementprefix") setType(NumPartEditorW::elementprefix);
|
||||||
@@ -89,7 +91,7 @@ void NumPartEditorW::setVisibleItems() {
|
|||||||
else
|
else
|
||||||
items << tr("Chiffre 1") << tr("Chiffre 1 - Folio") << tr("Chiffre 01")
|
items << tr("Chiffre 1") << tr("Chiffre 1 - Folio") << tr("Chiffre 01")
|
||||||
<< tr("Chiffre 01 - Folio") << tr("Chiffre 001") << tr("Chiffre 001 - Folio")
|
<< tr("Chiffre 01 - Folio") << tr("Chiffre 001") << tr("Chiffre 001 - Folio")
|
||||||
<< tr("Texte") << tr("N° folio") << tr("Folio")
|
<< tr("Texte") << tr("N° folio") << tr("Folio") << tr("Machine") << tr("Locmach")
|
||||||
<< tr("Element Line") << tr("Element Column") << tr("Element Prefix");
|
<< tr("Element Line") << tr("Element Column") << tr("Element Prefix");
|
||||||
ui->type_cb->insertItems(0,items);
|
ui->type_cb->insertItems(0,items);
|
||||||
}
|
}
|
||||||
@@ -129,6 +131,12 @@ NumerotationContext NumPartEditorW::toNumContext() {
|
|||||||
case folio:
|
case folio:
|
||||||
type_str = "folio";
|
type_str = "folio";
|
||||||
break;
|
break;
|
||||||
|
case machine:
|
||||||
|
type_str = "machine";
|
||||||
|
break;
|
||||||
|
case locmach:
|
||||||
|
type_str = "locmach";
|
||||||
|
break;
|
||||||
case elementline:
|
case elementline:
|
||||||
type_str = "elementline";
|
type_str = "elementline";
|
||||||
break;
|
break;
|
||||||
@@ -151,7 +159,7 @@ NumerotationContext NumPartEditorW::toNumContext() {
|
|||||||
* @return true if value field isn't empty or if type is folio
|
* @return true if value field isn't empty or if type is folio
|
||||||
*/
|
*/
|
||||||
bool NumPartEditorW::isValid() {
|
bool NumPartEditorW::isValid() {
|
||||||
if (type_ == folio || type_ == idfolio || type_ == elementline ||
|
if (type_ == folio || type_ == idfolio || type_ == elementline || type_ == machine || type_ == locmach ||
|
||||||
type_ == elementcolumn || type_ == elementprefix) {return true;}
|
type_ == elementcolumn || type_ == elementprefix) {return true;}
|
||||||
else if(ui -> value_field -> text().isEmpty()) {return false;}
|
else if(ui -> value_field -> text().isEmpty()) {return false;}
|
||||||
else return true;
|
else return true;
|
||||||
@@ -180,6 +188,10 @@ void NumPartEditorW::on_type_cb_activated(int) {
|
|||||||
setType(idfolio);
|
setType(idfolio);
|
||||||
else if (ui->type_cb->currentText() == tr("Folio"))
|
else if (ui->type_cb->currentText() == tr("Folio"))
|
||||||
setType(folio);
|
setType(folio);
|
||||||
|
else if (ui->type_cb->currentText() == tr("Machine"))
|
||||||
|
setType(machine);
|
||||||
|
else if (ui->type_cb->currentText() == tr("Locmach"))
|
||||||
|
setType(locmach);
|
||||||
else if (ui->type_cb->currentText() == tr("Element Line"))
|
else if (ui->type_cb->currentText() == tr("Element Line"))
|
||||||
setType(elementline);
|
setType(elementline);
|
||||||
else if (ui->type_cb->currentText() == tr("Element Column"))
|
else if (ui->type_cb->currentText() == tr("Element Column"))
|
||||||
@@ -217,7 +229,7 @@ void NumPartEditorW::setType(NumPartEditorW::type t, bool fnum) {
|
|||||||
//if @t is a numeric type and preview type @type_ isn't a numeric type
|
//if @t is a numeric type and preview type @type_ isn't a numeric type
|
||||||
//or @fnum is true, we set numeric behavior
|
//or @fnum is true, we set numeric behavior
|
||||||
if ( ((t==unit || t==unitfolio || t==ten || t==tenfolio || t==hundred || t==hundredfolio) &&
|
if ( ((t==unit || t==unitfolio || t==ten || t==tenfolio || t==hundred || t==hundredfolio) &&
|
||||||
(type_==string || type_==folio || type_==idfolio ||
|
(type_==string || type_==folio || type_==machine || type_==locmach ||type_==idfolio ||
|
||||||
type_==elementcolumn || type_==elementline || type_==elementprefix))
|
type_==elementcolumn || type_==elementline || type_==elementprefix))
|
||||||
|| fnum) {
|
|| fnum) {
|
||||||
ui -> value_field -> clear();
|
ui -> value_field -> clear();
|
||||||
@@ -227,7 +239,7 @@ void NumPartEditorW::setType(NumPartEditorW::type t, bool fnum) {
|
|||||||
ui -> increase_spinBox -> setValue(1);
|
ui -> increase_spinBox -> setValue(1);
|
||||||
}
|
}
|
||||||
//@t isn't a numeric type
|
//@t isn't a numeric type
|
||||||
else if (t == string || t == folio || t == idfolio || t == elementline ||
|
else if (t == string || t == folio || t == idfolio || t == elementline || t == machine || t == locmach ||
|
||||||
t == elementcolumn || t == elementprefix) {
|
t == elementcolumn || t == elementprefix) {
|
||||||
ui -> value_field -> clear();
|
ui -> value_field -> clear();
|
||||||
ui -> increase_spinBox -> setDisabled(true);
|
ui -> increase_spinBox -> setDisabled(true);
|
||||||
@@ -239,6 +251,14 @@ void NumPartEditorW::setType(NumPartEditorW::type t, bool fnum) {
|
|||||||
ui -> value_field -> setDisabled(true);
|
ui -> value_field -> setDisabled(true);
|
||||||
ui -> increase_spinBox -> setDisabled(true);
|
ui -> increase_spinBox -> setDisabled(true);
|
||||||
}
|
}
|
||||||
|
else if (t==machine) {
|
||||||
|
ui -> value_field -> setDisabled(true);
|
||||||
|
ui -> increase_spinBox -> setDisabled(true);
|
||||||
|
}
|
||||||
|
else if (t==locmach) {
|
||||||
|
ui -> value_field -> setDisabled(true);
|
||||||
|
ui -> increase_spinBox -> setDisabled(true);
|
||||||
|
}
|
||||||
else if (t==idfolio) {
|
else if (t==idfolio) {
|
||||||
ui -> value_field -> setDisabled(true);
|
ui -> value_field -> setDisabled(true);
|
||||||
ui -> increase_spinBox -> setDisabled(true);
|
ui -> increase_spinBox -> setDisabled(true);
|
||||||
@@ -284,8 +304,12 @@ void NumPartEditorW::setCurrentIndex(NumPartEditorW::type t) {
|
|||||||
i = ui->type_cb->findText(tr("N° folio"));
|
i = ui->type_cb->findText(tr("N° folio"));
|
||||||
else if (t == folio)
|
else if (t == folio)
|
||||||
i = ui->type_cb->findText(tr("Folio"));
|
i = ui->type_cb->findText(tr("Folio"));
|
||||||
|
else if (t == machine)
|
||||||
|
i = ui->type_cb->findText(tr("Machine"));
|
||||||
|
else if (t == locmach)
|
||||||
|
i = ui->type_cb->findText(tr("Locmach"));
|
||||||
else if (t == elementline)
|
else if (t == elementline)
|
||||||
i = ui->type_cb->findText(tr("Element Line"));
|
i = ui->type_cb->findText(tr("Element Line"));
|
||||||
else if (t == elementcolumn)
|
else if (t == elementcolumn)
|
||||||
i = ui->type_cb->findText(tr("Element Column"));
|
i = ui->type_cb->findText(tr("Element Column"));
|
||||||
else if (t == elementprefix)
|
else if (t == elementprefix)
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class NumPartEditorW : public QWidget
|
|||||||
~NumPartEditorW();
|
~NumPartEditorW();
|
||||||
|
|
||||||
enum type {unit,unitfolio,ten,tenfolio, hundred, hundredfolio,
|
enum type {unit,unitfolio,ten,tenfolio, hundred, hundredfolio,
|
||||||
string,idfolio,folio,
|
string,idfolio,folio,machine,locmach,
|
||||||
elementline,elementcolumn,elementprefix,
|
elementline,elementcolumn,elementprefix,
|
||||||
};
|
};
|
||||||
NumerotationContext toNumContext();
|
NumerotationContext toNumContext();
|
||||||
|
|||||||
@@ -244,6 +244,14 @@ void SelectAutonumW::contextToFormula() {
|
|||||||
else if (npe->type_ == NumPartEditorW::folio) {
|
else if (npe->type_ == NumPartEditorW::folio) {
|
||||||
m_eaw->setContext("%F");
|
m_eaw->setContext("%F");
|
||||||
}
|
}
|
||||||
|
else if (npe->type_ == NumPartEditorW::machine) {
|
||||||
|
m_eaw->setContext("%M");
|
||||||
|
}
|
||||||
|
else if (npe->type_ == NumPartEditorW::locmach) {
|
||||||
|
m_eaw->setContext("%LM");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
else if (npe->type_ == NumPartEditorW::elementcolumn) {
|
else if (npe->type_ == NumPartEditorW::elementcolumn) {
|
||||||
m_eaw->setContext("%c");
|
m_eaw->setContext("%c");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user