From 6d06370f4f16462abb5438936c3d6408d0077e04 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 19 Aug 2017 19:37:14 +0300 Subject: [PATCH] Use user define date/time format. --HG-- branch : feature --- src/libs/vlayout/vtextmanager.cpp | 9 +++++++-- src/libs/vtools/dialogs/support/dialogeditlabel.cpp | 8 ++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/libs/vlayout/vtextmanager.cpp b/src/libs/vlayout/vtextmanager.cpp index 37af5b0e8..55522db77 100644 --- a/src/libs/vlayout/vtextmanager.cpp +++ b/src/libs/vlayout/vtextmanager.cpp @@ -67,8 +67,13 @@ QMap PreparePlaceholders(const VAbstractPattern *doc) // Pattern tags 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_patternNumber, doc->GetPatternNumber()); placeholders.insert(pl_author, doc->GetCompanyName()); diff --git a/src/libs/vtools/dialogs/support/dialogeditlabel.cpp b/src/libs/vtools/dialogs/support/dialogeditlabel.cpp index b6ae04ceb..9c7ea8cee 100644 --- a/src/libs/vtools/dialogs/support/dialogeditlabel.cpp +++ b/src/libs/vtools/dialogs/support/dialogeditlabel.cpp @@ -466,8 +466,12 @@ void DialogEditLabel::InitPlaceholders() { // Pattern tags 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_patternNumber, qMakePair(tr("Pattern number"), m_doc->GetPatternNumber()));