Removed userDef attributes from DOM tree, where they are not necessary. Fixed some translations. Refactored finding the selected material in detail dialog
--HG-- branch : feature
This commit is contained in:
parent
3d06565f10
commit
b0532e6fb9
|
@ -689,7 +689,14 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
|
|||
MaterialCutPlacement mcp;
|
||||
QDomElement domMCP = nodeListMCP.at(iMCP).toElement();
|
||||
mcp.m_eMaterial = MaterialType(GetParametrUInt(domMCP, AttrMaterial, 0));
|
||||
if (mcp.m_eMaterial == MaterialType::mtUserDefined)
|
||||
{
|
||||
mcp.m_qsMaterialUserDef = GetParametrString(domMCP, AttrUserDefined, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
mcp.m_qsMaterialUserDef.clear();
|
||||
}
|
||||
mcp.m_iCutNumber = GetParametrUInt(domMCP, AttrCutNumber, 0);
|
||||
mcp.m_ePlacement = PlacementType(GetParametrUInt(domMCP, AttrPlacement, 0));
|
||||
detail.GetPatternPieceData().Append(mcp);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <QFontMetrics>
|
||||
#include <QLatin1String>
|
||||
#include <QRegularExpression>
|
||||
#include <QApplication>
|
||||
|
||||
#include "../ifc/xml/vabstractpattern.h"
|
||||
#include "../vpatterndb/vpatternpiecedata.h"
|
||||
|
@ -212,6 +213,11 @@ void VTextManager::Update(const QString& qsName, const VPatternPieceData& data)
|
|||
AddLine(tl);
|
||||
}
|
||||
// MCP
|
||||
QStringList qslMaterials;
|
||||
qslMaterials << QApplication::translate("Detail", "Fabric", 0)
|
||||
<< QApplication::translate("Detail", "Lining", 0)
|
||||
<< QApplication::translate("Detail", "Interfacing", 0)
|
||||
<< QApplication::translate("Detail", "Interlining", 0);
|
||||
QString qsText = tr("Cut %1 on %2%3");
|
||||
QStringList qslPlace;
|
||||
qslPlace << "" << QLatin1String(" ") + tr("on Fold");
|
||||
|
@ -222,7 +228,16 @@ void VTextManager::Update(const QString& qsName, const VPatternPieceData& data)
|
|||
MaterialCutPlacement mcp = data.GetMCP(i);
|
||||
if (mcp.m_iCutNumber > 0)
|
||||
{
|
||||
tl.m_qsText = qsText.arg(mcp.m_iCutNumber).arg(mcp.m_qsMaterialUserDef).
|
||||
QString qsMat;
|
||||
if (mcp.m_eMaterial == MaterialType::mtUserDefined)
|
||||
{
|
||||
qsMat = mcp.m_qsMaterialUserDef;
|
||||
}
|
||||
else
|
||||
{
|
||||
qsMat = qslMaterials[int(mcp.m_eMaterial)];
|
||||
}
|
||||
tl.m_qsText = qsText.arg(mcp.m_iCutNumber).arg(qsMat).
|
||||
arg(qslPlace[int(mcp.m_ePlacement)]);
|
||||
AddLine(tl);
|
||||
}
|
||||
|
|
|
@ -125,9 +125,16 @@ DialogDetail::DialogDetail(const VContainer *data, const quint32 &toolId, QWidge
|
|||
connect(ui.toolButtonUp, &QToolButton::clicked, this, &DialogDetail::ScrollUp);
|
||||
connect(ui.toolButtonDown, &QToolButton::clicked, this, &DialogDetail::ScrollDown);
|
||||
|
||||
m_qslMaterials << tr("Fabric") << tr("Lining") << tr("Interfacing") << tr("Interlining");
|
||||
m_qslMaterials << QApplication::translate("Detail", "Fabric", 0)
|
||||
<< QApplication::translate("Detail", "Lining", 0)
|
||||
<< QApplication::translate("Detail", "Interfacing", 0)
|
||||
<< QApplication::translate("Detail", "Interlining", 0);
|
||||
|
||||
ui.comboBoxMaterial->addItems(m_qslMaterials);
|
||||
//ui.comboBoxMaterial->addItems(m_qslMaterials);
|
||||
for (int i = 0; i < m_qslMaterials.count(); ++i)
|
||||
{
|
||||
ui.comboBoxMaterial->addItem(m_qslMaterials[i], i);
|
||||
}
|
||||
m_qslPlacements << tr("None") << tr("Cut on fold");
|
||||
ui.comboBoxPlacement->addItems(m_qslPlacements);
|
||||
|
||||
|
@ -237,13 +244,14 @@ void DialogDetail::AddUpdate()
|
|||
{
|
||||
MaterialCutPlacement mcp;
|
||||
mcp.m_qsMaterialUserDef = ui.comboBoxMaterial->currentText();
|
||||
mcp.m_eMaterial = MaterialType::mtUserDefined;
|
||||
for (int i = 0; i < m_qslMaterials.count(); ++i)
|
||||
{
|
||||
int i = ui.comboBoxMaterial->currentData().toInt();
|
||||
if (mcp.m_qsMaterialUserDef == m_qslMaterials[i])
|
||||
{
|
||||
mcp.m_eMaterial = MaterialType(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
mcp.m_eMaterial = MaterialType::mtUserDefined;
|
||||
}
|
||||
|
||||
mcp.m_iCutNumber = ui.spinBoxCutNumber->value();
|
||||
|
@ -414,8 +422,6 @@ VDetail DialogDetail::CreateDetail() const
|
|||
detail.GetPatternPieceData().SetRotation(m_oldData.GetRotation());
|
||||
detail.GetPatternPieceData().SetVisible(ui.checkBoxDetail->isChecked());
|
||||
|
||||
qDebug() << "DD VISIBLE" << detail.GetPatternPieceData().IsVisible();
|
||||
|
||||
detail.GetPatternInfo() = m_oldGeom;
|
||||
detail.GetPatternInfo().SetVisible(ui.checkBoxPattern->isChecked());
|
||||
|
||||
|
@ -781,7 +787,14 @@ void DialogDetail::SetEditMode()
|
|||
ui.pushButtonRemove->show();
|
||||
|
||||
MaterialCutPlacement mcp = m_conMCP.at(iR);
|
||||
if (mcp.m_eMaterial == MaterialType::mtUserDefined)
|
||||
{
|
||||
ui.comboBoxMaterial->setCurrentText(mcp.m_qsMaterialUserDef);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.comboBoxMaterial->setCurrentText(m_qslMaterials[int(mcp.m_eMaterial)]);
|
||||
}
|
||||
ui.spinBoxCutNumber->setValue(mcp.m_iCutNumber);
|
||||
ui.comboBoxPlacement->setCurrentIndex(int(mcp.m_ePlacement));
|
||||
|
||||
|
|
|
@ -444,7 +444,10 @@ void VToolDetail::AddToFile()
|
|||
MaterialCutPlacement mcp = data.GetMCP(i);
|
||||
QDomElement domMCP = doc->createElement(VAbstractPattern::TagMCP);
|
||||
doc->SetAttribute(domMCP, VAbstractPattern::AttrMaterial, int(mcp.m_eMaterial));
|
||||
if (mcp.m_eMaterial == MaterialType::mtUserDefined)
|
||||
{
|
||||
doc->SetAttribute(domMCP, VAbstractPattern::AttrUserDefined, mcp.m_qsMaterialUserDef);
|
||||
}
|
||||
doc->SetAttribute(domMCP, VAbstractPattern::AttrCutNumber, mcp.m_iCutNumber);
|
||||
doc->SetAttribute(domMCP, VAbstractPattern::AttrPlacement, int(mcp.m_ePlacement));
|
||||
domData.appendChild(domMCP);
|
||||
|
@ -503,7 +506,10 @@ void VToolDetail::RefreshDataInFile()
|
|||
MaterialCutPlacement mcp = data.GetMCP(i);
|
||||
QDomElement domMCP = doc->createElement(VAbstractPattern::TagMCP);
|
||||
doc->SetAttribute(domMCP, VAbstractPattern::AttrMaterial, int(mcp.m_eMaterial));
|
||||
if (mcp.m_eMaterial == MaterialType::mtUserDefined)
|
||||
{
|
||||
doc->SetAttribute(domMCP, VAbstractPattern::AttrUserDefined, mcp.m_qsMaterialUserDef);
|
||||
}
|
||||
doc->SetAttribute(domMCP, VAbstractPattern::AttrCutNumber, mcp.m_iCutNumber);
|
||||
doc->SetAttribute(domMCP, VAbstractPattern::AttrPlacement, int(mcp.m_ePlacement));
|
||||
domData.appendChild(domMCP);
|
||||
|
|
|
@ -161,7 +161,10 @@ void SaveDetailOptions::SavePatternPieceData(QDomElement &domElement, const VDet
|
|||
MaterialCutPlacement mcp = data.GetMCP(i);
|
||||
QDomElement domMCP = doc->createElement(VAbstractPattern::TagMCP);
|
||||
doc->SetAttribute(domMCP, VAbstractPattern::AttrMaterial, int(mcp.m_eMaterial));
|
||||
if (mcp.m_eMaterial == MaterialType::mtUserDefined)
|
||||
{
|
||||
doc->SetAttribute(domMCP, VAbstractPattern::AttrUserDefined, mcp.m_qsMaterialUserDef);
|
||||
}
|
||||
doc->SetAttribute(domMCP, VAbstractPattern::AttrCutNumber, mcp.m_iCutNumber);
|
||||
doc->SetAttribute(domMCP, VAbstractPattern::AttrPlacement, int(mcp.m_ePlacement));
|
||||
domData.appendChild(domMCP);
|
||||
|
|
Loading…
Reference in New Issue
Block a user