Resolved issue #712. Default seam allowance setting.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-07-03 11:23:34 +03:00
parent 14b0eade7a
commit 13d43d100d
6 changed files with 27 additions and 14 deletions

View File

@ -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.

View File

@ -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));
}

View File

@ -45,6 +45,7 @@ public:
virtual ~PreferencesPatternPage();
void Apply();
void InitDefaultSeamAllowance();
private:
Q_DISABLE_COPY(PreferencesPatternPage)

View File

@ -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);

View File

@ -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"<<value(settingPatternDefaultSeamAllowance, 0)
<< "to int. Return default value for default seam allowance is "
<< "to real. Return default value for default seam allowance is "
<< defaultValue << ".";
val = defaultValue;
}
if (val < 0)
{
val = defaultValue;
}
else
{
val = UnitConvertor(val, Unit::Cm, globalUnit);
}
return val;
}

View File

@ -2526,13 +2526,8 @@ void DialogSeamAllowance::InitSeamAllowanceTab()
connect(uiTabPaths->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));