diff --git a/ChangeLog.txt b/ChangeLog.txt
index 0233d3e18..ed7646772 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -13,6 +13,7 @@
- [#660] New export: Export details without layout.
- [#734] Optimization. Stop increments/variables table from updating immediately.
- [#750] Info Box Beside Mouse.
+- [#634] New feature: Fabric manager.
# Version 0.5.1
- [#683] Tool Seam allowance's dialog is off screen on small resolutions.
diff --git a/share/translations/valentina.ts b/share/translations/valentina.ts
index 9875d20a5..b59a113c8 100644
--- a/share/translations/valentina.ts
+++ b/share/translations/valentina.ts
@@ -1832,6 +1832,10 @@
on fold
+
+
+
+
DialogEditWrongFormula
@@ -2754,6 +2758,25 @@
+
+ DialogKnownMaterials
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogLayoutProgress
@@ -3616,6 +3639,21 @@ Apply settings anyway?
Line color:
+
+ DialogPatternMaterials
+
+
+ Dialog
+
+
+
+
+
+
+
+ Value
+
+
DialogPatternProperties
@@ -3834,6 +3872,22 @@ Apply settings anyway?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogPatternXmlEdit
@@ -7951,6 +8005,30 @@ Do you want to save your changes?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
QApplication
@@ -9879,6 +9957,13 @@ Do you want to save your changes?
Exception thrown: %1. Program will be terminated.
+
+ VComboBoxDelegate
+
+
+
+
+
VCommandLine
@@ -12961,6 +13046,11 @@ Do you want to save your changes?
placeholder
+
+
+ placeholder
+
+
VVITConverter
diff --git a/share/translations/valentina_cs_CZ.ts b/share/translations/valentina_cs_CZ.ts
index 6814c2278..afe8b2b84 100644
--- a/share/translations/valentina_cs_CZ.ts
+++ b/share/translations/valentina_cs_CZ.ts
@@ -1479,6 +1479,10 @@
+
+
+
+
DialogEditWrongFormula
@@ -2357,6 +2361,25 @@
+
+ DialogKnownMaterials
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogLayoutProgress
@@ -3174,6 +3197,21 @@ Apply settings anyway?
+
+ DialogPatternMaterials
+
+
+ Dialog
+
+
+
+
+
+
+
+ Hodnota
+
+
DialogPatternProperties
@@ -3352,6 +3390,22 @@ Apply settings anyway?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogPatternXmlEdit
@@ -6928,6 +6982,30 @@ Chcete uložit své změny?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
QCommandLineParser
@@ -8617,6 +8695,13 @@ Do you want to save your changes?
+
+ VComboBoxDelegate
+
+
+
+
+
VCommandLine
@@ -11429,6 +11514,11 @@ Do you want to save your changes?
placeholder
+
+
+ placeholder
+
+
VVITConverter
diff --git a/share/translations/valentina_de_DE.ts b/share/translations/valentina_de_DE.ts
index 46af28d6a..a3f6552d1 100644
--- a/share/translations/valentina_de_DE.ts
+++ b/share/translations/valentina_de_DE.ts
@@ -1756,6 +1756,10 @@
+
+
+
+
DialogEditWrongFormula
@@ -2674,6 +2678,25 @@
+
+ DialogKnownMaterials
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogLayoutProgress
@@ -3535,6 +3558,21 @@ Einstellungen trotzdem anwenden?
Linienfarbe:
+
+ DialogPatternMaterials
+
+
+ Dialog
+
+
+
+
+
+
+
+ Wert
+
+
DialogPatternProperties
@@ -3749,6 +3787,22 @@ Einstellungen trotzdem anwenden?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogPatternXmlEdit
@@ -7642,6 +7696,30 @@ Sollen die Änderungen gespeichert werden?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
QApplication
@@ -9484,6 +9562,13 @@ Do you want to save your changes?
Ausnahme ausgelöst: %1. Programm wird beendet.
+
+ VComboBoxDelegate
+
+
+
+
+
VCommandLine
@@ -12456,6 +12541,11 @@ Do you want to save your changes?
placeholder
+
+
+ placeholder
+
+
VVITConverter
diff --git a/share/translations/valentina_el_GR.ts b/share/translations/valentina_el_GR.ts
index 9f604f9a2..eee04e97d 100644
--- a/share/translations/valentina_el_GR.ts
+++ b/share/translations/valentina_el_GR.ts
@@ -1788,6 +1788,10 @@
στη δίπλωση
+
+
+
+
DialogEditWrongFormula
@@ -2698,6 +2702,25 @@
Άγνωστο
+
+ DialogKnownMaterials
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogLayoutProgress
@@ -3541,6 +3564,21 @@ Apply settings anyway?
Χρώμα γραμμής:
+
+ DialogPatternMaterials
+
+
+ Διάλογος
+
+
+
+
+
+
+
+ Τιμή
+
+
DialogPatternProperties
@@ -3755,6 +3793,22 @@ Apply settings anyway?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogPatternXmlEdit
@@ -4828,10 +4882,6 @@ Apply settings anyway?
DialogSeamAllowance
-
-
- Εργαλείο περιθωρίου ραφής
-
Έτοιμο!
@@ -7616,6 +7666,30 @@ Do you want to save your changes?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
QCommandLineParser
@@ -9401,6 +9475,13 @@ Do you want to save your changes?
+
+ VComboBoxDelegate
+
+
+
+
+
VCommandLine
@@ -12253,6 +12334,11 @@ Do you want to save your changes?
placeholder
+
+
+ placeholder
+
+
VVITConverter
diff --git a/share/translations/valentina_en_CA.ts b/share/translations/valentina_en_CA.ts
index b4ec2f091..8461aee88 100644
--- a/share/translations/valentina_en_CA.ts
+++ b/share/translations/valentina_en_CA.ts
@@ -1832,6 +1832,10 @@
on fold
+
+
+
+
DialogEditWrongFormula
@@ -2750,6 +2754,25 @@
Uknown
+
+ DialogKnownMaterials
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogLayoutProgress
@@ -3612,6 +3635,21 @@ Apply settings anyway?
Line color:
+
+ DialogPatternMaterials
+
+
+ Dialog
+
+
+
+
+
+
+
+ Value
+
+
DialogPatternProperties
@@ -3830,6 +3868,22 @@ Apply settings anyway?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogPatternXmlEdit
@@ -4915,10 +4969,6 @@ Apply settings anyway?
DialogSeamAllowance
-
-
- Seam allowance tool
-
Ready!
@@ -7075,10 +7125,6 @@ Do you want to save your changes?
Select point of center of elliptical arc
-
-
- Piece path tool
-
Select main path objects clockwise.
@@ -7775,6 +7821,30 @@ Do you want to save your changes?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
QApplication
@@ -9648,6 +9718,13 @@ Do you want to save your changes?
Exception thrown: %1. Program will be terminated.
+
+ VComboBoxDelegate
+
+
+
+
+
VCommandLine
@@ -12700,6 +12777,11 @@ Do you want to save your changes?
placeholder
+
+
+ placeholder
+
+
VVITConverter
diff --git a/share/translations/valentina_en_IN.ts b/share/translations/valentina_en_IN.ts
index cfb0d8fd9..5e4f554bb 100644
--- a/share/translations/valentina_en_IN.ts
+++ b/share/translations/valentina_en_IN.ts
@@ -1832,6 +1832,10 @@
on fold
+
+
+
+
DialogEditWrongFormula
@@ -2750,6 +2754,25 @@
Uknown
+
+ DialogKnownMaterials
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogLayoutProgress
@@ -3612,6 +3635,21 @@ Apply settings anyway?
Line color:
+
+ DialogPatternMaterials
+
+
+ Dialog
+
+
+
+
+
+
+
+ Value
+
+
DialogPatternProperties
@@ -3830,6 +3868,22 @@ Apply settings anyway?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogPatternXmlEdit
@@ -4915,10 +4969,6 @@ Apply settings anyway?
DialogSeamAllowance
-
-
- Seam allowance tool
-
Ready!
@@ -7075,10 +7125,6 @@ Do you want to save your changes?
Select point of center of elliptical arc
-
-
- Piece path tool
-
Select main path objects clockwise.
@@ -7775,6 +7821,30 @@ Do you want to save your changes?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
QApplication
@@ -9648,6 +9718,13 @@ Do you want to save your changes?
Exception thrown: %1. Program will be terminated.
+
+ VComboBoxDelegate
+
+
+
+
+
VCommandLine
@@ -12700,6 +12777,11 @@ Do you want to save your changes?
placeholder
+
+
+ placeholder
+
+
VVITConverter
diff --git a/share/translations/valentina_en_US.ts b/share/translations/valentina_en_US.ts
index f40111fc7..9877df709 100644
--- a/share/translations/valentina_en_US.ts
+++ b/share/translations/valentina_en_US.ts
@@ -1832,6 +1832,10 @@
on fold
+
+
+
+
DialogEditWrongFormula
@@ -2750,6 +2754,25 @@
Uknown
+
+ DialogKnownMaterials
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogLayoutProgress
@@ -3612,6 +3635,21 @@ Apply settings anyway?
Line color:
+
+ DialogPatternMaterials
+
+
+ Dialog
+
+
+
+
+
+
+
+ Value
+
+
DialogPatternProperties
@@ -3830,6 +3868,22 @@ Apply settings anyway?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogPatternXmlEdit
@@ -4915,10 +4969,6 @@ Apply settings anyway?
DialogSeamAllowance
-
-
- Seam allowance tool
-
Ready!
@@ -7075,10 +7125,6 @@ Do you want to save your changes?
Select point of center of elliptical arc
-
-
- Piece path tool
-
Select main path objects clockwise.
@@ -7775,6 +7821,30 @@ Do you want to save your changes?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
QApplication
@@ -9648,6 +9718,13 @@ Do you want to save your changes?
Exception thrown: %1. Program will be terminated.
+
+ VComboBoxDelegate
+
+
+
+
+
VCommandLine
@@ -12700,6 +12777,11 @@ Do you want to save your changes?
placeholder
+
+
+ placeholder
+
+
VVITConverter
diff --git a/share/translations/valentina_es_ES.ts b/share/translations/valentina_es_ES.ts
index 9faed58a3..16e03395b 100644
--- a/share/translations/valentina_es_ES.ts
+++ b/share/translations/valentina_es_ES.ts
@@ -1833,6 +1833,10 @@
en pliegue
+
+
+
+
DialogEditWrongFormula
@@ -2751,6 +2755,25 @@
Desconocido
+
+ DialogKnownMaterials
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogLayoutProgress
@@ -3612,6 +3635,21 @@ Apply settings anyway?
Color de la línea:
+
+ DialogPatternMaterials
+
+
+ Diálogo
+
+
+
+
+
+
+
+
+
+
DialogPatternProperties
@@ -3830,6 +3868,22 @@ Apply settings anyway?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogPatternXmlEdit
@@ -4915,10 +4969,6 @@ Apply settings anyway?
DialogSeamAllowance
-
-
- Herramienta para las costuras
-
¡Listo!
@@ -7075,10 +7125,6 @@ Quiere guardar los cambios?
Seleccionar el punto del centro del arco elíptico
-
-
- Herramienta de trayectoria de piezas
-
Seleccionar los objetos de la ruta principal en el sentido horario.
@@ -7775,6 +7821,30 @@ Quiere guardar los cambios?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
QApplication
@@ -9647,6 +9717,13 @@ Do you want to save your changes?
Se ha lanzado una excepción: %1. El programa se terminará.
+
+ VComboBoxDelegate
+
+
+
+
+
VCommandLine
@@ -12699,6 +12776,11 @@ Do you want to save your changes?
placeholder
+
+
+ placeholder
+
+
VVITConverter
diff --git a/share/translations/valentina_fi_FI.ts b/share/translations/valentina_fi_FI.ts
index dbed1cdd3..cabd9ee40 100644
--- a/share/translations/valentina_fi_FI.ts
+++ b/share/translations/valentina_fi_FI.ts
@@ -1472,6 +1472,10 @@
+
+
+
+
DialogEditWrongFormula
@@ -2350,6 +2354,25 @@
+
+ DialogKnownMaterials
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogLayoutProgress
@@ -3167,6 +3190,21 @@ Apply settings anyway?
+
+ DialogPatternMaterials
+
+
+
+
+
+
+
+
+
+
+ Arvo
+
+
DialogPatternProperties
@@ -3345,6 +3383,22 @@ Apply settings anyway?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogPatternXmlEdit
@@ -6913,6 +6967,30 @@ Haluatko tallentaa muutokset?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
QCoreApplication
@@ -8567,6 +8645,13 @@ Do you want to save your changes?
+
+ VComboBoxDelegate
+
+
+
+
+
VCommandLine
@@ -11369,6 +11454,11 @@ Do you want to save your changes?
placeholder
+
+
+ placeholder
+
+
VVITConverter
diff --git a/share/translations/valentina_fr_FR.ts b/share/translations/valentina_fr_FR.ts
index 7577fab8c..cb35a3c6e 100644
--- a/share/translations/valentina_fr_FR.ts
+++ b/share/translations/valentina_fr_FR.ts
@@ -1832,6 +1832,10 @@
+
+
+
+
DialogEditWrongFormula
@@ -2750,6 +2754,25 @@
+
+ DialogKnownMaterials
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogLayoutProgress
@@ -3609,6 +3632,21 @@ Appliquer les réglages quand-même ?
Couleur de la ligne:
+
+ DialogPatternMaterials
+
+
+ Dialogue
+
+
+
+
+
+
+
+ Valeur
+
+
DialogPatternProperties
@@ -3827,6 +3865,22 @@ Appliquer les réglages quand-même ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogPatternXmlEdit
@@ -4912,10 +4966,6 @@ Appliquer les réglages quand-même ?
DialogSeamAllowance
-
-
- Outil marge de couture
-
Prêt!
@@ -7756,6 +7806,30 @@ Voulez-vous sauvegarder les changements?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
QApplication
@@ -9621,6 +9695,13 @@ Voulez-vous enregistrer les changements?
Erreur : %1. Fin du programme.
+
+ VComboBoxDelegate
+
+
+
+
+
VCommandLine
@@ -12656,6 +12737,11 @@ Voulez-vous enregistrer les changements?
placeholder
+
+
+ placeholder
+
+
VVITConverter
diff --git a/share/translations/valentina_he_IL.ts b/share/translations/valentina_he_IL.ts
index 7c819d42c..e24727425 100644
--- a/share/translations/valentina_he_IL.ts
+++ b/share/translations/valentina_he_IL.ts
@@ -1145,6 +1145,10 @@
+
+
+
+
DialogEditWrongFormula
@@ -1935,6 +1939,25 @@
+
+ DialogKnownMaterials
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogLayoutProgress
@@ -2684,6 +2707,21 @@ Apply settings anyway?
+
+ DialogPatternMaterials
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogPatternProperties
@@ -2850,6 +2888,22 @@ Apply settings anyway?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogPiecePath
@@ -5964,6 +6018,30 @@ Do you want to save your changes?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
QCoreApplication
@@ -7513,6 +7591,13 @@ Do you want to save your changes?
+
+ VComboBoxDelegate
+
+
+
+
+
VCommandLine
@@ -10154,6 +10239,11 @@ Do you want to save your changes?
placeholder
+
+
+ placeholder
+
+
VWidgetDetails
diff --git a/share/translations/valentina_id_ID.ts b/share/translations/valentina_id_ID.ts
index af3a0686a..a7e65b75d 100644
--- a/share/translations/valentina_id_ID.ts
+++ b/share/translations/valentina_id_ID.ts
@@ -1384,6 +1384,10 @@
+
+
+
+
DialogEditWrongFormula
@@ -2202,6 +2206,25 @@
+
+ DialogKnownMaterials
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogLayoutProgress
@@ -2975,6 +2998,21 @@ Apply settings anyway?
+
+ DialogPatternMaterials
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogPatternProperties
@@ -3149,6 +3187,22 @@ Apply settings anyway?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogPiecePath
@@ -6308,6 +6362,30 @@ Apakah anda ingin menyimpan perubahan anda?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
QCoreApplication
@@ -7899,6 +7977,13 @@ Do you want to save your changes?
+
+ VComboBoxDelegate
+
+
+
+
+
VCommandLine
@@ -10552,6 +10637,11 @@ Do you want to save your changes?
placeholder
+
+
+ placeholder
+
+
VWidgetDetails
diff --git a/share/translations/valentina_it_IT.ts b/share/translations/valentina_it_IT.ts
index 57be93ad0..b3d59fe5d 100644
--- a/share/translations/valentina_it_IT.ts
+++ b/share/translations/valentina_it_IT.ts
@@ -1756,6 +1756,10 @@
+
+
+
+
DialogEditWrongFormula
@@ -2666,6 +2670,25 @@
+
+ DialogKnownMaterials
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogLayoutProgress
@@ -3524,6 +3547,21 @@ Applicare le impostazioni comunque?
Colore della linea:
+
+ DialogPatternMaterials
+
+
+ Finestra
+
+
+
+
+
+
+
+
+
+
DialogPatternProperties
@@ -3734,6 +3772,22 @@ Applicare le impostazioni comunque?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogPatternXmlEdit
@@ -7647,6 +7701,30 @@ Vuoi salvare i cambiamenti?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
QApplication
@@ -9512,6 +9590,13 @@ Vuoi salvare le tue modifiche?
Eccezione generata:%1. Il programma verrà terminato.
+
+ VComboBoxDelegate
+
+
+
+
+
VCommandLine
@@ -12373,6 +12458,11 @@ Vuoi salvare le tue modifiche?
placeholder
+
+
+ placeholder
+
+
VVITConverter
diff --git a/share/translations/valentina_nl_NL.ts b/share/translations/valentina_nl_NL.ts
index 5f3027ede..8f5279418 100644
--- a/share/translations/valentina_nl_NL.ts
+++ b/share/translations/valentina_nl_NL.ts
@@ -1832,6 +1832,10 @@
op vouw
+
+
+
+
DialogEditWrongFormula
@@ -2750,6 +2754,25 @@
Onbekend
+
+ DialogKnownMaterials
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogLayoutProgress
@@ -3612,6 +3635,21 @@ Toch de instellingen aanpassen?
Lijnkleur:
+
+ DialogPatternMaterials
+
+
+ Dialoog
+
+
+
+
+
+
+
+ Waarde
+
+
DialogPatternProperties
@@ -3830,6 +3868,22 @@ Toch de instellingen aanpassen?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogPatternXmlEdit
@@ -4915,10 +4969,6 @@ Toch de instellingen aanpassen?
DialogSeamAllowance
-
-
- Naadtoeslag gereedschap
-
Klaar!
@@ -7074,10 +7124,6 @@ Do you want to save your changes?
Selecteer het middelpunt van de ellipsvormige boog
-
-
- Gereedschap om pad van onderdeel te bepalen
-
Selecteer hoofdpad objecten met de klok mee.
@@ -7774,6 +7820,30 @@ Do you want to save your changes?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
QApplication
@@ -9647,6 +9717,13 @@ Wil je deze veranderingen opslaan?
Uitgeworpen uitzondering: %1. Programma wordt beëindigd.
+
+ VComboBoxDelegate
+
+
+
+
+
VCommandLine
@@ -12699,6 +12776,11 @@ Wil je deze veranderingen opslaan?
placeholder
+
+
+ placeholder
+
+
VVITConverter
diff --git a/share/translations/valentina_pt_BR.ts b/share/translations/valentina_pt_BR.ts
index ea1cf81a1..803278d99 100644
--- a/share/translations/valentina_pt_BR.ts
+++ b/share/translations/valentina_pt_BR.ts
@@ -1804,6 +1804,10 @@
+
+
+
+
DialogEditWrongFormula
@@ -2690,6 +2694,25 @@
Desconhecido
+
+ DialogKnownMaterials
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogLayoutProgress
@@ -3511,6 +3534,21 @@ Apply settings anyway?
Cor da linha:
+
+ DialogPatternMaterials
+
+
+ Caixa de diálogo
+
+
+
+
+
+
+
+ Valor
+
+
DialogPatternProperties
@@ -3721,6 +3759,22 @@ Apply settings anyway?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogPatternXmlEdit
@@ -7172,6 +7226,30 @@ Do you want to save your changes?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
QCoreApplication
@@ -8830,6 +8908,13 @@ Do you want to save your changes?
+
+ VComboBoxDelegate
+
+
+
+
+
VCommandLine
@@ -11571,6 +11656,11 @@ Do you want to save your changes?
placeholder
+
+
+ placeholder
+
+
VVITConverter
diff --git a/share/translations/valentina_ro_RO.ts b/share/translations/valentina_ro_RO.ts
index cf3408ab7..bbc941284 100644
--- a/share/translations/valentina_ro_RO.ts
+++ b/share/translations/valentina_ro_RO.ts
@@ -1633,6 +1633,10 @@
+
+
+
+
DialogEditWrongFormula
@@ -2515,6 +2519,25 @@
+
+ DialogKnownMaterials
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogLayoutProgress
@@ -3336,6 +3359,21 @@ Apply settings anyway?
Culoarea liniei:
+
+ DialogPatternMaterials
+
+
+ Dialog
+
+
+
+
+
+
+
+ Valoare
+
+
DialogPatternProperties
@@ -3514,6 +3552,22 @@ Apply settings anyway?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogPatternXmlEdit
@@ -6890,6 +6944,30 @@ Do you want to save your changes?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
QCoreApplication
@@ -8532,6 +8610,13 @@ Do you want to save your changes?
+
+ VComboBoxDelegate
+
+
+
+
+
VCommandLine
@@ -11236,6 +11321,11 @@ Do you want to save your changes?
placeholder
+
+
+ placeholder
+
+
VWidgetDetails
diff --git a/share/translations/valentina_ru_RU.ts b/share/translations/valentina_ru_RU.ts
index aff3b2482..79b2d0734 100644
--- a/share/translations/valentina_ru_RU.ts
+++ b/share/translations/valentina_ru_RU.ts
@@ -1832,6 +1832,10 @@
на сгибе
+
+
+
+
DialogEditWrongFormula
@@ -2750,6 +2754,25 @@
Неизвестное
+
+ DialogKnownMaterials
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogLayoutProgress
@@ -3612,6 +3635,21 @@ Apply settings anyway?
Цвет линии:
+
+ DialogPatternMaterials
+
+
+ Диалог
+
+
+
+
+
+
+
+ Значение
+
+
DialogPatternProperties
@@ -3830,6 +3868,22 @@ Apply settings anyway?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogPatternXmlEdit
@@ -4915,10 +4969,6 @@ Apply settings anyway?
DialogSeamAllowance
-
-
- Деталь
-
Готовы!
@@ -7075,10 +7125,6 @@ Do you want to save your changes?
Укажите точку размещения центра эллиптической дуги
-
-
- Инструмент контур детали
-
Выберите объекты основного контура по часовой стрелке.
@@ -7775,6 +7821,30 @@ Do you want to save your changes?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
QApplication
@@ -9648,6 +9718,13 @@ Do you want to save your changes?
Программное исключение: %1. Работа программы будет завершена.
+
+ VComboBoxDelegate
+
+
+
+
+
VCommandLine
@@ -12705,6 +12782,11 @@ Do you want to save your changes?
placeholder
+
+
+ placeholder
+
+
VVITConverter
diff --git a/share/translations/valentina_uk_UA.ts b/share/translations/valentina_uk_UA.ts
index 0bc2d7470..de75608b7 100644
--- a/share/translations/valentina_uk_UA.ts
+++ b/share/translations/valentina_uk_UA.ts
@@ -1832,6 +1832,10 @@
на згиб
+
+
+
+
DialogEditWrongFormula
@@ -2750,6 +2754,25 @@
Невідоме
+
+ DialogKnownMaterials
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogLayoutProgress
@@ -3612,6 +3635,21 @@ Apply settings anyway?
Колір лінії:
+
+ DialogPatternMaterials
+
+
+ Діалог
+
+
+
+
+
+
+
+ Значення
+
+
DialogPatternProperties
@@ -3830,6 +3868,22 @@ Apply settings anyway?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogPatternXmlEdit
@@ -4915,10 +4969,6 @@ Apply settings anyway?
DialogSeamAllowance
-
-
- Інструмент прибавка на шви
-
Готовий!
@@ -7074,10 +7124,6 @@ Do you want to save your changes?
Виберіть точку центру еліптичної дуги
-
-
- Інструмент контур деталі
-
Виберіть основний контур за годиниковою стрілкою.
@@ -7774,6 +7820,30 @@ Do you want to save your changes?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
QApplication
@@ -9647,6 +9717,13 @@ Do you want to save your changes?
Програмне виключення: %1. Програма буде закрита.
+
+ VComboBoxDelegate
+
+
+
+
+
VCommandLine
@@ -12698,6 +12775,11 @@ Do you want to save your changes?
placeholder
+
+
+ placeholder
+
+
VVITConverter
diff --git a/share/translations/valentina_zh_CN.ts b/share/translations/valentina_zh_CN.ts
index 6a49136b9..daef2d5f7 100644
--- a/share/translations/valentina_zh_CN.ts
+++ b/share/translations/valentina_zh_CN.ts
@@ -1259,6 +1259,10 @@
+
+
+
+
DialogEditWrongFormula
@@ -2041,6 +2045,25 @@
+
+ DialogKnownMaterials
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogLayoutProgress
@@ -2782,6 +2805,21 @@ Apply settings anyway?
线颜色:
+
+ DialogPatternMaterials
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogPatternProperties
@@ -2948,6 +2986,22 @@ Apply settings anyway?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DialogPiecePath
@@ -6048,6 +6102,30 @@ Do you want to save your changes?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
QCoreApplication
@@ -7662,6 +7740,13 @@ Do you want to save your changes?
+
+ VComboBoxDelegate
+
+
+
+
+
VCommandLine
@@ -10299,6 +10384,11 @@ Do you want to save your changes?
placeholder
+
+
+ placeholder
+
+
VWidgetDetails
diff --git a/src/app/valentina/dialogs/configpages/preferencespatternpage.cpp b/src/app/valentina/dialogs/configpages/preferencespatternpage.cpp
index fcfc633cc..745c9e7c6 100644
--- a/src/app/valentina/dialogs/configpages/preferencespatternpage.cpp
+++ b/src/app/valentina/dialogs/configpages/preferencespatternpage.cpp
@@ -31,6 +31,7 @@
#include "../../core/vapplication.h"
#include "../ifc/xml/vabstractpattern.h"
#include "../dialogdatetimeformats.h"
+#include "../dialogknownmaterials.h"
#include
#include
@@ -55,19 +56,28 @@ QStringList ComboBoxAllStrings(QComboBox *combo)
//---------------------------------------------------------------------------------------------------------------------
PreferencesPatternPage::PreferencesPatternPage(QWidget *parent)
: QWidget(parent),
- ui(new Ui::PreferencesPatternPage)
+ ui(new Ui::PreferencesPatternPage),
+ m_knownMaterials()
{
ui->setupUi(this);
- ui->graphOutputCheck->setChecked(qApp->ValentinaSettings()->GetGraphicalOutput());
- ui->undoCount->setValue(qApp->ValentinaSettings()->GetUndoCount());
+
+ VSettings *settings = qApp->ValentinaSettings();
+
+ ui->graphOutputCheck->setChecked(settings->GetGraphicalOutput());
+ ui->undoCount->setValue(settings->GetUndoCount());
InitDefaultSeamAllowance();
InitLabelDateTimeFormats();
- ui->forbidFlippingCheck->setChecked(qApp->ValentinaSettings()->GetForbidWorkpieceFlipping());
- ui->doublePassmarkCheck->setChecked(qApp->ValentinaSettings()->IsDoublePassmark());
- ui->checkBoxHideMainPath->setChecked(qApp->ValentinaSettings()->IsHideMainPath());
- ui->fontComboBoxLabelFont->setCurrentFont(qApp->ValentinaSettings()->GetLabelFont());
+ ui->forbidFlippingCheck->setChecked(settings->GetForbidWorkpieceFlipping());
+ ui->doublePassmarkCheck->setChecked(settings->IsDoublePassmark());
+ ui->checkBoxHideMainPath->setChecked(settings->IsHideMainPath());
+ ui->fontComboBoxLabelFont->setCurrentFont(settings->GetLabelFont());
+
+ ui->checkBoxRemeberPatternMaterials->setChecked(settings->IsRememberPatternMaterials());
+ m_knownMaterials = settings->GetKnownMaterials();
+
+ connect(ui->pushButtonKnownMaterials, &QPushButton::clicked, this, &PreferencesPatternPage::ManageKnownMaterials);
}
//---------------------------------------------------------------------------------------------------------------------
@@ -108,6 +118,9 @@ void PreferencesPatternPage::Apply()
settings->SetUserDefinedDateFormats(ComboBoxAllStrings(ui->comboBoxDateFormats));
settings->SetUserDefinedTimeFormats(ComboBoxAllStrings(ui->comboBoxTimeFormats));
+
+ settings->SetKnownMaterials(m_knownMaterials);
+ settings->SetRememberPatternMaterials(ui->checkBoxRemeberPatternMaterials->isChecked());
}
//---------------------------------------------------------------------------------------------------------------------
@@ -135,6 +148,18 @@ void PreferencesPatternPage::EditDateTimeFormats()
}
}
+//---------------------------------------------------------------------------------------------------------------------
+void PreferencesPatternPage::ManageKnownMaterials()
+{
+ DialogKnownMaterials editor;
+ editor.SetList(m_knownMaterials);
+
+ if (QDialog::Accepted == editor.exec())
+ {
+ m_knownMaterials = editor.GetList();
+ }
+}
+
//---------------------------------------------------------------------------------------------------------------------
void PreferencesPatternPage::InitLabelDateTimeFormats()
{
diff --git a/src/app/valentina/dialogs/configpages/preferencespatternpage.h b/src/app/valentina/dialogs/configpages/preferencespatternpage.h
index c13ec1baa..6fd263b27 100644
--- a/src/app/valentina/dialogs/configpages/preferencespatternpage.h
+++ b/src/app/valentina/dialogs/configpages/preferencespatternpage.h
@@ -51,10 +51,12 @@ public:
private slots:
void EditDateTimeFormats();
+ void ManageKnownMaterials();
private:
Q_DISABLE_COPY(PreferencesPatternPage)
Ui::PreferencesPatternPage *ui;
+ QStringList m_knownMaterials;
void InitLabelDateTimeFormats();
void InitComboBoxFormats(QComboBox *box, const QStringList &items, const QString ¤tFormat);
diff --git a/src/app/valentina/dialogs/configpages/preferencespatternpage.ui b/src/app/valentina/dialogs/configpages/preferencespatternpage.ui
index 957a4ce9e..b106abc43 100644
--- a/src/app/valentina/dialogs/configpages/preferencespatternpage.ui
+++ b/src/app/valentina/dialogs/configpages/preferencespatternpage.ui
@@ -13,7 +13,7 @@
Pattern
-
+
-
@@ -191,6 +191,68 @@
+ -
+
+
+ Materials
+
+
+
-
+
+
-
+
+
+ Known materials:
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Manage list of known materials
+
+
+ Manage
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ When manage pattern materials save them to known materials list
+
+
+ Remeber pattern materials
+
+
+ true
+
+
+
+
+
+
-
diff --git a/src/app/valentina/dialogs/dialogknownmaterials.cpp b/src/app/valentina/dialogs/dialogknownmaterials.cpp
new file mode 100644
index 000000000..312fec1dd
--- /dev/null
+++ b/src/app/valentina/dialogs/dialogknownmaterials.cpp
@@ -0,0 +1,161 @@
+/************************************************************************
+ **
+ ** @file dialogknownmaterials.cpp
+ ** @author Roman Telezhynskyi
+ ** @date 28 8, 2017
+ **
+ ** @brief
+ ** @copyright
+ ** This source code is part of the Valentine project, a pattern making
+ ** program, whose allow create and modeling patterns of clothing.
+ ** Copyright (C) 2017 Valentina project
+ ** All Rights Reserved.
+ **
+ ** Valentina is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** Valentina is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with Valentina. If not, see .
+ **
+ *************************************************************************/
+
+#include "dialogknownmaterials.h"
+#include "ui_dialogknownmaterials.h"
+
+//---------------------------------------------------------------------------------------------------------------------
+DialogKnownMaterials::DialogKnownMaterials(QWidget *parent)
+ : QDialog(parent),
+ ui(new Ui::DialogKnownMaterials)
+{
+ ui->setupUi(this);
+
+ ui->lineEditMaterial->setClearButtonEnabled(true);
+
+ connect(ui->toolButtonAdd, &QToolButton::clicked, this, &DialogKnownMaterials::Add);
+ connect(ui->toolButtonRemove, &QToolButton::clicked, this, &DialogKnownMaterials::Remove);
+ connect(ui->lineEditMaterial, &QLineEdit::textEdited, this, &DialogKnownMaterials::SaveText);
+ connect(ui->listWidget, &QListWidget::itemSelectionChanged, this, &DialogKnownMaterials::ShowDetails);
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+DialogKnownMaterials::~DialogKnownMaterials()
+{
+ delete ui;
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void DialogKnownMaterials::SetList(const QStringList &list)
+{
+ ui->listWidget->blockSignals(true);
+ ui->listWidget->clear();
+
+ int row = -1;
+
+ for (int i=0; ilistWidget->insertItem(++row, item);
+ }
+ }
+
+ ui->listWidget->blockSignals(false);
+
+ if (ui->listWidget->count() > 0)
+ {
+ ui->listWidget->setCurrentRow(0);
+ }
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+QStringList DialogKnownMaterials::GetList() const
+{
+ QStringList list;
+
+ for (int i=0; ilistWidget->count(); ++i)
+ {
+ if (const QListWidgetItem *item = ui->listWidget->item(i))
+ {
+ if (not item->text().isEmpty())
+ {
+ list.append(item->text());
+ }
+ }
+ }
+
+ return list;
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void DialogKnownMaterials::ShowDetails()
+{
+ if (ui->listWidget->count() > 0)
+ {
+ const QListWidgetItem *line = ui->listWidget->currentItem();
+ if (line)
+ {
+ ui->lineEditMaterial->blockSignals(true);
+ ui->lineEditMaterial->setText(line->text());
+ ui->lineEditMaterial->blockSignals(false);
+ }
+ }
+
+ SetupControls();
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void DialogKnownMaterials::Add()
+{
+ int row = ui->listWidget->currentRow();
+ ui->listWidget->insertItem(++row, new QListWidgetItem(tr("User material")));
+ ui->listWidget->setCurrentRow(row);
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void DialogKnownMaterials::Remove()
+{
+ ui->listWidget->blockSignals(true);
+ QListWidgetItem *curLine = ui->listWidget->takeItem(ui->listWidget->currentRow());
+ if (curLine)
+ {
+ delete curLine;
+ }
+ ui->listWidget->blockSignals(false);
+ ShowDetails();
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void DialogKnownMaterials::SaveText(const QString &text)
+{
+ QListWidgetItem *curLine = ui->listWidget->currentItem();
+ if (curLine)
+ {
+ curLine->setText(text);
+ }
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void DialogKnownMaterials::SetupControls()
+{
+ const bool enabled = ui->listWidget->count() > 0;
+
+ if (not enabled)
+ {
+ ui->lineEditMaterial->blockSignals(true);
+ ui->lineEditMaterial->clear();
+ ui->lineEditMaterial->blockSignals(false);
+ }
+
+ ui->toolButtonAdd->setEnabled(true);
+
+ ui->toolButtonRemove->setEnabled(enabled);
+ ui->lineEditMaterial->setEnabled(enabled);
+}
diff --git a/src/app/valentina/dialogs/dialogknownmaterials.h b/src/app/valentina/dialogs/dialogknownmaterials.h
new file mode 100644
index 000000000..d3e08ab37
--- /dev/null
+++ b/src/app/valentina/dialogs/dialogknownmaterials.h
@@ -0,0 +1,63 @@
+/************************************************************************
+ **
+ ** @file dialogknownmaterials.h
+ ** @author Roman Telezhynskyi
+ ** @date 28 8, 2017
+ **
+ ** @brief
+ ** @copyright
+ ** This source code is part of the Valentine project, a pattern making
+ ** program, whose allow create and modeling patterns of clothing.
+ ** Copyright (C) 2017 Valentina project
+ ** All Rights Reserved.
+ **
+ ** Valentina is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** Valentina is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with Valentina. If not, see .
+ **
+ *************************************************************************/
+
+#ifndef DIALOGKNOWNMATERIALS_H
+#define DIALOGKNOWNMATERIALS_H
+
+#include
+
+namespace Ui
+{
+ class DialogKnownMaterials;
+}
+
+class DialogKnownMaterials : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit DialogKnownMaterials(QWidget *parent = nullptr);
+ virtual ~DialogKnownMaterials();
+
+ void SetList(const QStringList &list);
+ QStringList GetList() const;
+
+private slots:
+ void ShowDetails();
+ void Add();
+ void Remove();
+ void SaveText(const QString &text);
+
+private:
+ Q_DISABLE_COPY(DialogKnownMaterials)
+ Ui::DialogKnownMaterials *ui;
+
+ void SetupControls();
+};
+
+#endif // DIALOGKNOWNMATERIALS_H
diff --git a/src/app/valentina/dialogs/dialogknownmaterials.ui b/src/app/valentina/dialogs/dialogknownmaterials.ui
new file mode 100644
index 000000000..ec6bf6225
--- /dev/null
+++ b/src/app/valentina/dialogs/dialogknownmaterials.ui
@@ -0,0 +1,149 @@
+
+
+ DialogKnownMaterials
+
+
+
+ 0
+ 0
+ 365
+ 369
+
+
+
+ Known materials
+
+
+
+ :/icon/64x64/icon64x64.png:/icon/64x64/icon64x64.png
+
+
+
-
+
+
+ true
+
+
+
+ -
+
+
-
+
+
+ Material:
+
+
+
+ -
+
+
+ false
+
+
+
+ 1
+ 0
+
+
+
+ Name of material
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 0
+ 20
+
+
+
+
+ -
+
+
+ ...
+
+
+
+ ..
+
+
+
+ -
+
+
+ false
+
+
+ ...
+
+
+
+ ..
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+
+
+ VLineEdit
+ QLineEdit
+
+
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ DialogKnownMaterials
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ DialogKnownMaterials
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/src/app/valentina/dialogs/dialogpatternmaterials.cpp b/src/app/valentina/dialogs/dialogpatternmaterials.cpp
new file mode 100644
index 000000000..6970ba2cf
--- /dev/null
+++ b/src/app/valentina/dialogs/dialogpatternmaterials.cpp
@@ -0,0 +1,196 @@
+/************************************************************************
+ **
+ ** @file dialogpatternmaterials.cpp
+ ** @author Roman Telezhynskyi
+ ** @date 28 8, 2017
+ **
+ ** @brief
+ ** @copyright
+ ** This source code is part of the Valentine project, a pattern making
+ ** program, whose allow create and modeling patterns of clothing.
+ ** Copyright (C) 2017 Valentina project
+ ** All Rights Reserved.
+ **
+ ** Valentina is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** Valentina is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with Valentina. If not, see .
+ **
+ *************************************************************************/
+
+#include "dialogpatternmaterials.h"
+#include "ui_dialogpatternmaterials.h"
+
+#include "../vmisc/def.h"
+#include "../core/vapplication.h"
+
+#include
+#include
+
+namespace
+{
+//---------------------------------------------------------------------------------------------------------------------
+QStringList PrepareKnowMaterials(const QStringList &patternMaterials, bool rememberPM)
+{
+ QStringList knownMaterials = qApp->ValentinaSettings()->GetKnownMaterials();
+
+ if (rememberPM)
+ {
+ for(int i=0; i < patternMaterials.size(); ++i)
+ {
+ if (not patternMaterials.at(i).isEmpty() && not knownMaterials.contains(patternMaterials.at(i)))
+ {
+ knownMaterials.append(patternMaterials.at(i));
+ }
+ }
+ }
+ return knownMaterials;
+}
+}
+
+class VComboBoxDelegate : public QItemDelegate
+{
+public:
+ VComboBoxDelegate(const QStringList &items, QObject *parent = nullptr)
+ : QItemDelegate(parent),
+ m_items(items)
+ {
+ m_items.prepend(QLatin1String("--") + tr("Select material") + QLatin1String("--"));
+ }
+
+ virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
+ const QModelIndex &index) const Q_DECL_OVERRIDE
+ {
+ Q_UNUSED(option)
+ Q_UNUSED(index)
+
+ QComboBox *editor = new QComboBox(parent);
+ editor->addItems(m_items);
+
+ return editor;
+ }
+
+ virtual void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE
+ {
+ const QString value = index.model()->data(index, Qt::EditRole).toString();
+
+ QComboBox *comboBox = static_cast(editor);
+ const int cIndex = comboBox->findText(value);
+
+ if (cIndex != -1)
+ {
+ comboBox->setCurrentIndex(cIndex);
+ }
+ }
+
+ virtual void setModelData(QWidget *editor, QAbstractItemModel *model,
+ const QModelIndex &index) const Q_DECL_OVERRIDE
+ {
+ QComboBox *comboBox = static_cast(editor);
+ QString value;
+ const int cIndex = comboBox->currentIndex();
+
+ if (cIndex > 0)
+ {
+ value = comboBox->currentText();
+ }
+
+ model->setData(index, value, Qt::EditRole);
+ }
+
+ virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
+ const QModelIndex &index) const Q_DECL_OVERRIDE
+ {
+ Q_UNUSED(index)
+ editor->setGeometry(option.rect);
+ }
+private:
+ Q_DISABLE_COPY(VComboBoxDelegate)
+ QStringList m_items;
+};
+
+//---------------------------------------------------------------------------------------------------------------------
+DialogPatternMaterials::DialogPatternMaterials(const QMap &list, bool rememberPM, QWidget *parent)
+ : QDialog(parent),
+ ui(new Ui::DialogPatternMaterials),
+ m_knownMaterials()
+{
+ ui->setupUi(this);
+
+ m_knownMaterials = PrepareKnowMaterials(list.values(), rememberPM);
+ SetPatternMaterials(list);
+
+ ui->tableWidget->setItemDelegateForColumn(1, new VComboBoxDelegate(m_knownMaterials, this));
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+DialogPatternMaterials::~DialogPatternMaterials()
+{
+ delete ui;
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void DialogPatternMaterials::SetPatternMaterials(const QMap &list)
+{
+ ui->tableWidget->setRowCount(userMaterialPlaceholdersQuantity);
+ QLatin1String per("%");
+
+ for (int i = 0; i < userMaterialPlaceholdersQuantity; ++i)
+ {
+ const QString translated = qApp->TrVars()->PlaceholderToUser(pl_userMaterial + QString::number(i + 1));
+ QTableWidgetItem *item = new QTableWidgetItem(per + translated + per);
+ item->setFlags(item->flags() ^ Qt::ItemIsEditable);
+ item->setTextAlignment(Qt::AlignLeft);
+
+ QFont font = item->font();
+ font.setBold(true);
+ item->setFont(font);
+
+ ui->tableWidget->setItem(i, 0, item);
+
+ QString value;
+ if (list.contains(i + 1))
+ {
+ value = list.value(i + 1);
+ }
+
+ item = new QTableWidgetItem(value);
+ item->setTextAlignment(Qt::AlignHCenter);
+ ui->tableWidget->setItem(i, 1, item);
+ }
+
+ ui->tableWidget->resizeColumnsToContents();
+ ui->tableWidget->resizeRowsToContents();
+ ui->tableWidget->verticalHeader()->setDefaultSectionSize(20);
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+QMap DialogPatternMaterials::GetPatternMaterials() const
+{
+ QMap materials;
+
+ for (int i = 0; i < ui->tableWidget->rowCount(); ++i)
+ {
+ const QTableWidgetItem *item = ui->tableWidget->item(i, 1);
+ if (not item->text().isEmpty())
+ {
+ materials.insert(i + 1, item->text());
+ }
+ }
+
+ return materials;
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+QStringList DialogPatternMaterials::GetKnownMaterials() const
+{
+ return m_knownMaterials;
+}
diff --git a/src/app/valentina/dialogs/dialogpatternmaterials.h b/src/app/valentina/dialogs/dialogpatternmaterials.h
new file mode 100644
index 000000000..9fb814542
--- /dev/null
+++ b/src/app/valentina/dialogs/dialogpatternmaterials.h
@@ -0,0 +1,61 @@
+/************************************************************************
+ **
+ ** @file dialogpatternmaterials.h
+ ** @author Roman Telezhynskyi
+ ** @date 28 8, 2017
+ **
+ ** @brief
+ ** @copyright
+ ** This source code is part of the Valentine project, a pattern making
+ ** program, whose allow create and modeling patterns of clothing.
+ ** Copyright (C) 2017 Valentina project
+ ** All Rights Reserved.
+ **
+ ** Valentina is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** Valentina is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with Valentina. If not, see .
+ **
+ *************************************************************************/
+
+#ifndef DIALOGPATTERNMATERIALS_H
+#define DIALOGPATTERNMATERIALS_H
+
+#include
+
+namespace Ui
+{
+ class DialogPatternMaterials;
+}
+
+class VComboBoxDelegate;
+
+class DialogPatternMaterials : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit DialogPatternMaterials(const QMap &list, bool rememberPM, QWidget *parent = nullptr);
+ virtual ~DialogPatternMaterials();
+
+
+ QMap GetPatternMaterials() const;
+ QStringList GetKnownMaterials() const;
+
+private:
+ Q_DISABLE_COPY(DialogPatternMaterials)
+ Ui::DialogPatternMaterials *ui;
+ QStringList m_knownMaterials;
+
+ void SetPatternMaterials(const QMap &list);
+};
+
+#endif // DIALOGPATTERNMATERIALS_H
diff --git a/src/app/valentina/dialogs/dialogpatternmaterials.ui b/src/app/valentina/dialogs/dialogpatternmaterials.ui
new file mode 100644
index 000000000..d52eee2d7
--- /dev/null
+++ b/src/app/valentina/dialogs/dialogpatternmaterials.ui
@@ -0,0 +1,105 @@
+
+
+ DialogPatternMaterials
+
+
+
+ 0
+ 0
+ 419
+ 472
+
+
+
+ Dialog
+
+
+ -
+
+
+ QAbstractItemView::AllEditTriggers
+
+
+ true
+
+
+ QAbstractItemView::SingleSelection
+
+
+ QAbstractItemView::SelectRows
+
+
+ false
+
+
+ Qt::NoPen
+
+
+ true
+
+
+ true
+
+
+ false
+
+
+
+ Placeholder
+
+
+
+
+ Value
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ DialogPatternMaterials
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ DialogPatternMaterials
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/src/app/valentina/dialogs/dialogpatternproperties.cpp b/src/app/valentina/dialogs/dialogpatternproperties.cpp
index 8619ea58a..3b7683924 100644
--- a/src/app/valentina/dialogs/dialogpatternproperties.cpp
+++ b/src/app/valentina/dialogs/dialogpatternproperties.cpp
@@ -39,6 +39,8 @@
#include "../vpatterndb/vcontainer.h"
#include "../core/vapplication.h"
#include "../vtools/dialogs/support/dialogeditlabel.h"
+#include "dialogknownmaterials.h"
+#include "dialogpatternmaterials.h"
// calc how many combinations we have
static const int heightsCount = (static_cast(GHeights::H200) -
@@ -63,11 +65,13 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
labelDataChanged(false),
askSaveLabelData(false),
templateDataChanged(false),
+ patternMaterialsChanged(false),
deleteAction(nullptr),
changeImageAction(nullptr),
saveImageAction(nullptr),
showImageAction(nullptr),
- templateLines()
+ templateLines(),
+ patternMaterials()
{
ui->setupUi(this);
@@ -76,6 +80,8 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
VSettings *settings = qApp->ValentinaSettings();
settings->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
+ patternMaterials = doc->GetPatternMaterials();
+
if (qApp->GetPPath().isEmpty())
{
ui->lineEditPathToFile->setText(tr(""));
@@ -181,6 +187,8 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
connect(ui->lineEditCompanyName, &QLineEdit::editingFinished, this, &DialogPatternProperties::LabelDataChanged);
connect(ui->lineEditCustomerName, &QLineEdit::editingFinished, this, &DialogPatternProperties::LabelDataChanged);
connect(ui->pushButtonEditPatternLabel, &QPushButton::clicked, this, &DialogPatternProperties::EditLabel);
+ connect(ui->pushButtonPatternMaterials, &QPushButton::clicked, this,
+ &DialogPatternProperties::ManagePatternMaterials);
InitComboBoxFormats(ui->comboBoxDateFormat,
VSettings::PredefinedDateFormats() + settings->GetUserDefinedDateFormats(),
@@ -219,6 +227,7 @@ void DialogPatternProperties::Apply()
case 3:
SaveLabelData();
SaveTemplateData();
+ SaveMaterialData();
emit doc->UpdatePatternLabel();
break;
default:
@@ -235,6 +244,7 @@ void DialogPatternProperties::Ok()
SaveReadOnlyState();
SaveLabelData();
SaveTemplateData();
+ SaveMaterialData();
emit doc->UpdatePatternLabel();
@@ -548,7 +558,6 @@ void DialogPatternProperties::SaveDescription()
doc->SetDescription(ui->plainTextEditDescription->document()->toPlainText());
descriptionChanged = false;
- emit doc->patternChanged(false);
}
}
@@ -561,7 +570,6 @@ void DialogPatternProperties::SaveGradation()
doc->SetGradationSizes(sizes);
emit UpdateGradation();
gradationChanged = false;
- emit doc->patternChanged(false);
}
}
@@ -599,8 +607,6 @@ void DialogPatternProperties::SaveLabelData()
labelDataChanged = false;
askSaveLabelData = false;
- emit doc->patternChanged(false);
- emit doc->UpdatePatternLabel();
}
}
@@ -611,8 +617,16 @@ void DialogPatternProperties::SaveTemplateData()
{
doc->SetPatternLabelTemplate(templateLines);
templateDataChanged = false;
- emit doc->patternChanged(false);
- emit doc->UpdatePatternLabel();
+ }
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void DialogPatternProperties::SaveMaterialData()
+{
+ if (patternMaterialsChanged)
+ {
+ doc->SetPatternMaterials(patternMaterials);
+ patternMaterialsChanged = false;
}
}
@@ -900,3 +914,22 @@ void DialogPatternProperties::EditLabel()
templateDataChanged = true;
}
}
+
+//---------------------------------------------------------------------------------------------------------------------
+void DialogPatternProperties::ManagePatternMaterials()
+{
+ VSettings *settings = qApp->ValentinaSettings();
+
+ DialogPatternMaterials editor(patternMaterials, settings->IsRememberPatternMaterials());
+
+ if (QDialog::Accepted == editor.exec())
+ {
+ patternMaterials = editor.GetPatternMaterials();
+ patternMaterialsChanged = true;
+
+ if (settings->IsRememberPatternMaterials())
+ {
+ settings->SetKnownMaterials(editor.GetKnownMaterials());
+ }
+ }
+}
diff --git a/src/app/valentina/dialogs/dialogpatternproperties.h b/src/app/valentina/dialogs/dialogpatternproperties.h
index ac826ff26..31977884f 100644
--- a/src/app/valentina/dialogs/dialogpatternproperties.h
+++ b/src/app/valentina/dialogs/dialogpatternproperties.h
@@ -62,6 +62,7 @@ private slots:
void ChangeImage();
void SaveImage();
void EditLabel();
+ void ManagePatternMaterials();
private:
Q_DISABLE_COPY(DialogPatternProperties)
Ui::DialogPatternProperties *ui;
@@ -79,12 +80,14 @@ private:
bool labelDataChanged;
bool askSaveLabelData;
bool templateDataChanged;
+ bool patternMaterialsChanged;
QAction *deleteAction;
QAction *changeImageAction;
QAction *saveImageAction;
QAction *showImageAction;
QVector templateLines;
+ QMap patternMaterials;
void SetHeightsChecked(bool enabled);
void SetSizesChecked(bool enabled);
@@ -103,6 +106,7 @@ private:
void SaveDefValues();
void SaveLabelData();
void SaveTemplateData();
+ void SaveMaterialData();
void SaveReadOnlyState();
void SetDefaultHeight(const QString &def);
diff --git a/src/app/valentina/dialogs/dialogpatternproperties.ui b/src/app/valentina/dialogs/dialogpatternproperties.ui
index 5c6448248..ce48451ae 100644
--- a/src/app/valentina/dialogs/dialogpatternproperties.ui
+++ b/src/app/valentina/dialogs/dialogpatternproperties.ui
@@ -21,7 +21,7 @@
-
- 0
+ 3
@@ -1239,7 +1239,7 @@
Label data
-
+
QFormLayout::ExpandingFieldsGrow
@@ -1322,6 +1322,48 @@
+ -
+
+
+ Materials
+
+
+
+ QFormLayout::ExpandingFieldsGrow
+
+
-
+
+
+ Pattern materials:
+
+
+
+ -
+
+
+ Manage list of pattern materials
+
+
+ Manage
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 90
+
+
+
+
diff --git a/src/app/valentina/dialogs/dialogs.pri b/src/app/valentina/dialogs/dialogs.pri
index 155d4041e..7962f91dc 100644
--- a/src/app/valentina/dialogs/dialogs.pri
+++ b/src/app/valentina/dialogs/dialogs.pri
@@ -17,7 +17,9 @@ HEADERS += \
$$PWD/configpages/preferencesconfigurationpage.h \
$$PWD/configpages/preferencespatternpage.h \
$$PWD/configpages/preferencespathpage.h \
- $$PWD/dialogdatetimeformats.h
+ $$PWD/dialogdatetimeformats.h \
+ $$PWD/dialogknownmaterials.h \
+ $$PWD/dialogpatternmaterials.h
SOURCES += \
$$PWD/dialogincrements.cpp \
@@ -34,7 +36,9 @@ SOURCES += \
$$PWD/configpages/preferencesconfigurationpage.cpp \
$$PWD/configpages/preferencespatternpage.cpp \
$$PWD/configpages/preferencespathpage.cpp \
- $$PWD/dialogdatetimeformats.cpp
+ $$PWD/dialogdatetimeformats.cpp \
+ $$PWD/dialogknownmaterials.cpp \
+ $$PWD/dialogpatternmaterials.cpp
FORMS += \
$$PWD/dialogincrements.ui \
@@ -51,4 +55,6 @@ FORMS += \
$$PWD/configpages/preferencesconfigurationpage.ui \
$$PWD/configpages/preferencespatternpage.ui \
$$PWD/configpages/preferencespathpage.ui \
- $$PWD/dialogdatetimeformats.ui
+ $$PWD/dialogdatetimeformats.ui \
+ $$PWD/dialogknownmaterials.ui \
+ $$PWD/dialogpatternmaterials.ui
diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp
index 502b46ca7..b6e19da18 100644
--- a/src/app/valentina/xml/vpattern.cpp
+++ b/src/app/valentina/xml/vpattern.cpp
@@ -151,7 +151,7 @@ void VPattern::Parse(const Document &parse)
QStringList tags = QStringList() << TagDraw << TagIncrements << TagDescription << TagNotes
<< TagMeasurements << TagVersion << TagGradation << TagImage << TagUnit
<< TagPatternName << TagPatternNum << TagCompanyName << TagCustomerName
- << TagPatternLabel;
+ << TagPatternLabel << TagPatternMaterials;
PrepareForParse(parse);
QDomNode domNode = documentElement().firstChild();
while (domNode.isNull() == false)
@@ -223,6 +223,9 @@ void VPattern::Parse(const Document &parse)
case 13: // TagPatternLabel
qCDebug(vXML, "Pattern label.");
break;
+ case 14: // TagPatternMaterials
+ qCDebug(vXML, "Pattern materials.");
+ break;
default:
qCDebug(vXML, "Wrong tag name %s", qUtf8Printable(domElement.tagName()));
break;
diff --git a/src/libs/ifc/schema.qrc b/src/libs/ifc/schema.qrc
index 78bfb02d4..bfc5bf737 100644
--- a/src/libs/ifc/schema.qrc
+++ b/src/libs/ifc/schema.qrc
@@ -35,6 +35,7 @@
schema/pattern/v0.5.0.xsd
schema/pattern/v0.5.1.xsd
schema/pattern/v0.6.0.xsd
+ schema/pattern/v0.6.1.xsd
schema/standard_measurements/v0.3.0.xsd
schema/standard_measurements/v0.4.0.xsd
schema/standard_measurements/v0.4.1.xsd
diff --git a/src/libs/ifc/schema/pattern/v0.6.1.xsd b/src/libs/ifc/schema/pattern/v0.6.1.xsd
new file mode 100644
index 000000000..323d4b5e1
--- /dev/null
+++ b/src/libs/ifc/schema/pattern/v0.6.1.xsd
@@ -0,0 +1,955 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp
index 9042c2acc..c8626c8d0 100644
--- a/src/libs/ifc/xml/vabstractpattern.cpp
+++ b/src/libs/ifc/xml/vabstractpattern.cpp
@@ -86,6 +86,8 @@ const QString VAbstractPattern::TagPatternNum = QStringLiteral("patternNum
const QString VAbstractPattern::TagCustomerName = QStringLiteral("customer");
const QString VAbstractPattern::TagCompanyName = QStringLiteral("company");
const QString VAbstractPattern::TagPatternLabel = QStringLiteral("patternLabel");
+const QString VAbstractPattern::TagPatternMaterials = QStringLiteral("patternMaterials");
+const QString VAbstractPattern::TagMaterial = QStringLiteral("material");
const QString VAbstractPattern::TagGrainline = QStringLiteral("grainline");
const QString VAbstractPattern::TagPath = QStringLiteral("path");
const QString VAbstractPattern::TagNodes = QStringLiteral("nodes");
@@ -121,6 +123,7 @@ const QString VAbstractPattern::AttrEnd = QStringLiteral("end");
const QString VAbstractPattern::AttrIncludeAs = QStringLiteral("includeAs");
const QString VAbstractPattern::AttrWidth = QStringLiteral("width");
const QString VAbstractPattern::AttrRotation = QStringLiteral("rotation");
+const QString VAbstractPattern::AttrNumber = QStringLiteral("number");
const QString VAbstractPattern::AttrAll = QStringLiteral("all");
@@ -195,6 +198,7 @@ const QString VAbstractPattern::NodeSplinePath = QStringLiteral("NodeSplinePath"
QHash VAbstractPattern::tools = QHash();
QVector VAbstractPattern::patternLabelLines = QVector();
+QMap VAbstractPattern::patternMaterials = QMap();
bool VAbstractPattern::patternLabelWasChanged = false;
namespace
@@ -1404,7 +1408,7 @@ QVector VAbstractPattern::GetPatternLabelTemplate() const
if (patternLabelLines.isEmpty())
{
const QDomNodeList list = elementsByTagName(TagPatternLabel);
- if (list.isEmpty())
+ if (list.isEmpty() || list.at(0).childNodes().count() == 0)
{
return QVector();
}
@@ -1415,6 +1419,35 @@ QVector VAbstractPattern::GetPatternLabelTemplate() const
return patternLabelLines;
}
+//---------------------------------------------------------------------------------------------------------------------
+void VAbstractPattern::SetPatternMaterials(const QMap &materials)
+{
+ QDomElement tag = CheckTagExists(TagPatternMaterials);
+ RemoveAllChildren(tag);
+ SetMaterials(tag, materials);
+ patternMaterials = materials;
+ patternLabelWasChanged = true;
+ modified = true;
+ emit patternChanged(false);
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+QMap VAbstractPattern::GetPatternMaterials() const
+{
+ if (patternMaterials.isEmpty())
+ {
+ const QDomNodeList list = elementsByTagName(TagPatternMaterials);
+ if (list.isEmpty() || list.at(0).childNodes().count() == 0)
+ {
+ return QMap();
+ }
+
+ patternMaterials = GetMaterials(list.at(0).toElement());
+ }
+
+ return patternMaterials;
+}
+
//---------------------------------------------------------------------------------------------------------------------
void VAbstractPattern::SetPatternWasChanged(bool changed)
{
@@ -1569,7 +1602,7 @@ QDomElement VAbstractPattern::CheckTagExists(const QString &tag)
{
const QStringList tags = QStringList() << TagUnit << TagImage << TagDescription << TagNotes
<< TagGradation << TagPatternName << TagPatternNum << TagCompanyName
- << TagCustomerName << TagPatternLabel;
+ << TagCustomerName << TagPatternLabel << TagPatternMaterials;
switch (tags.indexOf(tag))
{
case 1: //TagImage
@@ -1609,6 +1642,9 @@ QDomElement VAbstractPattern::CheckTagExists(const QString &tag)
case 9: // TagPatternLabel
element = createElement(TagPatternLabel);
break;
+ case 10: // TagPatternMaterials
+ element = createElement(TagPatternMaterials);
+ break;
case 0: //TagUnit (Mandatory tag)
default:
return QDomElement();
@@ -2018,6 +2054,52 @@ QPair > VAbstractPattern::ParseItemElement(const QD
}
}
+//---------------------------------------------------------------------------------------------------------------------
+QMap VAbstractPattern::GetMaterials(const QDomElement &element) const
+{
+ QMap materials;
+
+ if (not element.isNull())
+ {
+ QDomElement tagMaterial = element.firstChildElement();
+ while (tagMaterial.isNull() == false)
+ {
+ if (tagMaterial.tagName() == TagMaterial)
+ {
+ const int number = GetParametrUInt(tagMaterial, AttrNumber, "0");
+ const QString name = GetParametrEmptyString(tagMaterial, AttrName);
+
+ if (number > 0 && number <= userMaterialPlaceholdersQuantity)
+ {
+ materials.insert(number, name);
+ }
+ }
+ tagMaterial = tagMaterial.nextSiblingElement(TagMaterial);
+ }
+ }
+
+ return materials;
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void VAbstractPattern::SetMaterials(QDomElement &element, const QMap &materials)
+{
+ if (not element.isNull())
+ {
+ QMap::const_iterator i = materials.constBegin();
+ while (i != materials.constEnd())
+ {
+ QDomElement tagMaterial = createElement(TagMaterial);
+
+ SetAttribute(tagMaterial, AttrNumber, i.key());
+ SetAttribute(tagMaterial, AttrName, i.value());
+
+ element.appendChild(tagMaterial);
+ ++i;
+ }
+ }
+}
+
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief IsModified state of the document for cases that do not cover QUndoStack.
diff --git a/src/libs/ifc/xml/vabstractpattern.h b/src/libs/ifc/xml/vabstractpattern.h
index c70afa71e..f337e2d75 100644
--- a/src/libs/ifc/xml/vabstractpattern.h
+++ b/src/libs/ifc/xml/vabstractpattern.h
@@ -160,6 +160,9 @@ public:
void SetPatternLabelTemplate(const QVector &lines);
QVector GetPatternLabelTemplate() const;
+ void SetPatternMaterials(const QMap &materials);
+ QMap GetPatternMaterials() const;
+
void SetPatternWasChanged(bool changed);
bool GetPatternWasChanged() const;
@@ -216,6 +219,8 @@ public:
static const QString TagCompanyName;
static const QString TagCustomerName;
static const QString TagPatternLabel;
+ static const QString TagPatternMaterials;
+ static const QString TagMaterial;
static const QString TagGrainline;
static const QString TagPath;
static const QString TagNodes;
@@ -251,6 +256,7 @@ public:
static const QString AttrIncludeAs;
static const QString AttrWidth;
static const QString AttrRotation;
+ static const QString AttrNumber;
static const QString AttrAll;
@@ -395,6 +401,8 @@ protected:
static QHash tools;
/** @brief patternLabelLines list to speed up reading a template by many pieces. */
static QVector patternLabelLines;
+ /** @brief patternMaterials list to speed up reading materials by many pieces. */
+ static QMap patternMaterials;
static bool patternLabelWasChanged;
static void ToolExists(const quint32 &id);
@@ -431,6 +439,9 @@ private:
QPair > ParseItemElement(const QDomElement &domElement);
+ QMap GetMaterials(const QDomElement &element) const;
+ void SetMaterials(QDomElement &element, const QMap &materials);
+
};
#endif // VABSTRACTPATTERN_H
diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp
index 1b8cc5f24..e948d8de7 100644
--- a/src/libs/ifc/xml/vpatternconverter.cpp
+++ b/src/libs/ifc/xml/vpatternconverter.cpp
@@ -58,8 +58,8 @@ class QDomElement;
*/
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
-const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.6.0");
-const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.6.0.xsd");
+const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.6.1");
+const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.6.1.xsd");
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
@@ -241,6 +241,8 @@ QString VPatternConverter::XSDSchema(int ver) const
case (0x000501):
return QStringLiteral("://schema/pattern/v0.5.1.xsd");
case (0x000600):
+ return QStringLiteral("://schema/pattern/v0.6.0.xsd");
+ case (0x000601):
return CurrentSchema;
default:
InvalidVersion(ver);
@@ -391,6 +393,10 @@ void VPatternConverter::ApplyPatches()
ValidateXML(XSDSchema(0x000600), m_convertedFileName);
V_FALLTHROUGH
case (0x000600):
+ ToV0_6_1();
+ ValidateXML(XSDSchema(0x000601), m_convertedFileName);
+ V_FALLTHROUGH
+ case (0x000601):
break;
default:
InvalidVersion(m_ver);
@@ -409,7 +415,7 @@ void VPatternConverter::DowngradeToCurrentMaxVersion()
bool VPatternConverter::IsReadOnly() const
{
// Check if attribute readOnly was not changed in file format
- Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 6, 0),
+ Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 6, 1),
"Check attribute readOnly.");
// Possibly in future attribute readOnly will change position etc.
@@ -812,6 +818,16 @@ void VPatternConverter::ToV0_6_0()
Save();
}
+//---------------------------------------------------------------------------------------------------------------------
+void VPatternConverter::ToV0_6_1()
+{
+ // TODO. Delete if minimal supported version is 0.6.1
+ Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 6, 1),
+ "Time to refactor the code.");
+ SetVersion(QStringLiteral("0.6.1"));
+ Save();
+}
+
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::TagUnitToV0_2_0()
{
diff --git a/src/libs/ifc/xml/vpatternconverter.h b/src/libs/ifc/xml/vpatternconverter.h
index 0cc38b39f..63d5c99c4 100644
--- a/src/libs/ifc/xml/vpatternconverter.h
+++ b/src/libs/ifc/xml/vpatternconverter.h
@@ -53,7 +53,7 @@ public:
static const QString PatternMaxVerStr;
static const QString CurrentSchema;
static Q_DECL_CONSTEXPR const int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0);
- static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 6, 0);
+ static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 6, 1);
protected:
virtual int MinVer() const Q_DECL_OVERRIDE;
@@ -106,6 +106,7 @@ private:
void ToV0_5_0();
void ToV0_5_1();
void ToV0_6_0();
+ void ToV0_6_1();
void TagUnitToV0_2_0();
void TagIncrementToV0_2_0();
diff --git a/src/libs/vlayout/vtextmanager.cpp b/src/libs/vlayout/vtextmanager.cpp
index f16c9a717..afb02cd9e 100644
--- a/src/libs/vlayout/vtextmanager.cpp
+++ b/src/libs/vlayout/vtextmanager.cpp
@@ -102,6 +102,20 @@ QMap PreparePlaceholders(const VAbstractPattern *doc)
placeholders.insert(pl_height, curHeight);
placeholders.insert(pl_mExt, mExt);
+ const QMap materials = doc->GetPatternMaterials();
+ for (int i = 0; i < userMaterialPlaceholdersQuantity; ++i)
+ {
+ const QString number = QString::number(i + 1);
+
+ QString value;
+ if (materials.contains(i + 1))
+ {
+ value = materials.value(i + 1);
+ }
+
+ placeholders.insert(pl_userMaterial + number, value);
+ }
+
// Piece tags
placeholders.insert(pl_pLetter, "");
placeholders.insert(pl_pAnnotation, "");
diff --git a/src/libs/vmisc/def.cpp b/src/libs/vmisc/def.cpp
index e8f06e69e..da4838b46 100644
--- a/src/libs/vmisc/def.cpp
+++ b/src/libs/vmisc/def.cpp
@@ -117,6 +117,7 @@ const QString pl_patternName = QStringLiteral("patternName");
const QString pl_patternNumber = QStringLiteral("patternNumber");
const QString pl_author = QStringLiteral("author");
const QString pl_customer = QStringLiteral("customer");
+const QString pl_userMaterial = QStringLiteral("userMaterial");
const QString pl_pExt = QStringLiteral("pExt");
const QString pl_pFileName = QStringLiteral("pFileName");
const QString pl_mFileName = QStringLiteral("mFileName");
@@ -144,6 +145,7 @@ const QStringList labelTemplatePlaceholders = QStringList() << pl_size
<< pl_patternNumber
<< pl_author
<< pl_customer
+ << pl_userMaterial
<< pl_pExt
<< pl_pFileName
<< pl_mFileName
diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h
index e39b6dcca..4eaef17a3 100644
--- a/src/libs/vmisc/def.h
+++ b/src/libs/vmisc/def.h
@@ -359,6 +359,7 @@ extern const QString pl_patternName;
extern const QString pl_patternNumber;
extern const QString pl_author;
extern const QString pl_customer;
+extern const QString pl_userMaterial;
extern const QString pl_pExt;
extern const QString pl_pFileName;
extern const QString pl_mFileName;
@@ -378,6 +379,8 @@ extern const QString pl_mInterlining;
extern const QString pl_wCut;
extern const QString pl_wOnFold;
+const int userMaterialPlaceholdersQuantity = 9;
+
extern const QStringList labelTemplatePlaceholders;
extern const QString cursorArrowOpenHand;
diff --git a/src/libs/vmisc/vsettings.cpp b/src/libs/vmisc/vsettings.cpp
index 5cab4a234..131f8e097 100644
--- a/src/libs/vmisc/vsettings.cpp
+++ b/src/libs/vmisc/vsettings.cpp
@@ -51,7 +51,9 @@ const QString settingConfigurationLabelLanguage = QStringLiteral("configuration/
const QString settingPathsPattern = QStringLiteral("paths/pattern");
const QString settingPathsLayout = QStringLiteral("paths/layout");
-const QString settingPatternGraphicalOutput = QStringLiteral("pattern/graphicalOutput");
+const QString settingPatternGraphicalOutput = QStringLiteral("pattern/graphicalOutput");
+const QString settingPatternKnownMaterials = QStringLiteral("pattern/knownMaterials");
+const QString settingPatternRememberMaterials = QStringLiteral("pattern/rememberMaterials");
const QString settingCommunityServer = QStringLiteral("community/server");
const QString settingCommunityServerSecure = QStringLiteral("community/serverSecure");
@@ -606,3 +608,26 @@ void VSettings::SetTextAsPaths(bool value)
setValue(settingTextAsPaths, value);
}
+//---------------------------------------------------------------------------------------------------------------------
+QStringList VSettings::GetKnownMaterials() const
+{
+ return value(settingPatternKnownMaterials, QStringList()).toStringList();
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void VSettings::SetKnownMaterials(const QStringList &list)
+{
+ setValue(settingPatternKnownMaterials, list);
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+bool VSettings::IsRememberPatternMaterials() const
+{
+ return value(settingPatternRememberMaterials, true).toBool();
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void VSettings::SetRememberPatternMaterials(bool value)
+{
+ setValue(settingPatternRememberMaterials, value);
+}
diff --git a/src/libs/vmisc/vsettings.h b/src/libs/vmisc/vsettings.h
index 39454c69c..1c7530ab0 100644
--- a/src/libs/vmisc/vsettings.h
+++ b/src/libs/vmisc/vsettings.h
@@ -155,6 +155,12 @@ public:
static bool GetDefTextAsPaths();
void SetTextAsPaths(bool value);
+ QStringList GetKnownMaterials() const;
+ void SetKnownMaterials(const QStringList &list);
+
+ bool IsRememberPatternMaterials() const;
+ void SetRememberPatternMaterials(bool value);
+
private:
Q_DISABLE_COPY(VSettings)
};
diff --git a/src/libs/vpatterndb/vtranslatevars.cpp b/src/libs/vpatterndb/vtranslatevars.cpp
index a672e7e18..49df3568c 100644
--- a/src/libs/vpatterndb/vtranslatevars.cpp
+++ b/src/libs/vpatterndb/vtranslatevars.cpp
@@ -465,6 +465,7 @@ void VTranslateVars::InitPlaceholder()
placeholders.insert(pl_patternNumber, translate("VTranslateVars", "patternNumber", "placeholder"));
placeholders.insert(pl_author, translate("VTranslateVars", "author", "placeholder"));
placeholders.insert(pl_customer, translate("VTranslateVars", "customer", "placeholder"));
+ placeholders.insert(pl_userMaterial, translate("VTranslateVars", "userMaterial", "placeholder"));
placeholders.insert(pl_pExt, translate("VTranslateVars", "pExt", "placeholder"));
placeholders.insert(pl_pFileName, translate("VTranslateVars", "pFileName", "placeholder"));
placeholders.insert(pl_mFileName, translate("VTranslateVars", "mFileName", "placeholder"));
@@ -687,11 +688,18 @@ QString VTranslateVars::InternalVarToUser(const QString &var) const
}
//---------------------------------------------------------------------------------------------------------------------
-QString VTranslateVars::PlaceholderToUser(const QString &var) const
+QString VTranslateVars::PlaceholderToUser(QString var) const
{
+ QString number;
+ if (var.startsWith(pl_userMaterial) && var.length() > pl_userMaterial.length())
+ {
+ number = var.right(var.length() - pl_userMaterial.length());
+ var = pl_userMaterial;
+ }
+
if (placeholders.contains(var))
{
- return placeholders.value(var).translate();
+ return placeholders.value(var).translate() + number;
}
return var;
diff --git a/src/libs/vpatterndb/vtranslatevars.h b/src/libs/vpatterndb/vtranslatevars.h
index 1ac8a7c68..0596c0f58 100644
--- a/src/libs/vpatterndb/vtranslatevars.h
+++ b/src/libs/vpatterndb/vtranslatevars.h
@@ -46,7 +46,7 @@ public:
bool VariablesToUser(QString &newFormula, int position, const QString &token, int &bias) const;
QString InternalVarToUser(const QString &var) const;
- QString PlaceholderToUser(const QString &var) const;
+ QString PlaceholderToUser(QString var) const;
QString PlaceholderToUserText(QString text) const;
QString PlaceholderFromUserText(QString text) const;
diff --git a/src/libs/vtools/dialogs/support/dialogeditlabel.cpp b/src/libs/vtools/dialogs/support/dialogeditlabel.cpp
index 332e444f7..ed7a34a7b 100644
--- a/src/libs/vtools/dialogs/support/dialogeditlabel.cpp
+++ b/src/libs/vtools/dialogs/support/dialogeditlabel.cpp
@@ -506,6 +506,21 @@ void DialogEditLabel::InitPlaceholders()
m_placeholders.insert(pl_height, qMakePair(tr("Height"), curHeight));
m_placeholders.insert(pl_mExt, qMakePair(tr("Measurments extension"), mExt));
+ const QString materialDescription = tr("User material");
+ const QMap materials = m_doc->GetPatternMaterials();
+ for (int i = 0; i < userMaterialPlaceholdersQuantity; ++i)
+ {
+ const QString number = QString::number(i + 1);
+
+ QString value;
+ if (materials.contains(i + 1))
+ {
+ value = materials.value(i + 1);
+ }
+
+ m_placeholders.insert(pl_userMaterial + number, qMakePair(materialDescription + number, value));
+ }
+
// Piece tags
m_placeholders.insert(pl_pLetter, qMakePair(tr("Piece letter"), QString("")));
m_placeholders.insert(pl_pAnnotation, qMakePair(tr("Piece annotation"), QString("")));