Add new fild and titleblock "Function group"

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5622 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
scorpio810
2018-11-30 23:53:13 +00:00
parent 01414974a0
commit ee91337d75
26 changed files with 200 additions and 49 deletions

View File

@@ -187,6 +187,7 @@ namespace autonum
str.replace("%{auxiliary1}", dc.value("auxiliary1").toString());
str.replace("%{auxiliary2}", dc.value("auxiliary2").toString());
str.replace("%{machine-manufacturer-reference}", dc.value("machine-manufacturer-reference").toString());
str.replace("%{function-group}", dc.value("function-group").toString());
str.replace("%{location}", dc.value("location").toString());
str.replace("%{function}", dc.value("function").toString());
str.replace("%{void}", QString());
@@ -210,6 +211,7 @@ namespace autonum
m_assigned_label.replace("%id", QString::number(m_diagram->folioIndex()+1));
m_assigned_label.replace("%total", QString::number(m_diagram->border_and_titleblock.folioTotal()));
m_assigned_label.replace("%M", m_diagram -> border_and_titleblock.machine());
m_assigned_label.replace("%FG",m_diagram ->border_and_titleblock.funcgroup());
m_assigned_label.replace("%LM", m_diagram -> border_and_titleblock.locmach());
QSettings settings;
@@ -426,6 +428,9 @@ namespace autonum
else if (type == "machine") {
formula.append("%M");
}
else if (type == "funcgroup") {
formula.append("%FG");
}
else if (type == "locmach") {
formula.append("%LM");
}

View File

