mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 05:00:33 +01:00
Creation of folio sequential type for Element Autonumbering. Correction of autonumbering type handling in numparteditorw.cpp
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4592 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -92,14 +92,26 @@ void NumerotationContextCommands::setNumStrategy(const QString &str) {
|
||||
strategy_ = new UnitNum(diagram_);
|
||||
return;
|
||||
}
|
||||
else if (str == "unitfolio") {
|
||||
strategy_ = new UnitFNum (diagram_);
|
||||
return;
|
||||
}
|
||||
else if (str == "ten") {
|
||||
strategy_ = new TenNum (diagram_);
|
||||
return;
|
||||
}
|
||||
else if (str == "tenfolio") {
|
||||
strategy_ = new TenFNum (diagram_);
|
||||
return;
|
||||
}
|
||||
else if (str == "hundred") {
|
||||
strategy_ = new HundredNum (diagram_);
|
||||
return;
|
||||
}
|
||||
else if (str == "hundredfolio") {
|
||||
strategy_ = new HundredFNum (diagram_);
|
||||
return;
|
||||
}
|
||||
else if (str == "string") {
|
||||
strategy_ = new StringNum (diagram_);
|
||||
return;
|
||||
@@ -156,7 +168,7 @@ NumerotationContext NumStrategy::nextNumber (const NumerotationContext &nc, cons
|
||||
QStringList strl = nc.itemAt(i);
|
||||
NumerotationContext newnc;
|
||||
QString value = QString::number( (strl.at(1).toInt()) + (strl.at(2).toInt()) );
|
||||
newnc.addValue(strl.at(0), value, strl.at(2).toInt());
|
||||
newnc.addValue(strl.at(0), value, strl.at(2).toInt(), strl.at(3).toInt());
|
||||
return (newnc);
|
||||
}
|
||||
|
||||
@@ -168,7 +180,7 @@ NumerotationContext NumStrategy::previousNumber(const NumerotationContext &nc, c
|
||||
QStringList strl = nc.itemAt(i);
|
||||
NumerotationContext newnc;
|
||||
QString value = QString::number( (strl.at(1).toInt()) - (strl.at(2).toInt()) );
|
||||
newnc.addValue(strl.at(0), value, strl.at(2).toInt());
|
||||
newnc.addValue(strl.at(0), value, strl.at(2).toInt(), strl.at(3).toInt());
|
||||
return (newnc);
|
||||
}
|
||||
|
||||
@@ -203,6 +215,37 @@ NumerotationContext UnitNum::previous(const NumerotationContext &nc, const int i
|
||||
return (previousNumber(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
UnitFNum::UnitFNum(Diagram *d):
|
||||
NumStrategy(d)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief UnitFNum::toRepresentedString
|
||||
* @return the represented string of num
|
||||
*/
|
||||
QString UnitFNum::toRepresentedString(const QString num) const {
|
||||
return (num);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief UnitFNum::next
|
||||
* @return the next NumerotationContext nc at position i
|
||||
*/
|
||||
NumerotationContext UnitFNum::next (const NumerotationContext &nc, const int i) const {
|
||||
return (nextNumber(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief UnitFNum::previous
|
||||
* @return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
NumerotationContext UnitFNum::previous(const NumerotationContext &nc, const int i) const {
|
||||
return (previousNumber(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@@ -237,6 +280,41 @@ NumerotationContext TenNum::previous(const NumerotationContext &nc, const int i)
|
||||
return (previousNumber(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
TenFNum::TenFNum (Diagram *d):
|
||||
NumStrategy (d)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief TenFNum::toRepresentedString
|
||||
* @return the represented string of num
|
||||
*/
|
||||
QString TenFNum::toRepresentedString(const QString num) const {
|
||||
int numint = num.toInt();
|
||||
QString numstr = num;
|
||||
if (numint<10) numstr.prepend("0");
|
||||
return (numstr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TenFNum::next
|
||||
* @return the next NumerotationContext nc at position i
|
||||
*/
|
||||
NumerotationContext TenFNum::next (const NumerotationContext &nc, const int i) const {
|
||||
return (nextNumber(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TenFNum::previous
|
||||
* @return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
NumerotationContext TenFNum::previous(const NumerotationContext &nc, const int i) const {
|
||||
return (previousNumber(nc, i));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@@ -276,6 +354,45 @@ NumerotationContext HundredNum::previous(const NumerotationContext &nc, const in
|
||||
return (previousNumber(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
HundredFNum::HundredFNum (Diagram *d):
|
||||
NumStrategy (d)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief HundredFNum::toRepresentedString
|
||||
* @return the represented string of num
|
||||
*/
|
||||
QString HundredFNum::toRepresentedString(const QString num) const {
|
||||
int numint = num.toInt();
|
||||
QString numstr = num;
|
||||
if (numint<100) {
|
||||
if (numint<10) {
|
||||
numstr.prepend("00");
|
||||
}
|
||||
else numstr.prepend("0");
|
||||
}
|
||||
return (numstr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief HundredFNum::next
|
||||
* @return the next NumerotationContext nc at position i
|
||||
*/
|
||||
NumerotationContext HundredFNum::next (const NumerotationContext &nc, const int i) const {
|
||||
return (nextNumber(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief HundredFNum::previous
|
||||
* @return the previous NumerotationContext nc at posiiton i
|
||||
*/
|
||||
NumerotationContext HundredFNum::previous(const NumerotationContext &nc, const int i) const {
|
||||
return (previousNumber(nc, i));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@@ -352,7 +469,7 @@ FolioNum::FolioNum (Diagram *d):
|
||||
*/
|
||||
QString FolioNum::toRepresentedString(const QString str) const {
|
||||
Q_UNUSED(str);
|
||||
return (diagram_->border_and_titleblock.folio());
|
||||
return ("%F");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user