Move documantation to cpp file.
--HG-- branch : feature
This commit is contained in:
parent
55a7ba99a4
commit
34f9451460
|
@ -76,6 +76,10 @@ VPattern::VPattern(VContainer *data, QComboBox *comboBoxDraws, Valentina::Draws
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief CreateEmptyFile create minimal empty file.
|
||||||
|
* @param tablePath path to measurement file (standard or individual)
|
||||||
|
*/
|
||||||
void VPattern::CreateEmptyFile(const QString &tablePath)
|
void VPattern::CreateEmptyFile(const QString &tablePath)
|
||||||
{
|
{
|
||||||
if (tablePath.isEmpty())
|
if (tablePath.isEmpty())
|
||||||
|
@ -107,6 +111,11 @@ void VPattern::CreateEmptyFile(const QString &tablePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief ChangeActivDraw set new pattern peace name.
|
||||||
|
* @param name new name.
|
||||||
|
* @param parse parser file mode.
|
||||||
|
*/
|
||||||
void VPattern::ChangeActivDraw(const QString &name, const Document::Documents &parse)
|
void VPattern::ChangeActivDraw(const QString &name, const Document::Documents &parse)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(name.isEmpty() == false, "ChangeActivDraw", "name draw is empty");
|
Q_ASSERT_X(name.isEmpty() == false, "ChangeActivDraw", "name draw is empty");
|
||||||
|
@ -124,6 +133,11 @@ void VPattern::ChangeActivDraw(const QString &name, const Document::Documents &p
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief GetActivDrawElement return draw tag for current pattern peace.
|
||||||
|
* @param element draw tag.
|
||||||
|
* @return true if found.
|
||||||
|
*/
|
||||||
bool VPattern::GetActivDrawElement(QDomElement &element) const
|
bool VPattern::GetActivDrawElement(QDomElement &element) const
|
||||||
{
|
{
|
||||||
if (nameActivDraw.isEmpty() == false)
|
if (nameActivDraw.isEmpty() == false)
|
||||||
|
@ -150,6 +164,11 @@ bool VPattern::GetActivDrawElement(QDomElement &element) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief appendDraw add new pattern peace structure to the file.
|
||||||
|
* @param name pattern peace name.
|
||||||
|
* @return true if success.
|
||||||
|
*/
|
||||||
bool VPattern::appendDraw(const QString &name)
|
bool VPattern::appendDraw(const QString &name)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(name.isEmpty() == false, "appendDraw", "name draw is empty");
|
Q_ASSERT_X(name.isEmpty() == false, "appendDraw", "name draw is empty");
|
||||||
|
@ -184,6 +203,11 @@ bool VPattern::appendDraw(const QString &name)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief SetNameDraw change current pattern peace.
|
||||||
|
* @param name pattern peace name.
|
||||||
|
* @return true if success.
|
||||||
|
*/
|
||||||
bool VPattern::SetNameDraw(const QString &name)
|
bool VPattern::SetNameDraw(const QString &name)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(name.isEmpty() == false, "SetNameDraw", "name draw is empty");
|
Q_ASSERT_X(name.isEmpty() == false, "SetNameDraw", "name draw is empty");
|
||||||
|
@ -205,6 +229,12 @@ bool VPattern::SetNameDraw(const QString &name)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief Parse parse file.
|
||||||
|
* @param parse parser file mode.
|
||||||
|
* @param sceneDraw pointer to draw scene.
|
||||||
|
* @param sceneDetail pointer to details scene.
|
||||||
|
*/
|
||||||
void VPattern::Parse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail)
|
void VPattern::Parse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail)
|
||||||
{
|
{
|
||||||
Q_CHECK_PTR(sceneDraw);
|
Q_CHECK_PTR(sceneDraw);
|
||||||
|
@ -265,6 +295,11 @@ void VPattern::Parse(const Document::Documents &parse, VMainGraphicsScene *scene
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief getTool return tool from tool list.
|
||||||
|
* @param id tool id.
|
||||||
|
* @return tool.
|
||||||
|
*/
|
||||||
VDataTool *VPattern::getTool(const quint32 &id)
|
VDataTool *VPattern::getTool(const quint32 &id)
|
||||||
{
|
{
|
||||||
if (tools.contains(id))
|
if (tools.contains(id))
|
||||||
|
@ -280,6 +315,10 @@ VDataTool *VPattern::getTool(const quint32 &id)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief setCursor set cursor.
|
||||||
|
* @param value cursor.
|
||||||
|
*/
|
||||||
void VPattern::setCursor(const quint32 &value)
|
void VPattern::setCursor(const quint32 &value)
|
||||||
{
|
{
|
||||||
if (cursor != value)
|
if (cursor != value)
|
||||||
|
@ -290,6 +329,9 @@ void VPattern::setCursor(const quint32 &value)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief setCurrentData set current data set.
|
||||||
|
*/
|
||||||
void VPattern::setCurrentData()
|
void VPattern::setCurrentData()
|
||||||
{
|
{
|
||||||
if (*mode == Valentina::Calculation)
|
if (*mode == Valentina::Calculation)
|
||||||
|
@ -330,6 +372,11 @@ void VPattern::setCurrentData()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief AddTool add tool to list tools.
|
||||||
|
* @param id tool id.
|
||||||
|
* @param tool tool.
|
||||||
|
*/
|
||||||
void VPattern::AddTool(const quint32 &id, VDataTool *tool)
|
void VPattern::AddTool(const quint32 &id, VDataTool *tool)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
||||||
|
@ -338,6 +385,11 @@ void VPattern::AddTool(const quint32 &id, VDataTool *tool)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief UpdateToolData update tool in list tools.
|
||||||
|
* @param id tool id.
|
||||||
|
* @param data container with variables.
|
||||||
|
*/
|
||||||
void VPattern::UpdateToolData(const quint32 &id, VContainer *data)
|
void VPattern::UpdateToolData(const quint32 &id, VContainer *data)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
||||||
|
@ -348,6 +400,10 @@ void VPattern::UpdateToolData(const quint32 &id, VContainer *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief IncrementReferens increment reference parent objects.
|
||||||
|
* @param id parent object id.
|
||||||
|
*/
|
||||||
void VPattern::IncrementReferens(quint32 id) const
|
void VPattern::IncrementReferens(quint32 id) const
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
||||||
|
@ -357,6 +413,10 @@ void VPattern::IncrementReferens(quint32 id) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief DecrementReferens decrement reference parent objects.
|
||||||
|
* @param id parent object id.
|
||||||
|
*/
|
||||||
void VPattern::DecrementReferens(quint32 id) const
|
void VPattern::DecrementReferens(quint32 id) const
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
|
||||||
|
@ -366,6 +426,9 @@ void VPattern::DecrementReferens(quint32 id) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief TestUniqueId test exist unique id in pattern file. Each id must be unique.
|
||||||
|
*/
|
||||||
void VPattern::TestUniqueId() const
|
void VPattern::TestUniqueId() const
|
||||||
{
|
{
|
||||||
QVector<quint32> vector;
|
QVector<quint32> vector;
|
||||||
|
@ -373,6 +436,10 @@ void VPattern::TestUniqueId() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief SPointActiveDraw return id base point current pattern peace.
|
||||||
|
* @return id base point.
|
||||||
|
*/
|
||||||
quint32 VPattern::SPointActiveDraw()
|
quint32 VPattern::SPointActiveDraw()
|
||||||
{
|
{
|
||||||
QDomElement calcElement;
|
QDomElement calcElement;
|
||||||
|
@ -396,6 +463,11 @@ quint32 VPattern::SPointActiveDraw()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief CheckNameDraw check if exist pattern peace with this name.
|
||||||
|
* @param name pattern peace name.
|
||||||
|
* @return true if exist.
|
||||||
|
*/
|
||||||
bool VPattern::CheckNameDraw(const QString &name) const
|
bool VPattern::CheckNameDraw(const QString &name) const
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(name.isEmpty() == false, "CheckNameDraw", "name draw is empty");
|
Q_ASSERT_X(name.isEmpty() == false, "CheckNameDraw", "name draw is empty");
|
||||||
|
@ -419,6 +491,10 @@ bool VPattern::CheckNameDraw(const QString &name) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief SetActivDraw set current pattern peace.
|
||||||
|
* @param name pattern peace name.
|
||||||
|
*/
|
||||||
void VPattern::SetActivDraw(const QString &name)
|
void VPattern::SetActivDraw(const QString &name)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(name.isEmpty() == false, "SetActivDraw", "name draw is empty");
|
Q_ASSERT_X(name.isEmpty() == false, "SetActivDraw", "name draw is empty");
|
||||||
|
@ -426,6 +502,12 @@ void VPattern::SetActivDraw(const QString &name)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief GetActivNodeElement find element in current pattern piece by name.
|
||||||
|
* @param name name tag.
|
||||||
|
* @param element element.
|
||||||
|
* @return true if found.
|
||||||
|
*/
|
||||||
bool VPattern::GetActivNodeElement(const QString &name, QDomElement &element) const
|
bool VPattern::GetActivNodeElement(const QString &name, QDomElement &element) const
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(name.isEmpty() == false, "GetActivNodeElement", "name draw is empty");
|
Q_ASSERT_X(name.isEmpty() == false, "GetActivNodeElement", "name draw is empty");
|
||||||
|
@ -561,6 +643,9 @@ bool VPattern::SaveDocument(const QString &fileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief FullUpdateTree lite parse file.
|
||||||
|
*/
|
||||||
void VPattern::LiteParseTree()
|
void VPattern::LiteParseTree()
|
||||||
{
|
{
|
||||||
VMainGraphicsScene *scene = nullptr;
|
VMainGraphicsScene *scene = nullptr;
|
||||||
|
@ -631,6 +716,9 @@ void VPattern::LiteParseTree()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief haveLiteChange we have unsaved change.
|
||||||
|
*/
|
||||||
void VPattern::haveLiteChange()
|
void VPattern::haveLiteChange()
|
||||||
{
|
{
|
||||||
patternModified = true;
|
patternModified = true;
|
||||||
|
@ -638,12 +726,25 @@ void VPattern::haveLiteChange()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief ShowHistoryTool hightlight tool.
|
||||||
|
* @param id tool id.
|
||||||
|
* @param color hightlight color.
|
||||||
|
* @param enable enable or diasable hightlight.
|
||||||
|
*/
|
||||||
void VPattern::ShowHistoryTool(quint32 id, Qt::GlobalColor color, bool enable)
|
void VPattern::ShowHistoryTool(quint32 id, Qt::GlobalColor color, bool enable)
|
||||||
{
|
{
|
||||||
emit ShowTool(id, color, enable);
|
emit ShowTool(id, color, enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief ParseDrawElement parse draw tag.
|
||||||
|
* @param sceneDraw draw scene.
|
||||||
|
* @param sceneDetail details scene.
|
||||||
|
* @param node node.
|
||||||
|
* @param parse parser file mode.
|
||||||
|
*/
|
||||||
void VPattern::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, const QDomNode &node,
|
void VPattern::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, const QDomNode &node,
|
||||||
const Document::Documents &parse)
|
const Document::Documents &parse)
|
||||||
{
|
{
|
||||||
|
@ -679,6 +780,14 @@ void VPattern::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScen
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief ParseDrawMode parse draw tag with draw mode.
|
||||||
|
* @param sceneDraw draw scene.
|
||||||
|
* @param sceneDetail details scene.
|
||||||
|
* @param node node.
|
||||||
|
* @param parse parser file mode.
|
||||||
|
* @param mode draw mode.
|
||||||
|
*/
|
||||||
void VPattern::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, const QDomNode &node,
|
void VPattern::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, const QDomNode &node,
|
||||||
const Document::Documents &parse, const Valentina::Draws &mode)
|
const Document::Documents &parse, const Valentina::Draws &mode)
|
||||||
{
|
{
|
||||||
|
@ -727,6 +836,12 @@ void VPattern::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief ParseDetailElement parse detail tag.
|
||||||
|
* @param sceneDetail detail scene.
|
||||||
|
* @param domElement tag in xml tree.
|
||||||
|
* @param parse parser file mode.
|
||||||
|
*/
|
||||||
void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
|
void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
|
||||||
const Document::Documents &parse)
|
const Document::Documents &parse)
|
||||||
{
|
{
|
||||||
|
@ -794,6 +909,12 @@ void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomEle
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief ParseDetails parse details tag.
|
||||||
|
* @param sceneDetail detail scene.
|
||||||
|
* @param domElement tag in xml tree.
|
||||||
|
* @param parse parser file mode.
|
||||||
|
*/
|
||||||
void VPattern::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
|
void VPattern::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
|
||||||
const Document::Documents &parse)
|
const Document::Documents &parse)
|
||||||
{
|
{
|
||||||
|
@ -818,6 +939,13 @@ void VPattern::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief ParsePointElement parse point tag.
|
||||||
|
* @param scene scene.
|
||||||
|
* @param domElement tag in xml tree.
|
||||||
|
* @param parse parser file mode.
|
||||||
|
* @param type type of point.
|
||||||
|
*/
|
||||||
void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElement,
|
void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElement,
|
||||||
const Document::Documents &parse, const QString &type)
|
const Document::Documents &parse, const QString &type)
|
||||||
{
|
{
|
||||||
|
@ -1318,6 +1446,12 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief ParseLineElement parse line tag.
|
||||||
|
* @param scene scene.
|
||||||
|
* @param domElement tag in xml tree.
|
||||||
|
* @param parse parser file mode.
|
||||||
|
*/
|
||||||
void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
||||||
const Document::Documents &parse)
|
const Document::Documents &parse)
|
||||||
{
|
{
|
||||||
|
@ -1342,6 +1476,13 @@ void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &do
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief ParseSplineElement parse spline tag.
|
||||||
|
* @param scene scene.
|
||||||
|
* @param domElement tag in xml tree.
|
||||||
|
* @param parse parser file mode.
|
||||||
|
* @param type type of spline.
|
||||||
|
*/
|
||||||
void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
||||||
const Document::Documents &parse, const QString &type)
|
const Document::Documents &parse, const QString &type)
|
||||||
{
|
{
|
||||||
|
@ -1464,6 +1605,13 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief ParseArcElement parse arc tag.
|
||||||
|
* @param scene scene.
|
||||||
|
* @param domElement tag in xml tree.
|
||||||
|
* @param parse parser file mode.
|
||||||
|
* @param type type of spline.
|
||||||
|
*/
|
||||||
void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document::Documents &parse,
|
void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document::Documents &parse,
|
||||||
const QString &type)
|
const QString &type)
|
||||||
{
|
{
|
||||||
|
@ -1538,6 +1686,13 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElemen
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief ParseToolsElement parse tools tag.
|
||||||
|
* @param scene scene.
|
||||||
|
* @param domElement tag in xml tree.
|
||||||
|
* @param parse parser file mode.
|
||||||
|
* @param type type of spline.
|
||||||
|
*/
|
||||||
void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
||||||
const Document::Documents &parse, const QString &type)
|
const Document::Documents &parse, const QString &type)
|
||||||
{
|
{
|
||||||
|
@ -1575,6 +1730,10 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief ParseIncrementsElement parse increments tag.
|
||||||
|
* @param node tag in xml tree.
|
||||||
|
*/
|
||||||
void VPattern::ParseIncrementsElement(const QDomNode &node)
|
void VPattern::ParseIncrementsElement(const QDomNode &node)
|
||||||
{
|
{
|
||||||
QDomNode domNode = node.firstChild();
|
QDomNode domNode = node.firstChild();
|
||||||
|
@ -1603,6 +1762,11 @@ void VPattern::ParseIncrementsElement(const QDomNode &node)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief GetParametrId return value id attribute.
|
||||||
|
* @param domElement tag in xml tree.
|
||||||
|
* @return id value.
|
||||||
|
*/
|
||||||
quint32 VPattern::GetParametrId(const QDomElement &domElement) const
|
quint32 VPattern::GetParametrId(const QDomElement &domElement) const
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
||||||
|
@ -1628,6 +1792,11 @@ quint32 VPattern::GetParametrId(const QDomElement &domElement) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief CollectId recursive function, try find id attribute in file. Throw exclusion if find not unique.
|
||||||
|
* @param node tag in xml tree.
|
||||||
|
* @param vector list with ids.
|
||||||
|
*/
|
||||||
void VPattern::CollectId(const QDomElement &node, QVector<quint32> &vector) const
|
void VPattern::CollectId(const QDomElement &node, QVector<quint32> &vector) const
|
||||||
{
|
{
|
||||||
if (node.hasAttribute(VDomDocument::AttrId))
|
if (node.hasAttribute(VDomDocument::AttrId))
|
||||||
|
|
|
@ -63,117 +63,28 @@ class VPattern : public QObject, public VDomDocument
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VPattern(VContainer *data, QComboBox *comboBoxDraws, Valentina::Draws *mode, QObject *parent = nullptr);
|
VPattern(VContainer *data, QComboBox *comboBoxDraws, Valentina::Draws *mode, QObject *parent = nullptr);
|
||||||
/**
|
|
||||||
* @brief CreateEmptyFile create minimal empty file.
|
|
||||||
* @param tablePath path to measurement file (standard or individual)
|
|
||||||
*/
|
|
||||||
void CreateEmptyFile(const QString &tablePath);
|
void CreateEmptyFile(const QString &tablePath);
|
||||||
/**
|
|
||||||
* @brief ChangeActivDraw set new pattern peace name.
|
|
||||||
* @param name new name.
|
|
||||||
* @param parse parser file mode.
|
|
||||||
*/
|
|
||||||
void ChangeActivDraw(const QString& name, const Document::Documents &parse = Document::FullParse);
|
void ChangeActivDraw(const QString& name, const Document::Documents &parse = Document::FullParse);
|
||||||
/**
|
|
||||||
* @brief GetNameActivDraw return current pattern peace name.
|
|
||||||
* @return pattern peace name.
|
|
||||||
*/
|
|
||||||
QString GetNameActivDraw() const;
|
QString GetNameActivDraw() const;
|
||||||
/**
|
|
||||||
* @brief GetActivDrawElement return draw tag for current pattern peace.
|
|
||||||
* @param element draw tag.
|
|
||||||
* @return true if found.
|
|
||||||
*/
|
|
||||||
bool GetActivDrawElement(QDomElement &element) const;
|
bool GetActivDrawElement(QDomElement &element) const;
|
||||||
/**
|
|
||||||
* @brief appendDraw add new pattern peace structure to the file.
|
|
||||||
* @param name pattern peace name.
|
|
||||||
* @return true if success.
|
|
||||||
*/
|
|
||||||
bool appendDraw(const QString& name);
|
bool appendDraw(const QString& name);
|
||||||
/**
|
|
||||||
* @brief SetNameDraw change current pattern peace.
|
|
||||||
* @param name pattern peace name.
|
|
||||||
* @return true if success.
|
|
||||||
*/
|
|
||||||
bool SetNameDraw(const QString& name);
|
bool SetNameDraw(const QString& name);
|
||||||
/**
|
|
||||||
* @brief Parse parse file.
|
|
||||||
* @param parse parser file mode.
|
|
||||||
* @param sceneDraw pointer to draw scene.
|
|
||||||
* @param sceneDetail pointer to details scene.
|
|
||||||
*/
|
|
||||||
void Parse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw,
|
void Parse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw,
|
||||||
VMainGraphicsScene *sceneDetail);
|
VMainGraphicsScene *sceneDetail);
|
||||||
/**
|
|
||||||
* @brief getTools return list of tools pointers.
|
|
||||||
* @return list.
|
|
||||||
*/
|
|
||||||
QHash<quint32, VDataTool*>* getTools();
|
QHash<quint32, VDataTool*>* getTools();
|
||||||
/**
|
|
||||||
* @brief getTool return tool from tool list.
|
|
||||||
* @param id tool id.
|
|
||||||
* @return tool.
|
|
||||||
*/
|
|
||||||
VDataTool* getTool(const quint32 &id);
|
VDataTool* getTool(const quint32 &id);
|
||||||
/**
|
|
||||||
* @brief getHistory return list with list of history records.
|
|
||||||
* @return list of history records.
|
|
||||||
*/
|
|
||||||
QVector<VToolRecord> *getHistory();
|
QVector<VToolRecord> *getHistory();
|
||||||
/**
|
|
||||||
* @brief getCursor return cursor.
|
|
||||||
* @return cursor.
|
|
||||||
*/
|
|
||||||
quint32 getCursor() const;
|
quint32 getCursor() const;
|
||||||
/**
|
|
||||||
* @brief setCursor set cursor.
|
|
||||||
* @param value cursor.
|
|
||||||
*/
|
|
||||||
void setCursor(const quint32 &value);
|
void setCursor(const quint32 &value);
|
||||||
/**
|
|
||||||
* @brief setCurrentData set current data set.
|
|
||||||
*/
|
|
||||||
void setCurrentData();
|
void setCurrentData();
|
||||||
/**
|
|
||||||
* @brief AddTool add tool to list tools.
|
|
||||||
* @param id tool id.
|
|
||||||
* @param tool tool.
|
|
||||||
*/
|
|
||||||
void AddTool(const quint32 &id, VDataTool *tool);
|
void AddTool(const quint32 &id, VDataTool *tool);
|
||||||
/**
|
|
||||||
* @brief UpdateToolData update tool in list tools.
|
|
||||||
* @param id tool id.
|
|
||||||
* @param data container with variables.
|
|
||||||
*/
|
|
||||||
void UpdateToolData(const quint32 &id, VContainer *data);
|
void UpdateToolData(const quint32 &id, VContainer *data);
|
||||||
/**
|
|
||||||
* @brief IncrementReferens increment reference parent objects.
|
|
||||||
* @param id parent object id.
|
|
||||||
*/
|
|
||||||
void IncrementReferens(quint32 id) const;
|
void IncrementReferens(quint32 id) const;
|
||||||
/**
|
|
||||||
* @brief DecrementReferens decrement reference parent objects.
|
|
||||||
* @param id parent object id.
|
|
||||||
*/
|
|
||||||
void DecrementReferens(quint32 id) const;
|
void DecrementReferens(quint32 id) const;
|
||||||
/**
|
|
||||||
* @brief TestUniqueId test exist unique id in pattern file. Each id must be unique.
|
|
||||||
*/
|
|
||||||
void TestUniqueId() const;
|
void TestUniqueId() const;
|
||||||
/**
|
|
||||||
* @brief SPointActiveDraw return id base point current pattern peace.
|
|
||||||
* @return id base point.
|
|
||||||
*/
|
|
||||||
quint32 SPointActiveDraw();
|
quint32 SPointActiveDraw();
|
||||||
bool isPatternModified() const;
|
bool isPatternModified() const;
|
||||||
void setPatternModified(bool value);
|
void setPatternModified(bool value);
|
||||||
/**
|
|
||||||
* @brief GetActivNodeElement find element in current pattern piece by name.
|
|
||||||
* @param name name tag.
|
|
||||||
* @param element element.
|
|
||||||
* @return true if found.
|
|
||||||
*/
|
|
||||||
bool GetActivNodeElement(const QString& name, QDomElement& element) const;
|
bool GetActivNodeElement(const QString& name, QDomElement& element) const;
|
||||||
QString MPath() const;
|
QString MPath() const;
|
||||||
void SetPath(const QString &path);
|
void SetPath(const QString &path);
|
||||||
|
@ -238,186 +149,107 @@ signals:
|
||||||
void ChangedCursor(quint32 id);
|
void ChangedCursor(quint32 id);
|
||||||
void ClearMainWindow();
|
void ClearMainWindow();
|
||||||
public slots:
|
public slots:
|
||||||
/**
|
|
||||||
* @brief FullUpdateTree lite parse file.
|
|
||||||
*/
|
|
||||||
void LiteParseTree();
|
void LiteParseTree();
|
||||||
/**
|
|
||||||
* @brief haveLiteChange we have unsaved change.
|
|
||||||
*/
|
|
||||||
void haveLiteChange();
|
void haveLiteChange();
|
||||||
/**
|
|
||||||
* @brief ShowHistoryTool hightlight tool.
|
|
||||||
* @param id tool id.
|
|
||||||
* @param color hightlight color.
|
|
||||||
* @param enable enable or diasable hightlight.
|
|
||||||
*/
|
|
||||||
void ShowHistoryTool(quint32 id, Qt::GlobalColor color, bool enable);
|
void ShowHistoryTool(quint32 id, Qt::GlobalColor color, bool enable);
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VPattern)
|
Q_DISABLE_COPY(VPattern)
|
||||||
/**
|
|
||||||
* @brief nameActivDraw name current pattern peace.
|
|
||||||
*/
|
|
||||||
QString nameActivDraw;
|
|
||||||
/**
|
|
||||||
* @brief tools list with pointer on tools.
|
|
||||||
*/
|
|
||||||
QHash<quint32, VDataTool*> tools;
|
|
||||||
/**
|
|
||||||
* @brief history history records.
|
|
||||||
*/
|
|
||||||
QVector<VToolRecord> history;
|
|
||||||
/**
|
|
||||||
* @brief cursor cursor keep id tool after which we will add new tool in file.
|
|
||||||
*/
|
|
||||||
quint32 cursor;
|
|
||||||
QComboBox *comboBoxDraws;
|
|
||||||
/**
|
|
||||||
* @brief mode current draw mode.
|
|
||||||
*/
|
|
||||||
Valentina::Draws *mode;
|
|
||||||
/**
|
|
||||||
* @brief fileModified true if exist change in file.
|
|
||||||
*/
|
|
||||||
bool patternModified;
|
|
||||||
/**
|
|
||||||
* @brief CheckNameDraw check if exist pattern peace with this name.
|
|
||||||
* @param name pattern peace name.
|
|
||||||
* @return true if exist.
|
|
||||||
*/
|
|
||||||
bool CheckNameDraw(const QString& name) const;
|
|
||||||
/**
|
|
||||||
* @brief SetActivDraw set current pattern peace.
|
|
||||||
* @param name pattern peace name.
|
|
||||||
*/
|
|
||||||
void SetActivDraw(const QString& name);
|
|
||||||
|
|
||||||
/**
|
/** @brief nameActivDraw name current pattern peace. */
|
||||||
* @brief ParseDrawElement parse draw tag.
|
QString nameActivDraw;
|
||||||
* @param sceneDraw draw scene.
|
|
||||||
* @param sceneDetail details scene.
|
/** @brief tools list with pointer on tools. */
|
||||||
* @param node node.
|
QHash<quint32, VDataTool*> tools;
|
||||||
* @param parse parser file mode.
|
|
||||||
*/
|
/** @brief history history records. */
|
||||||
|
QVector<VToolRecord> history;
|
||||||
|
|
||||||
|
/** @brief cursor cursor keep id tool after which we will add new tool in file. */
|
||||||
|
quint32 cursor;
|
||||||
|
|
||||||
|
QComboBox *comboBoxDraws;
|
||||||
|
|
||||||
|
/** @brief mode current draw mode. */
|
||||||
|
Valentina::Draws *mode;
|
||||||
|
|
||||||
|
/** @brief fileModified true if exist change in file. */
|
||||||
|
bool patternModified;
|
||||||
|
|
||||||
|
bool CheckNameDraw(const QString& name) const;
|
||||||
|
void SetActivDraw(const QString& name);
|
||||||
void ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail,
|
void ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail,
|
||||||
const QDomNode& node, const Document::Documents &parse);
|
const QDomNode& node, const Document::Documents &parse);
|
||||||
/**
|
|
||||||
* @brief ParseDrawMode parse draw tag with draw mode.
|
|
||||||
* @param sceneDraw draw scene.
|
|
||||||
* @param sceneDetail details scene.
|
|
||||||
* @param node node.
|
|
||||||
* @param parse parser file mode.
|
|
||||||
* @param mode draw mode.
|
|
||||||
*/
|
|
||||||
void ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail,
|
void ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail,
|
||||||
const QDomNode& node, const Document::Documents &parse, const Valentina::Draws &mode);
|
const QDomNode& node, const Document::Documents &parse, const Valentina::Draws &mode);
|
||||||
/**
|
|
||||||
* @brief ParseDetailElement parse detail tag.
|
|
||||||
* @param sceneDetail detail scene.
|
|
||||||
* @param domElement tag in xml tree.
|
|
||||||
* @param parse parser file mode.
|
|
||||||
*/
|
|
||||||
void ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
|
void ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
|
||||||
const Document::Documents &parse);
|
const Document::Documents &parse);
|
||||||
/**
|
|
||||||
* @brief ParseDetails parse details tag.
|
|
||||||
* @param sceneDetail detail scene.
|
|
||||||
* @param domElement tag in xml tree.
|
|
||||||
* @param parse parser file mode.
|
|
||||||
*/
|
|
||||||
void ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
|
void ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
|
||||||
const Document::Documents &parse);
|
const Document::Documents &parse);
|
||||||
/**
|
|
||||||
* @brief ParsePointElement parse point tag.
|
|
||||||
* @param scene scene.
|
|
||||||
* @param domElement tag in xml tree.
|
|
||||||
* @param parse parser file mode.
|
|
||||||
* @param type type of point.
|
|
||||||
*/
|
|
||||||
void ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElement,
|
void ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElement,
|
||||||
const Document::Documents &parse, const QString &type);
|
const Document::Documents &parse, const QString &type);
|
||||||
/**
|
|
||||||
* @brief ParseLineElement parse line tag.
|
|
||||||
* @param scene scene.
|
|
||||||
* @param domElement tag in xml tree.
|
|
||||||
* @param parse parser file mode.
|
|
||||||
*/
|
|
||||||
void ParseLineElement(VMainGraphicsScene *scene, const QDomElement& domElement,
|
void ParseLineElement(VMainGraphicsScene *scene, const QDomElement& domElement,
|
||||||
const Document::Documents &parse);
|
const Document::Documents &parse);
|
||||||
/**
|
|
||||||
* @brief ParseSplineElement parse spline tag.
|
|
||||||
* @param scene scene.
|
|
||||||
* @param domElement tag in xml tree.
|
|
||||||
* @param parse parser file mode.
|
|
||||||
* @param type type of spline.
|
|
||||||
*/
|
|
||||||
void ParseSplineElement(VMainGraphicsScene *scene, const QDomElement& domElement,
|
void ParseSplineElement(VMainGraphicsScene *scene, const QDomElement& domElement,
|
||||||
const Document::Documents &parse, const QString& type);
|
const Document::Documents &parse, const QString& type);
|
||||||
/**
|
|
||||||
* @brief ParseArcElement parse arc tag.
|
|
||||||
* @param scene scene.
|
|
||||||
* @param domElement tag in xml tree.
|
|
||||||
* @param parse parser file mode.
|
|
||||||
* @param type type of spline.
|
|
||||||
*/
|
|
||||||
void ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElement,
|
void ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElement,
|
||||||
const Document::Documents &parse, const QString& type);
|
const Document::Documents &parse, const QString& type);
|
||||||
/**
|
|
||||||
* @brief ParseToolsElement parse tools tag.
|
|
||||||
* @param scene scene.
|
|
||||||
* @param domElement tag in xml tree.
|
|
||||||
* @param parse parser file mode.
|
|
||||||
* @param type type of spline.
|
|
||||||
*/
|
|
||||||
void ParseToolsElement(VMainGraphicsScene *scene, const QDomElement& domElement,
|
void ParseToolsElement(VMainGraphicsScene *scene, const QDomElement& domElement,
|
||||||
const Document::Documents &parse, const QString& type);
|
const Document::Documents &parse, const QString& type);
|
||||||
/**
|
|
||||||
* @brief ParseIncrementsElement parse increments tag.
|
|
||||||
* @param node tag in xml tree.
|
|
||||||
*/
|
|
||||||
void ParseIncrementsElement(const QDomNode& node);
|
void ParseIncrementsElement(const QDomNode& node);
|
||||||
/**
|
|
||||||
* @brief GetParametrId return value id attribute.
|
|
||||||
* @param domElement tag in xml tree.
|
|
||||||
* @return id value.
|
|
||||||
*/
|
|
||||||
quint32 GetParametrId(const QDomElement& domElement) const;
|
quint32 GetParametrId(const QDomElement& domElement) const;
|
||||||
/**
|
|
||||||
* @brief CollectId recursive function, try find id attribute in file. Throw exclusion if find not unique.
|
|
||||||
* @param node tag in xml tree.
|
|
||||||
* @param vector list with ids.
|
|
||||||
*/
|
|
||||||
void CollectId(const QDomElement &node, QVector<quint32> &vector)const;
|
void CollectId(const QDomElement &node, QVector<quint32> &vector)const;
|
||||||
void PrepareForParse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw,
|
void PrepareForParse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw,
|
||||||
VMainGraphicsScene *sceneDetail);
|
VMainGraphicsScene *sceneDetail);
|
||||||
void UpdateMeasurements();
|
void UpdateMeasurements();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief GetNameActivDraw return current pattern peace name.
|
||||||
|
* @return pattern peace name.
|
||||||
|
*/
|
||||||
inline QString VPattern::GetNameActivDraw() const
|
inline QString VPattern::GetNameActivDraw() const
|
||||||
{
|
{
|
||||||
return nameActivDraw;
|
return nameActivDraw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief getTools return list of tools pointers.
|
||||||
|
* @return list.
|
||||||
|
*/
|
||||||
inline QHash<quint32, VDataTool *> *VPattern::getTools()
|
inline QHash<quint32, VDataTool *> *VPattern::getTools()
|
||||||
{
|
{
|
||||||
return &tools;
|
return &tools;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief getHistory return list with list of history records.
|
||||||
|
* @return list of history records.
|
||||||
|
*/
|
||||||
inline QVector<VToolRecord> *VPattern::getHistory()
|
inline QVector<VToolRecord> *VPattern::getHistory()
|
||||||
{
|
{
|
||||||
return &history;
|
return &history;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief getCursor return cursor.
|
||||||
|
* @return cursor.
|
||||||
|
*/
|
||||||
inline quint32 VPattern::getCursor() const
|
inline quint32 VPattern::getCursor() const
|
||||||
{
|
{
|
||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline bool VPattern::isPatternModified() const
|
inline bool VPattern::isPatternModified() const
|
||||||
{
|
{
|
||||||
return patternModified;
|
return patternModified;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline void VPattern::setPatternModified(bool value)
|
inline void VPattern::setPatternModified(bool value)
|
||||||
{
|
{
|
||||||
patternModified = value;
|
patternModified = value;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user