57 #include <QMessageLogger>
63 #include "../ifc/ifcdef.h"
64 #include "../vmisc/def.h"
65 #include "../vmisc/vabstractapplication.h"
66 #include "../qmuparser/qmuparsererror.h"
67 #include "../qmuparser/qmutokenparser.h"
68 #include "../qmuparser/qmutranslation.h"
69 #include "../vpatterndb/vtranslatevars.h"
74 PMSystemNames(
QMap<QString,
qmu::QmuTranslation>()),
75 PMSystemAuthors(
QMap<QString,
qmu::QmuTranslation>()),
76 PMSystemBooks(
QMap<QString,
qmu::QmuTranslation>()),
77 variables(
QMap<QString,
qmu::QmuTranslation>()),
78 functions(
QMap<QString,
qmu::QmuTranslation>()),
79 postfixOperators(
QMap<QString,
qmu::QmuTranslation>()),
80 placeholders(
QMap<QString,
qmu::QmuTranslation>()),
81 stDescriptions(
QMap<QString,
qmu::QmuTranslation>())
94 #define translate(context, source, disambiguation) qmu::QmuTranslation::translate((context), (source), (disambiguation))
106 name =
translate(
"VTranslateVars",
"Bunka",
"System name");
107 author =
translate(
"VTranslateVars",
"Bunka Fashion College",
"Author name");
108 book =
translate(
"VTranslateVars",
"Fundamentals of Garment Design",
"Book name");
111 name =
translate(
"VTranslateVars",
"Barnfield and Richard",
"System name");
112 author =
translate(
"VTranslateVars",
"Jo Barnfield and Andrew Richards",
"Author name");
113 book =
translate(
"VTranslateVars",
"Pattern Making Primer",
"Book name");
116 name =
translate(
"VTranslateVars",
"Friendship/Women",
"System name");
117 author =
translate(
"VTranslateVars",
"Elizabeth Friendship",
"Author name");
119 "Creating Historical Clothes - Pattern Cutting from the 16th to the 19th Centuries",
"Book name");
122 name =
translate(
"VTranslateVars",
"Morris, K.",
"System name");
123 author =
translate(
"VTranslateVars",
"Karen Morris",
"Author name");
124 book =
translate(
"VTranslateVars",
"Sewing Lingerie that Fits",
"Book name");
127 name =
translate(
"VTranslateVars",
"Castro",
"System name");
128 author =
translate(
"VTranslateVars",
"Lucia Mors de Castro",
"Author name");
129 book =
translate(
"VTranslateVars",
"Patternmaking in Practic",
"Book name");
132 name =
translate(
"VTranslateVars",
"Kim & Uh",
"System name");
133 author =
translate(
"VTranslateVars",
"Injoo Kim and Mykyung Uh",
"Author name");
134 book =
translate(
"VTranslateVars",
"Apparel Making in Fashion Design",
"Book name");
137 name =
translate(
"VTranslateVars",
"Waugh",
"System name");
138 author =
translate(
"VTranslateVars",
"Norah Waugh",
"Author name");
139 book =
translate(
"VTranslateVars",
"Corsets and Crinolines",
"Book name");
142 name =
translate(
"VTranslateVars",
"Grimble",
"System name");
143 author =
translate(
"VTranslateVars",
"Frances Grimble",
"Author name");
144 book =
translate(
"VTranslateVars",
"Fashions of the Gilded Age",
"Book name");
147 name =
translate(
"VTranslateVars",
"Thornton's International System",
"System name");
148 author =
translate(
"VTranslateVars",
"ed. R. L. Shep",
"Author name");
149 book =
translate(
"VTranslateVars",
"The Great War: Styles and Patterns of the 1910s",
"Book name");
152 name =
translate(
"VTranslateVars",
"Hillhouse & Mansfield",
"System name");
153 author =
translate(
"VTranslateVars",
"Marion S. Hillhouse and Evelyn A. Mansfield",
"Author name");
154 book =
translate(
"VTranslateVars",
"Dress Design: Draping and Flat Pattern Making",
"Book name");
157 name =
translate(
"VTranslateVars",
"Pivnick",
"System name");
158 author =
translate(
"VTranslateVars",
"Esther Kaplan Pivnick",
"Author name");
159 book =
translate(
"VTranslateVars",
"How to Design Beautiful Clothes: Designing and Pattern Making",
"Book name");
162 name =
translate(
"VTranslateVars",
"Minister & Son",
"System name");
163 author =
translate(
"VTranslateVars",
"Edward Minister & Son, ed. R. L. Shep",
"Author name");
164 book =
translate(
"VTranslateVars",
"The Complete Guide to Practical Cutting (1853)",
"Book name");
167 name =
translate(
"VTranslateVars",
"Strickland",
"System name");
168 author =
translate(
"VTranslateVars",
"Gertrude Strickland",
"Author name");
169 book =
translate(
"VTranslateVars",
"A Tailoring Manual",
"Book name");
172 name =
translate(
"VTranslateVars",
"Loh & Lewis",
"System name");
173 author =
translate(
"VTranslateVars",
"May Loh and Diehl Lewis",
"Author name");
174 book =
translate(
"VTranslateVars",
"Patternless Fashion Design",
"Book name");
177 name =
translate(
"VTranslateVars",
"Morris, F. R.",
"System name");
178 author =
translate(
"VTranslateVars",
"F. R. Morris",
"Author name");
179 book =
translate(
"VTranslateVars",
"Ladies Garment Cutting and Making",
"Book name");
182 name =
translate(
"VTranslateVars",
"Mason",
"System name");
183 author =
translate(
"VTranslateVars",
"Gertrude Mason",
"Author name");
184 book =
translate(
"VTranslateVars",
"Gertrude Mason's Patternmaking Book",
"Book name");
187 name =
translate(
"VTranslateVars",
"Kimata",
"System name");
188 author =
translate(
"VTranslateVars",
"K. Kimata",
"Author name");
189 book =
translate(
"VTranslateVars",
"K.Kimata's Simplified Drafting Book for Dressmaking",
"Book name");
192 name =
translate(
"VTranslateVars",
"Master Designer",
"System name");
193 author =
translate(
"VTranslateVars",
"The Master Designer (Chicago, IL)",
"Author name");
194 book =
translate(
"VTranslateVars",
"Master Designer's System of Designing, Cutting and Grading",
"Book name");
197 name =
translate(
"VTranslateVars",
"Kopp",
"System name");
198 author =
translate(
"VTranslateVars",
"Ernestine Kopp, Vittorina Rolfo, Beatrice Zelin, Lee Gross",
"Author name");
199 book =
translate(
"VTranslateVars",
"How to Draft Basic Patterns",
"Book name");
202 name =
translate(
"VTranslateVars",
"Ekern",
"System name");
203 author =
translate(
"VTranslateVars",
"Doris Ekern",
"Author name");
204 book =
translate(
"VTranslateVars",
"Slacks Cut-to-Fit for Your Figure",
"Book name");
207 name =
translate(
"VTranslateVars",
"Doyle",
"System name");
208 author =
translate(
"VTranslateVars",
"Sarah J. Doyle",
"Author name");
209 book =
translate(
"VTranslateVars",
"Sarah's Key to Pattern Drafting",
"Book name");
212 name =
translate(
"VTranslateVars",
"Shelton",
"System name");
213 author =
translate(
"VTranslateVars",
"Karla J. Shelton",
"Author name");
214 book =
translate(
"VTranslateVars",
"Design and Sew Jeans",
"Book name");
217 name =
translate(
"VTranslateVars",
"Lady Boutique",
"System name");
218 author =
translate(
"VTranslateVars",
"Lady Boutique",
"Author name");
219 book =
translate(
"VTranslateVars",
"Lady Boutique magazine (Japan)",
"Book name");
222 name =
translate(
"VTranslateVars",
"Rohr",
"System name");
223 author =
translate(
"VTranslateVars",
"M. Rohr",
"Author name");
224 book =
translate(
"VTranslateVars",
"Pattern Drafting and Grading: Women's nd Misses' Garment Design",
"Book name");
227 name =
translate(
"VTranslateVars",
"Moore",
"System name");
228 author =
translate(
"VTranslateVars",
"Dorothy Moore",
"Author name");
229 book =
translate(
"VTranslateVars",
"Dorothy Moore's Pattern Drafting and Dressmaking",
"Book name");
232 name =
translate(
"VTranslateVars",
"Abling",
"System name");
233 author =
translate(
"VTranslateVars",
"Bina Abling",
"Author name");
234 book =
translate(
"VTranslateVars",
"Integrating Draping, Drafting and Drawing",
"Book name");
237 name =
translate(
"VTranslateVars",
"Fukomoto",
"System name");
238 author =
translate(
"VTranslateVars",
"Sue S. Fukomoto",
"Author name");
239 book =
translate(
"VTranslateVars",
"Scientific Pattern Drafting as taught at Style Center School of Costume "
240 "Design, Dressmaking and Millinery",
"Book name");
243 name =
translate(
"VTranslateVars",
"Dressmaking International",
"System name");
244 author =
translate(
"VTranslateVars",
"Dressmaking International",
"Author name");
245 book =
translate(
"VTranslateVars",
"Dressmaking International magazine (Japan)",
"Book name");
248 name =
translate(
"VTranslateVars",
"Erwin",
"System name");
249 author =
translate(
"VTranslateVars",
"Mabel D. Erwin",
"Author name");
250 book =
translate(
"VTranslateVars",
"Practical Dress Design",
"Book name");
253 name =
translate(
"VTranslateVars",
"Gough",
"System name");
254 author =
translate(
"VTranslateVars",
"E. L. G. Gough",
"Author name");
255 book =
translate(
"VTranslateVars",
"Principles of Garment Cutting",
"Book name");
258 name =
translate(
"VTranslateVars",
"Allemong",
"System name");
259 author =
translate(
"VTranslateVars",
"Elizabeth M. Allemong",
"Author name");
260 book =
translate(
"VTranslateVars",
"European Cut",
"Book name");
263 name =
translate(
"VTranslateVars",
"McCunn",
"System name");
264 author =
translate(
"VTranslateVars",
"Donald H. McCunn",
"Author name");
265 book =
translate(
"VTranslateVars",
"How to Make Your Own Sewing Patterns",
"Book name");
268 name =
translate(
"VTranslateVars",
"Zarapkar",
"System name");
269 author =
translate(
"VTranslateVars",
"Shri K. R. Zarapkar and Shri Arvind K. Zarapkar",
"Author name");
270 book =
translate(
"VTranslateVars",
"Zarapkar System of Cutting",
"Book name");
273 name =
translate(
"VTranslateVars",
"Kunick",
"System name");
274 author =
translate(
"VTranslateVars",
"Philip Kunick",
"Author name");
275 book =
translate(
"VTranslateVars",
"Sizing, Pattern Construction and Grading for Women's and Children's Garments",
279 name =
translate(
"VTranslateVars",
"Handford",
"System name");
280 author =
translate(
"VTranslateVars",
"Jack Handford",
"Author name");
281 book =
translate(
"VTranslateVars",
"Professional Patternmaking for Designers: Women's Wear, Men's Casual Wear",
285 name =
translate(
"VTranslateVars",
"Davis",
"System name");
286 author =
translate(
"VTranslateVars",
"R. I. Davis",
"Author name");
287 book =
translate(
"VTranslateVars",
"Men's 17th & 18th Century Costume, Cut & Fashion",
"Book name");
290 name =
translate(
"VTranslateVars",
"MacLochlainn",
"System name");
291 author =
translate(
"VTranslateVars",
"Jason MacLochlainn",
"Author name");
292 book =
translate(
"VTranslateVars",
"The Victorian Tailor: An Introduction to Period Tailoring",
"Book name");
295 name =
translate(
"VTranslateVars",
"Joseph-Armstrong",
"System name");
296 author =
translate(
"VTranslateVars",
"Helen Joseph-Armstrong",
"Author name");
297 book =
translate(
"VTranslateVars",
"Patternmaking for Fashion Design",
"Book name");
300 name =
translate(
"VTranslateVars",
"Supreme System",
"System name");
301 author =
translate(
"VTranslateVars",
"Frederick T. Croonberg",
"Author name");
302 book =
translate(
"VTranslateVars",
"The Blue Book of Men's Tailoring, Grand Edition of Supreme System for "
303 "Producing Mens Garments (1907)",
"Book name");
306 name =
translate(
"VTranslateVars",
"Sugino",
"System name");
307 author =
translate(
"VTranslateVars",
"Dressmaking",
"Author name");
308 book =
translate(
"VTranslateVars",
"Pattern Drafting Vols. I, II, III (Japan)",
"Book name");
311 name =
translate(
"VTranslateVars",
"Centre Point System",
"System name");
312 author =
translate(
"VTranslateVars",
"Louis Devere",
"Author name");
313 book =
translate(
"VTranslateVars",
"The Handbook of Practical Cutting on the Centre Point System",
"Book name");
316 name =
translate(
"VTranslateVars",
"Aldrich/Men",
"System name");
317 author =
translate(
"VTranslateVars",
"Winifred Aldrich",
"Author name");
318 book =
translate(
"VTranslateVars",
"Metric Pattern Cutting for Menswear",
"Book name");
321 name =
translate(
"VTranslateVars",
"Aldrich/Women",
"System name");
322 author =
translate(
"VTranslateVars",
"Winifred Aldrich",
"Author name");
323 book =
translate(
"VTranslateVars",
"Metric Pattern Cutting for Women's Wear",
"Book name");
326 name =
translate(
"VTranslateVars",
"Kershaw",
"System name");
327 author =
translate(
"VTranslateVars",
"Gareth Kershaw",
"Author name");
328 book =
translate(
"VTranslateVars",
"Patternmaking for Menswear",
"Book name");
331 name =
translate(
"VTranslateVars",
"Gilewska",
"System name");
332 author =
translate(
"VTranslateVars",
"Teresa Gilewska",
"Author name");
333 book =
translate(
"VTranslateVars",
"Pattern-Drafting for Fashion: The Basics",
"Book name");
336 name =
translate(
"VTranslateVars",
"Lo",
"System name");
337 author =
translate(
"VTranslateVars",
"Dennic Chunman Lo",
"Author name");
338 book =
translate(
"VTranslateVars",
"Pattern Cutting",
"Book name");
341 name =
translate(
"VTranslateVars",
"Bray",
"System name");
342 author =
translate(
"VTranslateVars",
"Natalie Bray",
"Author name");
343 book =
translate(
"VTranslateVars",
"Dress Pattern Designing: The Basic Principles of Cut and Fit",
"Book name");
346 name =
translate(
"VTranslateVars",
"Knowles/Men",
"System name");
347 author =
translate(
"VTranslateVars",
"Lori A. Knowles",
"Author name");
348 book =
translate(
"VTranslateVars",
"The Practical Guide to Patternmaking for Fashion Designers: Menswear",
352 name =
translate(
"VTranslateVars",
"Friendship/Men",
"System name");
353 author =
translate(
"VTranslateVars",
"Elizabeth Friendship",
"Author name");
354 book =
translate(
"VTranslateVars",
"Pattern Cutting for Men's Costume",
"Book name");
357 name =
translate(
"VTranslateVars",
"Brown",
"System name");
358 author =
translate(
"VTranslateVars",
"P. Clement Brown",
"Author name");
359 book =
translate(
"VTranslateVars",
"Art in Dress",
"Book name");
362 name =
translate(
"VTranslateVars",
"Mitchell",
"System name");
363 author =
translate(
"VTranslateVars",
"Jno. J. Mitchell",
"Author name");
364 book =
translate(
"VTranslateVars",
"\"Standard\" Work on Cutting (Men's Garments) 1886: The Art and Science of "
365 "Garment Cutting",
"Book name");
368 name =
translate(
"VTranslateVars",
"GOST 17917-86",
"System name");
369 author =
translate(
"VTranslateVars",
"Ministry of consumer industry of the USSR",
"Author name");
370 book =
translate(
"VTranslateVars",
"Standard figure boys",
"Book name");
373 name =
translate(
"VTranslateVars",
"Eddy",
"System name");
374 author =
translate(
"VTranslateVars",
"Josephine F. Eddy and Elizabeth C. B. Wiley",
"Author name");
375 book =
translate(
"VTranslateVars",
"Pattern and Dress Design",
"Book name");
378 name =
translate(
"VTranslateVars",
"Knowles/Women",
"System name");
379 author =
translate(
"VTranslateVars",
"Lori A. Knowles",
"Author name");
380 book =
translate(
"VTranslateVars",
"Practical Guide to Patternmaking for Fashion Designers: Juniors, Misses, and "
381 "Women",
"Book name");
384 name =
translate(
"VTranslateVars",
"American Garment Cutter",
"System name");
385 author =
translate(
"VTranslateVars",
"ed. R. L. Shep",
"Author name");
386 book =
translate(
"VTranslateVars",
"The Great War: Styles and Patterns of the 1910s",
"Book name");
389 name =
translate(
"VTranslateVars",
"None",
"System name");
390 author =
translate(
"VTranslateVars",
"Seamly2D team",
"Author name");
391 book =
translate(
"VTranslateVars",
"Seamly2D's internal standard",
"Book name");
417 "Do not add symbol _ to the end of the name"));
419 "Do not add symbol _ to the end of the name"));
423 "Do not add space between words"));
427 "Do not add symbol _ to the end of the name"));
429 "Do not add symbol _ to the end of the name"));
435 functions.insert(
degTorad_F,
translate(
"VTranslateVars",
"degTorad",
"Converts degrees to radians\nUsage: degTorad(angle θ in degrees)"));
436 functions.insert(
radTodeg_F,
translate(
"VTranslateVars",
"radTodeg",
"Converts radians to degrees\nUsage: radTodeg(angle θ in radians)"));
437 functions.insert(
sin_F,
translate(
"VTranslateVars",
"sin",
"Sine function working with radians\nUsage: sin(angle θ in radians)"));
438 functions.insert(
cos_F,
translate(
"VTranslateVars",
"cos",
"Cosine function working with radians\nUsage: cos(angle θ in radians)"));
439 functions.insert(
tan_F,
translate(
"VTranslateVars",
"tan",
"Tangent function working with radians\nUsage: tan(angle θ in radians)"));
440 functions.insert(
asin_F,
translate(
"VTranslateVars",
"asin",
"Inverse sine function working with radians\nUsage: asin(x)"));
441 functions.insert(
acos_F,
translate(
"VTranslateVars",
"acos",
"Inverse cosine function working with radians\nUsage: acos(x)"));
442 functions.insert(
atan_F,
translate(
"VTranslateVars",
"atan",
"Inverse tangent function working with radians\nUsage: atan(x)"));
443 functions.insert(
sinh_F,
translate(
"VTranslateVars",
"sinh",
"Hyperbolic sine function\nUsage: sinh(angle θ in radians)"));
444 functions.insert(
cosh_F,
translate(
"VTranslateVars",
"cosh",
"Hyperbolic cosine\nUsage: cosh(angle θ in radians)"));
445 functions.insert(
tanh_F,
translate(
"VTranslateVars",
"tanh",
"Hyperbolic tangent function\nUsage: tanh(angle θ in radians)"));
449 functions.insert(
sinD_F,
translate(
"VTranslateVars",
"sinD",
"Sine function working with degrees\nUsage: sinD(angle θ in degrees)"));
450 functions.insert(
cosD_F,
translate(
"VTranslateVars",
"cosD",
"Cosine function working with degrees\nUsage: cosD(angle θ in degrees)"));
451 functions.insert(
tanD_F,
translate(
"VTranslateVars",
"tanD",
"Tangent function working with degrees\nUsage: tanD(angle θ in degrees)"));
452 functions.insert(
asinD_F,
translate(
"VTranslateVars",
"asinD",
"Inverse sine function working with degrees\nUsage: asinD(x)"));
453 functions.insert(
acosD_F,
translate(
"VTranslateVars",
"acosD",
"Inverse cosine function working with degrees\nUsage: acosD(x)"));
454 functions.insert(
atanD_F,
translate(
"VTranslateVars",
"atanD",
"Inverse tangent function working with degrees\nUsage: atanD(x)"));
458 functions.insert(
ln_F,
translate(
"VTranslateVars",
"ln",
"Logarithm to base e (2.71828...)\nUsage: ln(x)"));
459 functions.insert(
exp_F,
translate(
"VTranslateVars",
"exp",
"E raised to the power of x\nUsage: exp(x) where e = 2.718"));
464 functions.insert(
min_F,
translate(
"VTranslateVars",
"min",
"Min of all arguments\nUsage: min(arg 1; arg 2; ... arg n)"));
465 functions.insert(
max_F,
translate(
"VTranslateVars",
"max",
"Max of all arguments\nUsage: max(arg 1; arg 2; ... arg n)"));
466 functions.insert(
sum_F,
translate(
"VTranslateVars",
"sum",
"Sum of all arguments\nUsage: sum(arg 1; arg 2; ... arg n)"));
467 functions.insert(
avg_F,
translate(
"VTranslateVars",
"avg",
"Mean value of all arguments\nUsage: avg(arg 1; arg 2; ... arg n)"));
469 "Returns the floating-point remainder of x/y (rounded towards zero)\nUsage: fmod(x; y)"));
557 while (i != tokens.constEnd())
559 if (i.key()<= position)
561 newTokens.insert(i.key(), i.value());
565 newTokens.insert(i.key()-bias, i.value());
594 if (token.indexOf(varTr) == 0)
596 if ((varTr == currentLengthTr || varTr == currentSeamAllowanceTr) && token != varTr)
602 newFormula.replace(position, varTr.length(), i.key());
603 QString newToken = token;
604 newToken.replace(0, varTr.length(), i.key());
605 bias = token.length() - newToken.length();
627 if (token == i.value().translate())
629 newFormula.replace(position, token.length(), i.key());
630 bias = token.length() - i.key().length();
652 if (token == i.value().translate())
654 newFormula.replace(position, token.length(), i.key());
655 bias = token.length() - i.key().length();
677 if (token.indexOf( i.key() ) == 0)
685 newFormula.replace(position, i.key().length(), i.value().translate());
687 QString newToken = token;
688 newToken.replace(0, i.key().length(), i.value().translate());
689 bias = token.length() - newToken.length();
700 QString newVar = var;
730 const QString translated = per + i.value().translate() + per;
731 const QString original = per + i.key() + per;
733 if (translated != original)
735 text.replace(original, translated);
749 const QString translated = per + i.value().translate() + per;
750 const QString original = per + i.key() + per;
752 if (translated != original)
754 text.replace(translated, original);
785 QString newVar = var;
844 if (formula.isEmpty())
848 QString newFormula = formula;
857 for (
int i = 0; i < tKeys.size(); ++i)
865 tKeys = tokens.keys();
866 tValues = tokens.values();
876 tKeys = tokens.keys();
877 tValues = tokens.values();
887 tKeys = tokens.keys();
888 tValues = tokens.values();
898 tKeys = tokens.keys();
899 tValues = tokens.values();
904 if (tValues.at(i) == QLocale().negativeSign())
906 newFormula.replace(tKeys.at(i), 1,
'-');
910 QLocale loc = QLocale();
911 if (loc != QLocale::c() && osSeparator)
915 for (
int i = 0; i < nKeys.size(); ++i)
919 const qreal d = loc.toDouble(nValues.at(i), &ok);
922 qDebug()<<
"Can't convert to double token"<<nValues.at(i);
927 const QString dStr = loc.toString(d);
928 newFormula.replace(nKeys.at(i), nValues.at(i).length(), dStr);
929 const int bias = nValues.at(i).length() - dStr.length();
933 nKeys = numbers.keys();
934 nValues = numbers.values();
947 return qApp->TrVars()->FormulaFromUser(formula, osSeparator);
965 if (formula.isEmpty())
970 QString newFormula = formula;
977 tokens = cal->GetTokens();
978 numbers = cal->GetNumbers();
982 qDebug() <<
"\nMath parser error:\n"
983 <<
"--------------------------------------\n"
984 <<
"Message: " << e.
GetMsg() <<
"\n"
985 <<
"Expression: " << e.
GetExpr() <<
"\n"
986 <<
"--------------------------------------";
992 for (
int i = 0; i < tKeys.size(); ++i)
996 newFormula.replace(tKeys.at(i), tValues.at(i).length(),
m_measurements.value(tValues.at(i)).translate());
997 int bias = tValues.at(i).length() -
m_measurements.value(tValues.at(i)).translate().length();
1001 tKeys = tokens.keys();
1002 tValues = tokens.values();
1009 newFormula.replace(tKeys.at(i), tValues.at(i).length(),
functions.value(tValues.at(i)).translate());
1010 int bias = tValues.at(i).length() -
functions.value(tValues.at(i)).translate().length();
1014 tKeys = tokens.keys();
1015 tValues = tokens.values();
1022 newFormula.replace(tKeys.at(i), tValues.at(i).length(),
postfixOperators.value(tValues.at(i)).translate());
1023 int bias = tValues.at(i).length() -
postfixOperators.value(tValues.at(i)).translate().length();
1027 tKeys = tokens.keys();
1028 tValues = tokens.values();
1039 tKeys = tokens.keys();
1040 tValues = tokens.values();
1045 if (tValues.at(i) == QChar(
'-'))
1047 newFormula.replace(tKeys.at(i), 1, QLocale().negativeSign());
1051 QLocale loc = QLocale();
1052 if (loc != QLocale::C && osSeparator)
1056 for (
int i = 0; i < nKeys.size(); ++i)
1060 const qreal d = loc.toDouble(nValues.at(i), &ok);
1063 qDebug()<<
"Can't convert to double token"<<nValues.at(i);
1068 QString dStr = loc.toString(d);
1069 newFormula.replace(nKeys.at(i), nValues.at(i).length(), dStr);
1070 const int bias = nValues.at(i).length() - dStr.length();
1074 nKeys = numbers.keys();
1075 nValues = numbers.values();
bool MeasurementsFromUser(QString &newFormula, int position, const QString &token, int &bias) const
MeasurementsFromUser translate measurement to internal look.
QMap< QString, qmu::QmuTranslation > m_measurements
virtual void Retranslate()
QString VarToUser(const QString &var) const
QString PlaceholderFromUserText(QString text) const
QString PMSystemName(const QString &code) const
QString PlaceholderToUserText(QString text) const
QString VarFromUser(const QString &var) const
virtual ~VTranslateVars() Q_DECL_OVERRIDE
QMap< QString, qmu::QmuTranslation > functions
virtual void Retranslate() Q_DECL_OVERRIDE
QString InternalVarToUser(const QString &var) const
QMap< QString, qmu::QmuTranslation > getFunctions() const
QMap< QString, qmu::QmuTranslation > PMSystemAuthors
void InitSystem(const QString &code, const qmu::QmuTranslation &name, const qmu::QmuTranslation &author, const qmu::QmuTranslation &book)
void InitPostfixOperators()
void CorrectionsPositions(int position, int bias, QMap< int, QString > &tokens, QMap< int, QString > &numbers) const
CorrectionsPositions correct position tokens in expression after token translation.
void InitPatternMakingSystems()
QMap< QString, qmu::QmuTranslation > PMSystemNames
QMap< QString, qmu::QmuTranslation > PMSystemBooks
static QString TryFormulaFromUser(const QString &formula, bool osSeparator)
bool PostfixOperatorsFromUser(QString &newFormula, int position, const QString &token, int &bias) const
PostfixOperatorsFromUser translate postfix operator to internal look.
bool FunctionsFromUser(QString &newFormula, int position, const QString &token, int &bias) const
FunctionsFromUser translate function name to internal look.
QString PlaceholderToUser(const QString &var) const
QMap< QString, qmu::QmuTranslation > placeholders
QString FormulaToUser(const QString &formula, bool osSeparator) const
FormulaToUser replace all known tokens in formula to user look. Also change decimal separator in numb...
bool VariablesFromUser(QString &newFormula, int position, const QString &token, int &bias) const
VariablesFromUser translate variable to internal look.
QMap< QString, qmu::QmuTranslation > postfixOperators
bool VariablesToUser(QString &newFormula, int position, const QString &token, int &bias) const
VariablesToUser translate variable name to user.
QString FormulaFromUser(const QString &formula, bool osSeparator) const
FormulaFromUser replace all known tokens in formula to internal look. Also change decimal separator i...
static void BiasTokens(int position, int bias, QMap< int, QString > &tokens)
BiasTokens change position for each token that have position more then "position".
QString PostfixOperator(const QString &name) const
QMap< QString, qmu::QmuTranslation > variables
QString PMSystemBook(const QString &code) const
QMap< QString, qmu::QmuTranslation > stDescriptions
QString PMSystemAuthor(const QString &code) const
Error class of the parser.
const QString & GetMsg() const
Returns the message string for this error.
const QString & GetExpr() const
gets the expression related tp this error.
QString translate() const
const QString pl_customer
const QString pl_pFoldPosition
const QString pl_pQuantity
const QString pl_mFileName
const QString pl_patternName
const QString pl_pAnnotation
const QString pl_patternNumber
const QString pl_pFileName
const QString pl_mInterfacing
const QString pl_pOrientation
const QString pl_pRotation
const QString pl_mInterlining
const QString angle1ElArc_
const QString angle1SplPath
const QString radius2ElArc_
const QString c1LengthSpl_
const QString angle2ElArc_
const QString currentSeamAllowance
const QString angle2SplPath
const QString c1LengthSplPath
const QString c2LengthSpl_
const QString currentLength
const QString c2LengthSplPath
const QString measurement_
const QString radius1ElArc_
Namespace for mathematical applications.
#define translate(context, source, disambiguation)