Current date is always used to show the pattern creation date

--HG--
branch : feature
This commit is contained in:
BojanKverh 2016-07-19 22:59:14 +02:00
parent 02edbcc8d6
commit 948102e74e
7 changed files with 10 additions and 50 deletions

View file

@ -170,7 +170,7 @@ DialogPatternProperties::DialogPatternProperties(const QString &filePath, VPatte
ui->lineEditPatternNumber->setText(doc->GetPatternNumber());
ui->lineEditCompanyName->setText(doc->GetCompanyName());
ui->lineEditCustomerName->setText(doc->GetCustomerName());
ui->labelCreationDate->setText(doc->GetCreationDate().toString(Qt::SystemLocaleLongDate));
ui->labelCreationDate->setText(QDate::currentDate().toString(Qt::SystemLocaleLongDate));
ui->lineEditSize->setText(doc->GetPatternSize());
ui->checkBoxShowDate->setChecked(doc->IsDateVisible());

View file

@ -486,7 +486,7 @@ void MainWindowsNoGUI::PrepareDetailsForLayout(const QHash<quint32, VDetail> *de
QDate date;
if (pDoc->IsDateVisible() == true)
{
date = pDoc->GetCreationDate();
date = QDate::currentDate();
}
det.SetPatternInfo(pDoc->GetPatternName(), pDoc->GetPatternNumber(), pDoc->GetPatternSize(),
pDoc->GetCompanyName(), pDoc->GetCustomerName(), date, geom, qApp->font());

View file

@ -83,11 +83,6 @@ void VPattern::CreateEmptyFile()
version.appendChild(newNodeText);
patternElement.appendChild(version);
QDomElement domCreated = createElement(TagCreationDate);
QDomText domCreatedText = createTextNode(QDate::currentDate().toString("d.M.yyyy"));
domCreated.appendChild(domCreatedText);
patternElement.appendChild(domCreated);
QDomElement unit = createElement(TagUnit);
newNodeText = createTextNode(UnitsToStr(qApp->patternUnit()));
unit.appendChild(newNodeText);
@ -139,7 +134,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 << TagSize << TagShowDate;
<< TagSize << TagShowDate;
PrepareForParse(parse);
QDomNode domNode = documentElement().firstChild();
while (domNode.isNull() == false)
@ -211,13 +206,10 @@ void VPattern::Parse(const Document &parse)
case 13: // TagCustomerName
qCDebug(vXML, "Customer name.");
break;
case 14: // TagCreationDate
qCDebug(vXML, "Creation date.");
break;
case 15: // TagSize
case 14: // TagSize
qCDebug(vXML, "Size");
break;
case 16:
case 15:
qCDebug(vXML, "Show creation date");
break;
default:

View file

@ -22,7 +22,6 @@
<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="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">

View file

@ -67,7 +67,6 @@ const QString VAbstractPattern::TagPatternName = QStringLiteral("patternName");
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");
@ -1056,29 +1055,6 @@ void VAbstractPattern::SetCustomerName(QString qsName)
emit patternChanged(false);
}
//---------------------------------------------------------------------------------------------------------------------
QDate VAbstractPattern::GetCreationDate() const
{
QStringList qsl = UniqueTagText(TagCreationDate).split(".");
if (qsl.count() == 3)
{
bool bDay;
bool bMonth;
bool bYear;
int iDay = qsl[0].toInt(&bDay);
int iMonth = qsl[1].toInt(&bMonth);
int iYear = qsl[2].toInt(&bYear);
if (bDay == true && bMonth == true && bYear == true)
{
QDate date;
date.setDate(iYear, iMonth, iDay);
return date;
}
}
return QDate::currentDate();
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractPattern::GetPatternSize() const
{
@ -1211,7 +1187,7 @@ QDomElement VAbstractPattern::CheckTagExists(const QString &tag)
{
const QStringList tags = QStringList() << TagUnit << TagImage << TagAuthor << TagDescription << TagNotes
<< TagGradation << TagPatternName << TagPatternNum << TagCompanyName
<< TagCustomerName << TagCreationDate << TagSize << TagShowDate;
<< TagCustomerName << TagSize << TagShowDate;
switch (tags.indexOf(tag))
{
case 0: //TagUnit
@ -1272,17 +1248,12 @@ QDomElement VAbstractPattern::CheckTagExists(const QString &tag)
element = createElement(TagCustomerName);
break;
}
case 10: // TagPatternName
{
element = createElement(TagCreationDate);
break;
}
case 11: // TagSize
case 10: // TagSize
{
element = createElement(TagSize);
break;
}
case 12: // TagShowDate
case 11: // TagShowDate
{
element = createElement(TagShowDate);
break;

View file

@ -116,7 +116,6 @@ public:
void SetPatternNumber(QString qsNum);
QString GetCustomerName() const;
void SetCustomerName(QString qsName);
QDate GetCreationDate() const;
QString GetPatternSize() const;
void SetPatternSize(QString qsSize);
bool IsDateVisible() const;
@ -177,8 +176,7 @@ public:
static const QString TagPatternNum;
static const QString TagCompanyName;
static const QString TagCustomerName;
static const QString TagCreationDate;
static const QString TagSize;
static const QString TagSize;
static const QString TagShowDate;
static const QString AttrName;

View file

@ -833,7 +833,7 @@ void VToolDetail::UpdatePatternInfo()
tl.m_eFontWeight = QFont::Normal;
tl.m_eStyle = QFont::StyleNormal;
tl.m_iFontSize = 0;
QStringList qslDate = doc->GetCreationDate().toString(Qt::SystemLocaleLongDate).split(", ");
QStringList qslDate = QDate::currentDate().toString(Qt::SystemLocaleLongDate).split(", ");
tl.m_qsText = qslDate.last();
patternInfo->AddLine(tl);
}