Refactoring method MUnit(). All formats have the same syntax.
--HG-- branch : release
This commit is contained in:
parent
124fd657e3
commit
bab0adfebc
|
@ -79,7 +79,6 @@ const QString VAbstractPattern::TagOperation = QStringLiteral("operation"
|
|||
const QString VAbstractPattern::TagGradation = QStringLiteral("gradation");
|
||||
const QString VAbstractPattern::TagHeights = QStringLiteral("heights");
|
||||
const QString VAbstractPattern::TagSizes = QStringLiteral("sizes");
|
||||
const QString VAbstractPattern::TagUnit = QStringLiteral("unit");
|
||||
const QString VAbstractPattern::TagData = QStringLiteral("data");
|
||||
const QString VAbstractPattern::TagPatternInfo = QStringLiteral("patternInfo");
|
||||
const QString VAbstractPattern::TagMCP = QStringLiteral("mcp");
|
||||
|
@ -774,23 +773,6 @@ void VAbstractPattern::SetPath(const QString &path)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Unit VAbstractPattern::MUnit() const
|
||||
{
|
||||
const QStringList units = QStringList() << "mm" << "cm" << "inch";
|
||||
const QString unit = UniqueTagText(TagUnit);
|
||||
switch (units.indexOf(unit))
|
||||
{
|
||||
case 0:// mm
|
||||
return Unit::Mm;
|
||||
case 2:// in
|
||||
return Unit::Inch;
|
||||
case 1:// cm
|
||||
default:
|
||||
return Unit::Cm;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VAbstractPattern::SiblingNodeId(const quint32 &nodeId) const
|
||||
{
|
||||
|
|
|
@ -108,7 +108,6 @@ public:
|
|||
|
||||
QString MPath() const;
|
||||
void SetPath(const QString &path);
|
||||
Unit MUnit() const;
|
||||
|
||||
quint32 SiblingNodeId(const quint32 &nodeId) const;
|
||||
|
||||
|
@ -189,7 +188,6 @@ public:
|
|||
static const QString TagGradation;
|
||||
static const QString TagHeights;
|
||||
static const QString TagSizes;
|
||||
static const QString TagUnit;
|
||||
static const QString TagData;
|
||||
static const QString TagPatternInfo;
|
||||
static const QString TagMCP;
|
||||
|
|
|
@ -129,6 +129,7 @@ const QString VDomDocument::UnitCM = QStringLiteral("cm");
|
|||
const QString VDomDocument::UnitINCH = QStringLiteral("inch");
|
||||
const QString VDomDocument::UnitPX = QStringLiteral("px");
|
||||
const QString VDomDocument::TagVersion = QStringLiteral("version");
|
||||
const QString VDomDocument::TagUnit = QStringLiteral("unit");
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VDomDocument::VDomDocument()
|
||||
|
@ -398,6 +399,19 @@ quint32 VDomDocument::GetParametrId(const QDomElement &domElement)
|
|||
return id;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Unit VDomDocument::MUnit() const
|
||||
{
|
||||
Unit unit = VDomDocument::StrToUnits(UniqueTagText(TagUnit, UnitCM));
|
||||
|
||||
if (unit == Unit::Px)
|
||||
{
|
||||
unit = Unit::Cm;
|
||||
}
|
||||
|
||||
return unit;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VDomDocument::UniqueTagText(const QString &tagName, const QString &defVal) const
|
||||
{
|
||||
|
@ -555,7 +569,7 @@ void VDomDocument::setXMLContent(const QString &fileName)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Unit VDomDocument::StrToUnits(const QString &unit)
|
||||
{
|
||||
QStringList units = QStringList() << UnitMM << UnitCM << UnitINCH << UnitPX;
|
||||
const QStringList units = QStringList() << UnitMM << UnitCM << UnitINCH << UnitPX;
|
||||
Unit result = Unit::Cm;
|
||||
switch (units.indexOf(unit))
|
||||
{
|
||||
|
|
|
@ -81,12 +81,13 @@ class VDomDocument : public QDomDocument
|
|||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(VDomDocument)
|
||||
public:
|
||||
static const QString AttrId;
|
||||
static const QString UnitMM;
|
||||
static const QString UnitCM;
|
||||
static const QString UnitINCH;
|
||||
static const QString UnitPX;
|
||||
static const QString TagVersion;
|
||||
static const QString AttrId;
|
||||
static const QString UnitMM;
|
||||
static const QString UnitCM;
|
||||
static const QString UnitINCH;
|
||||
static const QString UnitPX;
|
||||
static const QString TagVersion;
|
||||
static const QString TagUnit;
|
||||
|
||||
VDomDocument();
|
||||
virtual ~VDomDocument() Q_DECL_EQ_DEFAULT;
|
||||
|
@ -107,6 +108,8 @@ public:
|
|||
static qreal GetParametrDouble(const QDomElement& domElement, const QString &name, const QString &defValue);
|
||||
static quint32 GetParametrId(const QDomElement& domElement);
|
||||
|
||||
Unit MUnit() const;
|
||||
|
||||
static void ValidateXML(const QString &schema, const QString &fileName);
|
||||
virtual void setXMLContent(const QString &fileName);
|
||||
static Unit StrToUnits(const QString &unit);
|
||||
|
|
|
@ -56,7 +56,6 @@
|
|||
const QString VMeasurements::TagVST = QStringLiteral("vst");
|
||||
const QString VMeasurements::TagVIT = QStringLiteral("vit");
|
||||
const QString VMeasurements::TagBodyMeasurements = QStringLiteral("body-measurements");
|
||||
const QString VMeasurements::TagUnit = QStringLiteral("unit");
|
||||
const QString VMeasurements::TagNotes = QStringLiteral("notes");
|
||||
const QString VMeasurements::TagSize = QStringLiteral("size");
|
||||
const QString VMeasurements::TagHeight = QStringLiteral("height");
|
||||
|
@ -323,13 +322,6 @@ MeasurementsType VMeasurements::Type() const
|
|||
return type;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Unit VMeasurements::MUnit() const
|
||||
{
|
||||
const QString unit = UniqueTagText(TagUnit, UnitCM);
|
||||
return VDomDocument::StrToUnits(unit);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VMeasurements::BaseSize() const
|
||||
{
|
||||
|
|
|
@ -65,7 +65,6 @@ public:
|
|||
void ClearForExport();
|
||||
|
||||
MeasurementsType Type() const;
|
||||
Unit MUnit() const;
|
||||
int BaseSize() const;
|
||||
int BaseHeight() const;
|
||||
|
||||
|
@ -104,7 +103,6 @@ public:
|
|||
static const QString TagVST;
|
||||
static const QString TagVIT;
|
||||
static const QString TagBodyMeasurements;
|
||||
static const QString TagUnit;
|
||||
static const QString TagNotes;
|
||||
static const QString TagSize;
|
||||
static const QString TagHeight;
|
||||
|
|
Loading…
Reference in New Issue
Block a user