Use pointers to scenes.
--HG-- branch : feature
This commit is contained in:
parent
c03464144e
commit
b646a11bc0
|
@ -1886,7 +1886,7 @@ void MainWindow::LoadPattern(const QString &fileName)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
doc->Parse(Document::FullParse, sceneDraw, sceneDetails);
|
doc->Parse(Document::FullParse);
|
||||||
}
|
}
|
||||||
catch (const VExceptionObjectError &e)
|
catch (const VExceptionObjectError &e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -240,14 +240,14 @@ bool VPattern::SetNameDraw(const QString &name)
|
||||||
* @param sceneDraw pointer to draw scene.
|
* @param sceneDraw pointer to draw scene.
|
||||||
* @param sceneDetail pointer to details 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)
|
||||||
{
|
{
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
#endif
|
#endif
|
||||||
Q_CHECK_PTR(sceneDraw);
|
SCASSERT(sceneDraw != nullptr);
|
||||||
Q_CHECK_PTR(sceneDetail);
|
SCASSERT(sceneDetail != nullptr);
|
||||||
PrepareForParse(parse, sceneDraw, sceneDetail);
|
PrepareForParse(parse);
|
||||||
QDomNode domNode = documentElement().firstChild();
|
QDomNode domNode = documentElement().firstChild();
|
||||||
while (domNode.isNull() == false)
|
while (domNode.isNull() == false)
|
||||||
{
|
{
|
||||||
|
@ -661,50 +661,42 @@ bool VPattern::SaveDocument(const QString &fileName)
|
||||||
*/
|
*/
|
||||||
void VPattern::LiteParseTree()
|
void VPattern::LiteParseTree()
|
||||||
{
|
{
|
||||||
VMainGraphicsScene *scene = nullptr;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
scene = new VMainGraphicsScene();
|
Parse(Document::LiteParse);
|
||||||
Parse(Document::LiteParse, scene, scene);
|
|
||||||
}
|
}
|
||||||
catch (const VExceptionObjectError &e)
|
catch (const VExceptionObjectError &e)
|
||||||
{
|
{
|
||||||
delete scene;
|
|
||||||
e.CriticalMessageBox(tr("Error parsing file."));
|
e.CriticalMessageBox(tr("Error parsing file."));
|
||||||
emit ClearMainWindow();
|
emit ClearMainWindow();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (const VExceptionConversionError &e)
|
catch (const VExceptionConversionError &e)
|
||||||
{
|
{
|
||||||
delete scene;
|
|
||||||
e.CriticalMessageBox(tr("Error can't convert value."));
|
e.CriticalMessageBox(tr("Error can't convert value."));
|
||||||
emit ClearMainWindow();
|
emit ClearMainWindow();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (const VExceptionEmptyParameter &e)
|
catch (const VExceptionEmptyParameter &e)
|
||||||
{
|
{
|
||||||
delete scene;
|
|
||||||
e.CriticalMessageBox(tr("Error empty parameter."));
|
e.CriticalMessageBox(tr("Error empty parameter."));
|
||||||
emit ClearMainWindow();
|
emit ClearMainWindow();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (const VExceptionWrongId &e)
|
catch (const VExceptionWrongId &e)
|
||||||
{
|
{
|
||||||
delete scene;
|
|
||||||
e.CriticalMessageBox(tr("Error wrong id."));
|
e.CriticalMessageBox(tr("Error wrong id."));
|
||||||
emit ClearMainWindow();
|
emit ClearMainWindow();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (VException &e)
|
catch (VException &e)
|
||||||
{
|
{
|
||||||
delete scene;
|
|
||||||
e.CriticalMessageBox(tr("Error parsing file."));
|
e.CriticalMessageBox(tr("Error parsing file."));
|
||||||
emit ClearMainWindow();
|
emit ClearMainWindow();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (const std::bad_alloc &)
|
catch (const std::bad_alloc &)
|
||||||
{
|
{
|
||||||
delete scene;
|
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
#endif
|
#endif
|
||||||
|
@ -723,7 +715,6 @@ void VPattern::LiteParseTree()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete scene;
|
|
||||||
setCurrentData();
|
setCurrentData();
|
||||||
emit FullUpdateFromFile();
|
emit FullUpdateFromFile();
|
||||||
}
|
}
|
||||||
|
@ -1834,11 +1825,10 @@ void VPattern::CollectId(const QDomElement &node, QVector<quint32> &vector) cons
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPattern::PrepareForParse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw,
|
void VPattern::PrepareForParse(const Document::Documents &parse)
|
||||||
VMainGraphicsScene *sceneDetail)
|
|
||||||
{
|
{
|
||||||
Q_CHECK_PTR(sceneDraw);
|
SCASSERT(sceneDraw != nullptr);
|
||||||
Q_CHECK_PTR(sceneDetail);
|
SCASSERT(sceneDetail != nullptr);
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
TestUniqueId();
|
TestUniqueId();
|
||||||
|
|
|
@ -70,8 +70,7 @@ public:
|
||||||
bool GetActivDrawElement(QDomElement &element) const;
|
bool GetActivDrawElement(QDomElement &element) const;
|
||||||
bool appendDraw(const QString& name);
|
bool appendDraw(const QString& name);
|
||||||
bool SetNameDraw(const QString& name);
|
bool SetNameDraw(const QString& name);
|
||||||
void Parse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw,
|
void Parse(const Document::Documents &parse);
|
||||||
VMainGraphicsScene *sceneDetail);
|
|
||||||
QHash<quint32, VDataTool*>* getTools();
|
QHash<quint32, VDataTool*>* getTools();
|
||||||
VDataTool* getTool(const quint32 &id);
|
VDataTool* getTool(const quint32 &id);
|
||||||
QVector<VToolRecord> *getHistory();
|
QVector<VToolRecord> *getHistory();
|
||||||
|
@ -203,8 +202,7 @@ private:
|
||||||
void ParseIncrementsElement(const QDomNode& node);
|
void ParseIncrementsElement(const QDomNode& node);
|
||||||
quint32 GetParametrId(const QDomElement& domElement) const;
|
quint32 GetParametrId(const QDomElement& domElement) const;
|
||||||
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 *sceneDetail);
|
|
||||||
void UpdateMeasurements();
|
void UpdateMeasurements();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user