Use user define date/time format.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-08-19 19:37:14 +03:00
parent a8d8efd889
commit 6d06370f4f
2 changed files with 13 additions and 4 deletions

View File

@ -67,8 +67,13 @@ QMap<QString, QString> PreparePlaceholders(const VAbstractPattern *doc)
// Pattern tags // Pattern tags
QLocale locale(qApp->Settings()->GetLocale()); QLocale locale(qApp->Settings()->GetLocale());
placeholders.insert(pl_date, locale.toString(QDate::currentDate()));
placeholders.insert(pl_time, locale.toString(QTime::currentTime())); const QString date = locale.toString(QDate::currentDate(), doc->GetLabelDateFormat());
placeholders.insert(pl_date, date);
const QString time = locale.toString(QTime::currentTime(), doc->GetLabelTimeFormat());
placeholders.insert(pl_time, time);
placeholders.insert(pl_patternName, doc->GetPatternName()); placeholders.insert(pl_patternName, doc->GetPatternName());
placeholders.insert(pl_patternNumber, doc->GetPatternNumber()); placeholders.insert(pl_patternNumber, doc->GetPatternNumber());
placeholders.insert(pl_author, doc->GetCompanyName()); placeholders.insert(pl_author, doc->GetCompanyName());

View File

@ -466,8 +466,12 @@ void DialogEditLabel::InitPlaceholders()
{ {
// Pattern tags // Pattern tags
QLocale locale(qApp->Settings()->GetLocale()); QLocale locale(qApp->Settings()->GetLocale());
m_placeholders.insert(pl_date, qMakePair(tr("Date"), locale.toString(QDate::currentDate())));
m_placeholders.insert(pl_time, qMakePair(tr("Time"), locale.toString(QTime::currentTime()))); const QString date = locale.toString(QDate::currentDate(), m_doc->GetLabelDateFormat());
m_placeholders.insert(pl_date, qMakePair(tr("Date"), date));
const QString time = locale.toString(QTime::currentTime(), m_doc->GetLabelTimeFormat());
m_placeholders.insert(pl_time, qMakePair(tr("Time"), time));
m_placeholders.insert(pl_patternName, qMakePair(tr("Pattern name"), m_doc->GetPatternName())); m_placeholders.insert(pl_patternName, qMakePair(tr("Pattern name"), m_doc->GetPatternName()));
m_placeholders.insert(pl_patternNumber, qMakePair(tr("Pattern number"), m_doc->GetPatternNumber())); m_placeholders.insert(pl_patternNumber, qMakePair(tr("Pattern number"), m_doc->GetPatternNumber()));