Way to store string for translation.

--HG--
branch : feature
This commit is contained in:
dismine 2014-05-13 11:08:37 +03:00
parent 95e32b1e44
commit 28737034f3
12 changed files with 684 additions and 13 deletions

View file

@ -45,7 +45,8 @@ SOURCES += \
mainwindow.cpp \
tablewindow.cpp \
stable.cpp \
version.cpp
version.cpp \
options.cpp
HEADERS += \
mainwindow.h \

View file

@ -411,7 +411,7 @@ QString VContainer::GetNameLine(const quint32 &firstPoint, const quint32 &second
const VPointF *first = GeometricObject<const VPointF *>(firstPoint);
const VPointF *second = GeometricObject<const VPointF *>(secondPoint);
return QString("Line_%1_%2").arg(first->name(), second->name());
return QString(line_+"%1_%2").arg(first->name(), second->name());
}
//---------------------------------------------------------------------------------------------------------------------
@ -420,7 +420,7 @@ QString VContainer::GetNameLineAngle(const quint32 &firstPoint, const quint32 &s
const VPointF *first = GeometricObject<const VPointF *>(firstPoint);
const VPointF *second = GeometricObject<const VPointF *>(secondPoint);
return QString("AngleLine_%1_%2").arg(first->name(), second->name());
return QString(angleLine_+"%1_%2").arg(first->name(), second->name());
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -45,7 +45,7 @@ VArc::VArc (VPointF center, qreal radius, QString formulaRadius, qreal f1, QStri
: VGObject(GObject::Arc, idObject, mode), f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2),
radius(radius), formulaRadius(formulaRadius), center(center)
{
_name = QString ("Arc_%1").arg(this->GetCenter().name());
_name = QString (arc_+"%1").arg(this->GetCenter().name());
}
//---------------------------------------------------------------------------------------------------------------------
@ -188,5 +188,5 @@ QPointF VArc::CutArc(const qreal &length, VArc &arc1, VArc &arc2) const
void VArc::setId(const quint32 &id)
{
_id = id;
_name = QString ("Arc_%1_%2").arg(center.name()).arg(id);
_name = QString (arc_+"%1_%2").arg(center.name()).arg(id);
}

View file

@ -565,7 +565,7 @@ qreal VSpline::CalcSqDistance (qreal x1, qreal y1, qreal x2, qreal y2)
//---------------------------------------------------------------------------------------------------------------------
void VSpline::CreateName()
{
_name = QString("Spl_%1_%2").arg(this->GetP1().name(), this->GetP4().name());
_name = QString(spl_+"%1_%2").arg(this->GetP1().name(), this->GetP4().name());
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -44,7 +44,7 @@ VSplinePath::VSplinePath(const VSplinePath &splPath)
void VSplinePath::append(const VSplinePoint &point)
{
path.append(point);
_name = QString("SplPath");
_name = splPath;
_name.append(QString("_%1").arg(path.first().P().name()));
if (path.size() > 1)
{

142
src/app/options.cpp Normal file
View file

@ -0,0 +1,142 @@
/************************************************************************
**
** @file options.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 12 5, 2014
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#include "options.h"
const QString headGirth = QStringLiteral("head_girth");
const QString midNeckGirth = QStringLiteral("mid_neck_girth");
const QString neckBaseGirth = QStringLiteral("neck_base_girth");
const QString headAndNeckLength = QStringLiteral("head_and_neck_length");
const QString centerFrontWaistLength = QStringLiteral("center_front_waist_length");
const QString centerBackWaistLength = QStringLiteral("center_back_waist_length");
const QString shoulderLength = QStringLiteral("shoulder_length");
const QString sideWaistLength = QStringLiteral("side_waist_length");
const QString trunkLength = QStringLiteral("trunk_length");
const QString shoulderGirth = QStringLiteral("shoulder_girth");
const QString upperChestGirth = QStringLiteral("upper_chest_girth");
const QString bustGirth = QStringLiteral("bust_girth");
const QString underBustGirth = QStringLiteral("under_bust_girth");
const QString waistGirth = QStringLiteral("waist_girth");
const QString highHipGirth = QStringLiteral("high_hip_girth");
const QString hipGirth = QStringLiteral("hip_girth");
const QString upperFrontChestWidth = QStringLiteral("upper_front_chest_width");
const QString frontChestWidth = QStringLiteral("front_chest_width");
const QString acrossFrontShoulderWidth = QStringLiteral("across_front_shoulder_width");
const QString acrossBackShoulderWidth = QStringLiteral("across_back_shoulder_width");
const QString upperBackWidth = QStringLiteral("upper_back_width");
const QString backWidth = QStringLiteral("back_width");
const QString bustpointToBustpoint = QStringLiteral("bustpoint_to_bustpoint");
const QString halterBustpointToBustpoint = QStringLiteral("halter_bustpoint_to_bustpoint");
const QString neckToBustpoint = QStringLiteral("neck_to_bustpoint");
const QString crotchLength = QStringLiteral("crotch_length");
const QString riseHeight = QStringLiteral("rise_height");
const QString shoulderDrop = QStringLiteral("shoulder_drop");
const QString shoulderSlopeDegrees = QStringLiteral("shoulder_slope_degrees");
const QString frontShoulderSlopeLength = QStringLiteral("front_shoulder_slope_length");
const QString backShoulderSlopeLength = QStringLiteral("back_shoulder_slope_length");
const QString frontShoulderToWaistLength = QStringLiteral("front_shoulder_to_waist_length");
const QString backShoulderToWaistLength = QStringLiteral("back_shoulder_to_waist_length");
const QString frontNeckArc = QStringLiteral("front_neck_arc");
const QString backNeckArc = QStringLiteral("back_neck_arc");
const QString frontUpperBustArc = QStringLiteral("front_upper_bust_arc");
const QString backUpperBustArc = QStringLiteral("back_upper_bust_arc");
const QString frontWaistArc = QStringLiteral("front_waist_arc");
const QString backWaistArc = QStringLiteral("back_waist_arc");
const QString frontUpperHipArc = QStringLiteral("front_upper_hip_arc");
const QString backUpperHipArc = QStringLiteral("back_upper_hip_arc");
const QString frontHipArc = QStringLiteral("front_hip_arc");
const QString backHipArc = QStringLiteral("back_hip_arc");
const QString chestSlope = QStringLiteral("chest_slope");
const QString backSlope = QStringLiteral("back_slope");
const QString frontWaistSlope = QStringLiteral("front_waist_slope");
const QString backWaistSlope = QStringLiteral("back_waist_slope");
const QString frontNeckToUpperChestHeight = QStringLiteral("front_neck_to_upper_chest_height");
const QString frontNeckToBustHeight = QStringLiteral("front_neck_to_bust_height");
const QString armscyeGirth = QStringLiteral("armscye_girth");
const QString elbowGirth = QStringLiteral("elbow_girth");
const QString upperArmGirth = QStringLiteral("upper_arm_girth");
const QString wristGirth = QStringLiteral("wrist_girth");
const QString scyeDepth = QStringLiteral("scye_depth");
const QString shoulderAndArmLength = QStringLiteral("shoulder_and_arm_length");
const QString underarmLength = QStringLiteral("underarm_length");
const QString cervicaleToWristLength = QStringLiteral("cervicale_to_wrist_length");
const QString shoulderToElbowLength = QStringLiteral("shoulder_to_elbow_length");
const QString armLength = QStringLiteral("arm_length");
const QString handWidth = QStringLiteral("hand_width");
const QString handLength = QStringLiteral("hand_length");
const QString handGirth = QStringLiteral("hand_girth");
const QString thighGirth = QStringLiteral("thigh_girth");
const QString midThighGirth = QStringLiteral("mid_thigh_girth");
const QString kneeGirth = QStringLiteral("knee_girth");
const QString calfGirth = QStringLiteral("calf_girth");
const QString ankleGirth = QStringLiteral("ankle_girth");
const QString kneeHeight = QStringLiteral("knee_height");
const QString ankleHeight = QStringLiteral("ankle_height");
const QString footWidth = QStringLiteral("foot_width");
const QString footLength = QStringLiteral("foot_length");
const QString height = QStringLiteral("height");
const QString cervicaleHeight = QStringLiteral("cervicale_height");
const QString cervicaleToKneeHeight = QStringLiteral("cervicale_to_knee_height");
const QString waistHeight = QStringLiteral("waist_height");
const QString highHipHeight = QStringLiteral("high_hip_height");
const QString hipHeight = QStringLiteral("hip_height");
const QString waistToHipHeight = QStringLiteral("waist_to_hip_height");
const QString waistToKneeHeight = QStringLiteral("waist_to_knee_height");
const QString crotchHeight = QStringLiteral("crotch_height");
const QString line_ = QStringLiteral("Line_");
const QString angleLine_ = QStringLiteral("AngleLine_");
const QString arc_ = QStringLiteral("Arc_");
const QString spl_ = QStringLiteral("Spl_");
const QString splPath = QStringLiteral("splPath");
const QString sin_F = QStringLiteral("sin");
const QString cos_F = QStringLiteral("cos");
const QString tan_F = QStringLiteral("tan");
const QString asin_F = QStringLiteral("asin");
const QString acos_F = QStringLiteral("acos");
const QString atan_F = QStringLiteral("atan");
const QString sinh_F = QStringLiteral("sinh");
const QString cosh_F = QStringLiteral("cosh");
const QString tanh_F = QStringLiteral("tanh");
const QString asinh_F = QStringLiteral("asinh");
const QString acosh_F = QStringLiteral("acosh");
const QString atanh_F = QStringLiteral("atanh");
const QString log2_F = QStringLiteral("log2");
const QString log10_F = QStringLiteral("log10");
const QString log_F = QStringLiteral("log");
const QString ln_F = QStringLiteral("ln");
const QString exp_F = QStringLiteral("exp");
const QString sqrt_F = QStringLiteral("sqrt");
const QString sign_F = QStringLiteral("sign");
const QString rint_F = QStringLiteral("rint");
const QString abs_F = QStringLiteral("abs");
const QString min_F = QStringLiteral("min");
const QString max_F = QStringLiteral("max");
const QString sum_F = QStringLiteral("sum");
const QString avg_F = QStringLiteral("avg");

View file

@ -22,7 +22,7 @@
** 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/>.
** along with Valentina. If not, see <http://www.gnu.org/licenses.
**
*************************************************************************/
@ -32,11 +32,10 @@
#include <QFlags>
#include <QString>
#include <QMetaType>
#include <QtGlobal>
#define SceneSize 50000
extern const QString translationsPath;
namespace Valentina
{
/**
@ -113,4 +112,120 @@ namespace Pattern
}
Q_DECLARE_OPERATORS_FOR_FLAGS( Pattern::Measurements )
// measurements
extern const QString headGirth;
extern const QString midNeckGirth;
extern const QString neckBaseGirth;
extern const QString headAndNeckLength;
extern const QString centerFrontWaistLength;
extern const QString centerBackWaistLength;
extern const QString shoulderLength;
extern const QString sideWaistLength;
extern const QString trunkLength;
extern const QString shoulderGirth;
extern const QString upperChestGirth;
extern const QString bustGirth;
extern const QString underBustGirth;
extern const QString waistGirth;
extern const QString highHipGirth;
extern const QString hipGirth;
extern const QString upperFrontChestWidth;
extern const QString frontChestWidth;
extern const QString acrossFrontShoulderWidth;
extern const QString acrossBackShoulderWidth;
extern const QString upperBackWidth;
extern const QString backWidth;
extern const QString bustpointToBustpoint;
extern const QString halterBustpointToBustpoint;
extern const QString neckToBustpoint;
extern const QString crotchLength;
extern const QString riseHeight;
extern const QString shoulderDrop;
extern const QString shoulderSlopeDegrees;
extern const QString frontShoulderSlopeLength;
extern const QString backShoulderSlopeLength;
extern const QString frontShoulderToWaistLength;
extern const QString backShoulderToWaistLength;
extern const QString frontNeckArc;
extern const QString backNeckArc;
extern const QString frontUpperBustArc;
extern const QString backUpperBustArc;
extern const QString frontWaistArc;
extern const QString backWaistArc;
extern const QString frontUpperHipArc;
extern const QString backUpperHipArc;
extern const QString frontHipArc;
extern const QString backHipArc;
extern const QString chestSlope;
extern const QString backSlope;
extern const QString frontWaistSlope;
extern const QString backWaistSlope;
extern const QString frontNeckToUpperChestHeight;
extern const QString frontNeckToBustHeight;
extern const QString armscyeGirth;
extern const QString elbowGirth;
extern const QString upperArmGirth;
extern const QString wristGirth;
extern const QString scyeDepth;
extern const QString shoulderAndArmLength;
extern const QString underarmLength;
extern const QString cervicaleToWristLength;
extern const QString shoulderToElbowLength;
extern const QString armLength;
extern const QString handWidth;
extern const QString handLength;
extern const QString handGirth;
extern const QString thighGirth;
extern const QString midThighGirth;
extern const QString kneeGirth;
extern const QString calfGirth;
extern const QString ankleGirth;
extern const QString kneeHeight;
extern const QString ankleHeight;
extern const QString footWidth;
extern const QString footLength;
extern const QString height;
extern const QString cervicaleHeight;
extern const QString cervicaleToKneeHeight;
extern const QString waistHeight;
extern const QString highHipHeight;
extern const QString hipHeight;
extern const QString waistToHipHeight;
extern const QString waistToKneeHeight;
extern const QString crotchHeight;
// variables name
extern const QString line_;
extern const QString angleLine_;
extern const QString arc_;
extern const QString spl_;
extern const QString splPath;
// functions
extern const QString sin_F;
extern const QString cos_F;
extern const QString tan_F;
extern const QString asin_F;
extern const QString acos_F;
extern const QString atan_F;
extern const QString sinh_F;
extern const QString cosh_F;
extern const QString tanh_F;
extern const QString asinh_F;
extern const QString acosh_F;
extern const QString atanh_F;
extern const QString log2_F;
extern const QString log10_F;
extern const QString log_F;
extern const QString ln_F;
extern const QString exp_F;
extern const QString sqrt_F;
extern const QString sign_F;
extern const QString rint_F;
extern const QString abs_F;
extern const QString min_F;
extern const QString max_F;
extern const QString sum_F;
extern const QString avg_F;
#endif // OPTIONS_H

View file

@ -44,9 +44,14 @@ const qreal VApplication::PrintDPI = 96.0;
//---------------------------------------------------------------------------------------------------------------------
VApplication::VApplication(int &argc, char **argv)
: QApplication(argc, argv), _patternUnit(Valentina::Cm), _patternType(Pattern::Individual),
_widthMainLine(DefWidth), _widthHairLine(DefWidth/3.0)
_widthMainLine(DefWidth), _widthHairLine(DefWidth/3.0), measurements(QMap<QString, VTranslation>()),
guiText(QMap<QString, VTranslation>()), description(QMap<QString, VTranslation>()),
variables(QMap<QString, VTranslation>()), functions(QMap<QString, VTranslation>())
{
InitLineWidth();
InitMeasurements();
InitVariables();
InitFunctions();
}
//---------------------------------------------------------------------------------------------------------------------
@ -224,6 +229,282 @@ void VApplication::InitLineWidth()
_widthHairLine = _widthMainLine/3.0;
}
//---------------------------------------------------------------------------------------------------------------------
void VApplication::InitMeasurements()
{
// head_and_neck
InitMeasurement(headGirth, QStringLiteral("Head girth"), QStringLiteral("Around fullest part of Head"));
InitMeasurement(midNeckGirth, QStringLiteral("Mid-neck girth"), QStringLiteral("Around middle part of Neck"));
InitMeasurement(neckBaseGirth, QStringLiteral("Neck Base girth"), QStringLiteral("Around Neck at base"));
InitMeasurement(headAndNeckLength, QStringLiteral("Head and Neck length"),
QStringLiteral("Vertical Distance from Crown to Nape"));
// torso
InitMeasurement(centerFrontWaistLength, QStringLiteral("Front Center length"),
QStringLiteral("Front Neck Center over tape at Bustline to Front Waist Center"));
InitMeasurement(centerBackWaistLength, QStringLiteral("Back Center length"),
QStringLiteral("Back Neck Center to Back Waist Center"));
InitMeasurement(shoulderLength, QStringLiteral("Shoulder length"), QStringLiteral("NeckPoint to ShoulderTip"));
InitMeasurement(sideWaistLength, QStringLiteral("Side Waist length"), QStringLiteral("Armpit to Waist side"));
InitMeasurement(trunkLength, QStringLiteral("Trunk length"),
QStringLiteral("Around Body from middle of Shoulder length to BustPoint to Crotch up back to beginning point"));
InitMeasurement(shoulderGirth, QStringLiteral("Shoulder girth"),
QStringLiteral("Around Arms and Torso, at bicep level parallel to floor, with arms hanging at the sides"));
InitMeasurement(upperChestGirth, QStringLiteral("Upper Chest girth"),
QStringLiteral("Around Chest at Armfold level, will be parallel to floor across back, will not be parallel to floor"
" across front chest"));
InitMeasurement(bustGirth, QStringLiteral("Bust girth"),
QStringLiteral("Around fullest part of Bust, parallel to floor"));
InitMeasurement(underBustGirth, QStringLiteral("Under Bust girth"),
QStringLiteral("Around Chest below the Bust, parallel to floor"));
InitMeasurement(waistGirth, QStringLiteral("Waist girth"),
QStringLiteral("Tie a string around smallest part of waist, keep string tied while taking meaasurements. Not"
" usually parallel to floor for front waist or back waist."));
InitMeasurement(highHipGirth, QStringLiteral("HighHip girth"), QStringLiteral("Around HighHip, parallel to floor"));
InitMeasurement(hipGirth, QStringLiteral("Hip girth"), QStringLiteral("Around Hip, parallel to floor"));
InitMeasurement(upperFrontChestWidth, QStringLiteral("Front Upper Chest width"),
QStringLiteral("Across Front UpperChest, smallest width from armscye to armscye"));
InitMeasurement(frontChestWidth, QStringLiteral("Front Chest width"),
QStringLiteral("Across Front Chest, from armfold to armfold"));
InitMeasurement(acrossFrontShoulderWidth, QStringLiteral("Front Across Shoulder width"),
QStringLiteral("From ShoulderTip to ShoulderTip, across Front"));
InitMeasurement(acrossBackShoulderWidth, QStringLiteral("Back Across Shoulder width"),
QStringLiteral("From ShoulderTip to ShoulderTip, across Back"));
InitMeasurement(acrossBackShoulderWidth, QStringLiteral("Back Upper Chest width"),
QStringLiteral("Across Back UpperChest, smallest width from armscye to armscye"));
InitMeasurement(backWidth, QStringLiteral("Back Chest width"),
QStringLiteral("Across Back Chest, from armfold to armfold"));
InitMeasurement(bustpointToBustpoint, QStringLiteral("BustPoint to BustPoint"),
QStringLiteral("Distance between BustPoints, across Chest"));
InitMeasurement(halterBustpointToBustpoint, QStringLiteral("Halter Bustpoint to Bustpoint"),
QStringLiteral("Distance from Bustpoint, behind neck, down to Bustpoint"));
InitMeasurement(neckToBustpoint, QStringLiteral("NeckPoint to BustPoint"),
QStringLiteral("From NeckPoint to BustPoint"));
InitMeasurement(crotchLength, QStringLiteral("Crotch length"),
QStringLiteral("From Front Waist Center, down to crotch, up to Back Waist Center"));
InitMeasurement(riseHeight, QStringLiteral("Rise height"),
QStringLiteral("Sit on hard chair, measure from side waist straight down to chair bottom"));
InitMeasurement(shoulderDrop, QStringLiteral("Shoulder Drop"),
QStringLiteral("Vertical Distance from NeckPoint level to ShoulderTip level"));
InitMeasurement(shoulderSlopeDegrees, QStringLiteral("Shoulder Slope degrees"),
QStringLiteral("Degrees of angle from NeckPoint to ShoulderTip requires goniometer"));
InitMeasurement(frontShoulderSlopeLength, QStringLiteral("Front Shoulder Balance"),
QStringLiteral("ShoulderTip to Front Waist Center"));
InitMeasurement(backShoulderSlopeLength, QStringLiteral("Back Shoulder Balance"),
QStringLiteral("ShoulderTip to Back Waist Center"));
InitMeasurement(frontShoulderToWaistLength, QStringLiteral("Front Full Length"),
QStringLiteral("NeckPoint straight down front chest to Waistline"));
InitMeasurement(backShoulderToWaistLength, QStringLiteral("Back Full Length"),
QStringLiteral("Back NeckPoint straight down back chest to Waistline"));
InitMeasurement(frontNeckArc, QStringLiteral("Front Neck arc"),
QStringLiteral("NeckPoint to NeckPoint through Front Neck Center"));
InitMeasurement(backNeckArc, QStringLiteral("Back Neck arc"), QStringLiteral("NeckPoint to NeckPoint across Nape"));
InitMeasurement(frontUpperBustArc, QStringLiteral("front_upper-bust_arc"), QStringLiteral("front_upper-bust_arc"));
InitMeasurement(backUpperBustArc, QStringLiteral("Back UpperBust arc"),
QStringLiteral("Back UpperBust side to side"));
InitMeasurement(frontWaistArc, QStringLiteral("Front Waist arc"), QStringLiteral("Front Waist side to side"));
InitMeasurement(backWaistArc, QStringLiteral("Back Waist arc"), QStringLiteral("Back Waist side to side"));
InitMeasurement(frontUpperHipArc, QStringLiteral("Front UpperHip arc"),
QStringLiteral("Front UpperHip side to side"));
InitMeasurement(backUpperHipArc, QStringLiteral("Back UpperHip arc"), QStringLiteral("Back UpperHip side to side"));
InitMeasurement(frontHipArc, QStringLiteral("Front Hip arc"), QStringLiteral("Front Hip side to side"));
InitMeasurement(backHipArc, QStringLiteral("Back Hip arc"), QStringLiteral("Back Hip side to side"));
InitMeasurement(chestSlope, QStringLiteral("Chest Balance"), QStringLiteral("NeckPoint to Front ArmfoldPoint"));
InitMeasurement(backSlope, QStringLiteral("Back Balance"), QStringLiteral("NeckPoint to Back ArmfoldPoint"));
InitMeasurement(frontWaistSlope, QStringLiteral("Front Waist Balance"),
QStringLiteral("NeckPoint across Front Chest to Waist side"));
InitMeasurement(backWaistSlope, QStringLiteral("Back Waist Balance"),
QStringLiteral("NeckPoint across Back Chest to Waist side"));
InitMeasurement(frontNeckToUpperChestHeight, QStringLiteral("Front UpperChest height"),
QStringLiteral("Front Neck Center straight down to UpperChest line"));
InitMeasurement(frontNeckToBustHeight, QStringLiteral("Bust height"),
QStringLiteral("Front Neck Center straight down to Bust line"));
// arm
InitMeasurement(armscyeGirth, QStringLiteral("Armscye Girth"), QStringLiteral("Around Armscye"));
InitMeasurement(elbowGirth, QStringLiteral("Elbow Girth"), QStringLiteral("Around Elbow with elbow bent"));
InitMeasurement(upperArmGirth, QStringLiteral("Upperarm Girth"), QStringLiteral("Around UpperArm"));
InitMeasurement(wristGirth, QStringLiteral("Wrist girth"), QStringLiteral("Around Wrist"));
InitMeasurement(scyeDepth, QStringLiteral("Armscye depth"),
QStringLiteral("Nape straight down to UnderBust line (same as Back UpperBust height)"));
InitMeasurement(shoulderAndArmLength, QStringLiteral("Shoulder and Arm length"),
QStringLiteral("NeckPoint to ShoulderTip to Wrist, with elbow bent and hand on hip"));
InitMeasurement(underarmLength, QStringLiteral("Underarm length"),
QStringLiteral("Armpit to Wrist, with arm straight and hanging at side"));
InitMeasurement(cervicaleToWristLength, QStringLiteral("Nape to wrist length"),
QStringLiteral("Nape to Wrist, with elbow bent and hand on hip"));
InitMeasurement(shoulderToElbowLength, QStringLiteral("Elbow length"),
QStringLiteral("ShoulderTip to Elbow, with elbow bent and hand on hip"));
InitMeasurement(armLength, QStringLiteral("Arm length"),
QStringLiteral("ShoulderTip to Wrist, with elbow bent and hand on hip"));
// hand
InitMeasurement(handWidth, QStringLiteral("Hand width"), QStringLiteral("Hand side to side"));
InitMeasurement(handLength, QStringLiteral("Hand length"), QStringLiteral("Hand Middle Finger tip to wrist"));
InitMeasurement(handGirth, QStringLiteral("Hand girth"), QStringLiteral("Around Hand"));
// leg
InitMeasurement(thighGirth, QStringLiteral("Thigh girth"), QStringLiteral("Around Thigh"));
InitMeasurement(midThighGirth, QStringLiteral("Midthigh girth"), QStringLiteral("Around MidThigh"));
InitMeasurement(kneeGirth, QStringLiteral("Knee girth"), QStringLiteral("Around Knee"));
InitMeasurement(calfGirth, QStringLiteral("Calf girth"), QStringLiteral("Around Calf"));
InitMeasurement(ankleGirth, QStringLiteral("Ankle girth"), QStringLiteral("Around Ankle"));
InitMeasurement(kneeHeight, QStringLiteral("Knee height"), QStringLiteral("Knee to Floor"));
InitMeasurement(ankleHeight, QStringLiteral("Ankle height"), QStringLiteral("Ankle to Floor"));
// foot
InitMeasurement(footWidth, QStringLiteral("Foot width"), QStringLiteral("Widest part of Foot side to side"));
InitMeasurement(footLength, QStringLiteral("Foot length"),
QStringLiteral("Tip of Longest Toe straight to back of heel"));
// heights
InitMeasurement(height, QStringLiteral("Total Height"), QStringLiteral("Top of head to floor"));
InitMeasurement(cervicaleHeight, QStringLiteral("Nape height"), QStringLiteral("Nape to Floor"));
InitMeasurement(cervicaleToKneeHeight, QStringLiteral("Nape to knee height"), QStringLiteral("Nape to Knee"));
InitMeasurement(waistHeight, QStringLiteral("Waist height"), QStringLiteral("Waist side to floor"));
InitMeasurement(highHipHeight, QStringLiteral("HighHip height"), QStringLiteral("HighHip side to Floor"));
InitMeasurement(hipHeight, QStringLiteral("Hip height"), QStringLiteral("Hip side to Floor"));
InitMeasurement(waistToHipHeight, QStringLiteral("Waist to Hip height"), QStringLiteral("Waist side to Hip"));
InitMeasurement(waistToKneeHeight, QStringLiteral("Waist to Knee height"), QStringLiteral("Waist side to Knee"));
InitMeasurement(crotchHeight, QStringLiteral("Crotch height/Inseam"),
QStringLiteral("Crotch to Floor along inside leg"));
}
//---------------------------------------------------------------------------------------------------------------------
void VApplication::InitMeasurement(const QString &measurement, const QString &guiTxt, const QString &desc)
{
const QString context = QStringLiteral("Measurements");
const QString disambiguation1 = QStringLiteral("Short measurement name. Don't use math symbols in name!!!!");
const QString disambiguation2 = QStringLiteral("Full measurement name");
const QString disambiguation3 = QStringLiteral("Full measurement description");
measurements.insert(measurement, VTranslation::translate(context, measurement, disambiguation1));
guiText.insert(measurement, VTranslation::translate(context, guiTxt, disambiguation2));
description.insert(measurement, VTranslation::translate(context, desc, disambiguation3));
}
//---------------------------------------------------------------------------------------------------------------------
void VApplication::InitVariables()
{
const QString context = QStringLiteral("Variables");
const QString disambiguation = QStringLiteral("Left symbol _ in name");
variables.insert(line_, VTranslation::translate(context, line_, disambiguation));
variables.insert(angleLine_, VTranslation::translate(context, angleLine_, disambiguation));
variables.insert(arc_, VTranslation::translate(context, arc_, disambiguation));
variables.insert(spl_, VTranslation::translate(context, spl_, disambiguation));
variables.insert(splPath, VTranslation::translate(context, splPath, disambiguation));
}
//---------------------------------------------------------------------------------------------------------------------
void VApplication::InitFunctions()
{
const QString context = QStringLiteral("Functions");
functions.insert(sin_F, VTranslation::translate(context, sin_F, QStringLiteral("sine function")));
functions.insert(cos_F, VTranslation::translate(context, cos_F, QStringLiteral("cosine function")));
functions.insert(tan_F, VTranslation::translate(context, tan_F, QStringLiteral("tangens function")));
functions.insert(asin_F, VTranslation::translate(context, asin_F, QStringLiteral("arcus sine function")));
functions.insert(acos_F, VTranslation::translate(context, acos_F, QStringLiteral("arcus cosine function")));
functions.insert(atan_F, VTranslation::translate(context, atan_F, QStringLiteral("arcus tangens function")));
functions.insert(sinh_F, VTranslation::translate(context, sinh_F, QStringLiteral("hyperbolic sine function")));
functions.insert(cosh_F, VTranslation::translate(context, cosh_F, QStringLiteral("hyperbolic cosine")));
functions.insert(tanh_F, VTranslation::translate(context, tanh_F, QStringLiteral("hyperbolic tangens function")));
functions.insert(asinh_F, VTranslation::translate(context, asinh_F,
QStringLiteral("hyperbolic arcus sine function")));
functions.insert(acosh_F, VTranslation::translate(context, acosh_F,
QStringLiteral("hyperbolic arcus tangens function")));
functions.insert(atanh_F, VTranslation::translate(context, atanh_F,
QStringLiteral("hyperbolic arcur tangens function")));
functions.insert(log2_F, VTranslation::translate(context, log2_F, QStringLiteral("logarithm to the base 2")));
functions.insert(log10_F, VTranslation::translate(context, log10_F, QStringLiteral("logarithm to the base 10")));
functions.insert(log_F, VTranslation::translate(context, log_F, QStringLiteral("logarithm to the base 10")));
functions.insert(ln_F, VTranslation::translate(context, ln_F, QStringLiteral("logarithm to base e (2.71828...)")));
functions.insert(exp_F, VTranslation::translate(context, exp_F, QStringLiteral("e raised to the power of x")));
functions.insert(sqrt_F, VTranslation::translate(context, sqrt_F, QStringLiteral("square root of a value")));
functions.insert(sign_F, VTranslation::translate(context, sign_F,
QStringLiteral("sign function -1 if x<0; 1 if x>0")));
functions.insert(rint_F, VTranslation::translate(context, rint_F, QStringLiteral("round to nearest integer")));
functions.insert(abs_F, VTranslation::translate(context, abs_F, QStringLiteral("absolute value")));
functions.insert(min_F, VTranslation::translate(context, min_F, QStringLiteral("min of all arguments")));
functions.insert(max_F, VTranslation::translate(context, max_F, QStringLiteral("max of all arguments")));
functions.insert(sum_F, VTranslation::translate(context, sum_F, QStringLiteral("sum of all arguments")));
functions.insert(avg_F, VTranslation::translate(context, avg_F, QStringLiteral("mean value of all arguments")));
}
//---------------------------------------------------------------------------------------------------------------------
void VApplication::setPatternUnit(const Valentina::Units &patternUnit)
{

View file

@ -31,6 +31,7 @@
#include <QApplication>
#include "../options.h"
#include "vtranslation.h"
class VApplication;
@ -76,7 +77,17 @@ private:
Pattern::Measurements _patternType;
qreal _widthMainLine;
qreal _widthHairLine;
QMap<QString, VTranslation> measurements;
QMap<QString, VTranslation> guiText;
QMap<QString, VTranslation> description;
QMap<QString, VTranslation> variables;
QMap<QString, VTranslation> functions;
void InitLineWidth();
void InitMeasurements();
void InitMeasurement(const QString &measurement, const QString &guiTxt, const QString & desc);
void InitVariables();
void InitFunctions();
};
inline Valentina::Units VApplication::patternUnit() const

View file

@ -0,0 +1,55 @@
/************************************************************************
**
** @file vtranslation.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 12 5, 2014
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#include "vtranslation.h"
//---------------------------------------------------------------------------------------------------------------------
VTranslation VTranslation::translate(const QString &context, const QString &sourceText, const QString &disambiguation,
int n)
{
if (n < 0)
{
n = -1;
}
VTranslation t(context, sourceText, disambiguation, n);
return t;
}
//---------------------------------------------------------------------------------------------------------------------
VTranslation::VTranslation(const QString &context, const QString &sourceText, const QString &disambiguation, int n)
:mcontext(context), msourceText(sourceText), mdisambiguation(disambiguation), mn(n)
{
mn = -1;
}
//---------------------------------------------------------------------------------------------------------------------
QString VTranslation::VTranslation::translate() const
{
return QCoreApplication::translate(mcontext.toUtf8().constData(), msourceText.toUtf8().constData(),
mdisambiguation.toUtf8().constData(), mn);
}

View file

@ -0,0 +1,64 @@
/************************************************************************
**
** @file vtranslation.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 12 5, 2014
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef VTRANSLATION_H
#define VTRANSLATION_H
#include <QCoreApplication>
#include <QString>
/**
* @file
* @brief The VTranslation class help store string for translation.
*
* I took idea from this article http://ololoepepe.blogspot.com/2013/08/qt.html.
* As you know, if wrap string to a function translate, it will be marked for translation. No matter what namespace
* contains this function. In class Translation used this circumstance.
* Instead of using QT_TRANSLATE_NOOP3 macros we can store strings in QMap.
* Example:
* create map and fill up its
* QMap<QString, VTranslation> map;
* map.insert("head_girth", VTranslation::translate("Measurements", "head_girth", "Around fullest part of Head."));
* get translated string
* map.value(measurement).translate();
*/
class VTranslation
{
public:
VTranslation(const QString &context, const QString &sourceText, const QString &disambiguation = 0, int n = -1);
QString translate() const;
static VTranslation translate(const QString &context, const QString &sourceText, const QString &disambiguation = 0,
int n = -1);
private:
QString mcontext;
QString msourceText;
QString mdisambiguation;
int mn;
};
#endif // VTRANSLATION_H

View file

@ -10,7 +10,8 @@ HEADERS += \
widgets/vsimplespline.h \
widgets/vsimplesplinepath.h \
widgets/vsimplearc.h \
widgets/textdelegate.h
widgets/textdelegate.h \
widgets/vtranslation.h
SOURCES += \
widgets/vtablegraphicsview.cpp \
@ -24,4 +25,5 @@ SOURCES += \
widgets/vsimplespline.cpp \
widgets/vsimplesplinepath.cpp \
widgets/vsimplearc.cpp \
widgets/textdelegate.cpp
widgets/textdelegate.cpp \
widgets/vtranslation.cpp