diff --git a/sources/conductorautonumerotation.cpp b/sources/conductorautonumerotation.cpp
index 4aabf5c19..c2411cadf 100644
--- a/sources/conductorautonumerotation.cpp
+++ b/sources/conductorautonumerotation.cpp
@@ -134,7 +134,7 @@ void ConductorAutoNumerotation::numerateNewConductor() {
if (!conductor_ || m_diagram->conductorsAutonumName().isEmpty()) return;
QString name = m_diagram -> conductorsAutonumName();
- NumerotationContextCommands ncc (m_diagram, m_diagram->project()->conductorAutoNum(name));
+ NumerotationContextCommands ncc (m_diagram->project()->conductorAutoNum(name), m_diagram);
applyText(ncc.toRepresentedString());
m_diagram->project()->addConductorAutoNum(name, ncc.next());
}
diff --git a/sources/numerotationcontextcommands.cpp b/sources/numerotationcontextcommands.cpp
index 01ded0454..843dbb7f5 100644
--- a/sources/numerotationcontextcommands.cpp
+++ b/sources/numerotationcontextcommands.cpp
@@ -16,11 +16,12 @@
along with QElectroTech. If not, see .
*/
#include "numerotationcontextcommands.h"
+#include "diagram.h"
/**
* @brief Constructor
*/
-NumerotationContextCommands::NumerotationContextCommands(Diagram *d, const NumerotationContext &nc):
+NumerotationContextCommands::NumerotationContextCommands(const NumerotationContext &nc, Diagram *d):
diagram_ (d),
context_ (nc),
strategy_ (NULL)
@@ -48,6 +49,21 @@ NumerotationContext NumerotationContextCommands::next() {
return contextnum;
}
+/**
+ * @brief NumerotationContextCommands::previous
+ * @return the previous numerotation context
+ */
+NumerotationContext NumerotationContextCommands::previous() {
+ NumerotationContext contextnum;
+
+ for (int i=0; i previous(context_, i);
+ }
+ return contextnum;
+}
+
/**
* @brief NumerotationContextCommands::toFinalString
* @return the string represented by the numerotation context
@@ -62,7 +78,8 @@ QString NumerotationContextCommands::toRepresentedString() {
}
return num;
}
- return (diagram_ -> defaultConductorProperties.text);
+ if (diagram_) return (diagram_ -> defaultConductorProperties.text);
+ return QString();
}
/**
@@ -127,6 +144,18 @@ NumerotationContext NumStrategy::nextNumber (const NumerotationContext &nc, cons
return (newnc);
}
+/**
+ * @brief NumStrategy::previousNumber
+ * @return the previous value of @nc at position @i
+ */
+NumerotationContext NumStrategy::previousNumber(const NumerotationContext &nc, const int i) const {
+ 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());
+ return (newnc);
+}
+
/**
* Constructor
*/
@@ -150,6 +179,14 @@ NumerotationContext UnitNum::next (const NumerotationContext &nc, const int i) c
return (nextNumber(nc, i));
}
+/**
+ * @brief UnitNum::previous
+ * @return the previous NumerotationContext nc at posiiton i
+ */
+NumerotationContext UnitNum::previous(const NumerotationContext &nc, const int i) const {
+ return (previousNumber(nc, i));
+}
+
/**
* Constructor
*/
@@ -176,6 +213,14 @@ NumerotationContext TenNum::next (const NumerotationContext &nc, const int i) co
return (nextNumber(nc, i));
}
+/**
+ * @brief TenNum::previous
+ * @return the previous NumerotationContext nc at posiiton i
+ */
+NumerotationContext TenNum::previous(const NumerotationContext &nc, const int i) const {
+ return (previousNumber(nc, i));
+}
+
/**
* Constructor
*/
@@ -207,6 +252,14 @@ NumerotationContext HundredNum::next (const NumerotationContext &nc, const int i
return (nextNumber(nc, i));
}
+/**
+ * @brief HundredNum::previous
+ * @return the previous NumerotationContext nc at posiiton i
+ */
+NumerotationContext HundredNum::previous(const NumerotationContext &nc, const int i) const {
+ return (previousNumber(nc, i));
+}
+
/**
* Constructor
*/
@@ -230,6 +283,14 @@ NumerotationContext StringNum::next (const NumerotationContext &nc, const int i)
return (nextString(nc, i));
}
+/**
+ * @brief StringNum::previous
+ * @return the previous NumerotationContext nc at posiiton i
+ */
+NumerotationContext StringNum::previous(const NumerotationContext &nc, const int i) const {
+ return (nextString(nc, i));
+}
+
/**
* Constructor
@@ -255,3 +316,11 @@ NumerotationContext FolioNum::next (const NumerotationContext &nc, const int i)
return (nextString(nc, i));
}
+/**
+ * @brief FolioNum::previous
+ * @return the previous NumerotationContext nc at posiiton i
+ */
+NumerotationContext FolioNum::previous(const NumerotationContext &nc, const int i) const {
+ return (nextString(nc, i));
+}
+
diff --git a/sources/numerotationcontextcommands.h b/sources/numerotationcontextcommands.h
index 2eb5b14fb..993c371e9 100644
--- a/sources/numerotationcontextcommands.h
+++ b/sources/numerotationcontextcommands.h
@@ -19,9 +19,9 @@
#define NUMEROTATIONCONTEXTCOMMANDS_H
#include "numerotationcontext.h"
-#include "diagram.h"
class NumStrategy;
+class Diagram;
/**
* this class provide methods to handle content of NumerotationContext.
@@ -29,9 +29,10 @@ class NumStrategy;
class NumerotationContextCommands
{
public:
- NumerotationContextCommands (Diagram *, const NumerotationContext &);
+ NumerotationContextCommands (const NumerotationContext &, Diagram * = nullptr);
~NumerotationContextCommands ();
NumerotationContext next ();
+ NumerotationContext previous ();
QString toRepresentedString ();
private:
@@ -45,14 +46,16 @@ class NumerotationContextCommands
class NumStrategy
{
public:
- NumStrategy (Diagram *);
+ NumStrategy (Diagram * = nullptr);
virtual ~NumStrategy ();
virtual QString toRepresentedString (const QString) const = 0;
- virtual NumerotationContext next (const NumerotationContext &, const int) const = 0;
+ virtual NumerotationContext next (const NumerotationContext &, const int) const = 0;
+ virtual NumerotationContext previous (const NumerotationContext &, const int) const = 0;
protected:
NumerotationContext nextString (const NumerotationContext &, const int) const;
NumerotationContext nextNumber (const NumerotationContext &, const int) const;
+ NumerotationContext previousNumber (const NumerotationContext &, const int) const;
Diagram *diagram_;
};
@@ -62,7 +65,8 @@ class UnitNum: public NumStrategy
public:
UnitNum (Diagram *);
QString toRepresentedString(const QString) const;
- NumerotationContext next (const NumerotationContext &, const int) const;
+ NumerotationContext next (const NumerotationContext &, const int) const;
+ NumerotationContext previous (const NumerotationContext &, const int) const;
};
class TenNum: public NumStrategy
@@ -70,7 +74,8 @@ class TenNum: public NumStrategy
public:
TenNum (Diagram *);
QString toRepresentedString(const QString) const;
- NumerotationContext next (const NumerotationContext &, const int) const;
+ NumerotationContext next (const NumerotationContext &, const int) const;
+ NumerotationContext previous (const NumerotationContext &, const int) const;
};
class HundredNum: public NumStrategy
@@ -78,7 +83,8 @@ class HundredNum: public NumStrategy
public:
HundredNum (Diagram *);
QString toRepresentedString(const QString) const;
- NumerotationContext next (const NumerotationContext &, const int) const;
+ NumerotationContext next (const NumerotationContext &, const int) const;
+ NumerotationContext previous (const NumerotationContext &, const int) const;
};
class StringNum: public NumStrategy
@@ -86,7 +92,8 @@ class StringNum: public NumStrategy
public:
StringNum (Diagram *);
QString toRepresentedString(const QString) const;
- NumerotationContext next (const NumerotationContext &, const int) const;
+ NumerotationContext next (const NumerotationContext &, const int) const;
+ NumerotationContext previous (const NumerotationContext &, const int) const;
};
class FolioNum: public NumStrategy
@@ -94,7 +101,8 @@ class FolioNum: public NumStrategy
public:
FolioNum (Diagram *);
QString toRepresentedString(const QString) const;
- NumerotationContext next (const NumerotationContext &, const int) const;
+ NumerotationContext next (const NumerotationContext &, const int) const;
+ NumerotationContext previous (const NumerotationContext &, const int) const;
};
#endif // NUMEROTATIONCONTEXTCOMMANDS_H
diff --git a/sources/ui/numparteditorw.ui b/sources/ui/numparteditorw.ui
index a5c858052..a5ff122d9 100644
--- a/sources/ui/numparteditorw.ui
+++ b/sources/ui/numparteditorw.ui
@@ -6,99 +6,101 @@
0
0
- 400
- 300
+ 259
+ 42
Form
+
+ 0
+
+
+ 0
+
-
-
+
+
+
+ 0
+ 0
+
+
-
-
-
-
- 0
- 0
-
-
-
-
-
- Chiffre 1
-
-
- -
-
- Chiffre 01
-
-
- -
-
- Chiffre 001
-
-
- -
-
- Texte
-
-
- -
-
- N° folio
-
-
-
+
+ Chiffre 1
+
-
-
-
-
- 0
- 0
-
-
-
+
+ Chiffre 01
+
-
-
-
- true
-
-
-
- 0
- 0
-
-
-
-
- 0
- 0
-
-
-
- false
-
-
- Qt::AlignCenter
-
-
-
-
-
- true
-
-
-
-
-
- 1
-
-
+
+ Chiffre 001
+
-
+ -
+
+ Texte
+
+
+ -
+
+ N° folio
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 0
+
+
+
+ false
+
+
+ Qt::AlignCenter
+
+
+
+
+
+ true
+
+
+
+
+
+ 1
+
+
diff --git a/sources/ui/selectautonumw.cpp b/sources/ui/selectautonumw.cpp
index 44c0aceb1..a22317284 100644
--- a/sources/ui/selectautonumw.cpp
+++ b/sources/ui/selectautonumw.cpp
@@ -20,6 +20,7 @@
#include "numparteditorw.h"
#include
#include "qdebug.h"
+#include "numerotationcontextcommands.h"
/**
* Constructor
@@ -134,7 +135,6 @@ void SelectAutonumW::on_buttonBox_clicked(QAbstractButton *button) {
case QDialogButtonBox::HelpRole:
QMessageBox::information (this, tr("Autonum\351rotation", "title window"),
tr("C'est ici que vous pouvez d\351finir la mani\350re dont sera num\351rot\351 les nouveaux conducteurs.\n"
- "-Chaque Folio poss\350de sa propre m\351thode de num\351rotation.\n"
"-Une num\351rotation est compos\351e d'une variable minimum.\n"
"-Vous pouvez ajouter ou supprimer une variable de num\351rotation par le biais des boutons - et +.\n"
"-Une variable de num\351rotation comprant: un type, une valeur et une incr\351mentation.\n"
@@ -171,3 +171,21 @@ void SelectAutonumW::applyEnable(bool b) {
else
ui -> buttonBox -> button(QDialogButtonBox::Apply) -> setEnabled(b);
}
+
+/**
+ * @brief SelectAutonumW::on_m_next_pb_clicked
+ * Increase NumerotationContext
+ */
+void SelectAutonumW::on_m_next_pb_clicked() {
+ NumerotationContextCommands ncc (toNumContext());
+ setContext(ncc.next());
+}
+
+/**
+ * @brief SelectAutonumW::on_m_previous_pb_clicked
+ * Decrease NumerotationContext
+ */
+void SelectAutonumW::on_m_previous_pb_clicked() {
+ NumerotationContextCommands ncc (toNumContext());
+ setContext(ncc.previous());
+}
diff --git a/sources/ui/selectautonumw.h b/sources/ui/selectautonumw.h
index a74346f4e..f09e5f0b5 100644
--- a/sources/ui/selectautonumw.h
+++ b/sources/ui/selectautonumw.h
@@ -52,6 +52,10 @@ class SelectAutonumW : public QWidget
void applyEnable (bool = true);
//ATTRIBUTS
+ void on_m_next_pb_clicked();
+
+ void on_m_previous_pb_clicked();
+
private:
Ui::SelectAutonumW *ui;
QList num_part_list_;
diff --git a/sources/ui/selectautonumw.ui b/sources/ui/selectautonumw.ui
index 0a5525022..871772497 100644
--- a/sources/ui/selectautonumw.ui
+++ b/sources/ui/selectautonumw.ui
@@ -6,8 +6,8 @@
0
0
- 400
- 300
+ 432
+ 273
@@ -25,6 +25,19 @@
0
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
-
@@ -59,6 +72,47 @@
+ -
+
+
+ Précédent
+
+
+
+
+
+
+ :/ico/16x16/arrow-left.png:/ico/16x16/arrow-left.png
+
+
+
+ -
+
+
+ Suivant
+
+
+
+
+
+
+ :/ico/16x16/arrow-right.png:/ico/16x16/arrow-right.png
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
-