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->lineEditPatternNumber->setText(doc->GetPatternNumber());
ui->lineEditCompanyName->setText(doc->GetCompanyName()); ui->lineEditCompanyName->setText(doc->GetCompanyName());
ui->lineEditCustomerName->setText(doc->GetCustomerName()); 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->lineEditSize->setText(doc->GetPatternSize());
ui->checkBoxShowDate->setChecked(doc->IsDateVisible()); ui->checkBoxShowDate->setChecked(doc->IsDateVisible());

View File

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

View File

@ -83,11 +83,6 @@ void VPattern::CreateEmptyFile()
version.appendChild(newNodeText); version.appendChild(newNodeText);
patternElement.appendChild(version); 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); QDomElement unit = createElement(TagUnit);
newNodeText = createTextNode(UnitsToStr(qApp->patternUnit())); newNodeText = createTextNode(UnitsToStr(qApp->patternUnit()));
unit.appendChild(newNodeText); unit.appendChild(newNodeText);
@ -139,7 +134,7 @@ void VPattern::Parse(const Document &parse)
QStringList tags = QStringList() << TagDraw << TagIncrements << TagAuthor << TagDescription << TagNotes QStringList tags = QStringList() << TagDraw << TagIncrements << TagAuthor << TagDescription << TagNotes
<< TagMeasurements << TagVersion << TagGradation << TagImage << TagUnit << TagMeasurements << TagVersion << TagGradation << TagImage << TagUnit
<< TagPatternName << TagPatternNum << TagCompanyName << TagCustomerName << TagPatternName << TagPatternNum << TagCompanyName << TagCustomerName
<< TagCreationDate << TagSize << TagShowDate; << TagSize << TagShowDate;
PrepareForParse(parse); PrepareForParse(parse);
QDomNode domNode = documentElement().firstChild(); QDomNode domNode = documentElement().firstChild();
while (domNode.isNull() == false) while (domNode.isNull() == false)
@ -211,13 +206,10 @@ void VPattern::Parse(const Document &parse)
case 13: // TagCustomerName case 13: // TagCustomerName
qCDebug(vXML, "Customer name."); qCDebug(vXML, "Customer name.");
break; break;
case 14: // TagCreationDate case 14: // TagSize
qCDebug(vXML, "Creation date.");
break;
case 15: // TagSize
qCDebug(vXML, "Size"); qCDebug(vXML, "Size");
break; break;
case 16: case 15:
qCDebug(vXML, "Show creation date"); qCDebug(vXML, "Show creation date");
break; break;
default: default:

View File

@ -22,7 +22,6 @@
<xs:element name="patternNumber" 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="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="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="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="showDate" type="xs:boolean" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="gradation" minOccurs="0" maxOccurs="1"> <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::TagPatternNum = QStringLiteral("patternNumber");
const QString VAbstractPattern::TagCustomerName = QStringLiteral("customer"); const QString VAbstractPattern::TagCustomerName = QStringLiteral("customer");
const QString VAbstractPattern::TagCompanyName = QStringLiteral("company"); const QString VAbstractPattern::TagCompanyName = QStringLiteral("company");
const QString VAbstractPattern::TagCreationDate = QStringLiteral("created");
const QString VAbstractPattern::TagSize = QStringLiteral("size"); const QString VAbstractPattern::TagSize = QStringLiteral("size");
const QString VAbstractPattern::TagShowDate = QStringLiteral("showDate"); const QString VAbstractPattern::TagShowDate = QStringLiteral("showDate");
@ -1056,29 +1055,6 @@ void VAbstractPattern::SetCustomerName(QString qsName)
emit patternChanged(false); 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 QString VAbstractPattern::GetPatternSize() const
{ {
@ -1211,7 +1187,7 @@ QDomElement VAbstractPattern::CheckTagExists(const QString &tag)
{ {
const QStringList tags = QStringList() << TagUnit << TagImage << TagAuthor << TagDescription << TagNotes const QStringList tags = QStringList() << TagUnit << TagImage << TagAuthor << TagDescription << TagNotes
<< TagGradation << TagPatternName << TagPatternNum << TagCompanyName << TagGradation << TagPatternName << TagPatternNum << TagCompanyName
<< TagCustomerName << TagCreationDate << TagSize << TagShowDate; << TagCustomerName << TagSize << TagShowDate;
switch (tags.indexOf(tag)) switch (tags.indexOf(tag))
{ {
case 0: //TagUnit case 0: //TagUnit
@ -1272,17 +1248,12 @@ QDomElement VAbstractPattern::CheckTagExists(const QString &tag)
element = createElement(TagCustomerName); element = createElement(TagCustomerName);
break; break;
} }
case 10: // TagPatternName case 10: // TagSize
{
element = createElement(TagCreationDate);
break;
}
case 11: // TagSize
{ {
element = createElement(TagSize); element = createElement(TagSize);
break; break;
} }
case 12: // TagShowDate case 11: // TagShowDate
{ {
element = createElement(TagShowDate); element = createElement(TagShowDate);
break; break;

View File

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

View File

@ -833,7 +833,7 @@ void VToolDetail::UpdatePatternInfo()
tl.m_eFontWeight = QFont::Normal; tl.m_eFontWeight = QFont::Normal;
tl.m_eStyle = QFont::StyleNormal; tl.m_eStyle = QFont::StyleNormal;
tl.m_iFontSize = 0; 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(); tl.m_qsText = qslDate.last();
patternInfo->AddLine(tl); patternInfo->AddLine(tl);
} }