diff --git a/src/app/tape/mapplication.cpp b/src/app/tape/mapplication.cpp index 7a27805a2..78ca1db7d 100644 --- a/src/app/tape/mapplication.cpp +++ b/src/app/tape/mapplication.cpp @@ -636,7 +636,7 @@ void MApplication::ParseCommandLine(const SocketConnection &connection, const QS if (units.contains(unitValue)) { flagUnit = true; - unit = VDomDocument::StrToUnits(unitValue); + unit = StrToUnits(unitValue); } else { diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index 1e3d26786..599663941 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -535,9 +535,9 @@ void TMainWindow::changeEvent(QEvent *event) { ui->labelMType->setText(tr("Multisize measurements")); ui->labelBaseSizeValue->setText(QString().setNum(m->BaseSize()) + QLatin1String(" ") + - VDomDocument::UnitsToStr(m->MUnit(), true)); + UnitsToStr(m->MUnit(), true)); ui->labelBaseHeightValue->setText(QString().setNum(m->BaseHeight()) + QLatin1String(" ") + - VDomDocument::UnitsToStr(m->MUnit(), true)); + UnitsToStr(m->MUnit(), true)); labelGradationHeights = new QLabel(tr("Height:")); labelGradationSizes = new QLabel(tr("Size:")); @@ -1231,7 +1231,7 @@ void TMainWindow::Fx() dialog->setWindowTitle(tr("Edit measurement")); dialog->SetFormula(qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditFormula->toPlainText().replace("\n", " "), true)); - const QString postfix = VDomDocument::UnitsToStr(mUnit, true);//Show unit in dialog lable (cm, mm or inch) + const QString postfix = UnitsToStr(mUnit, true);//Show unit in dialog lable (cm, mm or inch) dialog->setPostfix(postfix); if (dialog->exec() == QDialog::Accepted) @@ -1488,7 +1488,7 @@ void TMainWindow::ShowNewMData(bool fresh) ui->doubleSpinBoxInSizes->blockSignals(true); ui->doubleSpinBoxInHeights->blockSignals(true); - const QString postfix = VDomDocument::UnitsToStr(pUnit);//Show unit in dialog lable (cm, mm or inch) + const QString postfix = UnitsToStr(pUnit);//Show unit in dialog lable (cm, mm or inch) const qreal value = UnitConvertor(data->GetTableValue(meash->GetName(), mType), mUnit, pUnit); ui->labelCalculatedValue->setText(qApp->LocaleToString(value) + " " +postfix); @@ -1670,14 +1670,14 @@ void TMainWindow::SaveMValue() if (formulaField->text() == text) { QTableWidgetItem *result = ui->tableWidget->item(row, ColumnCalcValue); - const QString postfix = VDomDocument::UnitsToStr(mUnit);//Show unit in dialog lable (cm, mm or inch) + const QString postfix = UnitsToStr(mUnit);//Show unit in dialog lable (cm, mm or inch) ui->labelCalculatedValue->setText(result->text() + " " +postfix); return; } if (text.isEmpty()) { - const QString postfix = VDomDocument::UnitsToStr(mUnit);//Show unit in dialog lable (cm, mm or inch) + const QString postfix = UnitsToStr(mUnit);//Show unit in dialog lable (cm, mm or inch) ui->labelCalculatedValue->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field.")); return; } @@ -1997,9 +1997,9 @@ void TMainWindow::InitWindow() { ui->labelMType->setText(tr("Multisize measurements")); ui->labelBaseSizeValue->setText(QString().setNum(m->BaseSize()) + " " + - VDomDocument::UnitsToStr(m->MUnit(), true)); + UnitsToStr(m->MUnit(), true)); ui->labelBaseHeightValue->setText(QString().setNum(m->BaseHeight()) + " " + - VDomDocument::UnitsToStr(m->MUnit(), true)); + UnitsToStr(m->MUnit(), true)); // Because Qt Designer doesn't know about our deleting we will create empty objects for correct // working the retranslation UI @@ -2184,9 +2184,9 @@ void TMainWindow::InitTable() //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::ShowUnits() { - const QString unit = VDomDocument::UnitsToStr(mUnit); + const QString unit = UnitsToStr(mUnit); - ShowHeaderUnits(ui->tableWidget, ColumnCalcValue, VDomDocument::UnitsToStr(pUnit));// calculated value + ShowHeaderUnits(ui->tableWidget, ColumnCalcValue, UnitsToStr(pUnit));// calculated value ShowHeaderUnits(ui->tableWidget, ColumnFormula, unit);// formula ShowHeaderUnits(ui->tableWidget, ColumnBaseValue, unit);// base value ShowHeaderUnits(ui->tableWidget, ColumnInSizes, unit);// in sizes @@ -2645,7 +2645,7 @@ QString TMainWindow::ClearCustomName(const QString &name) const //--------------------------------------------------------------------------------------------------------------------- bool TMainWindow::EvalFormula(const QString &formula, bool fromUser, VContainer *data, QLabel *label) { - const QString postfix = VDomDocument::UnitsToStr(pUnit);//Show unit in dialog lable (cm, mm or inch) + const QString postfix = UnitsToStr(pUnit);//Show unit in dialog lable (cm, mm or inch) if (formula.isEmpty()) { label->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field.")); @@ -3111,9 +3111,9 @@ void TMainWindow::InitUnits() void TMainWindow::InitComboBoxUnits() { SCASSERT(comboBoxUnits != nullptr) - comboBoxUnits->addItem(VDomDocument::UnitsToStr(Unit::Cm, true), QVariant(static_cast(Unit::Cm))); - comboBoxUnits->addItem(VDomDocument::UnitsToStr(Unit::Mm, true), QVariant(static_cast(Unit::Mm))); - comboBoxUnits->addItem(VDomDocument::UnitsToStr(Unit::Inch, true), QVariant(static_cast(Unit::Inch))); + comboBoxUnits->addItem(UnitsToStr(Unit::Cm, true), QVariant(static_cast(Unit::Cm))); + comboBoxUnits->addItem(UnitsToStr(Unit::Mm, true), QVariant(static_cast(Unit::Mm))); + comboBoxUnits->addItem(UnitsToStr(Unit::Inch, true), QVariant(static_cast(Unit::Inch))); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/valentina/core/vtooloptionspropertybrowser.cpp b/src/app/valentina/core/vtooloptionspropertybrowser.cpp index c83bfe7f2..b6a9346d9 100644 --- a/src/app/valentina/core/vtooloptionspropertybrowser.cpp +++ b/src/app/valentina/core/vtooloptionspropertybrowser.cpp @@ -2237,7 +2237,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSpline(QGraphicsItem *item) VFormula length1(spl.GetC1LengthFormula(), i->getData()); length1.setCheckZero(false); length1.setToolId(i->getId()); - length1.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit())); + length1.setPostfix(UnitsToStr(qApp->patternUnit())); AddPropertyFormula(tr("C1: length:"), length1, AttrLength1); VFormula angle2(spl.GetEndAngleFormula(), i->getData()); @@ -2249,7 +2249,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSpline(QGraphicsItem *item) VFormula length2(spl.GetC2LengthFormula(), i->getData()); length2.setCheckZero(false); length2.setToolId(i->getId()); - length2.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit())); + length2.setPostfix(UnitsToStr(qApp->patternUnit())); AddPropertyFormula(tr("C2: length:"), length2, AttrLength2); AddPropertyCurvePenStyle(i, tr("Pen style:"), CurvePenStylesPics()); @@ -2947,7 +2947,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline() VFormula length1F(spl.GetC1LengthFormula(), i->getData()); length1F.setCheckZero(false); length1F.setToolId(i->getId()); - length1F.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit())); + length1F.setPostfix(UnitsToStr(qApp->patternUnit())); QVariant length1; length1.setValue(length1F); idToProperty[AttrLength1]->setValue(length1); @@ -2963,7 +2963,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline() VFormula length2F(spl.GetC2LengthFormula(), i->getData()); length2F.setCheckZero(false); length2F.setToolId(i->getId()); - length2F.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit())); + length2F.setPostfix(UnitsToStr(qApp->patternUnit())); QVariant length2; length2.setValue(length2F); idToProperty[AttrLength2]->setValue(length2); diff --git a/src/app/valentina/dialogs/configpages/preferencespatternpage.ui b/src/app/valentina/dialogs/configpages/preferencespatternpage.ui index ffd7d7f26..085dc4f3d 100644 --- a/src/app/valentina/dialogs/configpages/preferencespatternpage.ui +++ b/src/app/valentina/dialogs/configpages/preferencespatternpage.ui @@ -155,7 +155,7 @@ 3 - 10.000000000000000 + 100.000000000000000 0.100000000000000 diff --git a/src/app/valentina/dialogs/dialogincrements.cpp b/src/app/valentina/dialogs/dialogincrements.cpp index 33d3c5ec8..968f7cf0b 100644 --- a/src/app/valentina/dialogs/dialogincrements.cpp +++ b/src/app/valentina/dialogs/dialogincrements.cpp @@ -254,7 +254,7 @@ void DialogIncrements::FillAnglesCurves() //--------------------------------------------------------------------------------------------------------------------- void DialogIncrements::ShowUnits() { - const QString unit = VDomDocument::UnitsToStr(qApp->patternUnit()); + const QString unit = UnitsToStr(qApp->patternUnit()); ShowHeaderUnits(ui->tableWidgetIncrement, 1, unit);// calculated value ShowHeaderUnits(ui->tableWidgetIncrement, 2, unit);// formula @@ -328,7 +328,7 @@ QString DialogIncrements::ClearIncrementName(const QString &name) const //--------------------------------------------------------------------------------------------------------------------- bool DialogIncrements::EvalIncrementFormula(const QString &formula, bool fromUser, VContainer *data, QLabel *label) { - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit());//Show unit in dialog lable (cm, mm or inch) + const QString postfix = UnitsToStr(qApp->patternUnit());//Show unit in dialog lable (cm, mm or inch) if (formula.isEmpty()) { label->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field.")); @@ -636,7 +636,7 @@ void DialogIncrements::SaveIncrFormula() { QTableWidgetItem *result = ui->tableWidgetIncrement->item(row, 1); //Show unit in dialog lable (cm, mm or inch) - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit()); + const QString postfix = UnitsToStr(qApp->patternUnit()); ui->labelCalculatedValue->setText(result->text() + " " +postfix); return; } @@ -644,7 +644,7 @@ void DialogIncrements::SaveIncrFormula() if (text.isEmpty()) { //Show unit in dialog lable (cm, mm or inch) - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit()); + const QString postfix = UnitsToStr(qApp->patternUnit()); ui->labelCalculatedValue->setText(tr("Error") + " (" + postfix + "). " + tr("Empty field.")); return; } @@ -725,7 +725,7 @@ void DialogIncrements::Fx() dialog->setWindowTitle(tr("Edit increment")); dialog->SetFormula(qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditFormula->toPlainText().replace("\n", " "), qApp->Settings()->GetOsSeparator())); - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); dialog->setPostfix(postfix);//Show unit in dialog lable (cm, mm or inch) if (dialog->exec() == QDialog::Accepted) diff --git a/src/app/valentina/dialogs/dialoglayoutsettings.cpp b/src/app/valentina/dialogs/dialoglayoutsettings.cpp index 0776d6410..663d014c7 100644 --- a/src/app/valentina/dialogs/dialoglayoutsettings.cpp +++ b/src/app/valentina/dialogs/dialoglayoutsettings.cpp @@ -703,13 +703,13 @@ void DialogLayoutSettings::IgnoreAllFields(int state) //--------------------------------------------------------------------------------------------------------------------- void DialogLayoutSettings::InitPaperUnits() { - ui->comboBoxPaperSizeUnit->addItem(tr("Millimiters"), QVariant(VDomDocument::UnitsToStr(Unit::Mm))); - ui->comboBoxPaperSizeUnit->addItem(tr("Centimeters"), QVariant(VDomDocument::UnitsToStr(Unit::Cm))); - ui->comboBoxPaperSizeUnit->addItem(tr("Inches"), QVariant(VDomDocument::UnitsToStr(Unit::Inch))); - ui->comboBoxPaperSizeUnit->addItem(tr("Pixels"), QVariant(VDomDocument::UnitsToStr(Unit::Px))); + ui->comboBoxPaperSizeUnit->addItem(tr("Millimiters"), QVariant(UnitsToStr(Unit::Mm))); + ui->comboBoxPaperSizeUnit->addItem(tr("Centimeters"), QVariant(UnitsToStr(Unit::Cm))); + ui->comboBoxPaperSizeUnit->addItem(tr("Inches"), QVariant(UnitsToStr(Unit::Inch))); + ui->comboBoxPaperSizeUnit->addItem(tr("Pixels"), QVariant(UnitsToStr(Unit::Px))); // set default unit - oldPaperUnit = VDomDocument::StrToUnits(qApp->ValentinaSettings()->GetUnit()); + oldPaperUnit = StrToUnits(qApp->ValentinaSettings()->GetUnit()); const qint32 indexUnit = ui->comboBoxPaperSizeUnit->findData(qApp->ValentinaSettings()->GetUnit()); if (indexUnit != -1) { @@ -720,12 +720,12 @@ void DialogLayoutSettings::InitPaperUnits() //--------------------------------------------------------------------------------------------------------------------- void DialogLayoutSettings::InitLayoutUnits() { - ui->comboBoxLayoutUnit->addItem(tr("Centimeters"), QVariant(VDomDocument::UnitsToStr(Unit::Cm))); - ui->comboBoxLayoutUnit->addItem(tr("Millimiters"), QVariant(VDomDocument::UnitsToStr(Unit::Mm))); - ui->comboBoxLayoutUnit->addItem(tr("Inches"), QVariant(VDomDocument::UnitsToStr(Unit::Inch))); + ui->comboBoxLayoutUnit->addItem(tr("Centimeters"), QVariant(UnitsToStr(Unit::Cm))); + ui->comboBoxLayoutUnit->addItem(tr("Millimiters"), QVariant(UnitsToStr(Unit::Mm))); + ui->comboBoxLayoutUnit->addItem(tr("Inches"), QVariant(UnitsToStr(Unit::Inch))); // set default unit - oldLayoutUnit = VDomDocument::StrToUnits(qApp->ValentinaSettings()->GetUnit()); + oldLayoutUnit = StrToUnits(qApp->ValentinaSettings()->GetUnit()); const qint32 indexUnit = ui->comboBoxLayoutUnit->findData(qApp->ValentinaSettings()->GetUnit()); if (indexUnit != -1) { @@ -976,13 +976,13 @@ QMarginsF DialogLayoutSettings::GetDefPrinterFields() const //--------------------------------------------------------------------------------------------------------------------- Unit DialogLayoutSettings::PaperUnit() const { - return VDomDocument::StrToUnits(ui->comboBoxPaperSizeUnit->currentData().toString()); + return StrToUnits(ui->comboBoxPaperSizeUnit->currentData().toString()); } //--------------------------------------------------------------------------------------------------------------------- Unit DialogLayoutSettings::LayoutUnit() const { - return VDomDocument::StrToUnits(ui->comboBoxLayoutUnit->currentData().toString()); + return StrToUnits(ui->comboBoxLayoutUnit->currentData().toString()); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/valentina/dialogs/dialognewpattern.cpp b/src/app/valentina/dialogs/dialognewpattern.cpp index 3f8692bc0..eec7f03ee 100644 --- a/src/app/valentina/dialogs/dialognewpattern.cpp +++ b/src/app/valentina/dialogs/dialognewpattern.cpp @@ -31,7 +31,6 @@ #include "../core/vapplication.h" #include "../vmisc/vsettings.h" #include "../vpatterndb/vcontainer.h" -#include "../ifc/xml/vdomdocument.h" #include #include @@ -70,7 +69,7 @@ DialogNewPattern::~DialogNewPattern() Unit DialogNewPattern::PatternUnit() const { const qint32 index = ui->comboBoxUnits->currentIndex(); - return VDomDocument::StrToUnits(ui->comboBoxUnits->itemData(index).toString()); + return StrToUnits(ui->comboBoxUnits->itemData(index).toString()); } //--------------------------------------------------------------------------------------------------------------------- @@ -111,9 +110,9 @@ void DialogNewPattern::showEvent(QShowEvent *event) //--------------------------------------------------------------------------------------------------------------------- void DialogNewPattern::InitUnits() { - ui->comboBoxUnits->addItem(tr("Centimeters"), QVariant(VDomDocument::UnitsToStr(Unit::Cm))); - ui->comboBoxUnits->addItem(tr("Millimiters"), QVariant(VDomDocument::UnitsToStr(Unit::Mm))); - ui->comboBoxUnits->addItem(tr("Inches"), QVariant(VDomDocument::UnitsToStr(Unit::Inch))); + ui->comboBoxUnits->addItem(tr("Centimeters"), QVariant(UnitsToStr(Unit::Cm))); + ui->comboBoxUnits->addItem(tr("Millimiters"), QVariant(UnitsToStr(Unit::Mm))); + ui->comboBoxUnits->addItem(tr("Inches"), QVariant(UnitsToStr(Unit::Inch))); // set default unit const qint32 indexUnit = ui->comboBoxUnits->findData(qApp->ValentinaSettings()->GetUnit()); diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 5d874a04e..aca45571f 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -1631,7 +1631,7 @@ void MainWindow::ShowMeasurements() arguments = QStringList() << absoluteMPath << "-u" - << VDomDocument::UnitsToStr(qApp->patternUnit()) + << UnitsToStr(qApp->patternUnit()) << "-e" << QString().setNum(static_cast(UnitConvertor(VContainer::height(), doc->MUnit(), Unit::Cm))) << "-s" @@ -1641,7 +1641,7 @@ void MainWindow::ShowMeasurements() { arguments = QStringList() << absoluteMPath << "-u" - << VDomDocument::UnitsToStr(qApp->patternUnit()); + << UnitsToStr(qApp->patternUnit()); } if (isNoScaling) @@ -1790,7 +1790,7 @@ void MainWindow::ToolBarOption() ui->toolBarOption->addSeparator(); } - mouseCoordinate = new QLabel(QString("0, 0 (%1)").arg(VDomDocument::UnitsToStr(qApp->patternUnit(), true))); + mouseCoordinate = new QLabel(QString("0, 0 (%1)").arg(UnitsToStr(qApp->patternUnit(), true))); ui->toolBarOption->addWidget(mouseCoordinate); } @@ -1964,7 +1964,7 @@ void MainWindow::MouseMove(const QPointF &scenePos) //: Coords in status line: "X, Y (units)" mouseCoordinate->setText(QString("%1, %2 (%3)").arg(static_cast(qApp->fromPixel(scenePos.x()))) .arg(static_cast(qApp->fromPixel(scenePos.y()))) - .arg(VDomDocument::UnitsToStr(qApp->patternUnit(), true))); + .arg(UnitsToStr(qApp->patternUnit(), true))); } } @@ -3123,7 +3123,7 @@ void MainWindow::New() AddPP(patternPieceName); - mouseCoordinate = new QLabel(QString("0, 0 (%1)").arg(VDomDocument::UnitsToStr(qApp->patternUnit(), true))); + mouseCoordinate = new QLabel(QString("0, 0 (%1)").arg(UnitsToStr(qApp->patternUnit(), true))); ui->toolBarOption->addWidget(mouseCoordinate); m_curFileFormatVersion = VPatternConverter::PatternMaxVer; diff --git a/src/libs/ifc/xml/vdomdocument.cpp b/src/libs/ifc/xml/vdomdocument.cpp index e0a522b05..2b2d5b9bb 100644 --- a/src/libs/ifc/xml/vdomdocument.cpp +++ b/src/libs/ifc/xml/vdomdocument.cpp @@ -484,7 +484,7 @@ quint32 VDomDocument::GetParametrId(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- Unit VDomDocument::MUnit() const { - Unit unit = VDomDocument::StrToUnits(UniqueTagText(TagUnit, unitCM)); + Unit unit = StrToUnits(UniqueTagText(TagUnit, unitCM)); if (unit == Unit::Px) { @@ -648,61 +648,6 @@ void VDomDocument::setXMLContent(const QString &fileName) } } -//--------------------------------------------------------------------------------------------------------------------- -Unit VDomDocument::StrToUnits(const QString &unit) -{ - const QStringList units = QStringList() << unitMM << unitCM << unitINCH << unitPX; - Unit result = Unit::Cm; - switch (units.indexOf(unit)) - { - case 0:// mm - result = Unit::Mm; - break; - case 2:// inch - result = Unit::Inch; - break; - case 3:// px - result = Unit::Px; - break; - case 1:// cm - default: - result = Unit::Cm; - break; - } - return result; -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief UnitsToStr translate unit to string. - * - * This method used when need write unit in xml file and for showing unit in dialogs. - * @param unit curent unit - * @param translate true if need show translated name. Default value false. - * @return string reprezantation for unit. - */ -QString VDomDocument::UnitsToStr(const Unit &unit, const bool translate) -{ - QString result; - switch (unit) - { - case Unit::Mm: - translate ? result = QObject::tr("mm") : result = unitMM; - break; - case Unit::Inch: - translate ? result = QObject::tr("inch") : result = unitINCH; - break; - case Unit::Px: - translate ? result = QObject::tr("px") : result = unitPX; - break; - case Unit::Cm: - default: - translate ? result = QObject::tr("cm") : result = unitCM; - break; - } - return result; -} - //--------------------------------------------------------------------------------------------------------------------- QString VDomDocument::UnitsHelpString() { diff --git a/src/libs/ifc/xml/vdomdocument.h b/src/libs/ifc/xml/vdomdocument.h index b1f546788..372fff003 100644 --- a/src/libs/ifc/xml/vdomdocument.h +++ b/src/libs/ifc/xml/vdomdocument.h @@ -109,8 +109,6 @@ public: static void ValidateXML(const QString &schema, const QString &fileName); virtual void setXMLContent(const QString &fileName); - static Unit StrToUnits(const QString &unit); - static QString UnitsToStr(const Unit &unit, const bool translate = false); static QString UnitsHelpString(); virtual bool SaveDocument(const QString &fileName, QString &error); diff --git a/src/libs/vmisc/def.cpp b/src/libs/vmisc/def.cpp index a56cdf368..33f820bf0 100644 --- a/src/libs/vmisc/def.cpp +++ b/src/libs/vmisc/def.cpp @@ -677,6 +677,62 @@ PassmarkAngleType StringToPassmarkAngleType(const QString &value) return PassmarkAngleType::Straightforward; } + +//--------------------------------------------------------------------------------------------------------------------- +Unit StrToUnits(const QString &unit) +{ + const QStringList units = QStringList() << unitMM << unitCM << unitINCH << unitPX; + Unit result = Unit::Cm; + switch (units.indexOf(unit)) + { + case 0:// mm + result = Unit::Mm; + break; + case 2:// inch + result = Unit::Inch; + break; + case 3:// px + result = Unit::Px; + break; + case 1:// cm + default: + result = Unit::Cm; + break; + } + return result; +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief UnitsToStr translate unit to string. + * + * This method used when need write unit in xml file and for showing unit in dialogs. + * @param unit curent unit + * @param translate true if need show translated name. Default value false. + * @return string reprezantation for unit. + */ +QString UnitsToStr(const Unit &unit, const bool translate) +{ + QString result; + switch (unit) + { + case Unit::Mm: + translate ? result = QObject::tr("mm") : result = unitMM; + break; + case Unit::Inch: + translate ? result = QObject::tr("inch") : result = unitINCH; + break; + case Unit::Px: + translate ? result = QObject::tr("px") : result = unitPX; + break; + case Unit::Cm: + default: + translate ? result = QObject::tr("cm") : result = unitCM; + break; + } + return result; +} + //--------------------------------------------------------------------------------------------------------------------- void InitLanguages(QComboBox *combobox) { diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index a7cc08e90..a2e2c13ed 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -94,6 +94,11 @@ enum class PassmarkAngleType : unsigned char QString PassmarkAngleTypeToString(PassmarkAngleType type); PassmarkAngleType StringToPassmarkAngleType(const QString &value); + +Unit StrToUnits(const QString &unit); +QString UnitsToStr(const Unit &unit, const bool translate = false); + + enum class PiecePathIncludeType : unsigned char { AsMainPath = 0, diff --git a/src/libs/vmisc/vcommonsettings.cpp b/src/libs/vmisc/vcommonsettings.cpp index 26f1d5f63..df6ea666b 100644 --- a/src/libs/vmisc/vcommonsettings.cpp +++ b/src/libs/vmisc/vcommonsettings.cpp @@ -774,8 +774,7 @@ double VCommonSettings::GetDefaultSeamAllowance() { double defaultValue; - //Unit globalUnit = VDomDocument::StrToUnits(GetUnit()); - Unit globalUnit = Unit::Cm; // just for test purpuses + Unit globalUnit = StrToUnits(GetUnit()); switch (globalUnit) { diff --git a/src/libs/vmisc/vcommonsettings.h b/src/libs/vmisc/vcommonsettings.h index ded22d785..d30c8b5d3 100644 --- a/src/libs/vmisc/vcommonsettings.h +++ b/src/libs/vmisc/vcommonsettings.h @@ -40,8 +40,6 @@ #include "../vlayout/vbank.h" -class VDomDocument; - class VCommonSettings : public QSettings { Q_OBJECT diff --git a/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp b/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp index b17fba173..613419d6f 100644 --- a/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp +++ b/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp @@ -174,28 +174,28 @@ void DialogEditWrongFormula::ValChanged(int row) const QString name = qApp->TrVars()->VarFromUser(item->text()); const QSharedPointer stable = data->GetVariable(name); SetDescription(item->text(), data->GetTableValue(name, qApp->patternType()), - VDomDocument::UnitsToStr(qApp->patternUnit(), true), stable->GetGuiText()); + UnitsToStr(qApp->patternUnit(), true), stable->GetGuiText()); return; } if (ui->radioButtonIncrements->isChecked()) { const QSharedPointer incr = data->GetVariable(item->text()); SetDescription(item->text(), data->GetTableValue(item->text(), qApp->patternType()), - VDomDocument::UnitsToStr(qApp->patternUnit(), true), incr->GetDescription()); + UnitsToStr(qApp->patternUnit(), true), incr->GetDescription()); return; } if (ui->radioButtonLengthLine->isChecked()) { SetDescription(item->text(), *data->GetVariable(qApp->TrVars()->VarFromUser(item->text()))->GetValue(), - VDomDocument::UnitsToStr(qApp->patternUnit(), true), tr("Line length")); + UnitsToStr(qApp->patternUnit(), true), tr("Line length")); return; } if (ui->radioButtonLengthSpline->isChecked()) { SetDescription(item->text(), *data->GetVariable(qApp->TrVars()->VarFromUser(item->text()))->GetValue(), - VDomDocument::UnitsToStr(qApp->patternUnit(), true), tr("Curve length")); + UnitsToStr(qApp->patternUnit(), true), tr("Curve length")); return; } if (ui->radioButtonAngleLine->isChecked()) @@ -209,7 +209,7 @@ void DialogEditWrongFormula::ValChanged(int row) { SetDescription(item->text(), *data->GetVariable(qApp->TrVars()->VarFromUser(item->text()))->GetValue(), - VDomDocument::UnitsToStr(qApp->patternUnit(), true), tr("Arc radius")); + UnitsToStr(qApp->patternUnit(), true), tr("Arc radius")); return; } if (ui->radioButtonAnglesCurves->isChecked()) diff --git a/src/libs/vtools/dialogs/tools/dialogalongline.cpp b/src/libs/vtools/dialogs/tools/dialogalongline.cpp index ac5b7044d..d6d3f1302 100644 --- a/src/libs/vtools/dialogs/tools/dialogalongline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogalongline.cpp @@ -132,7 +132,7 @@ void DialogAlongLine::FXLength() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit length")); dialog->SetFormula(GetFormula()); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { SetFormula(dialog->GetFormula()); diff --git a/src/libs/vtools/dialogs/tools/dialogarc.cpp b/src/libs/vtools/dialogs/tools/dialogarc.cpp index d4eb11b94..a781355b0 100644 --- a/src/libs/vtools/dialogs/tools/dialogarc.cpp +++ b/src/libs/vtools/dialogs/tools/dialogarc.cpp @@ -292,7 +292,7 @@ void DialogArc::RadiusChanged() { labelEditFormula = ui->labelEditRadius; labelResultCalculation = ui->labelResultRadius; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); ValFormulaChanged(flagRadius, ui->plainTextEditFormula, timerRadius, postfix); } @@ -324,7 +324,7 @@ void DialogArc::FXRadius() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit radius")); dialog->SetFormula(GetRadius()); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { SetRadius(dialog->GetFormula()); @@ -379,7 +379,7 @@ void DialogArc::CheckState() void DialogArc::EvalRadius() { labelEditFormula = ui->labelEditRadius; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); const qreal radius = Eval(ui->plainTextEditFormula->toPlainText(), flagRadius, ui->labelResultRadius, postfix); if (radius < 0) diff --git a/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp b/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp index ef28d59fb..65c6ec5d4 100644 --- a/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp +++ b/src/libs/vtools/dialogs/tools/dialogarcwithlength.cpp @@ -251,7 +251,7 @@ void DialogArcWithLength::RadiusChanged() { labelEditFormula = ui->labelEditRadius; labelResultCalculation = ui->labelResultRadius; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); ValFormulaChanged(flagRadius, ui->plainTextEditRadius, timerRadius, postfix); } @@ -268,7 +268,7 @@ void DialogArcWithLength::LengthChanged() { labelEditFormula = ui->labelEditLength; labelResultCalculation = ui->labelResultLength; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); ValFormulaChanged(flagLength, ui->plainTextEditLength, timerLength, postfix); } @@ -278,7 +278,7 @@ void DialogArcWithLength::FXRadius() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit radius")); dialog->SetFormula(GetRadius()); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { SetRadius(dialog->GetFormula()); @@ -306,7 +306,7 @@ void DialogArcWithLength::FXLength() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit the arc length")); dialog->SetFormula(GetLength()); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { SetLength(dialog->GetFormula()); @@ -367,7 +367,7 @@ void DialogArcWithLength::closeEvent(QCloseEvent *event) void DialogArcWithLength::Radius() { labelEditFormula = ui->labelEditRadius; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); const qreal radius = Eval(ui->plainTextEditRadius->toPlainText(), flagRadius, ui->labelResultRadius, postfix); if (radius < 0) @@ -385,7 +385,7 @@ void DialogArcWithLength::Radius() void DialogArcWithLength::Length() { labelEditFormula = ui->labelEditLength; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); const qreal length = Eval(ui->plainTextEditLength->toPlainText(), flagLength, ui->labelResultLength, postfix); if (qFuzzyIsNull(length)) diff --git a/src/libs/vtools/dialogs/tools/dialogbisector.cpp b/src/libs/vtools/dialogs/tools/dialogbisector.cpp index 76a3a62d6..9fb9928d4 100644 --- a/src/libs/vtools/dialogs/tools/dialogbisector.cpp +++ b/src/libs/vtools/dialogs/tools/dialogbisector.cpp @@ -129,7 +129,7 @@ void DialogBisector::FXLength() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit length")); dialog->SetFormula(GetFormula()); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { SetFormula(dialog->GetFormula()); diff --git a/src/libs/vtools/dialogs/tools/dialogcutarc.cpp b/src/libs/vtools/dialogs/tools/dialogcutarc.cpp index aafb398bb..78f88c5cb 100644 --- a/src/libs/vtools/dialogs/tools/dialogcutarc.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcutarc.cpp @@ -90,7 +90,7 @@ void DialogCutArc::FXLength() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit length")); dialog->SetFormula(GetFormula()); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { SetFormula(dialog->GetFormula()); diff --git a/src/libs/vtools/dialogs/tools/dialogcutspline.cpp b/src/libs/vtools/dialogs/tools/dialogcutspline.cpp index d499f3738..1ca9e366e 100644 --- a/src/libs/vtools/dialogs/tools/dialogcutspline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcutspline.cpp @@ -189,7 +189,7 @@ void DialogCutSpline::FXLength() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit length")); dialog->SetFormula(GetFormula()); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { SetFormula(dialog->GetFormula()); diff --git a/src/libs/vtools/dialogs/tools/dialogcutsplinepath.cpp b/src/libs/vtools/dialogs/tools/dialogcutsplinepath.cpp index 5e2fe299e..10735b94e 100644 --- a/src/libs/vtools/dialogs/tools/dialogcutsplinepath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcutsplinepath.cpp @@ -189,7 +189,7 @@ void DialogCutSplinePath::FXLength() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit length")); dialog->SetFormula(GetFormula()); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { SetFormula(dialog->GetFormula()); diff --git a/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp b/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp index a18dbf2d4..fffa32b60 100644 --- a/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp +++ b/src/libs/vtools/dialogs/tools/dialogellipticalarc.cpp @@ -367,7 +367,7 @@ void DialogEllipticalArc::SetColor(const QString &value) void DialogEllipticalArc::EvalRadiuses() { labelEditFormula = ui->labelEditRadius1; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); const qreal radius_1 = Eval(ui->plainTextEditRadius1->toPlainText(), flagRadius1, ui->labelResultRadius1, postfix); if (radius_1 < 0) @@ -442,7 +442,7 @@ void DialogEllipticalArc::FXRadius1() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit radius1")); dialog->SetFormula(GetRadius1()); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { SetRadius1(dialog->GetFormula()); @@ -456,7 +456,7 @@ void DialogEllipticalArc::FXRadius2() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit radius2")); dialog->SetFormula(GetRadius2()); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { SetRadius2(dialog->GetFormula()); @@ -514,7 +514,7 @@ void DialogEllipticalArc::Radius1Changed() { labelEditFormula = ui->labelEditRadius1; labelResultCalculation = ui->labelResultRadius1; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); ValFormulaChanged(flagRadius1, ui->plainTextEditRadius1, timerRadius1, postfix); } @@ -526,7 +526,7 @@ void DialogEllipticalArc::Radius2Changed() { labelEditFormula = ui->labelEditRadius2; labelResultCalculation = ui->labelResultRadius2; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); ValFormulaChanged(flagRadius2, ui->plainTextEditRadius2, timerRadius2, postfix); } diff --git a/src/libs/vtools/dialogs/tools/dialogendline.cpp b/src/libs/vtools/dialogs/tools/dialogendline.cpp index 43f76af37..8c454244f 100644 --- a/src/libs/vtools/dialogs/tools/dialogendline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogendline.cpp @@ -164,7 +164,7 @@ void DialogEndLine::FXLength() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit length")); dialog->SetFormula(GetFormula()); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { SetFormula(dialog->GetFormula()); diff --git a/src/libs/vtools/dialogs/tools/dialogmove.cpp b/src/libs/vtools/dialogs/tools/dialogmove.cpp index 7fce06f03..2997e1ad5 100644 --- a/src/libs/vtools/dialogs/tools/dialogmove.cpp +++ b/src/libs/vtools/dialogs/tools/dialogmove.cpp @@ -313,7 +313,7 @@ void DialogMove::FXLength() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit length")); dialog->SetFormula(GetLength()); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { SetLength(dialog->GetFormula()); @@ -415,6 +415,6 @@ void DialogMove::EvalAngle() void DialogMove::EvalLength() { labelEditFormula = ui->labelEditLength; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); Eval(ui->plainTextEditLength->toPlainText(), flagLength, ui->labelResultLength, postfix); } diff --git a/src/libs/vtools/dialogs/tools/dialognormal.cpp b/src/libs/vtools/dialogs/tools/dialognormal.cpp index 941f42f4b..11a9756c2 100644 --- a/src/libs/vtools/dialogs/tools/dialognormal.cpp +++ b/src/libs/vtools/dialogs/tools/dialognormal.cpp @@ -123,7 +123,7 @@ void DialogNormal::FXLength() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit length")); dialog->SetFormula(GetFormula()); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { SetFormula(dialog->GetFormula()); diff --git a/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp b/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp index e8c934a7a..037627ebd 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointfromcircleandtangent.cpp @@ -255,7 +255,7 @@ void DialogPointFromCircleAndTangent::CircleRadiusChanged() { labelEditFormula = ui->labelEditRadius; labelResultCalculation = ui->labelResultCircleRadius; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); ValFormulaChanged(flagCircleRadius, ui->plainTextEditRadius, timerCircleRadius, postfix); } @@ -265,7 +265,7 @@ void DialogPointFromCircleAndTangent::FXCircleRadius() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit radius")); dialog->SetFormula(GetCircleRadius()); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { SetCircleRadius(dialog->GetFormula()); @@ -277,7 +277,7 @@ void DialogPointFromCircleAndTangent::FXCircleRadius() void DialogPointFromCircleAndTangent::EvalCircleRadius() { labelEditFormula = ui->labelEditRadius; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); const qreal radius = Eval(ui->plainTextEditRadius->toPlainText(), flagCircleRadius, ui->labelResultCircleRadius, postfix); diff --git a/src/libs/vtools/dialogs/tools/dialogpointofcontact.cpp b/src/libs/vtools/dialogs/tools/dialogpointofcontact.cpp index 1b1b164f1..000627b57 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointofcontact.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointofcontact.cpp @@ -133,7 +133,7 @@ void DialogPointOfContact::FXRadius() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit radius")); dialog->SetFormula(getRadius()); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { setRadius(dialog->GetFormula()); diff --git a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp index c083fd0db..4465c408d 100644 --- a/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpointofintersectioncircles.cpp @@ -301,7 +301,7 @@ void DialogPointOfIntersectionCircles::Circle1RadiusChanged() { labelEditFormula = ui->labelEditCircle1Radius; labelResultCalculation = ui->labelResultCircle1Radius; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); ValFormulaChanged(flagCircle1Radius, ui->plainTextEditCircle1Radius, timerCircle1Radius, postfix); } @@ -310,7 +310,7 @@ void DialogPointOfIntersectionCircles::Circle2RadiusChanged() { labelEditFormula = ui->labelEditCircle2Radius; labelResultCalculation = ui->labelResultCircle2Radius; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); ValFormulaChanged(flagCircle2Radius, ui->plainTextEditCircle2Radius, timerCircle2Radius, postfix); } @@ -320,7 +320,7 @@ void DialogPointOfIntersectionCircles::FXCircle1Radius() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit first circle radius")); dialog->SetFormula(GetFirstCircleRadius()); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { SetFirstCircleRadius(dialog->GetFormula()); @@ -334,7 +334,7 @@ void DialogPointOfIntersectionCircles::FXCircle2Radius() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit second circle radius")); dialog->SetFormula(GetSecondCircleRadius()); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { SetSecondCircleRadius(dialog->GetFormula()); @@ -346,7 +346,7 @@ void DialogPointOfIntersectionCircles::FXCircle2Radius() void DialogPointOfIntersectionCircles::EvalCircle1Radius() { labelEditFormula = ui->labelEditCircle1Radius; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); const qreal radius = Eval(ui->plainTextEditCircle1Radius->toPlainText(), flagCircle1Radius, ui->labelResultCircle1Radius, postfix); @@ -365,7 +365,7 @@ void DialogPointOfIntersectionCircles::EvalCircle1Radius() void DialogPointOfIntersectionCircles::EvalCircle2Radius() { labelEditFormula = ui->labelEditCircle2Radius; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); const qreal radius = Eval(ui->plainTextEditCircle2Radius->toPlainText(), flagCircle2Radius, ui->labelResultCircle2Radius, postfix); diff --git a/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp b/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp index bf762a565..8e4f1e93e 100644 --- a/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp +++ b/src/libs/vtools/dialogs/tools/dialogshoulderpoint.cpp @@ -131,7 +131,7 @@ void DialogShoulderPoint::FXLength() DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this); dialog->setWindowTitle(tr("Edit length")); dialog->SetFormula(GetFormula()); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { SetFormula(dialog->GetFormula()); diff --git a/src/libs/vtools/dialogs/tools/dialogspline.cpp b/src/libs/vtools/dialogs/tools/dialogspline.cpp index 299d69d4c..14ce9e136 100644 --- a/src/libs/vtools/dialogs/tools/dialogspline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogspline.cpp @@ -268,7 +268,7 @@ void DialogSpline::Length1Changed() { labelEditFormula = ui->labelEditLength1; labelResultCalculation = ui->labelResultLength1; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); ValFormulaChanged(flagLength1, ui->plainTextEditLength1F, timerLength1, postfix); } @@ -277,7 +277,7 @@ void DialogSpline::Length2Changed() { labelEditFormula = ui->labelEditLength2; labelResultCalculation = ui->labelResultLength2; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); ValFormulaChanged(flagLength2, ui->plainTextEditLength2F, timerLength2, postfix); } @@ -335,7 +335,7 @@ void DialogSpline::FXLength1() QString length1F = qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditLength1F->toPlainText(), qApp->Settings()->GetOsSeparator()); dialog->SetFormula(length1F); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { length1F = qApp->TrVars()->FormulaToUser(dialog->GetFormula(), qApp->Settings()->GetOsSeparator()); @@ -358,7 +358,7 @@ void DialogSpline::FXLength2() QString length2F = qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditLength2F->toPlainText(), qApp->Settings()->GetOsSeparator()); dialog->SetFormula(length2F); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { length2F = qApp->TrVars()->FormulaToUser(dialog->GetFormula(), qApp->Settings()->GetOsSeparator()); @@ -403,7 +403,7 @@ void DialogSpline::EvalAngle2() void DialogSpline::EvalLength1() { labelEditFormula = ui->labelEditLength1; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); const qreal length1 = Eval(ui->plainTextEditLength1F->toPlainText(), flagLength1, ui->labelResultLength1, postfix, false); @@ -422,7 +422,7 @@ void DialogSpline::EvalLength1() void DialogSpline::EvalLength2() { labelEditFormula = ui->labelEditLength2; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); const qreal length2 = Eval(ui->plainTextEditLength2F->toPlainText(), flagLength2, ui->labelResultLength2, postfix, false); diff --git a/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp b/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp index ed701f55c..c001648ef 100644 --- a/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp @@ -523,7 +523,7 @@ void DialogSplinePath::FXLength1() qApp->Settings()->GetOsSeparator()); dialog->SetFormula(length1F); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { length1F = qApp->TrVars()->FormulaToUser(dialog->GetFormula(), qApp->Settings()->GetOsSeparator()); @@ -548,7 +548,7 @@ void DialogSplinePath::FXLength2() qApp->Settings()->GetOsSeparator()); dialog->SetFormula(length2F); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { length2F = qApp->TrVars()->FormulaToUser(dialog->GetFormula(), qApp->Settings()->GetOsSeparator()); @@ -611,7 +611,7 @@ void DialogSplinePath::EvalLength1() } labelEditFormula = ui->labelEditLength1; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); const qreal length1 = Eval(ui->plainTextEditLength1F->toPlainText(), flagLength1[row], ui->labelResultLength1, postfix, false); @@ -642,7 +642,7 @@ void DialogSplinePath::EvalLength2() } labelEditFormula = ui->labelEditLength2; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); const qreal length2 = Eval(ui->plainTextEditLength2F->toPlainText(), flagLength2[row], ui->labelResultLength2, postfix, false); diff --git a/src/libs/vtools/dialogs/tools/dialogtool.cpp b/src/libs/vtools/dialogs/tools/dialogtool.cpp index 6f99f0020..ee7e0d01e 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtool.cpp @@ -1222,7 +1222,7 @@ void DialogTool::EvalFormula() { SCASSERT(plainTextEditFormula != nullptr) SCASSERT(labelResultCalculation != nullptr) - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit());//Show unit in dialog lable (cm, mm or inch) + const QString postfix = UnitsToStr(qApp->patternUnit());//Show unit in dialog lable (cm, mm or inch) Eval(plainTextEditFormula->toPlainText(), flagFormula, labelResultCalculation, postfix, false); } diff --git a/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp b/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp index 07f711a79..1f6861c16 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogpiecepath.cpp @@ -554,7 +554,7 @@ void DialogPiecePath::PassmarkAngleTypeChanged(int id) void DialogPiecePath::EvalWidth() { labelEditFormula = ui->labelEditWidth; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); const QString formula = ui->plainTextEditFormulaWidth->toPlainText(); m_saWidth = Eval(formula, flagFormula, ui->labelResultWidth, postfix, false, true); @@ -574,7 +574,7 @@ void DialogPiecePath::EvalWidth() void DialogPiecePath::EvalWidthBefore() { labelEditFormula = ui->labelEditBefore; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); QString formula = ui->plainTextEditFormulaWidthBefore->toPlainText(); bool flagFormula = false; // fake flag Eval(formula, flagFormula, ui->labelResultBefore, postfix, false, true); @@ -592,7 +592,7 @@ void DialogPiecePath::EvalWidthBefore() void DialogPiecePath::EvalWidthAfter() { labelEditFormula = ui->labelEditAfter; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); QString formula = ui->plainTextEditFormulaWidthAfter->toPlainText(); bool flagFormula = false; // fake flag Eval(formula, flagFormula, ui->labelResultAfter, postfix, false, true); @@ -613,7 +613,7 @@ void DialogPiecePath::FXWidth() dialog->setWindowTitle(tr("Edit seam allowance width")); dialog->SetFormula(GetFormulaSAWidth()); dialog->setCheckLessThanZero(true); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { SetFormulaSAWidth(dialog->GetFormula()); @@ -628,7 +628,7 @@ void DialogPiecePath::FXWidthBefore() dialog->setWindowTitle(tr("Edit seam allowance width before")); dialog->SetFormula(GetFormulaSAWidthBefore()); dialog->setCheckLessThanZero(true); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { SetCurrentSABefore(dialog->GetFormula()); @@ -643,7 +643,7 @@ void DialogPiecePath::FXWidthAfter() dialog->setWindowTitle(tr("Edit seam allowance width after")); dialog->SetFormula(GetFormulaSAWidthAfter()); dialog->setCheckLessThanZero(true); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { SetCurrentSAAfter(dialog->GetFormula()); @@ -656,7 +656,7 @@ void DialogPiecePath::WidthChanged() { labelEditFormula = ui->labelEditWidth; labelResultCalculation = ui->labelResultWidth; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); ValFormulaChanged(flagFormula, ui->plainTextEditFormulaWidth, m_timerWidth, postfix); } @@ -665,7 +665,7 @@ void DialogPiecePath::WidthBeforeChanged() { labelEditFormula = ui->labelEditBefore; labelResultCalculation = ui->labelResultBefore; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); bool flagFormula = false; ValFormulaChanged(flagFormula, ui->plainTextEditFormulaWidthBefore, m_timerWidthBefore, postfix); } @@ -675,7 +675,7 @@ void DialogPiecePath::WidthAfterChanged() { labelEditFormula = ui->labelEditAfter; labelResultCalculation = ui->labelResultAfter; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); bool flagFormula = false; ValFormulaChanged(flagFormula, ui->plainTextEditFormulaWidthAfter, m_timerWidthAfter, postfix); } diff --git a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp index b34516a45..daa09450c 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp @@ -1305,7 +1305,7 @@ void DialogSeamAllowance::UpdateGrainlineValues() { plbVal = uiTabGrainline->labelLen; plbText = uiTabGrainline->labelEditLen; - qsUnit = QLatin1String(" ") + VDomDocument::UnitsToStr(qApp->patternUnit()); + qsUnit = QLatin1String(" ") + UnitsToStr(qApp->patternUnit()); } plbVal->setToolTip(tr("Value")); @@ -1375,13 +1375,13 @@ void DialogSeamAllowance::UpdateDetailLabelValues() { plbVal = uiTabLabels->labelDLWidth; plbText = uiTabLabels->labelEditDLWidth; - qsUnit = QLatin1String(" ") + VDomDocument::UnitsToStr(qApp->patternUnit()); + qsUnit = QLatin1String(" ") + UnitsToStr(qApp->patternUnit()); } else if (i == 1) { plbVal = uiTabLabels->labelDLHeight; plbText = uiTabLabels->labelEditDLHeight; - qsUnit = QLatin1String(" ") + VDomDocument::UnitsToStr(qApp->patternUnit()); + qsUnit = QLatin1String(" ") + UnitsToStr(qApp->patternUnit()); } else { @@ -1460,13 +1460,13 @@ void DialogSeamAllowance::UpdatePatternLabelValues() { plbVal = uiTabLabels->labelPLWidth; plbText = uiTabLabels->labelEditPLWidth; - qsUnit = QLatin1String(" ") + VDomDocument::UnitsToStr(qApp->patternUnit()); + qsUnit = QLatin1String(" ") + UnitsToStr(qApp->patternUnit()); } else if (i == 1) { plbVal = uiTabLabels->labelPLHeight; plbText = uiTabLabels->labelEditPLHeight; - qsUnit = QLatin1String(" ") + VDomDocument::UnitsToStr(qApp->patternUnit()); + qsUnit = QLatin1String(" ") + UnitsToStr(qApp->patternUnit()); } else { @@ -1868,7 +1868,7 @@ void DialogSeamAllowance::ResetLabelsWarning() void DialogSeamAllowance::EvalWidth() { labelEditFormula = uiTabPaths->labelEditWidth; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); const QString formula = uiTabPaths->plainTextEditFormulaWidth->toPlainText(); m_saWidth = Eval(formula, flagFormula, uiTabPaths->labelResultWidth, postfix, false, true); @@ -1888,7 +1888,7 @@ void DialogSeamAllowance::EvalWidth() void DialogSeamAllowance::EvalWidthBefore() { labelEditFormula = uiTabPaths->labelEditBefore; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); const QString formula = uiTabPaths->plainTextEditFormulaWidthBefore->toPlainText(); bool flagFormula = false; // fake flag Eval(formula, flagFormula, uiTabPaths->labelResultBefore, postfix, false, true); @@ -1902,7 +1902,7 @@ void DialogSeamAllowance::EvalWidthBefore() void DialogSeamAllowance::EvalWidthAfter() { labelEditFormula = uiTabPaths->labelEditAfter; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); const QString formula = uiTabPaths->plainTextEditFormulaWidthAfter->toPlainText(); bool flagFormula = false; // fake flag Eval(formula, flagFormula, uiTabPaths->labelResultAfter, postfix, false, true); @@ -1919,7 +1919,7 @@ void DialogSeamAllowance::FXWidth() dialog->setWindowTitle(tr("Edit seam allowance width")); dialog->SetFormula(GetFormulaSAWidth()); dialog->setCheckLessThanZero(true); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { SetFormulaSAWidth(dialog->GetFormula()); @@ -1934,7 +1934,7 @@ void DialogSeamAllowance::FXWidthBefore() dialog->setWindowTitle(tr("Edit seam allowance width before")); dialog->SetFormula(GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidthBefore)); dialog->setCheckLessThanZero(true); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { SetCurrentSABefore(dialog->GetFormula()); @@ -1949,7 +1949,7 @@ void DialogSeamAllowance::FXWidthAfter() dialog->setWindowTitle(tr("Edit seam allowance width after")); dialog->SetFormula(GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidthAfter)); dialog->setCheckLessThanZero(true); - dialog->setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true)); if (dialog->exec() == QDialog::Accepted) { SetCurrentSAAfter(dialog->GetFormula()); @@ -1962,7 +1962,7 @@ void DialogSeamAllowance::WidthChanged() { labelEditFormula = uiTabPaths->labelEditWidth; labelResultCalculation = uiTabPaths->labelResultWidth; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); ValFormulaChanged(flagFormula, uiTabPaths->plainTextEditFormulaWidth, m_timerWidth, postfix); } @@ -1971,7 +1971,7 @@ void DialogSeamAllowance::WidthBeforeChanged() { labelEditFormula = uiTabPaths->labelEditBefore; labelResultCalculation = uiTabPaths->labelResultBefore; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); bool flagFormula = false; ValFormulaChanged(flagFormula, uiTabPaths->plainTextEditFormulaWidthBefore, m_timerWidthBefore, postfix); } @@ -1981,7 +1981,7 @@ void DialogSeamAllowance::WidthAfterChanged() { labelEditFormula = uiTabPaths->labelEditAfter; labelResultCalculation = uiTabPaths->labelResultAfter; - const QString postfix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + const QString postfix = UnitsToStr(qApp->patternUnit(), true); bool flagFormula = false; ValFormulaChanged(flagFormula, uiTabPaths->plainTextEditFormulaWidthAfter, m_timerWidthAfter, postfix); } @@ -2525,8 +2525,15 @@ void DialogSeamAllowance::InitSeamAllowanceTab() connect(uiTabPaths->checkBoxSeams, &QCheckBox::toggled, this, &DialogSeamAllowance::EnableSeamAllowance); - // Default value for seam allowence is 1 cm. But pattern have different units, so just set 1 in dialog not enough. - m_saWidth = UnitConvertor(1, Unit::Cm, qApp->patternUnit()); + // init the default seam allowance, convert the value if app unit is different than pattern unit + m_saWidth = qApp->Settings()->GetDefaultSeamAllowance(); + Unit defaultUnit = StrToUnits(qApp->Settings()->GetUnit()); + Unit patternUnit = qApp->patternUnit(); + if(defaultUnit != patternUnit) + { + m_saWidth = UnitConvertor(m_saWidth, defaultUnit, patternUnit); + } + uiTabPaths->plainTextEditFormulaWidth->setPlainText(qApp->LocaleToString(m_saWidth)); InitNodesList(); diff --git a/src/libs/vtools/dialogs/tools/piece/tabs/tabpaths.ui b/src/libs/vtools/dialogs/tools/piece/tabs/tabpaths.ui index 7de6b5f19..dc7cd1bda 100644 --- a/src/libs/vtools/dialogs/tools/piece/tabs/tabpaths.ui +++ b/src/libs/vtools/dialogs/tools/piece/tabs/tabpaths.ui @@ -36,7 +36,7 @@ - 0 + 1 diff --git a/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp b/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp index 971d37297..10706f229 100644 --- a/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp +++ b/src/libs/vtools/tools/drawTools/operation/vtoolmove.cpp @@ -262,7 +262,7 @@ VFormula VToolMove::GetFormulaLength() const VFormula fLength(formulaLength, getData()); fLength.setCheckZero(true); fLength.setToolId(id); - fLength.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit())); + fLength.setPostfix(UnitsToStr(qApp->patternUnit())); return fLength; } diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp index 73cb42663..ab51974bd 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp @@ -227,7 +227,7 @@ VFormula VToolArc::GetFormulaRadius() const VFormula radius(arc->GetFormulaRadius(), getData()); radius.setCheckZero(true); radius.setToolId(id); - radius.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit())); + radius.setPostfix(UnitsToStr(qApp->patternUnit())); return radius; } diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp index 6f273222a..a98b06f25 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp @@ -196,7 +196,7 @@ VFormula VToolArcWithLength::GetFormulaRadius() const VFormula radius(arc->GetFormulaRadius(), getData()); radius.setCheckZero(true); radius.setToolId(id); - radius.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit())); + radius.setPostfix(UnitsToStr(qApp->patternUnit())); return radius; } @@ -253,7 +253,7 @@ VFormula VToolArcWithLength::GetFormulaLength() const VFormula radius(arc->GetFormulaLength(), getData()); radius.setCheckZero(true); radius.setToolId(id); - radius.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit())); + radius.setPostfix(UnitsToStr(qApp->patternUnit())); return radius; } diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp index 081861c5f..91ca64549 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolellipticalarc.cpp @@ -240,7 +240,7 @@ VFormula VToolEllipticalArc::GetFormulaRadius1() const VFormula radius1(elArc->GetFormulaRadius1(), getData()); radius1.setCheckZero(true); radius1.setToolId(id); - radius1.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit())); + radius1.setPostfix(UnitsToStr(qApp->patternUnit())); return radius1; } @@ -268,7 +268,7 @@ VFormula VToolEllipticalArc::GetFormulaRadius2() const VFormula radius2(elArc->GetFormulaRadius2(), getData()); radius2.setCheckZero(true); radius2.setToolId(id); - radius2.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit())); + radius2.setPostfix(UnitsToStr(qApp->patternUnit())); return radius2; } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp index de4638d12..710f25b2d 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.cpp @@ -99,7 +99,7 @@ VFormula VToolCut::GetFormula() const VFormula val(formula, getData()); val.setCheckZero(true); val.setToolId(id); - val.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit())); + val.setPostfix(UnitsToStr(qApp->patternUnit())); return val; } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp index 3f93d6a06..388078528 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollinepoint.cpp @@ -214,7 +214,7 @@ VFormula VToolLinePoint::GetFormulaLength() const VFormula fLength(formulaLength, this->getData()); fLength.setCheckZero(true); fLength.setToolId(id); - fLength.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit())); + fLength.setPostfix(UnitsToStr(qApp->patternUnit())); return fLength; } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp index d32249070..5ea4feebf 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp @@ -230,7 +230,7 @@ VFormula VToolPointFromCircleAndTangent::GetCircleRadius() const VFormula radius(circleRadius, getData()); radius.setCheckZero(true); radius.setToolId(id); - radius.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit())); + radius.setPostfix(UnitsToStr(qApp->patternUnit())); return radius; } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp index da11c31bf..896eda56e 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp @@ -409,7 +409,7 @@ VFormula VToolPointOfContact::getArcRadius() const VFormula radius(arcRadius, this->getData()); radius.setCheckZero(true); radius.setToolId(id); - radius.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit())); + radius.setPostfix(UnitsToStr(qApp->patternUnit())); return radius; } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp index e78d07047..e7ae1564f 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp @@ -245,7 +245,7 @@ VFormula VToolPointOfIntersectionCircles::GetFirstCircleRadius() const VFormula radius(firstCircleRadius, getData()); radius.setCheckZero(true); radius.setToolId(id); - radius.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit())); + radius.setPostfix(UnitsToStr(qApp->patternUnit())); return radius; } @@ -269,7 +269,7 @@ VFormula VToolPointOfIntersectionCircles::GetSecondCircleRadius() const VFormula radius(secondCircleRadius, getData()); radius.setCheckZero(true); radius.setToolId(id); - radius.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit())); + radius.setPostfix(UnitsToStr(qApp->patternUnit())); return radius; } diff --git a/src/libs/vtools/visualization/line/operation/vistoolmove.cpp b/src/libs/vtools/visualization/line/operation/vistoolmove.cpp index 05e008b7f..3a62544fc 100644 --- a/src/libs/vtools/visualization/line/operation/vistoolmove.cpp +++ b/src/libs/vtools/visualization/line/operation/vistoolmove.cpp @@ -117,7 +117,7 @@ void VisToolMove::RefreshGeometry() DrawLine(this, line, supportColor2, Qt::DashLine); DrawPoint(pointFinish, line.p2(), supportColor); - static const QString prefix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + static const QString prefix = UnitsToStr(qApp->patternUnit(), true); Visualization::toolTip = tr("Length = %1%2, angle = %3°, Shift - sticking angle, " "Mouse click - finish creation") .arg(qApp->TrVars()->FormulaToUser(QString::number(qApp->fromPixel(tempLength)), diff --git a/src/libs/vtools/visualization/line/vistoolendline.cpp b/src/libs/vtools/visualization/line/vistoolendline.cpp index 2c0722d03..561b9ab20 100644 --- a/src/libs/vtools/visualization/line/vistoolendline.cpp +++ b/src/libs/vtools/visualization/line/vistoolendline.cpp @@ -78,7 +78,7 @@ void VisToolEndLine::RefreshGeometry() DrawPoint(point, line.p2(), mainColor); } DrawLine(this, line, mainColor, lineStyle); - static const QString prefix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); + static const QString prefix = UnitsToStr(qApp->patternUnit(), true); Visualization::toolTip = tr("Point at distance and angle: angle = %1°, length = %2%3; " "Shift - sticking angle, Enter - finish creation") .arg(this->line().angle())