1 /************************************************************************
2  **
3  **  @file   vtranslatemeasurements.h
4  **  @author Roman Telezhynskyi <dismine(at)gmail.com>
5  **  @date   2 8, 2015
6  **
7  **  @brief
8  **  @copyright
9  **  This source code is part of the Valentina project, a pattern making
10  **  program, whose allow create and modeling patterns of clothing.
11  **  Copyright (C) 2015 Valentina project
12  **  <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
13  **
14  **  Valentina is free software: you can redistribute it and/or modify
15  **  it under the terms of the GNU General Public License as published by
16  **  the Free Software Foundation, either version 3 of the License, or
17  **  (at your option) any later version.
18  **
19  **  Valentina is distributed in the hope that it will be useful,
20  **  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  **  GNU General Public License for more details.
23  **
24  **  You should have received a copy of the GNU General Public License
25  **  along with Valentina.  If not, see <http://www.gnu.org/licenses/>.
26  **
27  *************************************************************************/
28 
29 #ifndef VTRANSLATEMEASUREMENTS_H
30 #define VTRANSLATEMEASUREMENTS_H
31 
32 #include <QMap>
33 #include <QString>
34 #include <QtGlobal>
35 
36 #include "../qmuparser/qmutranslation.h"
37 
38 class VTranslateMeasurements
39 {
40 public:
41     VTranslateMeasurements();
42     virtual ~VTranslateMeasurements();
43 
44     bool MeasurementsFromUser(QString &newFormula, int position, const QString &token, int &bias) const;
45 
46     QString MFromUser(const QString &measurement) const;
47     QString MToUser(const QString &measurement) const;
48     QString MNumber(const QString &measurement) const;
49     QString MFormula(const QString &measurement) const;
50     QString GuiText(const QString &measurement) const;
51     QString Description(const QString &measurement) const;
52 
53     virtual void Retranslate();
54 
55 protected:
56     QMap<QString, qmu::QmuTranslation> measurements;
57 
58 private:
59     Q_DISABLE_COPY(VTranslateMeasurements)
60     QMap<QString, qmu::QmuTranslation> guiTexts;
61     QMap<QString, qmu::QmuTranslation> descriptions;
62     QMap<QString, QString> numbers;
63     QMap<QString, QString> formulas;
64 
65     void InitGroupA(); // Direct Height
66     void InitGroupB(); // Direct Width
67     void InitGroupC(); // Indentation
68     void InitGroupD(); // Circumference and Arc
69     void InitGroupE(); // Vertical
70     void InitGroupF(); // Horizontal
71     void InitGroupG(); // Bust
72     void InitGroupH(); // Balance
73     void InitGroupI(); // Arm
74     void InitGroupJ(); // Leg
75     void InitGroupK(); // Crotch and Rise
76     void InitGroupL(); // Hand
77     void InitGroupM(); // Foot
78     void InitGroupN(); // Head
79     void InitGroupO(); // Men & Tailoring
80     void InitGroupP(); // Historical & Specialty
81     void InitGroupQ(); // Patternmaking measurements
82 
83     void InitMeasurements();
84 
85     void InitMeasurement(const QString &name, const qmu::QmuTranslation &m, const qmu::QmuTranslation &g,
86                          const qmu::QmuTranslation &d, const QString &number, const QString &formula = QString());
87 };
88 
89 #endif // VTRANSLATEMEASUREMENTS_H
90