2015-06-11 12:15:57 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vtranslatevars.cpp
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 10 6, 2015
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2015-06-11 12:15:57 +02:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2015 Valentina project
|
2020-01-31 07:00:05 +01:00
|
|
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
2015-06-11 12:15:57 +02:00
|
|
|
**
|
|
|
|
** 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 <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#include "vtranslatevars.h"
|
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <QList>
|
2015-10-18 21:30:51 +02:00
|
|
|
#include <QLocale>
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <QMap>
|
|
|
|
#include <QMessageLogger>
|
|
|
|
#include <QString>
|
2015-10-18 21:30:51 +02:00
|
|
|
#include <QtDebug>
|
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
#include "../ifc/ifcdef.h"
|
|
|
|
#include "../qmuparser/qmuparsererror.h"
|
|
|
|
#include "../qmuparser/qmutokenparser.h"
|
|
|
|
#include "../qmuparser/qmutranslation.h"
|
2016-08-09 15:55:46 +02:00
|
|
|
#include "../vpatterndb/vtranslatevars.h"
|
|
|
|
#include "../vmisc/def.h"
|
2016-08-08 13:44:49 +02:00
|
|
|
#include "../vmisc/vabstractapplication.h"
|
|
|
|
#include "vtranslatemeasurements.h"
|
2017-06-01 12:04:25 +02:00
|
|
|
#include "pmsystems.h"
|
2016-08-08 13:44:49 +02:00
|
|
|
|
2015-06-11 12:15:57 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-05-23 17:23:39 +02:00
|
|
|
VTranslateVars::VTranslateVars()
|
2020-02-27 16:26:32 +01:00
|
|
|
:VTranslateMeasurements()
|
2015-06-11 12:15:57 +02:00
|
|
|
{
|
2015-08-02 17:27:18 +02:00
|
|
|
InitPatternMakingSystems();
|
2015-06-11 12:15:57 +02:00
|
|
|
InitVariables();
|
|
|
|
InitFunctions();
|
2017-12-04 10:44:29 +01:00
|
|
|
|
|
|
|
PrepareFunctionTranslations();
|
2015-06-11 12:15:57 +02:00
|
|
|
}
|
|
|
|
|
2016-12-21 13:02:55 +01:00
|
|
|
#define translate(context, source, disambiguation) qmu::QmuTranslation::translate((context), (source), (disambiguation))
|
2015-10-08 07:24:15 +02:00
|
|
|
|
2015-08-02 17:27:18 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VTranslateVars::InitPatternMakingSystems()
|
|
|
|
{
|
|
|
|
//Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't
|
|
|
|
//mark such string to translation.
|
2016-12-21 13:02:55 +01:00
|
|
|
qmu::QmuTranslation name;
|
|
|
|
qmu::QmuTranslation author;
|
|
|
|
qmu::QmuTranslation book;
|
2015-08-02 17:27:18 +02:00
|
|
|
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Bunka", "System name");
|
|
|
|
author = translate("VTranslateVars", "Bunka Fashion College", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Fundamentals of Garment Design", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p0_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Barnfield and Richard", "System name");
|
|
|
|
author = translate("VTranslateVars", "Jo Barnfield and Andrew Richards", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Pattern Making Primer", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p1_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Friendship/Women", "System name");
|
|
|
|
author = translate("VTranslateVars", "Elizabeth Friendship", "Author name");
|
|
|
|
book = translate("VTranslateVars",
|
|
|
|
"Creating Historical Clothes - Pattern Cutting from the 16th to the 19th Centuries", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p2_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Morris, K.", "System name");
|
|
|
|
author = translate("VTranslateVars", "Karen Morris", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Sewing Lingerie that Fits", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p3_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Castro", "System name");
|
|
|
|
author = translate("VTranslateVars", "Lucia Mors de Castro", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Patternmaking in Practic", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p4_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Kim & Uh", "System name");
|
|
|
|
author = translate("VTranslateVars", "Injoo Kim and Mykyung Uh", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Apparel Making in Fashion Design", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p5_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Waugh", "System name");
|
|
|
|
author = translate("VTranslateVars", "Norah Waugh", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Corsets and Crinolines", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p6_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Grimble", "System name");
|
|
|
|
author = translate("VTranslateVars", "Frances Grimble", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Fashions of the Gilded Age", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p7_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Thornton's International System", "System name");
|
|
|
|
author = translate("VTranslateVars", "ed. R. L. Shep", "Author name");
|
|
|
|
book = translate("VTranslateVars", "The Great War: Styles and Patterns of the 1910s", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p8_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Hillhouse & Mansfield", "System name");
|
|
|
|
author = translate("VTranslateVars", "Marion S. Hillhouse and Evelyn A. Mansfield", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Dress Design: Draping and Flat Pattern Making", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p9_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Pivnick", "System name");
|
|
|
|
author = translate("VTranslateVars", "Esther Kaplan Pivnick", "Author name");
|
|
|
|
book = translate("VTranslateVars", "How to Design Beautiful Clothes: Designing and Pattern Making", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p10_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Minister & Son", "System name");
|
|
|
|
author = translate("VTranslateVars", "Edward Minister & Son, ed. R. L. Shep", "Author name");
|
|
|
|
book = translate("VTranslateVars", "The Complete Guide to Practical Cutting (1853)", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p11_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Strickland", "System name");
|
|
|
|
author = translate("VTranslateVars", "Gertrude Strickland", "Author name");
|
|
|
|
book = translate("VTranslateVars", "A Tailoring Manual", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p12_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Loh & Lewis", "System name");
|
|
|
|
author = translate("VTranslateVars", "May Loh and Diehl Lewis", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Patternless Fashion Design", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p13_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Morris, F. R.", "System name");
|
|
|
|
author = translate("VTranslateVars", "F. R. Morris", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Ladies Garment Cutting and Making", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p14_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Mason", "System name");
|
|
|
|
author = translate("VTranslateVars", "Gertrude Mason", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Gertrude Mason's Patternmaking Book", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p15_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Kimata", "System name");
|
|
|
|
author = translate("VTranslateVars", "K. Kimata", "Author name");
|
|
|
|
book = translate("VTranslateVars", "K.Kimata's Simplified Drafting Book for Dressmaking", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p16_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Master Designer", "System name");
|
|
|
|
author = translate("VTranslateVars", "The Master Designer (Chicago, IL)", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Master Designer's System of Designing, Cutting and Grading", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p17_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Kopp", "System name");
|
|
|
|
author = translate("VTranslateVars", "Ernestine Kopp, Vittorina Rolfo, Beatrice Zelin, Lee Gross", "Author name");
|
|
|
|
book = translate("VTranslateVars", "How to Draft Basic Patterns", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p18_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Ekern", "System name");
|
|
|
|
author = translate("VTranslateVars", "Doris Ekern", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Slacks Cut-to-Fit for Your Figure", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p19_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Doyle", "System name");
|
|
|
|
author = translate("VTranslateVars", "Sarah J. Doyle", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Sarah's Key to Pattern Drafting", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p20_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Shelton", "System name");
|
|
|
|
author = translate("VTranslateVars", "Karla J. Shelton", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Design and Sew Jeans", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p21_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Lady Boutique", "System name");
|
|
|
|
author = translate("VTranslateVars", "Lady Boutique", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Lady Boutique magazine (Japan)", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p22_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Rohr", "System name");
|
|
|
|
author = translate("VTranslateVars", "M. Rohr", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Pattern Drafting and Grading: Women's nd Misses' Garment Design", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p23_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Moore", "System name");
|
|
|
|
author = translate("VTranslateVars", "Dorothy Moore", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Dorothy Moore's Pattern Drafting and Dressmaking", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p24_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Abling", "System name");
|
|
|
|
author = translate("VTranslateVars", "Bina Abling", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Integrating Draping, Drafting and Drawing", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p25_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Fukomoto", "System name");
|
|
|
|
author = translate("VTranslateVars", "Sue S. Fukomoto", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Scientific Pattern Drafting as taught at Style Center School of Costume "
|
|
|
|
"Design, Dressmaking and Millinery", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p26_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Dressmaking International", "System name");
|
|
|
|
author = translate("VTranslateVars", "Dressmaking International", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Dressmaking International magazine (Japan)", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p27_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Erwin", "System name");
|
|
|
|
author = translate("VTranslateVars", "Mabel D. Erwin", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Practical Dress Design", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p28_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Gough", "System name");
|
|
|
|
author = translate("VTranslateVars", "E. L. G. Gough", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Principles of Garment Cutting", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p29_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Allemong", "System name");
|
|
|
|
author = translate("VTranslateVars", "Elizabeth M. Allemong", "Author name");
|
|
|
|
book = translate("VTranslateVars", "European Cut", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p30_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "McCunn", "System name");
|
|
|
|
author = translate("VTranslateVars", "Donald H. McCunn", "Author name");
|
|
|
|
book = translate("VTranslateVars", "How to Make Your Own Sewing Patterns", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p31_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Zarapkar", "System name");
|
|
|
|
author = translate("VTranslateVars", "Shri K. R. Zarapkar and Shri Arvind K. Zarapkar", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Zarapkar System of Cutting", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p32_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Kunick", "System name");
|
|
|
|
author = translate("VTranslateVars", "Philip Kunick", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Sizing, Pattern Construction and Grading for Women's and Children's Garments",
|
|
|
|
"Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p33_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Handford", "System name");
|
|
|
|
author = translate("VTranslateVars", "Jack Handford", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Professional Patternmaking for Designers: Women's Wear, Men's Casual Wear",
|
|
|
|
"Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p34_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Davis", "System name");
|
|
|
|
author = translate("VTranslateVars", "R. I. Davis", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Men's 17th & 18th Century Costume, Cut & Fashion", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p35_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "MacLochlainn", "System name");
|
|
|
|
author = translate("VTranslateVars", "Jason MacLochlainn", "Author name");
|
|
|
|
book = translate("VTranslateVars", "The Victorian Tailor: An Introduction to Period Tailoring", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p36_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Joseph-Armstrong", "System name");
|
|
|
|
author = translate("VTranslateVars", "Helen Joseph-Armstrong", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Patternmaking for Fashion Design", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p37_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Supreme System", "System name");
|
|
|
|
author = translate("VTranslateVars", "Frederick T. Croonberg", "Author name");
|
|
|
|
book = translate("VTranslateVars", "The Blue Book of Men's Tailoring, Grand Edition of Supreme System for "
|
|
|
|
"Producing Mens Garments (1907)", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p38_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Sugino", "System name");
|
|
|
|
author = translate("VTranslateVars", "Dressmaking", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Pattern Drafting Vols. I, II, III (Japan)", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p39_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Centre Point System", "System name");
|
|
|
|
author = translate("VTranslateVars", "Louis Devere", "Author name");
|
|
|
|
book = translate("VTranslateVars", "The Handbook of Practical Cutting on the Centre Point System", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p40_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Aldrich/Men", "System name");
|
|
|
|
author = translate("VTranslateVars", "Winifred Aldrich", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Metric Pattern Cutting for Menswear", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p41_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Aldrich/Women", "System name");
|
|
|
|
author = translate("VTranslateVars", "Winifred Aldrich", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Metric Pattern Cutting for Women's Wear", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p42_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Kershaw", "System name");
|
|
|
|
author = translate("VTranslateVars", "Gareth Kershaw", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Patternmaking for Menswear", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p43_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Gilewska", "System name");
|
|
|
|
author = translate("VTranslateVars", "Teresa Gilewska", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Pattern-Drafting for Fashion: The Basics", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p44_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Lo", "System name");
|
|
|
|
author = translate("VTranslateVars", "Dennic Chunman Lo", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Pattern Cutting", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p45_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Bray", "System name");
|
|
|
|
author = translate("VTranslateVars", "Natalie Bray", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Dress Pattern Designing: The Basic Principles of Cut and Fit", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p46_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Knowles/Men", "System name");
|
|
|
|
author = translate("VTranslateVars", "Lori A. Knowles", "Author name");
|
|
|
|
book = translate("VTranslateVars", "The Practical Guide to Patternmaking for Fashion Designers: Menswear",
|
|
|
|
"Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p47_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Friendship/Men", "System name");
|
|
|
|
author = translate("VTranslateVars", "Elizabeth Friendship", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Pattern Cutting for Men's Costume", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p48_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Brown", "System name");
|
|
|
|
author = translate("VTranslateVars", "P. Clement Brown", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Art in Dress", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p49_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Mitchell", "System name");
|
|
|
|
author = translate("VTranslateVars", "Jno. J. Mitchell", "Author name");
|
|
|
|
book = translate("VTranslateVars", "\"Standard\" Work on Cutting (Men's Garments) 1886: The Art and Science of "
|
|
|
|
"Garment Cutting", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p50_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "GOST 17917-86", "System name");
|
|
|
|
author = translate("VTranslateVars", "Ministry of consumer industry of the USSR", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Standard figure boys", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p51_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Eddy", "System name");
|
|
|
|
author = translate("VTranslateVars", "Josephine F. Eddy and Elizabeth C. B. Wiley", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Pattern and Dress Design", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p52_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "Knowles/Women", "System name");
|
|
|
|
author = translate("VTranslateVars", "Lori A. Knowles", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Practical Guide to Patternmaking for Fashion Designers: Juniors, Misses, and "
|
|
|
|
"Women", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p53_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "American Garment Cutter", "System name");
|
|
|
|
author = translate("VTranslateVars", "ed. R. L. Shep", "Author name");
|
|
|
|
book = translate("VTranslateVars", "The Great War: Styles and Patterns of the 1910s", "Book name");
|
2015-08-02 17:27:18 +02:00
|
|
|
InitSystem(p54_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-10-16 22:00:05 +02:00
|
|
|
name = translate("VTranslateVars", "None", "System name");
|
|
|
|
author = translate("VTranslateVars", "Valentina team", "Author name");
|
|
|
|
book = translate("VTranslateVars", "Valentina's internal standard", "Book name");
|
2015-10-07 19:57:18 +02:00
|
|
|
InitSystem(p998_S, name, author, book);
|
|
|
|
//=================================================================================================================
|
2015-08-02 17:27:18 +02:00
|
|
|
}
|
|
|
|
|
2015-06-11 12:15:57 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VTranslateVars::InitVariables()
|
|
|
|
{
|
2017-03-28 09:18:19 +02:00
|
|
|
variables.insert(measurement_, translate("VTranslateVars", "M_", "Left symbol _ in the name"));
|
|
|
|
variables.insert(increment_, translate("VTranslateVars", "Increment_", "Left symbol _ in the name"));
|
2016-04-01 23:15:04 +02:00
|
|
|
variables.insert(line_, translate("VTranslateVars", "Line_", "Left symbol _ in the name"));
|
|
|
|
variables.insert(angleLine_, translate("VTranslateVars", "AngleLine_", "Left symbol _ in the name"));
|
|
|
|
variables.insert(arc_, translate("VTranslateVars", "Arc_", "Left symbol _ in the name"));
|
2017-08-08 17:27:36 +02:00
|
|
|
variables.insert(elarc_, translate("VTranslateVars", "ElArc_", "Left symbol _ in the name"));
|
2016-04-01 23:15:04 +02:00
|
|
|
variables.insert(spl_, translate("VTranslateVars", "Spl_", "Left symbol _ in the name"));
|
|
|
|
variables.insert(splPath, translate("VTranslateVars", "SplPath", "Do not add symbol _ to the end of the name"));
|
|
|
|
variables.insert(radiusArc_, translate("VTranslateVars", "RadiusArc_", "Left symbol _ in the name"));
|
2017-08-08 17:27:36 +02:00
|
|
|
variables.insert(radius1ElArc_, translate("VTranslateVars", "Radius1ElArc_", "Left symbol _ in the name"));
|
|
|
|
variables.insert(radius2ElArc_, translate("VTranslateVars", "Radius2ElArc_", "Left symbol _ in the name"));
|
2016-04-01 23:15:04 +02:00
|
|
|
variables.insert(angle1Arc_, translate("VTranslateVars", "Angle1Arc_", "Left symbol _ in the name"));
|
|
|
|
variables.insert(angle2Arc_, translate("VTranslateVars", "Angle2Arc_", "Left symbol _ in the name"));
|
2017-08-08 17:27:36 +02:00
|
|
|
variables.insert(angle1ElArc_, translate("VTranslateVars", "Angle1ElArc_", "Left symbol _ in the name"));
|
|
|
|
variables.insert(angle2ElArc_, translate("VTranslateVars", "Angle2ElArc_", "Left symbol _ in the name"));
|
2016-04-01 23:15:04 +02:00
|
|
|
variables.insert(angle1Spl_, translate("VTranslateVars", "Angle1Spl_", "Left symbol _ in the name"));
|
|
|
|
variables.insert(angle2Spl_, translate("VTranslateVars", "Angle2Spl_", "Left symbol _ in the name"));
|
2015-10-16 22:00:05 +02:00
|
|
|
variables.insert(angle1SplPath, translate("VTranslateVars", "Angle1SplPath",
|
2016-04-01 23:15:04 +02:00
|
|
|
"Do not add symbol _ to the end of the name"));
|
2015-10-16 22:00:05 +02:00
|
|
|
variables.insert(angle2SplPath, translate("VTranslateVars", "Angle2SplPath",
|
2016-04-01 23:15:04 +02:00
|
|
|
"Do not add symbol _ to the end of the name"));
|
|
|
|
variables.insert(seg_, translate("VTranslateVars", "Seg_", "Segment. Left symbol _ in the name"));
|
2016-06-23 19:20:21 +02:00
|
|
|
variables.insert(currentLength, translate("VTranslateVars", "CurrentLength", "Do not add space between words"));
|
2017-01-20 14:58:35 +01:00
|
|
|
variables.insert(currentSeamAllowance, translate("VTranslateVars", "CurrentSeamAllowance",
|
|
|
|
"Do not add space between words"));
|
2016-09-26 21:33:28 +02:00
|
|
|
variables.insert(c1LengthSpl_, translate("VTranslateVars", "C1LengthSpl_", "Left symbol _ in the name"));
|
|
|
|
variables.insert(c2LengthSpl_, translate("VTranslateVars", "C2LengthSpl_", "Left symbol _ in the name"));
|
|
|
|
variables.insert(c1LengthSplPath, translate("VTranslateVars", "C1LengthSplPath",
|
|
|
|
"Do not add symbol _ to the end of the name"));
|
|
|
|
variables.insert(c2LengthSplPath, translate("VTranslateVars", "C2LengthSplPath",
|
|
|
|
"Do not add symbol _ to the end of the name"));
|
2018-01-05 20:07:47 +01:00
|
|
|
variables.insert(rotationElArc_, translate("VTranslateVars", "RotationElArc_", "Left symbol _ in the name"));
|
2015-06-11 12:15:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VTranslateVars::InitFunctions()
|
|
|
|
{
|
qmuparser: added triangular functions that work with degree
new functions are: degTorad, radTodeg, , sinD, cosD, tanD, asinD, acosD , atanD, sinhD, coshD , tanhD, asinhD, acoshD, atanhD
--HG--
branch : feature
2017-02-27 20:42:35 +01:00
|
|
|
functions.insert(degTorad_F, translate("VTranslateVars", "degTorad", "converts degrees to radian"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(degTorad_F, translate("VTranslateVars", "converts degrees to radian",
|
2020-02-27 16:26:32 +01:00
|
|
|
"functionm degTorad"));
|
|
|
|
|
qmuparser: added triangular functions that work with degree
new functions are: degTorad, radTodeg, , sinD, cosD, tanD, asinD, acosD , atanD, sinhD, coshD , tanhD, asinhD, acoshD, atanhD
--HG--
branch : feature
2017-02-27 20:42:35 +01:00
|
|
|
functions.insert(radTodeg_F, translate("VTranslateVars", "radTodeg", "converts radian to degrees"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(radTodeg_F, translate("VTranslateVars", "converts radian to degrees",
|
2020-02-27 16:26:32 +01:00
|
|
|
"function radTodeg"));
|
|
|
|
|
qmuparser: added triangular functions that work with degree
new functions are: degTorad, radTodeg, , sinD, cosD, tanD, asinD, acosD , atanD, sinhD, coshD , tanhD, asinhD, acoshD, atanhD
--HG--
branch : feature
2017-02-27 20:42:35 +01:00
|
|
|
functions.insert(sin_F, translate("VTranslateVars", "sin", "sine function working with radians"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(sin_F, translate("VTranslateVars", "sine function working with radians",
|
2020-02-27 16:26:32 +01:00
|
|
|
"function sin"));
|
|
|
|
|
qmuparser: added triangular functions that work with degree
new functions are: degTorad, radTodeg, , sinD, cosD, tanD, asinD, acosD , atanD, sinhD, coshD , tanhD, asinhD, acoshD, atanhD
--HG--
branch : feature
2017-02-27 20:42:35 +01:00
|
|
|
functions.insert(cos_F, translate("VTranslateVars", "cos", "cosine function working with radians"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(cos_F, translate("VTranslateVars", "cosine function working with radians",
|
2020-02-27 16:26:32 +01:00
|
|
|
"function cos"));
|
|
|
|
|
qmuparser: added triangular functions that work with degree
new functions are: degTorad, radTodeg, , sinD, cosD, tanD, asinD, acosD , atanD, sinhD, coshD , tanhD, asinhD, acoshD, atanhD
--HG--
branch : feature
2017-02-27 20:42:35 +01:00
|
|
|
functions.insert(tan_F, translate("VTranslateVars", "tan", "tangens function working with radians"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(tan_F, translate("VTranslateVars", "tangens function working with radians",
|
2020-02-27 16:26:32 +01:00
|
|
|
"function tan"));
|
|
|
|
|
qmuparser: added triangular functions that work with degree
new functions are: degTorad, radTodeg, , sinD, cosD, tanD, asinD, acosD , atanD, sinhD, coshD , tanhD, asinhD, acoshD, atanhD
--HG--
branch : feature
2017-02-27 20:42:35 +01:00
|
|
|
functions.insert(asin_F, translate("VTranslateVars", "asin", "arcus sine function working with radians"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(asin_F, translate("VTranslateVars", "arcus sine function working with radians",
|
2020-02-27 16:26:32 +01:00
|
|
|
"function asin"));
|
|
|
|
|
qmuparser: added triangular functions that work with degree
new functions are: degTorad, radTodeg, , sinD, cosD, tanD, asinD, acosD , atanD, sinhD, coshD , tanhD, asinhD, acoshD, atanhD
--HG--
branch : feature
2017-02-27 20:42:35 +01:00
|
|
|
functions.insert(acos_F, translate("VTranslateVars", "acos", "arcus cosine function working with radians"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(acos_F, translate("VTranslateVars", "arcus cosine function working with radians",
|
2020-02-27 16:26:32 +01:00
|
|
|
"function acos"));
|
|
|
|
|
qmuparser: added triangular functions that work with degree
new functions are: degTorad, radTodeg, , sinD, cosD, tanD, asinD, acosD , atanD, sinhD, coshD , tanhD, asinhD, acoshD, atanhD
--HG--
branch : feature
2017-02-27 20:42:35 +01:00
|
|
|
functions.insert(atan_F, translate("VTranslateVars", "atan", "arcus tangens function working with radians"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(atan_F, translate("VTranslateVars", "arcus tangens function working with radians",
|
2020-02-27 16:26:32 +01:00
|
|
|
"function atan"));
|
|
|
|
|
2017-04-14 17:42:49 +02:00
|
|
|
functions.insert(sinh_F, translate("VTranslateVars", "sinh", "hyperbolic sine function"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(sinh_F, translate("VTranslateVars", "hyperbolic sine function", "function sinh"));
|
2020-02-27 16:26:32 +01:00
|
|
|
|
2017-04-14 17:42:49 +02:00
|
|
|
functions.insert(cosh_F, translate("VTranslateVars", "cosh", "hyperbolic cosine"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(cosh_F, translate("VTranslateVars", "hyperbolic cosine", "function cosh"));
|
2020-02-27 16:26:32 +01:00
|
|
|
|
2017-04-14 17:42:49 +02:00
|
|
|
functions.insert(tanh_F, translate("VTranslateVars", "tanh", "hyperbolic tangens function"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(tanh_F, translate("VTranslateVars", "hyperbolic tangens function", "function tanh"));
|
2020-02-27 16:26:32 +01:00
|
|
|
|
2017-04-14 17:42:49 +02:00
|
|
|
functions.insert(asinh_F, translate("VTranslateVars", "asinh", "hyperbolic arcus sine function"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(asinh_F, translate("VTranslateVars", "hyperbolic arcus sine function",
|
2020-02-27 16:26:32 +01:00
|
|
|
"function asinh"));
|
|
|
|
|
2017-04-14 17:42:49 +02:00
|
|
|
functions.insert(acosh_F, translate("VTranslateVars", "acosh", "hyperbolic arcus cosine function"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(acosh_F, translate("VTranslateVars", "hyperbolic arcus cosine function",
|
2020-02-27 16:26:32 +01:00
|
|
|
"function acosh"));
|
|
|
|
|
2017-04-14 17:42:49 +02:00
|
|
|
functions.insert(atanh_F, translate("VTranslateVars", "atanh", "hyperbolic arcur tangens function"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(atanh_F, translate("VTranslateVars", "hyperbolic arcur tangens function",
|
2020-02-27 16:26:32 +01:00
|
|
|
"function atanh"));
|
|
|
|
|
qmuparser: added triangular functions that work with degree
new functions are: degTorad, radTodeg, , sinD, cosD, tanD, asinD, acosD , atanD, sinhD, coshD , tanhD, asinhD, acoshD, atanhD
--HG--
branch : feature
2017-02-27 20:42:35 +01:00
|
|
|
functions.insert(sinD_F, translate("VTranslateVars", "sinD", "sine function working with degrees"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(sinD_F, translate("VTranslateVars", "sine function working with degrees",
|
2020-02-27 16:26:32 +01:00
|
|
|
"function sinD"));
|
|
|
|
|
qmuparser: added triangular functions that work with degree
new functions are: degTorad, radTodeg, , sinD, cosD, tanD, asinD, acosD , atanD, sinhD, coshD , tanhD, asinhD, acoshD, atanhD
--HG--
branch : feature
2017-02-27 20:42:35 +01:00
|
|
|
functions.insert(cosD_F, translate("VTranslateVars", "cosD", "cosine function working with degrees"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(cosD_F, translate("VTranslateVars", "cosine function working with degrees",
|
2020-02-27 16:26:32 +01:00
|
|
|
"function cosD"));
|
|
|
|
|
qmuparser: added triangular functions that work with degree
new functions are: degTorad, radTodeg, , sinD, cosD, tanD, asinD, acosD , atanD, sinhD, coshD , tanhD, asinhD, acoshD, atanhD
--HG--
branch : feature
2017-02-27 20:42:35 +01:00
|
|
|
functions.insert(tanD_F, translate("VTranslateVars", "tanD", "tangens function working with degrees"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(tanD_F, translate("VTranslateVars", "tangens function working with degrees",
|
2020-02-27 16:26:32 +01:00
|
|
|
"function tanD"));
|
|
|
|
|
qmuparser: added triangular functions that work with degree
new functions are: degTorad, radTodeg, , sinD, cosD, tanD, asinD, acosD , atanD, sinhD, coshD , tanhD, asinhD, acoshD, atanhD
--HG--
branch : feature
2017-02-27 20:42:35 +01:00
|
|
|
functions.insert(asinD_F, translate("VTranslateVars", "asinD", "arcus sine function working with degrees"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(asinD_F, translate("VTranslateVars", "arcus sine function working with degrees",
|
2020-02-27 16:26:32 +01:00
|
|
|
"function asinD"));
|
|
|
|
|
qmuparser: added triangular functions that work with degree
new functions are: degTorad, radTodeg, , sinD, cosD, tanD, asinD, acosD , atanD, sinhD, coshD , tanhD, asinhD, acoshD, atanhD
--HG--
branch : feature
2017-02-27 20:42:35 +01:00
|
|
|
functions.insert(acosD_F, translate("VTranslateVars", "acosD", "arcus cosine function working with degrees"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(acosD_F, translate("VTranslateVars", "arcus cosine function working with degrees",
|
2020-02-27 16:26:32 +01:00
|
|
|
"function acosD"));
|
|
|
|
|
qmuparser: added triangular functions that work with degree
new functions are: degTorad, radTodeg, , sinD, cosD, tanD, asinD, acosD , atanD, sinhD, coshD , tanhD, asinhD, acoshD, atanhD
--HG--
branch : feature
2017-02-27 20:42:35 +01:00
|
|
|
functions.insert(atanD_F, translate("VTranslateVars", "atanD", "arcus tangens function working with degrees"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(atanD_F, translate("VTranslateVars", "arcus tangens function working with degrees",
|
2020-02-27 16:26:32 +01:00
|
|
|
"function atanD"));
|
|
|
|
|
2015-10-16 22:00:05 +02:00
|
|
|
functions.insert(log2_F, translate("VTranslateVars", "log2", "logarithm to the base 2"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(log2_F, translate("VTranslateVars", "logarithm to the base 2", "function log2"));
|
2020-02-27 16:26:32 +01:00
|
|
|
|
2015-10-16 22:00:05 +02:00
|
|
|
functions.insert(log10_F, translate("VTranslateVars", "log10", "logarithm to the base 10"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(log10_F, translate("VTranslateVars", "logarithm to the base 10", "function log10"));
|
2020-02-27 16:26:32 +01:00
|
|
|
|
2015-10-16 22:00:05 +02:00
|
|
|
functions.insert(log_F, translate("VTranslateVars", "log", "logarithm to the base 10"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(log_F, translate("VTranslateVars", "logarithm to the base 10", "function log"));
|
2020-02-27 16:26:32 +01:00
|
|
|
|
2015-10-16 22:00:05 +02:00
|
|
|
functions.insert(ln_F, translate("VTranslateVars", "ln", "logarithm to base e (2.71828...)"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(ln_F, translate("VTranslateVars", "logarithm to base e (2.71828...)", "function ln"));
|
2020-02-27 16:26:32 +01:00
|
|
|
|
2015-10-16 22:00:05 +02:00
|
|
|
functions.insert(exp_F, translate("VTranslateVars", "exp", "e raised to the power of x"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(exp_F, translate("VTranslateVars", "e raised to the power of x", "function exp"));
|
2020-02-27 16:26:32 +01:00
|
|
|
|
2015-10-16 22:00:05 +02:00
|
|
|
functions.insert(sqrt_F, translate("VTranslateVars", "sqrt", "square root of a value"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(sqrt_F, translate("VTranslateVars", "square root of a value", "function sqrt"));
|
2020-02-27 16:26:32 +01:00
|
|
|
|
2015-10-16 22:00:05 +02:00
|
|
|
functions.insert(sign_F, translate("VTranslateVars", "sign", "sign function -1 if x<0; 1 if x>0"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(sign_F, translate("VTranslateVars", "sign function -1 if x<0; 1 if x>0",
|
2020-02-27 16:26:32 +01:00
|
|
|
"function sign"));
|
|
|
|
|
2015-10-16 22:00:05 +02:00
|
|
|
functions.insert(rint_F, translate("VTranslateVars", "rint", "round to nearest integer"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(rint_F, translate("VTranslateVars", "round to nearest integer", "function rint"));
|
2020-02-27 16:26:32 +01:00
|
|
|
|
2017-09-29 16:47:11 +02:00
|
|
|
functions.insert(r2cm_F, translate("VTranslateVars", "r2cm", "round to up to 1 decimal"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(r2cm_F, translate("VTranslateVars", "round to up to 1 decimal", "function r2cm"));
|
2020-02-27 16:26:32 +01:00
|
|
|
|
2017-11-13 09:53:27 +01:00
|
|
|
functions.insert(csrCm_F, translate("VTranslateVars", "csrCm", "cut, split and rotate modeling operation. Takes"
|
|
|
|
" cm units."));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(csrCm_F, translate("VTranslateVars", "cut, split and rotate modeling operation. Takes "
|
2020-02-27 16:26:32 +01:00
|
|
|
"cm units.", "function csrCm"));
|
|
|
|
|
2017-11-13 09:53:27 +01:00
|
|
|
functions.insert(csrInch_F, translate("VTranslateVars", "csrInch", "cut, split and rotate modeling operation. Takes"
|
2020-02-27 16:26:32 +01:00
|
|
|
" inch units."));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(csrInch_F, translate("VTranslateVars", "cut, split and rotate modeling operation. Takes"
|
2020-02-27 16:26:32 +01:00
|
|
|
" inch units.", "function csrInch"));
|
|
|
|
|
2015-10-16 22:00:05 +02:00
|
|
|
functions.insert(abs_F, translate("VTranslateVars", "abs", "absolute value"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(abs_F, translate("VTranslateVars", "absolute value", "function abs"));
|
2020-02-27 16:26:32 +01:00
|
|
|
|
2015-10-16 22:00:05 +02:00
|
|
|
functions.insert(min_F, translate("VTranslateVars", "min", "min of all arguments"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(min_F, translate("VTranslateVars", "min of all arguments", "function min"));
|
2020-02-27 16:26:32 +01:00
|
|
|
|
2015-10-16 22:00:05 +02:00
|
|
|
functions.insert(max_F, translate("VTranslateVars", "max", "max of all arguments"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(max_F, translate("VTranslateVars", "max of all arguments", "function max"));
|
2020-02-27 16:26:32 +01:00
|
|
|
|
2015-10-16 22:00:05 +02:00
|
|
|
functions.insert(sum_F, translate("VTranslateVars", "sum", "sum of all arguments"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(sum_F, translate("VTranslateVars", "sum of all arguments", "function sum"));
|
2020-02-27 16:26:32 +01:00
|
|
|
|
2015-10-16 22:00:05 +02:00
|
|
|
functions.insert(avg_F, translate("VTranslateVars", "avg", "mean value of all arguments"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(avg_F, translate("VTranslateVars", "mean value of all arguments", "function avg"));
|
2020-02-27 16:26:32 +01:00
|
|
|
|
2015-10-16 22:00:05 +02:00
|
|
|
functions.insert(fmod_F, translate("VTranslateVars", "fmod",
|
2015-10-15 11:32:50 +02:00
|
|
|
"Returns the floating-point remainder of numer/denom (rounded towards zero)"));
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.insert(fmod_F, translate("VTranslateVars", "Returns the floating-point remainder of "
|
2020-02-27 16:26:32 +01:00
|
|
|
"numer/denom (rounded towards zero)",
|
|
|
|
"function fmod"));
|
2020-11-20 12:18:38 +01:00
|
|
|
functions.insert(warning_F, translate("VTranslateVars", "warning", "Calculation warning"));
|
|
|
|
functionsDescriptions.insert(warning_F, translate("VTranslateVars", "Show a warning in calculations",
|
|
|
|
"function warning"));
|
2015-06-11 12:15:57 +02:00
|
|
|
}
|
|
|
|
|
2015-10-15 11:32:50 +02:00
|
|
|
#undef translate
|
2015-10-08 07:24:15 +02:00
|
|
|
|
2017-12-04 10:44:29 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VTranslateVars::PrepareFunctionTranslations()
|
|
|
|
{
|
|
|
|
translatedFunctions.clear();
|
|
|
|
QMap<QString, qmu::QmuTranslation>::const_iterator i = functions.constBegin();
|
|
|
|
while (i != functions.constEnd())
|
|
|
|
{
|
2021-02-06 14:52:21 +01:00
|
|
|
const QString translated = i.value().translate(VAbstractApplication::VApp()->Settings()->GetLocale());
|
2017-12-04 10:44:29 +01:00
|
|
|
if (i.key() != translated)
|
|
|
|
{
|
|
|
|
translatedFunctions.insert(translated, i.key());
|
|
|
|
}
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-02 17:27:18 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-12-21 13:02:55 +01:00
|
|
|
void VTranslateVars::InitSystem(const QString &code, const qmu::QmuTranslation &name, const qmu::QmuTranslation &author,
|
|
|
|
const qmu::QmuTranslation &book)
|
2015-08-02 17:27:18 +02:00
|
|
|
{
|
|
|
|
PMSystemNames.insert(code, name);
|
|
|
|
PMSystemAuthors.insert(code, author);
|
|
|
|
PMSystemBooks.insert(code, book);
|
|
|
|
}
|
|
|
|
|
2015-06-11 12:15:57 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief CorrectionsPositions correct position tokens in expression after token translation.
|
|
|
|
*
|
|
|
|
* Because translated string can have different length compare to original need make correction after each translation.
|
|
|
|
* If bias = 0 correction will not happens.
|
|
|
|
*
|
|
|
|
* @param position position currecnt token in expression
|
|
|
|
* @param bias difference between original token length and translated
|
|
|
|
* @param tokens all tokens
|
|
|
|
* @param numbers all numbers
|
|
|
|
*/
|
|
|
|
void VTranslateVars::CorrectionsPositions(int position, int bias, QMap<int, QString> &tokens,
|
|
|
|
QMap<int, QString> &numbers) const
|
|
|
|
{
|
|
|
|
if (bias == 0)
|
|
|
|
{
|
|
|
|
return;// Nothing to correct;
|
|
|
|
}
|
|
|
|
|
|
|
|
BiasTokens(position, bias, tokens);
|
|
|
|
BiasTokens(position, bias, numbers);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief BiasTokens change position for each token that have position more then "position".
|
|
|
|
* @param position token position
|
|
|
|
* @param bias difference between original token length and translated
|
|
|
|
* @param tokens all tokens
|
|
|
|
*/
|
2015-06-12 11:15:59 +02:00
|
|
|
void VTranslateVars::BiasTokens(int position, int bias, QMap<int, QString> &tokens)
|
2015-06-11 12:15:57 +02:00
|
|
|
{
|
|
|
|
QMap<int, QString> newTokens;
|
|
|
|
QMap<int, QString>::const_iterator i = tokens.constBegin();
|
|
|
|
while (i != tokens.constEnd())
|
|
|
|
{
|
|
|
|
if (i.key()<= position)
|
|
|
|
{ // Tokens before position "position" did not change his positions.
|
|
|
|
newTokens.insert(i.key(), i.value());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
newTokens.insert(i.key()-bias, i.value());
|
|
|
|
}
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
tokens = newTokens;
|
|
|
|
}
|
|
|
|
|
2015-08-02 19:39:29 +02:00
|
|
|
|
2015-06-11 12:15:57 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief VariablesFromUser translate variable to internal look.
|
|
|
|
* @param newFormula [in|out] expression to translate
|
|
|
|
* @param position token position
|
|
|
|
* @param token token to translate
|
|
|
|
* @param bias hold change of length between translated and origin token string
|
|
|
|
* @return true if was found variable with same name.
|
|
|
|
*/
|
|
|
|
bool VTranslateVars::VariablesFromUser(QString &newFormula, int position, const QString &token, int &bias) const
|
|
|
|
{
|
2021-02-06 14:52:21 +01:00
|
|
|
const QString currentLengthTr =
|
|
|
|
variables.value(currentLength).translate(VAbstractApplication::VApp()->Settings()->GetLocale());
|
2018-01-21 15:00:53 +01:00
|
|
|
const QString currentSeamAllowanceTr = variables.value(currentSeamAllowance)
|
2021-02-06 14:52:21 +01:00
|
|
|
.translate(VAbstractApplication::VApp()->Settings()->GetLocale());
|
2017-08-04 09:28:44 +02:00
|
|
|
|
2016-12-21 13:02:55 +01:00
|
|
|
QMap<QString, qmu::QmuTranslation>::const_iterator i = variables.constBegin();
|
2015-06-11 12:15:57 +02:00
|
|
|
while (i != variables.constEnd())
|
|
|
|
{
|
2016-12-21 13:02:55 +01:00
|
|
|
const qmu::QmuTranslation &var = i.value();
|
2021-02-06 14:52:21 +01:00
|
|
|
const QString varTr = var.translate(VAbstractApplication::VApp()->Settings()->GetLocale());
|
2017-08-04 09:28:44 +02:00
|
|
|
|
|
|
|
if (token.indexOf(varTr) == 0)
|
2015-06-11 12:15:57 +02:00
|
|
|
{
|
2017-08-04 09:28:44 +02:00
|
|
|
if ((varTr == currentLengthTr || varTr == currentSeamAllowanceTr) && token != varTr)
|
|
|
|
{
|
|
|
|
++i;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
newFormula.replace(position, varTr.length(), i.key());
|
2015-06-11 12:15:57 +02:00
|
|
|
QString newToken = token;
|
2017-08-04 09:28:44 +02:00
|
|
|
newToken.replace(0, varTr.length(), i.key());
|
2015-06-11 12:15:57 +02:00
|
|
|
bias = token.length() - newToken.length();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief FunctionsFromUser translate function name to internal look.
|
|
|
|
* @param newFormula [in|out] expression to translate
|
|
|
|
* @param position token position
|
|
|
|
* @param token token to translate
|
|
|
|
* @param bias hold change of length between translated and origin token string
|
|
|
|
* @return true if was found function with same name.
|
|
|
|
*/
|
|
|
|
bool VTranslateVars::FunctionsFromUser(QString &newFormula, int position, const QString &token, int &bias) const
|
|
|
|
{
|
2016-12-21 13:02:55 +01:00
|
|
|
QMap<QString, qmu::QmuTranslation>::const_iterator i = functions.constBegin();
|
2015-06-11 12:15:57 +02:00
|
|
|
while (i != functions.constEnd())
|
|
|
|
{
|
2021-02-06 14:52:21 +01:00
|
|
|
if (token == i.value().translate(VAbstractApplication::VApp()->Settings()->GetLocale()))
|
2015-06-11 12:15:57 +02:00
|
|
|
{
|
|
|
|
newFormula.replace(position, token.length(), i.key());
|
|
|
|
bias = token.length() - i.key().length();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief VariablesToUser translate variable name to user.
|
|
|
|
* @param newFormula [in|out] expression to translate
|
|
|
|
* @param position token position
|
|
|
|
* @param token token to translate
|
|
|
|
* @param bias hold change of length between translated and origin token string
|
|
|
|
* @return true if was found variable with same name.
|
|
|
|
*/
|
|
|
|
bool VTranslateVars::VariablesToUser(QString &newFormula, int position, const QString &token, int &bias) const
|
|
|
|
{
|
2016-12-21 13:02:55 +01:00
|
|
|
QMap<QString, qmu::QmuTranslation>::const_iterator i = variables.constBegin();
|
2015-06-11 12:15:57 +02:00
|
|
|
while (i != variables.constEnd())
|
|
|
|
{
|
|
|
|
if (token.indexOf( i.key() ) == 0)
|
|
|
|
{
|
2017-08-04 09:28:44 +02:00
|
|
|
if ((i.key() == currentLength || i.key() == currentSeamAllowance) && token != i.key())
|
|
|
|
{
|
|
|
|
++i;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2021-02-06 14:52:21 +01:00
|
|
|
newFormula.replace(position, i.key().length(),
|
|
|
|
i.value().translate(VAbstractApplication::VApp()->Settings()->GetLocale()));
|
2015-06-11 12:15:57 +02:00
|
|
|
|
|
|
|
QString newToken = token;
|
2021-02-06 14:52:21 +01:00
|
|
|
newToken.replace(0, i.key().length(),
|
|
|
|
i.value().translate(VAbstractApplication::VApp()->Settings()->GetLocale()));
|
2015-06-11 12:15:57 +02:00
|
|
|
bias = token.length() - newToken.length();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-12-17 11:52:10 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QString VTranslateVars::InternalVarToUser(const QString &var) const
|
|
|
|
{
|
|
|
|
QString newVar = var;
|
|
|
|
int bias = 0;
|
|
|
|
if (VariablesToUser(newVar, 0, var, bias))
|
|
|
|
{
|
|
|
|
return newVar;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return var;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-11 12:15:57 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QString VTranslateVars::VarToUser(const QString &var) const
|
|
|
|
{
|
2021-02-06 14:52:21 +01:00
|
|
|
if (VAbstractApplication::VApp()->Settings()->GetLocale() == QStringLiteral("zh_CN"))
|
2019-01-17 15:08:55 +01:00
|
|
|
{
|
|
|
|
return var; // We do not support translation of variables for Chinese
|
|
|
|
}
|
|
|
|
|
2015-06-11 12:15:57 +02:00
|
|
|
if (measurements.contains(var))
|
|
|
|
{
|
2021-02-06 14:52:21 +01:00
|
|
|
return measurements.value(var).translate(VAbstractApplication::VApp()->Settings()->GetLocale());
|
2015-06-11 12:15:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (functions.contains(var))
|
|
|
|
{
|
2021-02-06 14:52:21 +01:00
|
|
|
return functions.value(var).translate(VAbstractApplication::VApp()->Settings()->GetLocale());
|
2015-06-11 12:15:57 +02:00
|
|
|
}
|
|
|
|
|
2015-12-17 11:52:10 +01:00
|
|
|
return InternalVarToUser(var);
|
2015-06-11 12:15:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QString VTranslateVars::VarFromUser(const QString &var) const
|
|
|
|
{
|
2021-02-06 14:52:21 +01:00
|
|
|
if (VAbstractApplication::VApp()->Settings()->GetLocale() == QStringLiteral("zh_CN"))
|
2019-01-17 15:08:55 +01:00
|
|
|
{
|
|
|
|
return var; // We do not support translation of variables for Chinese
|
|
|
|
}
|
|
|
|
|
2015-06-11 12:15:57 +02:00
|
|
|
QString newVar = var;
|
|
|
|
int bias = 0;
|
|
|
|
if (MeasurementsFromUser(newVar, 0, var, bias))
|
|
|
|
{
|
|
|
|
return newVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (VariablesFromUser(newVar, 0, var, bias))
|
|
|
|
{
|
|
|
|
return newVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (FunctionsFromUser(newVar, 0, var, bias))
|
|
|
|
{
|
|
|
|
return newVar;
|
|
|
|
}
|
|
|
|
return newVar;
|
|
|
|
}
|
|
|
|
|
2015-08-02 17:27:18 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QString VTranslateVars::PMSystemName(const QString &code) const
|
|
|
|
{
|
2021-02-06 14:52:21 +01:00
|
|
|
return PMSystemNames.value(code).translate(VAbstractApplication::VApp()->Settings()->GetLocale());
|
2015-08-02 17:27:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QString VTranslateVars::PMSystemAuthor(const QString &code) const
|
|
|
|
{
|
2021-02-06 14:52:21 +01:00
|
|
|
return PMSystemAuthors.value(code).translate(VAbstractApplication::VApp()->Settings()->GetLocale());
|
2015-08-02 17:27:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QString VTranslateVars::PMSystemBook(const QString &code) const
|
|
|
|
{
|
2021-02-06 14:52:21 +01:00
|
|
|
return PMSystemBooks.value(code).translate(VAbstractApplication::VApp()->Settings()->GetLocale());
|
2015-08-02 17:27:18 +02:00
|
|
|
}
|
|
|
|
|
2015-06-11 12:15:57 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief FormulaFromUser replace all known tokens in formula to internal look. Also change decimal
|
|
|
|
* separator in numbers.
|
|
|
|
* @param formula expression that need translate
|
2015-08-25 12:35:50 +02:00
|
|
|
* @throw qmu::QmuParserError in case of a wrong expression
|
2015-06-11 12:15:57 +02:00
|
|
|
* @return translated expression
|
|
|
|
*/
|
2015-06-12 10:55:44 +02:00
|
|
|
QString VTranslateVars::FormulaFromUser(const QString &formula, bool osSeparator) const
|
2015-06-11 12:15:57 +02:00
|
|
|
{
|
|
|
|
if (formula.isEmpty())
|
|
|
|
{
|
|
|
|
return formula;
|
|
|
|
}
|
|
|
|
QString newFormula = formula;// Local copy for making changes
|
|
|
|
|
2017-12-04 10:44:29 +01:00
|
|
|
// Eval formula
|
2017-12-04 15:38:32 +01:00
|
|
|
QScopedPointer<qmu::QmuTokenParser> cal(new qmu::QmuTokenParser(formula, osSeparator, true, GetTranslatedFunctions()));
|
2015-06-11 12:15:57 +02:00
|
|
|
QMap<int, QString> tokens = cal->GetTokens();// Tokens (variables, measurements)
|
|
|
|
QMap<int, QString> numbers = cal->GetNumbers();// All numbers in expression for changing decimal separator
|
2017-01-03 09:58:52 +01:00
|
|
|
delete cal.take();
|
2015-06-11 12:15:57 +02:00
|
|
|
|
|
|
|
QList<int> tKeys = tokens.keys();// Take all tokens positions
|
|
|
|
QList<QString> tValues = tokens.values();
|
|
|
|
for (int i = 0; i < tKeys.size(); ++i)
|
|
|
|
{
|
|
|
|
int bias = 0;
|
|
|
|
if (MeasurementsFromUser(newFormula, tKeys.at(i), tValues.at(i), bias))
|
|
|
|
{
|
|
|
|
if (bias != 0)
|
|
|
|
{// Translated token has different length than original. Position next tokens need to be corrected.
|
|
|
|
CorrectionsPositions(tKeys.at(i), bias, tokens, numbers);
|
|
|
|
tKeys = tokens.keys();
|
|
|
|
tValues = tokens.values();
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (VariablesFromUser(newFormula, tKeys.at(i), tValues.at(i), bias))
|
|
|
|
{
|
|
|
|
if (bias != 0)
|
|
|
|
{// Translated token has different length than original. Position next tokens need to be corrected.
|
|
|
|
CorrectionsPositions(tKeys.at(i), bias, tokens, numbers);
|
|
|
|
tKeys = tokens.keys();
|
|
|
|
tValues = tokens.values();
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (FunctionsFromUser(newFormula, tKeys.at(i), tValues.at(i), bias))
|
|
|
|
{
|
|
|
|
if (bias != 0)
|
|
|
|
{// Translated token has different length than original. Position next tokens need to be corrected.
|
|
|
|
CorrectionsPositions(tKeys.at(i), bias, tokens, numbers);
|
|
|
|
tKeys = tokens.keys();
|
|
|
|
tValues = tokens.values();
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
2017-01-03 10:14:32 +01:00
|
|
|
|
|
|
|
if (tValues.at(i) == QLocale().negativeSign())
|
|
|
|
{// unary minus
|
|
|
|
newFormula.replace(tKeys.at(i), 1, '-');
|
|
|
|
}
|
2015-06-11 12:15:57 +02:00
|
|
|
}
|
|
|
|
|
2017-01-03 09:46:28 +01:00
|
|
|
QLocale loc = QLocale(); // User locale
|
2016-08-26 11:38:23 +02:00
|
|
|
if (loc != QLocale::c() && osSeparator)
|
2015-06-11 12:15:57 +02:00
|
|
|
{// User want use Os separator
|
|
|
|
QList<int> nKeys = numbers.keys();// Positions for all numbers in expression
|
|
|
|
QList<QString> nValues = numbers.values();
|
|
|
|
for (int i = 0; i < nKeys.size(); ++i)
|
|
|
|
{
|
2017-01-03 09:46:28 +01:00
|
|
|
loc = QLocale();// From system locale
|
2015-06-11 12:15:57 +02:00
|
|
|
bool ok = false;
|
|
|
|
const qreal d = loc.toDouble(nValues.at(i), &ok);
|
|
|
|
if (ok == false)
|
|
|
|
{
|
|
|
|
qDebug()<<"Can't convert to double token"<<nValues.at(i);
|
|
|
|
continue;//Leave with out translation
|
|
|
|
}
|
|
|
|
|
2016-08-26 11:38:23 +02:00
|
|
|
loc = QLocale::c();// To internal locale
|
2015-06-11 12:15:57 +02:00
|
|
|
const QString dStr = loc.toString(d);// Internal look for number
|
|
|
|
newFormula.replace(nKeys.at(i), nValues.at(i).length(), dStr);
|
|
|
|
const int bias = nValues.at(i).length() - dStr.length();
|
|
|
|
if (bias != 0)
|
|
|
|
{// Translated number has different length than original. Position next tokens need to be corrected.
|
|
|
|
CorrectionsPositions(nKeys.at(i), bias, tokens, numbers);
|
|
|
|
nKeys = numbers.keys();
|
|
|
|
nValues = numbers.values();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return newFormula;
|
|
|
|
}
|
|
|
|
|
2016-03-05 16:27:07 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-08-02 14:12:13 +02:00
|
|
|
QString VTranslateVars::TryFormulaFromUser(const QString &formula, bool osSeparator)
|
2016-03-05 16:27:07 +01:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2021-02-06 14:52:21 +01:00
|
|
|
SCASSERT(VAbstractApplication::VApp()->TrVars() != nullptr)
|
|
|
|
return VAbstractApplication::VApp()->TrVars()->FormulaFromUser(formula, osSeparator);
|
2016-03-05 16:27:07 +01:00
|
|
|
}
|
|
|
|
catch (qmu::QmuParserError &e)// In case something bad will happen
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
return formula;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-11 12:15:57 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief FormulaToUser replace all known tokens in formula to user look. Also change decimal
|
|
|
|
* separator in numbers.
|
|
|
|
* @param formula expression that need translate
|
|
|
|
* @return translated expression
|
|
|
|
*/
|
2016-05-23 17:23:39 +02:00
|
|
|
QString VTranslateVars::FormulaToUser(const QString &formula, bool osSeparator) const
|
2015-06-11 12:15:57 +02:00
|
|
|
{
|
|
|
|
if (formula.isEmpty())
|
|
|
|
{
|
|
|
|
return formula;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString newFormula = formula;// Local copy for making changes
|
|
|
|
|
|
|
|
QMap<int, QString> tokens;
|
|
|
|
QMap<int, QString> numbers;
|
|
|
|
try
|
|
|
|
{
|
2017-01-03 09:58:52 +01:00
|
|
|
QScopedPointer<qmu::QmuTokenParser> cal(new qmu::QmuTokenParser(formula, false, false));// Eval formula
|
2015-06-11 12:15:57 +02:00
|
|
|
tokens = cal->GetTokens();// Tokens (variables, measurements)
|
|
|
|
numbers = cal->GetNumbers();// All numbers in expression for changing decimal separator
|
|
|
|
}
|
|
|
|
catch (qmu::QmuParserError &e)
|
|
|
|
{
|
|
|
|
qDebug() << "\nMath parser error:\n"
|
|
|
|
<< "--------------------------------------\n"
|
|
|
|
<< "Message: " << e.GetMsg() << "\n"
|
|
|
|
<< "Expression: " << e.GetExpr() << "\n"
|
|
|
|
<< "--------------------------------------";
|
|
|
|
return newFormula;
|
|
|
|
}
|
|
|
|
|
|
|
|
QList<int> tKeys = tokens.keys();
|
|
|
|
QList<QString> tValues = tokens.values();
|
|
|
|
for (int i = 0; i < tKeys.size(); ++i)
|
|
|
|
{
|
|
|
|
if (measurements.contains(tValues.at(i)))
|
|
|
|
{
|
2018-01-21 15:00:53 +01:00
|
|
|
newFormula.replace(tKeys.at(i), tValues.at(i).length(),
|
2021-02-06 14:52:21 +01:00
|
|
|
measurements.value(tValues.at(i))
|
|
|
|
.translate(VAbstractApplication::VApp()->Settings()->GetLocale()));
|
2018-01-21 15:00:53 +01:00
|
|
|
int bias = tValues.at(i).length() - measurements.value(tValues.at(i))
|
2021-02-06 14:52:21 +01:00
|
|
|
.translate(VAbstractApplication::VApp()->Settings()->GetLocale()).length();
|
2015-06-11 12:15:57 +02:00
|
|
|
if (bias != 0)
|
|
|
|
{// Translated token has different length than original. Position next tokens need to be corrected.
|
|
|
|
CorrectionsPositions(tKeys.at(i), bias, tokens, numbers);
|
|
|
|
tKeys = tokens.keys();
|
|
|
|
tValues = tokens.values();
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (functions.contains(tValues.at(i)))
|
|
|
|
{
|
2018-01-21 15:00:53 +01:00
|
|
|
newFormula.replace(tKeys.at(i), tValues.at(i).length(),
|
2021-02-06 14:52:21 +01:00
|
|
|
functions.value(tValues.at(i))
|
|
|
|
.translate(VAbstractApplication::VApp()->Settings()->GetLocale()));
|
2018-01-21 15:00:53 +01:00
|
|
|
int bias = tValues.at(i).length() - functions.value(tValues.at(i))
|
2021-02-06 14:52:21 +01:00
|
|
|
.translate(VAbstractApplication::VApp()->Settings()->GetLocale()).length();
|
2015-06-11 12:15:57 +02:00
|
|
|
if (bias != 0)
|
|
|
|
{// Translated token has different length than original. Position next tokens need to be corrected.
|
|
|
|
CorrectionsPositions(tKeys.at(i), bias, tokens, numbers);
|
|
|
|
tKeys = tokens.keys();
|
|
|
|
tValues = tokens.values();
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
int bias = 0;
|
|
|
|
if (VariablesToUser(newFormula, tKeys.at(i), tValues.at(i), bias))
|
|
|
|
{
|
|
|
|
if (bias != 0)
|
|
|
|
{// Translated token has different length than original. Position next tokens need to be corrected.
|
|
|
|
CorrectionsPositions(tKeys.at(i), bias, tokens, numbers);
|
|
|
|
tKeys = tokens.keys();
|
|
|
|
tValues = tokens.values();
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
2017-01-03 10:14:32 +01:00
|
|
|
|
|
|
|
if (tValues.at(i) == QChar('-'))
|
|
|
|
{// unary minus
|
|
|
|
newFormula.replace(tKeys.at(i), 1, QLocale().negativeSign());
|
|
|
|
}
|
2015-06-11 12:15:57 +02:00
|
|
|
}
|
|
|
|
|
2017-01-03 09:46:28 +01:00
|
|
|
QLocale loc = QLocale();// User locale
|
2015-06-12 10:55:44 +02:00
|
|
|
if (loc != QLocale::C && osSeparator)
|
2015-06-11 12:15:57 +02:00
|
|
|
{// User want use Os separator
|
|
|
|
QList<int> nKeys = numbers.keys();// Positions for all numbers in expression
|
|
|
|
QList<QString> nValues = numbers.values();
|
|
|
|
for (int i = 0; i < nKeys.size(); ++i)
|
|
|
|
{
|
2016-08-26 11:38:23 +02:00
|
|
|
loc = QLocale::c();// From pattern locale
|
2015-06-11 12:15:57 +02:00
|
|
|
bool ok = false;
|
|
|
|
const qreal d = loc.toDouble(nValues.at(i), &ok);
|
|
|
|
if (ok == false)
|
|
|
|
{
|
|
|
|
qDebug()<<"Can't convert to double token"<<nValues.at(i);
|
|
|
|
continue;//Leave with out translation
|
|
|
|
}
|
|
|
|
|
2017-01-03 09:46:28 +01:00
|
|
|
loc = QLocale();// To user locale
|
2016-02-25 20:21:48 +01:00
|
|
|
QString dStr = loc.toString(d);// Number string in user locale
|
2017-09-06 08:58:48 +02:00
|
|
|
if (loc.groupSeparator().isSpace())
|
|
|
|
{
|
2018-03-14 15:01:24 +01:00
|
|
|
dStr.replace(loc.groupSeparator(), QString());
|
2017-09-06 08:58:48 +02:00
|
|
|
}
|
2015-06-11 12:15:57 +02:00
|
|
|
newFormula.replace(nKeys.at(i), nValues.at(i).length(), dStr);
|
|
|
|
const int bias = nValues.at(i).length() - dStr.length();
|
|
|
|
if (bias != 0)
|
|
|
|
{// Translated number has different length than original. Position next tokens need to be corrected.
|
|
|
|
CorrectionsPositions(nKeys.at(i), bias, tokens, numbers);
|
|
|
|
nKeys = numbers.keys();
|
|
|
|
nValues = numbers.values();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return newFormula;
|
|
|
|
}
|
2015-08-01 11:39:32 +02:00
|
|
|
|
2017-09-26 16:24:02 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QString VTranslateVars::TryFormulaToUser(const QString &formula, bool osSeparator)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2021-02-06 14:52:21 +01:00
|
|
|
return VAbstractApplication::VApp()->TrVars()->FormulaToUser(formula, osSeparator);
|
2017-09-26 16:24:02 +02:00
|
|
|
}
|
|
|
|
catch (qmu::QmuParserError &e)// In case something bad will happen
|
|
|
|
{
|
|
|
|
Q_UNUSED(e)
|
|
|
|
return formula;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-08 16:33:37 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VTranslateVars::Retranslate()
|
|
|
|
{
|
|
|
|
VTranslateMeasurements::Retranslate();
|
|
|
|
|
|
|
|
PMSystemNames.clear();
|
|
|
|
PMSystemAuthors.clear();
|
|
|
|
PMSystemBooks.clear();
|
|
|
|
variables.clear();
|
|
|
|
functions.clear();
|
2020-02-27 16:28:20 +01:00
|
|
|
functionsDescriptions.clear();
|
2015-08-08 16:33:37 +02:00
|
|
|
stDescriptions.clear();
|
|
|
|
|
|
|
|
InitPatternMakingSystems();
|
|
|
|
InitVariables();
|
|
|
|
InitFunctions();
|
2017-12-04 10:44:29 +01:00
|
|
|
|
|
|
|
PrepareFunctionTranslations();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QMap<QString, QString> VTranslateVars::GetTranslatedFunctions() const
|
|
|
|
{
|
|
|
|
return translatedFunctions;
|
2015-08-08 16:33:37 +02:00
|
|
|
}
|
2016-08-16 22:13:34 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-12-21 13:02:55 +01:00
|
|
|
QMap<QString, qmu::QmuTranslation> VTranslateVars::GetFunctions() const
|
2016-08-16 22:13:34 +02:00
|
|
|
{
|
|
|
|
return functions;
|
|
|
|
}
|
2020-02-27 16:26:32 +01:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QMap<QString, qmu::QmuTranslation> VTranslateVars::GetFunctionsDescriptions() const
|
|
|
|
{
|
2020-02-27 16:28:20 +01:00
|
|
|
return functionsDescriptions;
|
2020-02-27 16:26:32 +01:00
|
|
|
}
|