2016-08-12 12:11:12 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vpatternpiecedata.cpp
|
|
|
|
** @author Bojan Kverh
|
|
|
|
** @date July 19, 2016
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
|
|
|
** This source code is part of the Valentine project, a pattern making
|
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2013-2015 Valentina project
|
|
|
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
|
|
**
|
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
|
|
|
** it under the terms of the GNU General Public License as published by
|
|
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
|
|
** (at your option) any later version.
|
|
|
|
**
|
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
** GNU General Public License for more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <QDate>
|
|
|
|
#include <QFileInfo>
|
2016-07-18 22:30:14 +02:00
|
|
|
#include <QFontMetrics>
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <QLatin1String>
|
|
|
|
#include <QRegularExpression>
|
2016-08-11 22:44:53 +02:00
|
|
|
#include <QApplication>
|
2017-01-25 17:07:18 +01:00
|
|
|
#include <QDebug>
|
2016-07-18 22:30:14 +02:00
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
#include "../ifc/xml/vabstractpattern.h"
|
2017-02-23 10:37:19 +01:00
|
|
|
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
2016-08-23 13:02:09 +02:00
|
|
|
#include "../vmisc/vabstractapplication.h"
|
2016-12-14 10:59:21 +01:00
|
|
|
#include "../vmisc/vmath.h"
|
2016-07-18 22:30:14 +02:00
|
|
|
#include "vtextmanager.h"
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-07-23 15:26:15 +02:00
|
|
|
/**
|
|
|
|
* @brief TextLine::TextLine default constructor
|
|
|
|
*/
|
2016-07-18 22:30:14 +02:00
|
|
|
TextLine::TextLine()
|
2016-12-15 07:46:45 +01:00
|
|
|
: m_qsText(),
|
|
|
|
m_iFontSize(MIN_FONT_SIZE),
|
|
|
|
m_eFontWeight(QFont::Normal),
|
|
|
|
m_eStyle(QFont::StyleNormal),
|
|
|
|
m_eAlign(Qt::AlignCenter)
|
2016-07-18 22:30:14 +02:00
|
|
|
{}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-07-23 15:26:15 +02:00
|
|
|
/**
|
|
|
|
* @brief VTextManager::VTextManager constructor
|
|
|
|
*/
|
2016-07-18 22:30:14 +02:00
|
|
|
VTextManager::VTextManager()
|
2016-12-15 07:46:45 +01:00
|
|
|
: m_font(), m_liLines()
|
2016-07-18 22:30:14 +02:00
|
|
|
{}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-07-23 15:26:15 +02:00
|
|
|
/**
|
|
|
|
* @brief VTextManager::~VTextManager destructor
|
|
|
|
*/
|
2016-07-18 22:30:14 +02:00
|
|
|
VTextManager::~VTextManager()
|
|
|
|
{}
|
|
|
|
|
2016-11-01 09:42:32 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
VTextManager::VTextManager(const VTextManager &text)
|
2016-12-14 00:56:30 +01:00
|
|
|
: m_font(text.GetFont()), m_liLines(text.GetAllSourceLines())
|
2016-11-01 09:42:32 +01:00
|
|
|
{}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
VTextManager &VTextManager::operator=(const VTextManager &text)
|
|
|
|
{
|
|
|
|
if ( &text == this )
|
|
|
|
{
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
m_font = text.GetFont();
|
|
|
|
m_liLines = text.GetAllSourceLines();
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2016-07-18 22:30:14 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-07-23 15:26:15 +02:00
|
|
|
/**
|
2016-11-01 09:42:32 +01:00
|
|
|
* @brief GetSpacing returns the vertical spacing between the lines
|
2016-11-01 10:46:51 +01:00
|
|
|
* @return spacing
|
2016-07-23 15:26:15 +02:00
|
|
|
*/
|
2016-07-18 22:30:14 +02:00
|
|
|
int VTextManager::GetSpacing() const
|
2016-07-19 02:26:50 +02:00
|
|
|
{
|
2016-12-14 00:56:30 +01:00
|
|
|
return 0;
|
2016-07-19 02:26:50 +02:00
|
|
|
}
|
2016-07-18 22:30:14 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-07-23 15:26:15 +02:00
|
|
|
/**
|
2016-11-01 09:42:32 +01:00
|
|
|
* @brief SetFont set the text base font
|
2016-07-23 15:26:15 +02:00
|
|
|
* @param font text base font
|
|
|
|
*/
|
2016-07-18 22:30:14 +02:00
|
|
|
void VTextManager::SetFont(const QFont& font)
|
2016-07-19 02:26:50 +02:00
|
|
|
{
|
|
|
|
m_font = font;
|
|
|
|
}
|
2016-07-18 22:30:14 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-07-23 15:26:15 +02:00
|
|
|
/**
|
2016-11-01 09:42:32 +01:00
|
|
|
* @brief GetFont returns the text base font
|
2016-07-23 15:26:15 +02:00
|
|
|
* @return text base font
|
|
|
|
*/
|
2016-07-18 22:30:14 +02:00
|
|
|
const QFont& VTextManager::GetFont() const
|
2016-07-19 02:26:50 +02:00
|
|
|
{
|
|
|
|
return m_font;
|
|
|
|
}
|
2016-07-18 22:30:14 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-07-23 15:26:15 +02:00
|
|
|
/**
|
2016-11-01 09:42:32 +01:00
|
|
|
* @brief SetFontSize sets the font size
|
2016-07-23 15:26:15 +02:00
|
|
|
* @param iFS font size in pixels
|
|
|
|
*/
|
2016-07-18 22:30:14 +02:00
|
|
|
void VTextManager::SetFontSize(int iFS)
|
2016-07-19 02:26:50 +02:00
|
|
|
{
|
2016-12-14 10:59:21 +01:00
|
|
|
iFS < MIN_FONT_SIZE ? m_font.setPixelSize(MIN_FONT_SIZE) : m_font.setPixelSize(iFS);
|
2016-07-19 02:26:50 +02:00
|
|
|
}
|
2016-07-18 22:30:14 +02:00
|
|
|
|
2016-11-01 09:42:32 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QList<TextLine> VTextManager::GetAllSourceLines() const
|
|
|
|
{
|
|
|
|
return m_liLines;
|
|
|
|
}
|
|
|
|
|
2016-07-18 22:30:14 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-07-23 15:26:15 +02:00
|
|
|
/**
|
2016-11-01 09:42:32 +01:00
|
|
|
* @brief AddSourceLine add new text line to the list
|
2016-07-23 15:26:15 +02:00
|
|
|
* @param tl text line object to be added
|
|
|
|
*/
|
2016-11-01 09:42:32 +01:00
|
|
|
void VTextManager::AddSourceLine(const TextLine& tl)
|
2016-07-19 02:26:50 +02:00
|
|
|
{
|
|
|
|
m_liLines << tl;
|
|
|
|
}
|
2016-07-18 22:30:14 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-07-23 15:26:15 +02:00
|
|
|
/**
|
2016-11-01 09:42:32 +01:00
|
|
|
* @brief ClearSourceLines deletes the list of texts
|
2016-07-23 15:26:15 +02:00
|
|
|
*/
|
2016-11-01 09:42:32 +01:00
|
|
|
void VTextManager::ClearSourceLines()
|
2016-07-19 02:26:50 +02:00
|
|
|
{
|
|
|
|
m_liLines.clear();
|
|
|
|
}
|
2016-07-18 22:30:14 +02:00
|
|
|
|
2016-07-19 02:26:50 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-07-23 15:26:15 +02:00
|
|
|
/**
|
2016-11-01 09:42:32 +01:00
|
|
|
* @brief VTextManager::GetSourceLinesCount returns the number of input text lines
|
2016-07-23 15:26:15 +02:00
|
|
|
* @return number of text lines that were added to the list by calling AddLine
|
|
|
|
*/
|
2016-11-01 09:42:32 +01:00
|
|
|
int VTextManager::GetSourceLinesCount() const
|
2016-07-19 02:26:50 +02:00
|
|
|
{
|
|
|
|
return m_liLines.count();
|
|
|
|
}
|
2016-07-18 22:30:14 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-07-23 15:26:15 +02:00
|
|
|
/**
|
2016-12-14 00:56:30 +01:00
|
|
|
* @brief VTextManager::GetSourceLine returns the reference to i-th text line
|
|
|
|
* @param i index of the requested line
|
|
|
|
* @return reference to the requested TextLine object
|
2016-07-23 15:26:15 +02:00
|
|
|
*/
|
2016-12-14 00:56:30 +01:00
|
|
|
const TextLine& VTextManager::GetSourceLine(int i) const
|
2016-07-19 02:26:50 +02:00
|
|
|
{
|
2016-12-14 00:56:30 +01:00
|
|
|
Q_ASSERT(i >= 0);
|
|
|
|
Q_ASSERT(i < m_liLines.count());
|
2016-12-14 10:59:21 +01:00
|
|
|
return m_liLines.at(i);
|
2016-07-19 02:26:50 +02:00
|
|
|
}
|
2016-07-18 22:30:14 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-07-23 15:26:15 +02:00
|
|
|
/**
|
2016-12-14 00:56:30 +01:00
|
|
|
* @brief VTextManager::FitFontSize sets the font size just big enough, so that the text fits into rectangle of
|
|
|
|
* size (fW, fH)
|
2016-07-23 15:26:15 +02:00
|
|
|
* @param fW rectangle width
|
|
|
|
* @param fH rectangle height
|
|
|
|
*/
|
2016-12-14 00:56:30 +01:00
|
|
|
void VTextManager::FitFontSize(qreal fW, qreal fH)
|
2016-07-18 22:30:14 +02:00
|
|
|
{
|
2017-01-05 12:11:18 +01:00
|
|
|
int iFS = 0;
|
|
|
|
if (GetSourceLinesCount() > 0)
|
|
|
|
{//division by zero
|
|
|
|
iFS = 3*qFloor(fH/GetSourceLinesCount())/4;
|
|
|
|
}
|
|
|
|
|
2016-12-14 00:56:30 +01:00
|
|
|
if (iFS < MIN_FONT_SIZE)
|
|
|
|
{
|
|
|
|
iFS = MIN_FONT_SIZE;
|
|
|
|
}
|
2016-09-29 01:39:50 +02:00
|
|
|
|
2016-12-14 00:56:30 +01:00
|
|
|
// get ratio between char width and height
|
|
|
|
|
|
|
|
int iMaxLen = 0;
|
2016-12-15 07:50:25 +01:00
|
|
|
TextLine maxLine;
|
2016-12-14 00:56:30 +01:00
|
|
|
QFont fnt;
|
|
|
|
for (int i = 0; i < GetSourceLinesCount(); ++i)
|
2016-07-18 22:30:14 +02:00
|
|
|
{
|
2016-12-14 00:56:30 +01:00
|
|
|
const TextLine& tl = GetSourceLine(i);
|
|
|
|
fnt = m_font;
|
|
|
|
fnt.setPixelSize(iFS + tl.m_iFontSize);
|
|
|
|
fnt.setWeight(tl.m_eFontWeight);
|
|
|
|
fnt.setStyle(tl.m_eStyle);
|
2016-07-18 22:30:14 +02:00
|
|
|
QFontMetrics fm(fnt);
|
2016-12-15 07:50:25 +01:00
|
|
|
const int iTW = fm.width(tl.m_qsText);
|
2016-12-14 00:56:30 +01:00
|
|
|
if (iTW > iMaxLen)
|
2016-07-18 22:30:14 +02:00
|
|
|
{
|
2016-12-14 00:56:30 +01:00
|
|
|
iMaxLen = iTW;
|
2016-12-15 07:50:25 +01:00
|
|
|
maxLine = tl;
|
2016-07-18 22:30:14 +02:00
|
|
|
}
|
|
|
|
}
|
2016-12-14 00:56:30 +01:00
|
|
|
if (iMaxLen > fW)
|
2016-09-29 01:39:50 +02:00
|
|
|
{
|
2016-12-15 07:50:25 +01:00
|
|
|
QFont fnt = m_font;
|
|
|
|
fnt.setWeight(maxLine.m_eFontWeight);
|
|
|
|
fnt.setStyle(maxLine.m_eStyle);
|
|
|
|
|
|
|
|
int lineLength = 0;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
--iFS;
|
|
|
|
fnt.setPixelSize(iFS + maxLine.m_iFontSize);
|
|
|
|
QFontMetrics fm(fnt);
|
|
|
|
lineLength = fm.width(maxLine.m_qsText);
|
|
|
|
}
|
|
|
|
while (lineLength > fW && iFS > MIN_FONT_SIZE);
|
2016-09-29 01:39:50 +02:00
|
|
|
}
|
2016-12-14 00:56:30 +01:00
|
|
|
SetFontSize(iFS);
|
|
|
|
qDebug() << "Font size" << GetSourceLinesCount() << iFS;
|
2016-07-19 13:47:21 +02:00
|
|
|
}
|
|
|
|
|
2016-07-21 21:46:49 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-07-23 15:26:15 +02:00
|
|
|
/**
|
|
|
|
* @brief VTextManager::Update updates the text lines with detail data
|
|
|
|
* @param qsName detail name
|
|
|
|
* @param data reference to the detail data
|
|
|
|
*/
|
2017-02-23 10:19:27 +01:00
|
|
|
void VTextManager::Update(const QString& qsName, const VPieceLabelData& data)
|
2016-07-21 21:46:49 +02:00
|
|
|
{
|
2016-11-01 09:42:32 +01:00
|
|
|
ClearSourceLines();
|
2016-07-21 21:46:49 +02:00
|
|
|
TextLine tl;
|
|
|
|
// all text must be centered and normal style!
|
|
|
|
tl.m_eAlign = Qt::AlignCenter;
|
|
|
|
tl.m_eStyle = QFont::StyleNormal;
|
|
|
|
|
|
|
|
// letter
|
|
|
|
tl.m_qsText = data.GetLetter();
|
|
|
|
if (tl.m_qsText.isEmpty() == false)
|
|
|
|
{
|
|
|
|
tl.m_eFontWeight = QFont::Bold;
|
|
|
|
tl.m_iFontSize = 6;
|
2016-11-01 09:42:32 +01:00
|
|
|
AddSourceLine(tl);
|
2016-07-21 21:46:49 +02:00
|
|
|
}
|
|
|
|
// name
|
|
|
|
tl.m_qsText = qsName;
|
|
|
|
if (tl.m_qsText.isEmpty() == false)
|
|
|
|
{
|
|
|
|
tl.m_eFontWeight = QFont::DemiBold;
|
|
|
|
tl.m_iFontSize = 2;
|
2016-11-01 09:42:32 +01:00
|
|
|
AddSourceLine(tl);
|
2016-07-21 21:46:49 +02:00
|
|
|
}
|
|
|
|
// MCP
|
2016-08-11 22:44:53 +02:00
|
|
|
QStringList qslMaterials;
|
|
|
|
qslMaterials << QApplication::translate("Detail", "Fabric", 0)
|
|
|
|
<< QApplication::translate("Detail", "Lining", 0)
|
|
|
|
<< QApplication::translate("Detail", "Interfacing", 0)
|
|
|
|
<< QApplication::translate("Detail", "Interlining", 0);
|
2016-08-26 11:28:30 +02:00
|
|
|
QString qsText = QLatin1String("%1, ") + tr("cut") + QLatin1String(" %2%3");
|
2016-07-21 21:46:49 +02:00
|
|
|
QStringList qslPlace;
|
2016-08-26 11:28:30 +02:00
|
|
|
qslPlace << "" << QLatin1String(" ") + tr("on fold");
|
2016-07-21 21:46:49 +02:00
|
|
|
tl.m_eFontWeight = QFont::Normal;
|
|
|
|
tl.m_iFontSize = 0;
|
|
|
|
for (int i = 0; i < data.GetMCPCount(); ++i)
|
|
|
|
{
|
|
|
|
MaterialCutPlacement mcp = data.GetMCP(i);
|
2016-08-22 10:47:21 +02:00
|
|
|
if (mcp.m_iCutNumber > 0)//Not gonna happen because min value is 1 now, but decided to left
|
2016-07-21 21:46:49 +02:00
|
|
|
{
|
2016-08-11 22:44:53 +02:00
|
|
|
QString qsMat;
|
|
|
|
if (mcp.m_eMaterial == MaterialType::mtUserDefined)
|
|
|
|
{
|
|
|
|
qsMat = mcp.m_qsMaterialUserDef;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
qsMat = qslMaterials[int(mcp.m_eMaterial)];
|
|
|
|
}
|
2016-08-22 11:00:12 +02:00
|
|
|
tl.m_qsText = qsText.arg(qsMat).arg(mcp.m_iCutNumber).
|
2016-07-21 21:46:49 +02:00
|
|
|
arg(qslPlace[int(mcp.m_ePlacement)]);
|
2016-11-01 09:42:32 +01:00
|
|
|
AddSourceLine(tl);
|
2016-07-21 21:46:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2016-07-23 15:26:15 +02:00
|
|
|
/**
|
|
|
|
* @brief VTextManager::Update updates the text lines with pattern info
|
|
|
|
* @param pDoc pointer to the abstract pattern object
|
|
|
|
*/
|
2016-08-15 13:03:59 +02:00
|
|
|
void VTextManager::Update(const VAbstractPattern *pDoc, qreal dSize, qreal dHeight)
|
2016-07-21 21:46:49 +02:00
|
|
|
{
|
2016-11-01 09:42:32 +01:00
|
|
|
ClearSourceLines();
|
2016-07-21 21:46:49 +02:00
|
|
|
TextLine tl;
|
|
|
|
// all information must be centered
|
|
|
|
tl.m_eAlign = Qt::AlignCenter;
|
|
|
|
|
|
|
|
// Company name
|
2016-07-22 11:56:45 +02:00
|
|
|
tl.m_qsText = pDoc->GetCompanyName();
|
2016-07-21 21:46:49 +02:00
|
|
|
if (tl.m_qsText.isEmpty() == false)
|
|
|
|
{
|
|
|
|
tl.m_eFontWeight = QFont::DemiBold;
|
|
|
|
tl.m_eStyle = QFont::StyleNormal;
|
|
|
|
tl.m_iFontSize = 4;
|
2016-11-01 09:42:32 +01:00
|
|
|
AddSourceLine(tl);
|
2016-07-21 21:46:49 +02:00
|
|
|
}
|
|
|
|
// Pattern name
|
2016-07-22 11:56:45 +02:00
|
|
|
tl.m_qsText = pDoc->GetPatternName();
|
2016-07-21 21:46:49 +02:00
|
|
|
if (tl.m_qsText.isEmpty() == false)
|
|
|
|
{
|
|
|
|
tl.m_eFontWeight = QFont::Normal;
|
|
|
|
tl.m_eStyle = QFont::StyleNormal;
|
|
|
|
tl.m_iFontSize = 2;
|
2016-11-01 09:42:32 +01:00
|
|
|
AddSourceLine(tl);
|
2016-07-21 21:46:49 +02:00
|
|
|
}
|
|
|
|
// Pattern number
|
2016-07-22 11:56:45 +02:00
|
|
|
tl.m_qsText = pDoc->GetPatternNumber();
|
2016-07-21 21:46:49 +02:00
|
|
|
if (tl.m_qsText.isEmpty() == false)
|
|
|
|
{
|
|
|
|
tl.m_eFontWeight = QFont::Normal;
|
|
|
|
tl.m_eStyle = QFont::StyleNormal;
|
|
|
|
tl.m_iFontSize = 0;
|
2016-11-01 09:42:32 +01:00
|
|
|
AddSourceLine(tl);
|
2016-07-21 21:46:49 +02:00
|
|
|
}
|
|
|
|
// Customer name
|
2016-07-22 11:56:45 +02:00
|
|
|
tl.m_qsText = pDoc->GetCustomerName();
|
2016-07-21 21:46:49 +02:00
|
|
|
if (tl.m_qsText.isEmpty() == false)
|
|
|
|
{
|
|
|
|
tl.m_eFontWeight = QFont::Normal;
|
|
|
|
tl.m_eStyle = QFont::StyleItalic;
|
|
|
|
tl.m_iFontSize = 0;
|
2016-11-01 09:42:32 +01:00
|
|
|
AddSourceLine(tl);
|
2016-07-21 21:46:49 +02:00
|
|
|
}
|
|
|
|
// Size
|
2016-07-22 11:56:45 +02:00
|
|
|
tl.m_qsText = pDoc->GetPatternSize();
|
2016-07-21 21:46:49 +02:00
|
|
|
if (tl.m_qsText.isEmpty() == false)
|
|
|
|
{
|
2016-08-23 13:02:09 +02:00
|
|
|
// Such describing placeholders will help avoid mistake of localization.
|
|
|
|
// Translators very often remove '%'.
|
|
|
|
QString placeholder = QLatin1String("%") + qApp->TrVars()->PlaceholderToUser(pl_size) + QLatin1String("%");
|
|
|
|
tl.m_qsText.replace(placeholder, QString::number(dSize));
|
|
|
|
|
|
|
|
placeholder = QLatin1String("%") + qApp->TrVars()->PlaceholderToUser(pl_height) + QLatin1String("%");
|
|
|
|
tl.m_qsText.replace(placeholder, QString::number(dHeight));
|
|
|
|
|
2016-07-21 21:46:49 +02:00
|
|
|
tl.m_eFontWeight = QFont::Normal;
|
|
|
|
tl.m_eStyle = QFont::StyleNormal;
|
|
|
|
tl.m_iFontSize = 0;
|
2016-11-01 09:42:32 +01:00
|
|
|
AddSourceLine(tl);
|
2016-07-21 21:46:49 +02:00
|
|
|
}
|
2016-07-24 12:30:10 +02:00
|
|
|
// Measurements
|
2016-07-25 19:10:13 +02:00
|
|
|
tl.m_qsText = QFileInfo(pDoc->MPath()).fileName();
|
2016-07-24 12:30:10 +02:00
|
|
|
if (tl.m_qsText.isEmpty() == false && pDoc->IsMeasurementsVisible() == true)
|
|
|
|
{
|
|
|
|
tl.m_eFontWeight = QFont::Normal;
|
|
|
|
tl.m_eStyle = QFont::StyleNormal;
|
|
|
|
tl.m_iFontSize = 0;
|
2016-11-01 09:42:32 +01:00
|
|
|
AddSourceLine(tl);
|
2016-07-24 12:30:10 +02:00
|
|
|
}
|
2016-07-21 21:46:49 +02:00
|
|
|
// Date
|
2016-07-22 11:56:45 +02:00
|
|
|
QDate date;
|
|
|
|
if (pDoc->IsDateVisible() == true)
|
|
|
|
{
|
|
|
|
date = QDate::currentDate();
|
|
|
|
}
|
2016-07-21 21:46:49 +02:00
|
|
|
if (date.isValid() == true)
|
|
|
|
{
|
2017-06-29 13:47:24 +02:00
|
|
|
QLocale locale(qApp->Settings()->GetLocale());
|
|
|
|
tl.m_qsText = locale.toString(date, "dd MMMM yyyy");
|
2016-07-21 21:46:49 +02:00
|
|
|
tl.m_eFontWeight = QFont::Normal;
|
|
|
|
tl.m_eStyle = QFont::StyleNormal;
|
|
|
|
tl.m_iFontSize = 0;
|
2016-11-01 09:42:32 +01:00
|
|
|
AddSourceLine(tl);
|
2016-07-21 21:46:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|