Corrected all the issues reported by Roman till 10:11 AM
--HG-- branch : feature
This commit is contained in:
parent
28af32f027
commit
0e7b369c2e
|
@ -488,8 +488,7 @@ void MainWindowsNoGUI::PrepareDetailsForLayout(const QHash<quint32, VDetail> *de
|
|||
{
|
||||
date = QDate::currentDate();
|
||||
}
|
||||
det.SetPatternInfo(pDoc->GetPatternName(), pDoc->GetPatternNumber(), pDoc->GetPatternSize(),
|
||||
pDoc->GetCompanyName(), pDoc->GetCustomerName(), date, geom, qApp->font());
|
||||
det.SetPatternInfo(pDoc, geom, qApp->font());
|
||||
}
|
||||
det.setWidth(qApp->toPixel(d.getWidth()));
|
||||
det.CreateTextItems();
|
||||
|
|
|
@ -656,21 +656,27 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
|
|||
}
|
||||
else if (element.tagName() == TagData)
|
||||
{
|
||||
QString qsVisible = element.attribute(AttrVisible, "1");
|
||||
detail.GetPatternPieceData().SetVisible(qsVisible.toInt() != 0);
|
||||
QString qsLetter = element.attribute(AttrLetter, "");
|
||||
bool bVisible = GetParametrBool(element, AttrVisible, trueStr);
|
||||
detail.GetPatternPieceData().SetVisible(bVisible);
|
||||
try
|
||||
{
|
||||
QString qsLetter = GetParametrString(element, AttrLetter, "");
|
||||
detail.GetPatternPieceData().SetLetter(qsLetter);
|
||||
} catch(...)
|
||||
{
|
||||
detail.GetPatternPieceData().SetLetter("");
|
||||
}
|
||||
QPointF ptPos;
|
||||
ptPos.setX(element.attribute(AttrMx, "0").toDouble());
|
||||
ptPos.setY(element.attribute(AttrMy, "0").toDouble());
|
||||
ptPos.setX(GetParametrDouble(element, AttrMx, "0"));
|
||||
ptPos.setY(GetParametrDouble(element, AttrMy, "0"));
|
||||
detail.GetPatternPieceData().SetPos(ptPos);
|
||||
qreal dLW = element.attribute(VToolDetail::AttrWidth, "0").toDouble();
|
||||
qreal dLW = GetParametrDouble(element, VToolDetail::AttrWidth, "0");
|
||||
detail.GetPatternPieceData().SetLabelWidth(dLW);
|
||||
qreal dLH = element.attribute(VToolDetail::AttrHeight, "0").toDouble();
|
||||
qreal dLH = GetParametrDouble(element, VToolDetail::AttrHeight, "0");
|
||||
detail.GetPatternPieceData().SetLabelHeight(dLH);
|
||||
int iFS = element.attribute(VToolDetail::AttrFont, "0").toInt();
|
||||
int iFS = GetParametrUInt(element, VToolDetail::AttrFont, "0");
|
||||
detail.GetPatternPieceData().SetFontSize(iFS);
|
||||
qreal dRot = element.attribute(VToolDetail::AttrRotation, "0").toDouble();
|
||||
qreal dRot = GetParametrDouble(element, VToolDetail::AttrRotation, "0");
|
||||
detail.GetPatternPieceData().SetRotation(dRot);
|
||||
|
||||
QDomNodeList nodeListMCP = element.childNodes();
|
||||
|
@ -687,24 +693,23 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
|
|||
}
|
||||
else if (element.tagName() == TagPatternInfo)
|
||||
{
|
||||
detail.GetPatternInfo().SetVisible(element.attribute(AttrVisible, "1").toInt() != 0);
|
||||
detail.GetPatternInfo().SetVisible(GetParametrBool(element, AttrVisible, trueStr));
|
||||
QPointF ptPos;
|
||||
ptPos.setX(element.attribute(AttrMx, "0").toDouble());
|
||||
ptPos.setY(element.attribute(AttrMy, "0").toDouble());
|
||||
ptPos.setX(GetParametrDouble(element, AttrMx, "0"));
|
||||
ptPos.setY(GetParametrDouble(element, AttrMy, "0"));
|
||||
detail.GetPatternInfo().SetPos(ptPos);
|
||||
qreal dLW = element.attribute(VToolDetail::AttrWidth, "0").toDouble();
|
||||
qreal dLW = GetParametrDouble(element, VToolDetail::AttrWidth, "0");
|
||||
detail.GetPatternInfo().SetLabelWidth(dLW);
|
||||
qreal dLH = element.attribute(VToolDetail::AttrHeight, "0").toDouble();
|
||||
qreal dLH = GetParametrDouble(element, VToolDetail::AttrHeight, "0");
|
||||
detail.GetPatternInfo().SetLabelHeight(dLH);
|
||||
int iFS = element.attribute(VToolDetail::AttrFont, "0").toInt();
|
||||
int iFS = GetParametrUInt(element, VToolDetail::AttrFont, "0");
|
||||
detail.GetPatternInfo().SetFontSize(iFS);
|
||||
qreal dRot = element.attribute(VToolDetail::AttrRotation, "0").toDouble();
|
||||
qreal dRot = GetParametrDouble(element, VToolDetail::AttrRotation, "0");
|
||||
detail.GetPatternInfo().SetRotation(dRot);
|
||||
}
|
||||
}
|
||||
}
|
||||
VToolDetail::Create(id, detail, sceneDetail, this, data, parse, Source::FromFile);
|
||||
SetVersion();
|
||||
}
|
||||
catch (const VExceptionBadId &e)
|
||||
{
|
||||
|
|
|
@ -18,12 +18,6 @@
|
|||
<xs:element name="author" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="notes" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="patternName" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="patternNumber" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="company" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="customer" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="size" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="showDate" type="xs:boolean" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="gradation" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
|
@ -79,6 +73,12 @@
|
|||
<xs:attribute name="defSize" type="baseSize"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="patternName" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="patternNumber" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="company" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="customer" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="size" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="showDate" type="xs:boolean" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="measurements" type="xs:string"></xs:element>
|
||||
<xs:element name="increments" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
|
@ -346,13 +346,13 @@
|
|||
<xs:complexType>
|
||||
<xs:attribute name="cutNumber" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="userDef" type="xs:string"/>
|
||||
<xs:attribute name="material" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="placement" type="xs:unsignedInt"/>
|
||||
<xs:attribute name="material" type="materialType"/>
|
||||
<xs:attribute name="placement" type="placementType"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="letter" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="visible" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="visible" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="fontSize" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="mx" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="my" type="xs:double"></xs:attribute>
|
||||
|
@ -363,7 +363,7 @@
|
|||
</xs:element>
|
||||
<xs:element name="patternInfo" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="visible" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="visible" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="fontSize" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="mx" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="my" type="xs:double"></xs:attribute>
|
||||
|
@ -552,4 +552,19 @@
|
|||
<xs:enumeration value="2"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="materialType">
|
||||
<xs:restriction base="xs:unsignedInt">
|
||||
<xs:enumeration value="0"/><!--Fabric-->
|
||||
<xs:enumeration value="1"/><!--Lining-->
|
||||
<xs:enumeration value="2"/><!--Interfacing-->
|
||||
<xs:enumeration value="3"/><!--Interlining-->
|
||||
<xs:enumeration value="4"/><!--UserDefined-->
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="placementType">
|
||||
<xs:restriction base="xs:unsignedInt">
|
||||
<xs:enumeration value="0"/><!--No placement-->
|
||||
<xs:enumeration value="1"/><!--Cut on Fold-->
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:schema>
|
||||
|
|
|
@ -1073,14 +1073,14 @@ void VAbstractPattern::SetPatternSize(QString qsSize)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VAbstractPattern::IsDateVisible() const
|
||||
{
|
||||
return UniqueTagText(TagShowDate) != QStringLiteral("false");
|
||||
return UniqueTagText(TagShowDate) != falseStr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractPattern::SetDateVisible(bool bVisible)
|
||||
{
|
||||
CheckTagExists(TagShowDate);
|
||||
setTagText(TagShowDate, bVisible == true? QStringLiteral("true") : QStringLiteral("false"));
|
||||
setTagText(TagShowDate, bVisible == true? trueStr : falseStr);
|
||||
modified = true;
|
||||
emit patternChanged(false);
|
||||
}
|
||||
|
@ -1245,17 +1245,17 @@ QDomElement VAbstractPattern::CheckTagExists(const QString &tag)
|
|||
element = createElement(TagPatternName);
|
||||
break;
|
||||
}
|
||||
case 7: // TagPatternName
|
||||
case 7: // TagPatternNum
|
||||
{
|
||||
element = createElement(TagPatternNum);
|
||||
break;
|
||||
}
|
||||
case 8: // TagPatternName
|
||||
case 8: // TagCompanyName
|
||||
{
|
||||
element = createElement(TagCompanyName);
|
||||
break;
|
||||
}
|
||||
case 9: // TagPatternName
|
||||
case 9: // TagCustomerName
|
||||
{
|
||||
element = createElement(TagCustomerName);
|
||||
break;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
# File with common stuff for whole project
|
||||
include(../../../common.pri)
|
||||
|
||||
QT += core gui widgets printsupport
|
||||
QT += core gui widgets printsupport xml
|
||||
|
||||
# Name of library
|
||||
TARGET = vlayout
|
||||
|
|
|
@ -133,7 +133,7 @@ void VLayoutDetail::SetDetail(const QString& qsName, const VPatternPieceData& da
|
|||
<< QPointF(ptPos.x(), ptPos.y() + data.GetLabelHeight());
|
||||
for (int i = 0; i < v.count(); ++i)
|
||||
{
|
||||
v[i] = RotatePoint(ptCenter, v[i], dAng);
|
||||
v[i] = RotatePoint(ptCenter, v.at(i), dAng);
|
||||
}
|
||||
d->detailLabel = RoundPoints(v);
|
||||
|
||||
|
@ -147,9 +147,7 @@ void VLayoutDetail::SetDetail(const QString& qsName, const VPatternPieceData& da
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VLayoutDetail::SetPatternInfo(const QString& qsPattern, const QString& qsNumber, const QString& qsSize,
|
||||
const QString& qsCompany, const QString& qsCustomer, const QDate& date,
|
||||
const VPatternInfoGeometry& geom, const QFont &font)
|
||||
void VLayoutDetail::SetPatternInfo(const VAbstractPattern* pDoc, const VPatternInfoGeometry& geom, const QFont &font)
|
||||
{
|
||||
d->patternGeom = geom;
|
||||
qreal dAng = qDegreesToRadians(geom.GetRotation());
|
||||
|
@ -169,7 +167,7 @@ void VLayoutDetail::SetPatternInfo(const QString& qsPattern, const QString& qsNu
|
|||
m_tmPattern.SetFont(font);
|
||||
m_tmPattern.SetFontSize(geom.GetFontSize());
|
||||
|
||||
m_tmPattern.Update(qsPattern, qsNumber, qsSize, qsCompany, qsCustomer, date);
|
||||
m_tmPattern.Update(pDoc);
|
||||
// generate lines of text
|
||||
m_tmPattern.SetFontSize(geom.GetFontSize());
|
||||
m_tmPattern.FitFontSize(geom.GetLabelWidth(), geom.GetLabelHeight());
|
||||
|
|
|
@ -60,9 +60,7 @@ public:
|
|||
|
||||
void SetDetail(const QString &qsName, const VPatternPieceData& data, const QFont& font);
|
||||
|
||||
void SetPatternInfo(const QString& qsPattern, const QString& qsNumber, const QString& qsSize,
|
||||
const QString& qsCompany, const QString& qsCustomer, const QDate& date,
|
||||
const VPatternInfoGeometry& geom, const QFont& font);
|
||||
void SetPatternInfo(const VAbstractPattern* pDoc, const VPatternInfoGeometry& geom, const QFont& font);
|
||||
|
||||
QTransform GetMatrix() const;
|
||||
void SetMatrix(const QTransform &matrix);
|
||||
|
|
|
@ -155,8 +155,7 @@ void VTextManager::Update(const QString& qsName, const VPatternPieceData& data)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VTextManager::Update(const QString &qsPattern, const QString &qsNumber, const QString &qsSize,
|
||||
const QString &qsCompany, const QString &qsCustomer, const QDate& date)
|
||||
void VTextManager::Update(const VAbstractPattern *pDoc)
|
||||
{
|
||||
Clear();
|
||||
TextLine tl;
|
||||
|
@ -164,7 +163,7 @@ void VTextManager::Update(const QString &qsPattern, const QString &qsNumber, con
|
|||
tl.m_eAlign = Qt::AlignCenter;
|
||||
|
||||
// Company name
|
||||
tl.m_qsText = qsCompany;
|
||||
tl.m_qsText = pDoc->GetCompanyName();
|
||||
if (tl.m_qsText.isEmpty() == false)
|
||||
{
|
||||
tl.m_eFontWeight = QFont::DemiBold;
|
||||
|
@ -173,7 +172,7 @@ void VTextManager::Update(const QString &qsPattern, const QString &qsNumber, con
|
|||
AddLine(tl);
|
||||
}
|
||||
// Pattern name
|
||||
tl.m_qsText = qsPattern;
|
||||
tl.m_qsText = pDoc->GetPatternName();
|
||||
if (tl.m_qsText.isEmpty() == false)
|
||||
{
|
||||
tl.m_eFontWeight = QFont::Normal;
|
||||
|
@ -182,7 +181,7 @@ void VTextManager::Update(const QString &qsPattern, const QString &qsNumber, con
|
|||
AddLine(tl);
|
||||
}
|
||||
// Pattern number
|
||||
tl.m_qsText = qsNumber;
|
||||
tl.m_qsText = pDoc->GetPatternNumber();
|
||||
if (tl.m_qsText.isEmpty() == false)
|
||||
{
|
||||
tl.m_eFontWeight = QFont::Normal;
|
||||
|
@ -191,7 +190,7 @@ void VTextManager::Update(const QString &qsPattern, const QString &qsNumber, con
|
|||
AddLine(tl);
|
||||
}
|
||||
// Customer name
|
||||
tl.m_qsText = qsCustomer;
|
||||
tl.m_qsText = pDoc->GetCustomerName();
|
||||
if (tl.m_qsText.isEmpty() == false)
|
||||
{
|
||||
tl.m_eFontWeight = QFont::Normal;
|
||||
|
@ -200,7 +199,7 @@ void VTextManager::Update(const QString &qsPattern, const QString &qsNumber, con
|
|||
AddLine(tl);
|
||||
}
|
||||
// Size
|
||||
tl.m_qsText = qsSize;
|
||||
tl.m_qsText = pDoc->GetPatternSize();
|
||||
if (tl.m_qsText.isEmpty() == false)
|
||||
{
|
||||
tl.m_eFontWeight = QFont::Normal;
|
||||
|
@ -209,6 +208,11 @@ void VTextManager::Update(const QString &qsPattern, const QString &qsNumber, con
|
|||
AddLine(tl);
|
||||
}
|
||||
// Date
|
||||
QDate date;
|
||||
if (pDoc->IsDateVisible() == true)
|
||||
{
|
||||
date = QDate::currentDate();
|
||||
}
|
||||
if (date.isValid() == true)
|
||||
{
|
||||
tl.m_qsText = date.toString("dd MMMM yyyy");
|
||||
|
@ -217,6 +221,7 @@ void VTextManager::Update(const QString &qsPattern, const QString &qsNumber, con
|
|||
tl.m_iFontSize = 0;
|
||||
AddLine(tl);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <QDate>
|
||||
|
||||
#include "../vpatterndb/vpatternpiecedata.h"
|
||||
#include "../ifc/xml/vabstractpattern.h"
|
||||
|
||||
#define MIN_FONT_SIZE 12
|
||||
#define MAX_FONT_SIZE 128
|
||||
|
@ -43,12 +44,9 @@ public:
|
|||
* Updates the manager with detail name and detail data
|
||||
*/
|
||||
void Update(const QString& qsName, const VPatternPieceData& data);
|
||||
/** @brief Updateconst QString& qsPattern, const QString& qsNumber, const QString& qsSize,
|
||||
const QString& qsCompany, const QString& qsCustomer, const QDate& date)
|
||||
Updates the manager with pattern data
|
||||
/** @brief Update(const VAbstractPattern* pDoc) updates the manager with pattern data
|
||||
*/
|
||||
void Update(const QString& qsPattern, const QString& qsNumber, const QString& qsSize,
|
||||
const QString& qsCompany, const QString& qsCustomer, const QDate& date);
|
||||
void Update(const VAbstractPattern* pDoc);
|
||||
|
||||
protected:
|
||||
QStringList SplitString(const QString& qs, qreal fW, const QFontMetrics& fm);
|
||||
|
|
|
@ -37,14 +37,18 @@
|
|||
|
||||
enum class MaterialType : char
|
||||
{
|
||||
mtFabric,
|
||||
mtLining,
|
||||
mtInterfacing,
|
||||
mtInterlining,
|
||||
mtUserDefined
|
||||
mtFabric = 0,
|
||||
mtLining = 1,
|
||||
mtInterfacing = 2,
|
||||
mtInterlining = 3,
|
||||
mtUserDefined = 4
|
||||
};
|
||||
|
||||
enum class PlacementType : char { ptNone, ptCutOnFold };
|
||||
enum class PlacementType : char
|
||||
{
|
||||
ptNone = 0,
|
||||
ptCutOnFold = 1
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This structure holds a material, cut number and placement 3-tuple
|
||||
|
|
|
@ -227,10 +227,9 @@ void VTextGraphicsItem::UpdateData(const QString &qsName, const VPatternPieceDat
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VTextGraphicsItem::UpdateData(const QString &qsPattern, const QString &qsNumber, const QString &qsSize,
|
||||
const QString &qsCompany, const QString &qsCustomer, const QDate &date)
|
||||
void VTextGraphicsItem::UpdateData(const VAbstractPattern* pDoc)
|
||||
{
|
||||
m_tm.Update(qsPattern, qsNumber, qsSize, qsCompany, qsCustomer, date);
|
||||
m_tm.Update(pDoc);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -63,8 +63,7 @@ public:
|
|||
void Update();
|
||||
bool IsContained(QRectF rectBB, qreal dRot, qreal& dX, qreal& dY) const;
|
||||
void UpdateData(const QString& qsName, const VPatternPieceData& data);
|
||||
void UpdateData(const QString& qsPattern, const QString& qsNumber, const QString& qsSize,
|
||||
const QString& qsCompany, const QString& qsCustomer, const QDate& date);
|
||||
void UpdateData(const VAbstractPattern* pDoc);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent* pME);
|
||||
|
|
|
@ -730,14 +730,7 @@ void VToolDetail::UpdatePatternInfo()
|
|||
fnt.setPixelSize(iFS);
|
||||
patternInfo->SetFont(fnt);
|
||||
patternInfo->SetSize(geom.GetLabelWidth(), geom.GetLabelHeight());
|
||||
|
||||
QDate date;
|
||||
if (doc->IsDateVisible() == true)
|
||||
{
|
||||
date = QDate::currentDate();
|
||||
}
|
||||
patternInfo->UpdateData(doc->GetPatternName(), doc->GetPatternNumber(), doc->GetPatternSize(),
|
||||
doc->GetCompanyName(), doc->GetCustomerName(), date);
|
||||
patternInfo->UpdateData(doc);
|
||||
|
||||
QPointF pt = geom.GetPos();
|
||||
QRectF rectBB;
|
||||
|
|
Loading…
Reference in New Issue
Block a user