@@ -101,7 +101,7 @@ QStringList NumerotationContext::itemAt(const int i) const {
* @return all type use to numerotation
*/
QString NumerotationContext::validRegExpNum () const {
return ("unit|unitfolio|ten|tenfolio|hundred|hundredfolio|string|idfolio|folio|machine|locmach|elementline|elementcolumn|elementprefix");
return ("unit|unitfolio|ten|tenfolio|hundred|hundredfolio|string|idfolio|folio|machine|funcgroup|locmach|elementline|elementcolumn|elementprefix");
}
/**

View File

@@ -128,6 +128,11 @@ void NumerotationContextCommands::setNumStrategy(const QString &str) {
strategy_ = new MachineNum (diagram_);
return;
}
else if (str=="funcgroup"){
strategy_ = new FuncgroupNum (diagram_);
return;
}
else if (str=="locmach"){
strategy_ = new LocmachNum (diagram_);
return;
@@ -529,6 +534,39 @@ NumerotationContext MachineNum::previous(const NumerotationContext &nc, const in
}
/**
* Constructor
*/
FuncgroupNum::FuncgroupNum (Diagram *d):
NumStrategy (d)
{}
/**
* @brief FuncgroupNum::toRepresentedString
* @return the represented string of folio
*/
QString FuncgroupNum::toRepresentedString(const QString str) const {
Q_UNUSED(str);
return "%FG";
}
/**
* @brief FuncgroupNum::next
* @return the next NumerotationContext nc at position i
*/
NumerotationContext FuncgroupNum::next (const NumerotationContext &nc, const int i) const {
return (nextString(nc, i));
}
/**
* @brief FuncgroupNum::previous
* @return the previous NumerotationContext nc at posiiton i
*/
NumerotationContext FuncgroupNum::previous(const NumerotationContext &nc, const int i) const {
return (nextString(nc, i));
}
/**
* Constructor
*/

View File

@@ -150,6 +150,15 @@ class MachineNum: public NumStrategy
NumerotationContext previous (const NumerotationContext &, const int) const override;
};
class FuncgroupNum: public NumStrategy
{
public:
FuncgroupNum (Diagram *);
QString toRepresentedString(const QString) const override;
NumerotationContext next (const NumerotationContext &, const int) const override;
NumerotationContext previous (const NumerotationContext &, const int) const override;
};
class LocmachNum: public NumStrategy
{
public:

View File

@@ -59,6 +59,7 @@ NumPartEditorW::NumPartEditorW (NumerotationContext &context, int i, int type, Q
else if (strl.at(0)=="idfolio") setType(NumPartEditorW::idfolio);
else if (strl.at(0)=="folio") setType(NumPartEditorW::folio);
else if (strl.at(0)=="machine") setType(NumPartEditorW::machine);
else if (strl.at(0)=="funcgroup") setType(NumPartEditorW::funcgroup);
else if (strl.at(0)=="locmach") setType(NumPartEditorW::locmach);
else if (strl.at(0)=="elementline") setType(NumPartEditorW::elementline);
else if (strl.at(0)=="elementcolumn") setType(NumPartEditorW::elementcolumn);
@@ -91,12 +92,12 @@ void NumPartEditorW::setVisibleItems()
{
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") << tr("Machine") << tr("Locmach");
<< tr("Texte") << tr("N° folio") << tr("Folio") << tr("Machine") << tr("Funcgroup") << tr("Locmach");
}
else
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") << tr("Machine") << tr("Locmach")
<< tr("Texte") << tr("N° folio") << tr("Folio") << tr("Machine") << tr("Funcgroup") << tr("Locmach")
<< tr("Element Line") << tr("Element Column") << tr("Element Prefix");
ui->type_cb->insertItems(0,items);
}
@@ -139,6 +140,9 @@ NumerotationContext NumPartEditorW::toNumContext() {
case machine:
type_str = "machine";
break;
case funcgroup:
type_str = "funcgroup";
break;
case locmach:
type_str = "locmach";
break;
@@ -164,7 +168,7 @@ NumerotationContext NumPartEditorW::toNumContext() {
* @return true if value field isn't empty or if type is folio
*/
bool NumPartEditorW::isValid() {
if (type_ == folio || type_ == idfolio || type_ == elementline || type_ == machine || type_ == locmach ||
if (type_ == folio || type_ == idfolio || type_ == elementline || type_ == machine || type_ == funcgroup || type_ == locmach ||
type_ == elementcolumn || type_ == elementprefix) {return true;}
else if(ui -> value_field -> text().isEmpty()) {return false;}
else return true;
@@ -195,6 +199,8 @@ void NumPartEditorW::on_type_cb_activated(int) {
setType(folio);
else if (ui->type_cb->currentText() == tr("Machine"))
setType(machine);
else if (ui->type_cb->currentText() == tr("Funcgroup"))
setType(funcgroup);
else if (ui->type_cb->currentText() == tr("Locmach"))
setType(locmach);
else if (ui->type_cb->currentText() == tr("Element Line"))
@@ -234,7 +240,7 @@ void NumPartEditorW::setType(NumPartEditorW::type t, bool fnum) {
//if @t is a numeric type and preview type @type_ isn't a numeric type
//or @fnum is true, we set numeric behavior
if ( ((t==unit || t==unitfolio || t==ten || t==tenfolio || t==hundred || t==hundredfolio) &&
(type_==string || type_==folio || type_==machine || type_==locmach ||type_==idfolio ||
(type_==string || type_==folio || type_==machine || type_ ==funcgroup || type_==locmach ||type_==idfolio ||
type_==elementcolumn || type_==elementline || type_==elementprefix))
|| fnum) {
ui -> value_field -> clear();
@@ -244,7 +250,7 @@ void NumPartEditorW::setType(NumPartEditorW::type t, bool fnum) {
ui -> increase_spinBox -> setValue(1);
}
//@t isn't a numeric type
else if (t == string || t == folio || t == idfolio || t == elementline || t == machine || t == locmach ||
else if (t == string || t == folio || t == idfolio || t == elementline || t == machine || t == funcgroup ||t == locmach ||
t == elementcolumn || t == elementprefix) {
ui -> value_field -> clear();
ui -> increase_spinBox -> setDisabled(true);
@@ -260,6 +266,12 @@ void NumPartEditorW::setType(NumPartEditorW::type t, bool fnum) {
ui -> value_field -> setDisabled(true);
ui -> increase_spinBox -> setDisabled(true);
}
else if (t==funcgroup) {
ui -> value_field -> setDisabled(true);
ui -> increase_spinBox -> setDisabled(true);
}
else if (t==locmach) {
ui -> value_field -> setDisabled(true);
ui -> increase_spinBox -> setDisabled(true);
@@ -311,6 +323,8 @@ void NumPartEditorW::setCurrentIndex(NumPartEditorW::type t) {
i = ui->type_cb->findText(tr("Folio"));
else if (t == machine)
i = ui->type_cb->findText(tr("Machine"));
else if (t == funcgroup)
i = ui->type_cb->findText(tr("Funcgroup"));
else if (t == locmach)
i = ui->type_cb->findText(tr("Locmach"));
else if (t == elementline)

View File

@@ -42,7 +42,7 @@ class NumPartEditorW : public QWidget
~NumPartEditorW() override;
enum type {unit,unitfolio,ten,tenfolio, hundred, hundredfolio,
string,idfolio,folio,machine,locmach,
string,idfolio,folio,machine,funcgroup,locmach,
elementline,elementcolumn,elementprefix,
};
NumerotationContext toNumContext();