diff --git a/ChangeLog.txt b/ChangeLog.txt index 04bc38d4d..3c840dcfe 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -6,6 +6,7 @@ - [#637] Max scene size too small to fit all objects. - New feature Zoom Fit Best Current pattern piece. - [#693] New feature: Sort workpiece "Groups" by name. +- [#712] Default seam allowance setting. # Version 0.5.1 - [#683] Tool Seam allowance's dialog is off screen on small resolutions. diff --git a/src/app/valentina/dialogs/configpages/preferencespatternpage.cpp b/src/app/valentina/dialogs/configpages/preferencespatternpage.cpp index d71a18c0b..9a3449653 100644 --- a/src/app/valentina/dialogs/configpages/preferencespatternpage.cpp +++ b/src/app/valentina/dialogs/configpages/preferencespatternpage.cpp @@ -52,7 +52,7 @@ PreferencesPatternPage::PreferencesPatternPage(QWidget *parent) QMessageBox::information(this, QCoreApplication::applicationName(), qsMsg); }); - ui->defaultSeamAllowance->setValue(qApp->ValentinaSettings()->GetDefaultSeamAllowance()); + InitDefaultSeamAllowance(); ui->forbidFlippingCheck->setChecked(qApp->ValentinaSettings()->GetForbidWorkpieceFlipping()); ui->doublePassmarkCheck->setChecked(qApp->ValentinaSettings()->IsDoublePassmark()); @@ -92,3 +92,10 @@ void PreferencesPatternPage::Apply() qApp->getCurrentDocument()->LiteParseTree(Document::LiteParse); } } + +//--------------------------------------------------------------------------------------------------------------------- +void PreferencesPatternPage::InitDefaultSeamAllowance() +{ + ui->defaultSeamAllowance->setValue(qApp->ValentinaSettings()->GetDefaultSeamAllowance()); + ui->defaultSeamAllowance->setSuffix(UnitsToStr(StrToUnits(qApp->ValentinaSettings()->GetUnit()), true)); +} diff --git a/src/app/valentina/dialogs/configpages/preferencespatternpage.h b/src/app/valentina/dialogs/configpages/preferencespatternpage.h index a09cd6186..7d82c316d 100644 --- a/src/app/valentina/dialogs/configpages/preferencespatternpage.h +++ b/src/app/valentina/dialogs/configpages/preferencespatternpage.h @@ -45,6 +45,7 @@ public: virtual ~PreferencesPatternPage(); void Apply(); + void InitDefaultSeamAllowance(); private: Q_DISABLE_COPY(PreferencesPatternPage) diff --git a/src/app/valentina/dialogs/dialogpreferences.cpp b/src/app/valentina/dialogs/dialogpreferences.cpp index 170b4b736..98cfdc16c 100644 --- a/src/app/valentina/dialogs/dialogpreferences.cpp +++ b/src/app/valentina/dialogs/dialogpreferences.cpp @@ -126,6 +126,8 @@ void DialogPreferences::Apply() m_patternPage->Apply(); m_pathPage->Apply(); + m_patternPage->InitDefaultSeamAllowance(); + qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c()); emit UpdateProperties(); setResult(QDialog::Accepted); diff --git a/src/libs/vmisc/vcommonsettings.cpp b/src/libs/vmisc/vcommonsettings.cpp index df6ea666b..11a84390f 100644 --- a/src/libs/vmisc/vcommonsettings.cpp +++ b/src/libs/vmisc/vcommonsettings.cpp @@ -43,8 +43,6 @@ #include "../vmisc/def.h" #include "../vmisc/vmath.h" #include "../vpatterndb/pmsystems.h" -//#include "../ifc/xml/vdomdocument.h" - const QString settingPathsIndividualMeasurements = QStringLiteral("paths/individual_measurements"); const QString settingPathsStandardMeasurements = QStringLiteral("paths/standard_measurements"); @@ -762,7 +760,7 @@ QChar VCommonSettings::GetDefCSVSeparator() const //--------------------------------------------------------------------------------------------------------------------- void VCommonSettings::SetDefaultSeamAllowance(double value) { - setValue(settingPatternDefaultSeamAllowance, value); + setValue(settingPatternDefaultSeamAllowance, UnitConvertor(value, StrToUnits(GetUnit()), Unit::Cm)); } //--------------------------------------------------------------------------------------------------------------------- @@ -774,7 +772,7 @@ double VCommonSettings::GetDefaultSeamAllowance() { double defaultValue; - Unit globalUnit = StrToUnits(GetUnit()); + const Unit globalUnit = StrToUnits(GetUnit()); switch (globalUnit) { @@ -791,15 +789,24 @@ double VCommonSettings::GetDefaultSeamAllowance() } bool ok = false; - double val = value(settingPatternDefaultSeamAllowance, defaultValue).toDouble(&ok); + double val = value(settingPatternDefaultSeamAllowance, -1).toDouble(&ok); if (ok == false) { qDebug()<< "Could not convert value"<checkBoxSeams, &QCheckBox::toggled, this, &DialogSeamAllowance::EnableSeamAllowance); // 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); - } + m_saWidth = UnitConvertor(qApp->Settings()->GetDefaultSeamAllowance(), + StrToUnits(qApp->Settings()->GetUnit()), qApp->patternUnit()); uiTabPaths->plainTextEditFormulaWidth->setPlainText(qApp->LocaleToString(m_saWidth));