Added pattern size field and creation date visibility flag to pattern properties
--HG-- branch : feature
This commit is contained in:
parent
37425be026
commit
25a58421cc
|
@ -166,6 +166,8 @@ DialogPatternProperties::DialogPatternProperties(const QString &filePath, VPatte
|
|||
ui->lineEditCompanyName->setText(doc->GetCompanyName());
|
||||
ui->lineEditCustomerName->setText(doc->GetCustomerName());
|
||||
ui->labelCreationDate->setText(doc->GetCreationDate().toString(Qt::SystemLocaleLongDate));
|
||||
ui->lineEditSize->setText(doc->GetPatternSize());
|
||||
ui->checkBoxShowDate->setChecked(doc->IsDateVisible());
|
||||
|
||||
connect(ui->lineEditPatternName, &QLineEdit::editingFinished, this, &DialogPatternProperties::GeneralInfoChanged);
|
||||
connect(ui->lineEditPatternNumber, &QLineEdit::editingFinished, this, &DialogPatternProperties::GeneralInfoChanged);
|
||||
|
@ -552,6 +554,8 @@ void DialogPatternProperties::SaveGeneralInfo()
|
|||
doc->SetPatternNumber(ui->lineEditPatternNumber->text());
|
||||
doc->SetCompanyName(ui->lineEditCompanyName->text());
|
||||
doc->SetCustomerName(ui->lineEditCustomerName->text());
|
||||
doc->SetPatternSize(ui->lineEditSize->text());
|
||||
doc->SetDateVisible(ui->checkBoxShowDate->isChecked());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -1053,7 +1053,7 @@
|
|||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>401</width>
|
||||
<height>171</height>
|
||||
<height>221</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
|
@ -1100,17 +1100,34 @@
|
|||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="lineEditCustomerName"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="7" column="1">
|
||||
<widget class="QLabel" name="labelCreationDate">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Created:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLabel" name="labelCreationDate">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>Pattern size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="lineEditSize"/>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="checkBoxShowDate">
|
||||
<property name="text">
|
||||
<string>Show date of creation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -139,7 +139,7 @@ void VPattern::Parse(const Document &parse)
|
|||
QStringList tags = QStringList() << TagDraw << TagIncrements << TagAuthor << TagDescription << TagNotes
|
||||
<< TagMeasurements << TagVersion << TagGradation << TagImage << TagUnit
|
||||
<< TagPatternName << TagPatternNum << TagCompanyName << TagCustomerName
|
||||
<< TagCreationDate;
|
||||
<< TagCreationDate << TagSize << TagShowDate;
|
||||
PrepareForParse(parse);
|
||||
QDomNode domNode = documentElement().firstChild();
|
||||
while (domNode.isNull() == false)
|
||||
|
@ -214,6 +214,12 @@ void VPattern::Parse(const Document &parse)
|
|||
case 14: // TagCreationDate
|
||||
qCDebug(vXML, "Creation date.");
|
||||
break;
|
||||
case 15: // TagSize
|
||||
qCDebug(vXML, "Size");
|
||||
break;
|
||||
case 16:
|
||||
qCDebug(vXML, "Show creation date");
|
||||
break;
|
||||
default:
|
||||
qCDebug(vXML, "Wrong tag name %s", qUtf8Printable(domElement.tagName()));
|
||||
break;
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
<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="created" 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>
|
||||
|
|
|
@ -68,6 +68,9 @@ const QString VAbstractPattern::TagPatternNum = QStringLiteral("patternNumber"
|
|||
const QString VAbstractPattern::TagCustomerName = QStringLiteral("customer");
|
||||
const QString VAbstractPattern::TagCompanyName = QStringLiteral("company");
|
||||
const QString VAbstractPattern::TagCreationDate = QStringLiteral("created");
|
||||
const QString VAbstractPattern::TagSize = QStringLiteral("size");
|
||||
const QString VAbstractPattern::TagShowDate = QStringLiteral("showDate");
|
||||
|
||||
|
||||
const QString VAbstractPattern::AttrName = QStringLiteral("name");
|
||||
const QString VAbstractPattern::AttrVisible = QStringLiteral("visible");
|
||||
|
@ -1076,6 +1079,36 @@ QDate VAbstractPattern::GetCreationDate() const
|
|||
return QDate::currentDate();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VAbstractPattern::GetPatternSize() const
|
||||
{
|
||||
return UniqueTagText(TagSize);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractPattern::SetPatternSize(QString qsSize)
|
||||
{
|
||||
CheckTagExists(TagSize);
|
||||
setTagText(TagSize, qsSize);
|
||||
modified = true;
|
||||
emit patternChanged(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VAbstractPattern::IsDateVisible() const
|
||||
{
|
||||
return UniqueTagText(TagShowDate) != QStringLiteral("false");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractPattern::SetDateVisible(bool bVisible)
|
||||
{
|
||||
CheckTagExists(TagShowDate);
|
||||
setTagText(TagShowDate, bVisible == true? QStringLiteral("true") : QStringLiteral("false"));
|
||||
modified = true;
|
||||
emit patternChanged(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VAbstractPattern::GetImage() const
|
||||
{
|
||||
|
@ -1178,7 +1211,7 @@ QDomElement VAbstractPattern::CheckTagExists(const QString &tag)
|
|||
{
|
||||
const QStringList tags = QStringList() << TagUnit << TagImage << TagAuthor << TagDescription << TagNotes
|
||||
<< TagGradation << TagPatternName << TagPatternNum << TagCompanyName
|
||||
<< TagCustomerName << TagCreationDate;
|
||||
<< TagCustomerName << TagCreationDate << TagSize << TagShowDate;
|
||||
switch (tags.indexOf(tag))
|
||||
{
|
||||
case 0: //TagUnit
|
||||
|
@ -1244,6 +1277,16 @@ QDomElement VAbstractPattern::CheckTagExists(const QString &tag)
|
|||
element = createElement(TagCreationDate);
|
||||
break;
|
||||
}
|
||||
case 11: // TagSize
|
||||
{
|
||||
element = createElement(TagSize);
|
||||
break;
|
||||
}
|
||||
case 12: // TagShowDate
|
||||
{
|
||||
element = createElement(TagShowDate);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
|
|
|
@ -117,6 +117,10 @@ public:
|
|||
QString GetCustomerName() const;
|
||||
void SetCustomerName(QString qsName);
|
||||
QDate GetCreationDate() const;
|
||||
QString GetPatternSize() const;
|
||||
void SetPatternSize(QString qsSize);
|
||||
bool IsDateVisible() const;
|
||||
void SetDateVisible(bool bVisible);
|
||||
|
||||
QString GetImage() const;
|
||||
QString GetImageExtension() const;
|
||||
|
@ -174,6 +178,8 @@ public:
|
|||
static const QString TagCompanyName;
|
||||
static const QString TagCustomerName;
|
||||
static const QString TagCreationDate;
|
||||
static const QString TagSize;
|
||||
static const QString TagShowDate;
|
||||
|
||||
static const QString AttrName;
|
||||
static const QString AttrVisible;
|
||||
|
|
|
@ -18,7 +18,8 @@ SOURCES += \
|
|||
$$PWD/variables/vmeasurement.cpp \
|
||||
$$PWD/variables/vvariable.cpp \
|
||||
$$PWD/vformula.cpp \
|
||||
$$PWD/vpatternpiecedata.cpp
|
||||
$$PWD/vpatternpiecedata.cpp \
|
||||
$$PWD/vpatterninfogeometry.cpp
|
||||
|
||||
win32-msvc*:SOURCES += $$PWD/stable.cpp
|
||||
|
||||
|
@ -51,4 +52,5 @@ HEADERS += \
|
|||
$$PWD/variables/vvariable.h \
|
||||
$$PWD/variables/vvariable_p.h \
|
||||
$$PWD/vformula.h \
|
||||
$$PWD/vpatternpiecedata.h
|
||||
$$PWD/vpatternpiecedata.h \
|
||||
$$PWD/vpatterninfogeometry.h
|
||||
|
|
|
@ -100,10 +100,3 @@ CONFIG(debug, debug|release){
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
HEADERS += \
|
||||
vpatterninfogeometry.h
|
||||
|
||||
SOURCES += \
|
||||
vpatterninfogeometry.cpp
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <QGraphicsView>
|
||||
#include <QTransform>
|
||||
#include <QCursor>
|
||||
#include <QtMath>
|
||||
#include <QDebug>
|
||||
|
||||
#include "../vmisc/def.h"
|
||||
|
@ -311,7 +312,7 @@ void VTextGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent* pME)
|
|||
m_dAngle = GetAngle(pME->scenePos());
|
||||
return;
|
||||
}
|
||||
double dAng = 180*(GetAngle(pME->scenePos()) - m_dAngle)/M_PI;
|
||||
double dAng = qRadiansToDegrees(GetAngle(pME->scenePos()) - m_dAngle);
|
||||
rectBB.setTopLeft(m_ptStartPos);
|
||||
rectBB.setWidth(m_rectBoundingBox.width());
|
||||
rectBB.setHeight(m_rectBoundingBox.height());
|
||||
|
@ -480,7 +481,7 @@ QRectF VTextGraphicsItem::GetBoundingRect(QRectF rectBB, qreal dRot) const
|
|||
qreal dY1 = 0;
|
||||
qreal dY2 = 0;
|
||||
|
||||
double dAng = M_PI*dRot/180;
|
||||
double dAng = qDegreesToRadians(dRot);
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
QPointF pt = apt[i] - ptCenter;
|
||||
|
|
|
@ -689,16 +689,25 @@ void VToolDetail::UpdateLabel()
|
|||
TextLine tl;
|
||||
// letter
|
||||
tl.m_qsText = data.GetLetter();
|
||||
if (tl.m_qsText.isEmpty() == false)
|
||||
{
|
||||
tl.m_eAlign = Qt::AlignCenter;
|
||||
tl.m_eFontWeight = QFont::Bold;
|
||||
tl.m_eStyle = QFont::StyleNormal;
|
||||
tl.m_iFontSize = 6;
|
||||
dataLabel->AddLine(tl);
|
||||
}
|
||||
|
||||
// name
|
||||
tl.m_qsText = detail.getName();
|
||||
if (tl.m_qsText.isEmpty() == false)
|
||||
{
|
||||
tl.m_eAlign = Qt::AlignCenter;
|
||||
tl.m_eFontWeight = QFont::DemiBold;
|
||||
tl.m_iFontSize = 2;
|
||||
dataLabel->AddLine(tl);
|
||||
}
|
||||
|
||||
// MCP
|
||||
tl.m_eAlign = Qt::AlignLeft | Qt::AlignVCenter;
|
||||
tl.m_eFontWeight = QFont::Normal;
|
||||
|
@ -761,33 +770,56 @@ void VToolDetail::UpdatePatternInfo()
|
|||
|
||||
// Company name
|
||||
tl.m_qsText = doc->GetCompanyName();
|
||||
if (tl.m_qsText.isEmpty() == false)
|
||||
{
|
||||
tl.m_eAlign = Qt::AlignCenter;
|
||||
tl.m_eFontWeight = QFont::DemiBold;
|
||||
tl.m_eStyle = QFont::StyleNormal;
|
||||
tl.m_iFontSize = 4;
|
||||
patternInfo->AddLine(tl);
|
||||
}
|
||||
|
||||
// Pattern name
|
||||
tl.m_qsText = doc->GetPatternName();
|
||||
if (tl.m_qsText.isEmpty() == false)
|
||||
{
|
||||
tl.m_eFontWeight = QFont::Normal;
|
||||
tl.m_iFontSize = 2;
|
||||
patternInfo->AddLine(tl);
|
||||
}
|
||||
|
||||
// Pattern number
|
||||
tl.m_qsText = doc->GetPatternNumber();
|
||||
if (tl.m_qsText.isEmpty() == false)
|
||||
{
|
||||
tl.m_iFontSize = 0;
|
||||
tl.m_eAlign = Qt::AlignLeft | Qt::AlignVCenter;
|
||||
patternInfo->AddLine(tl);
|
||||
}
|
||||
|
||||
// Customer name
|
||||
tl.m_qsText = doc->GetCustomerName();
|
||||
if (tl.m_qsText.isEmpty() == false)
|
||||
{
|
||||
tl.m_eStyle = QFont::StyleItalic;
|
||||
patternInfo->AddLine(tl);
|
||||
}
|
||||
|
||||
// Size
|
||||
tl.m_qsText = doc->GetPatternSize();
|
||||
if (tl.m_qsText.isEmpty() == false)
|
||||
{
|
||||
tl.m_eStyle = QFont::StyleNormal;
|
||||
patternInfo->AddLine(tl);
|
||||
}
|
||||
|
||||
// Creation date
|
||||
if (doc->IsDateVisible() == true)
|
||||
{
|
||||
QStringList qslDate = doc->GetCreationDate().toString(Qt::SystemLocaleLongDate).split(", ");
|
||||
tl.m_qsText = qslDate.last();
|
||||
patternInfo->AddLine(tl);
|
||||
}
|
||||
|
||||
QPointF pt = geom.GetPos();
|
||||
QRectF rectBB;
|
||||
|
|
Loading…
Reference in New Issue
Block a user