issue #712 new setting added in dialog for seam default seam allowance. not taken into account in the rest of the programm yet

--HG--
branch : develop
This commit is contained in:
Ronan Le Tiec 2017-07-02 10:14:01 +02:00
parent b2d310fea4
commit 07556c6c46
4 changed files with 98 additions and 6 deletions

View File

@ -52,6 +52,8 @@ PreferencesPatternPage::PreferencesPatternPage(QWidget *parent)
QMessageBox::information(this, QCoreApplication::applicationName(), qsMsg);
});
ui->defaultSeamAllowance->setValue(qApp->ValentinaSettings()->GetDefaultSeamAllowance());
ui->forbidFlippingCheck->setChecked(qApp->ValentinaSettings()->GetForbidWorkpieceFlipping());
ui->doublePassmarkCheck->setChecked(qApp->ValentinaSettings()->IsDoublePassmark());
ui->checkBoxHideMainPath->setChecked(qApp->ValentinaSettings()->IsHideMainPath());
@ -79,6 +81,8 @@ void PreferencesPatternPage::Apply()
* prints a warning and does nothing.*/
settings->SetUndoCount(ui->undoCount->value());
settings->SetDefaultSeamAllowance(ui->defaultSeamAllowance->value());
settings->SetForbidWorkpieceFlipping(ui->forbidFlippingCheck->isChecked());
settings->SetHideMainPath(ui->checkBoxHideMainPath->isChecked());

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>327</width>
<height>414</height>
<height>482</height>
</rect>
</property>
<property name="windowTitle">
@ -136,6 +136,38 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_6">
<property name="title">
<string>Seam allowance</string>
</property>
<layout class="QFormLayout" name="formLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label_defaultSeamAllowance">
<property name="text">
<string>Default value:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="defaultSeamAllowance">
<property name="decimals">
<number>3</number>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">

View File

@ -43,6 +43,8 @@
#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");
@ -64,6 +66,7 @@ const QString settingPatternUndo = QStringLiteral("pattern/undo");
const QString settingPatternForbidFlipping = QStringLiteral("pattern/forbidFlipping");
const QString settingPatternHideMainPath = QStringLiteral("pattern/hideMainPath");
const QString settingDoublePassmark = QStringLiteral("pattern/doublePassmark");
const QString settingPatternDefaultSeamAllowance = QStringLiteral("pattern/defaultSeamAllowance");
const QString settingGeneralRecentFileList = QStringLiteral("recentFileList");
const QString settingGeneralRestoreFileList = QStringLiteral("restoreFileList");
@ -755,3 +758,50 @@ QChar VCommonSettings::GetDefCSVSeparator() const
{
return QChar(',');
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetDefaultSeamAllowance(double value)
{
setValue(settingPatternDefaultSeamAllowance, value);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief returns the default seam allowance. The corresponding unit is the default unit.
* @return the default seam allowance
*/
double VCommonSettings::GetDefaultSeamAllowance()
{
double defaultValue;
//Unit globalUnit = VDomDocument::StrToUnits(GetUnit());
Unit globalUnit = Unit::Cm; // just for test purpuses
switch (globalUnit)
{
case Unit::Mm:
defaultValue = 10;
break;
case Unit::Inch:
defaultValue = 0.25;
break;
default:
case Unit::Cm:
defaultValue = 1;
break;
}
bool ok = false;
double val = value(settingPatternDefaultSeamAllowance, defaultValue).toDouble(&ok);
if (ok == false)
{
qDebug()<< "Could not convert value"<<value(settingPatternDefaultSeamAllowance, 0)
<< "to int. Return default value for default seam allowance is "
<< defaultValue << ".";
val = defaultValue;
}
return val;
}

View File

@ -40,6 +40,8 @@
#include "../vlayout/vbank.h"
class VDomDocument;
class VCommonSettings : public QSettings
{
Q_OBJECT
@ -157,6 +159,10 @@ public:
QChar GetCSVSeparator() const;
QChar GetDefCSVSeparator() const;
void SetDefaultSeamAllowance(double value);
double GetDefaultSeamAllowance();
#if !defined(Q_OS_WIN)
static const QString unixStandardSharePath;
#endif