diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp index 80bc87533..d1a264a8f 100644 --- a/src/app/mainwindow.cpp +++ b/src/app/mainwindow.cpp @@ -1886,7 +1886,7 @@ void MainWindow::LoadPattern(const QString &fileName) try { - doc->Parse(Document::FullParse, sceneDraw, sceneDetails); + doc->Parse(Document::FullParse); } catch (const VExceptionObjectError &e) { diff --git a/src/app/xml/vpattern.cpp b/src/app/xml/vpattern.cpp index 9430e8aec..0fcfff830 100644 --- a/src/app/xml/vpattern.cpp +++ b/src/app/xml/vpattern.cpp @@ -240,14 +240,14 @@ bool VPattern::SetNameDraw(const QString &name) * @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) { #ifndef QT_NO_CURSOR QApplication::setOverrideCursor(Qt::WaitCursor); #endif - Q_CHECK_PTR(sceneDraw); - Q_CHECK_PTR(sceneDetail); - PrepareForParse(parse, sceneDraw, sceneDetail); + SCASSERT(sceneDraw != nullptr); + SCASSERT(sceneDetail != nullptr); + PrepareForParse(parse); QDomNode domNode = documentElement().firstChild(); while (domNode.isNull() == false) { @@ -661,50 +661,42 @@ bool VPattern::SaveDocument(const QString &fileName) */ void VPattern::LiteParseTree() { - VMainGraphicsScene *scene = nullptr; try { - scene = new VMainGraphicsScene(); - Parse(Document::LiteParse, scene, scene); + Parse(Document::LiteParse); } catch (const VExceptionObjectError &e) { - delete scene; e.CriticalMessageBox(tr("Error parsing file.")); emit ClearMainWindow(); return; } catch (const VExceptionConversionError &e) { - delete scene; e.CriticalMessageBox(tr("Error can't convert value.")); emit ClearMainWindow(); return; } catch (const VExceptionEmptyParameter &e) { - delete scene; e.CriticalMessageBox(tr("Error empty parameter.")); emit ClearMainWindow(); return; } catch (const VExceptionWrongId &e) { - delete scene; e.CriticalMessageBox(tr("Error wrong id.")); emit ClearMainWindow(); return; } catch (VException &e) { - delete scene; e.CriticalMessageBox(tr("Error parsing file.")); emit ClearMainWindow(); return; } catch (const std::bad_alloc &) { - delete scene; #ifndef QT_NO_CURSOR QApplication::restoreOverrideCursor(); #endif @@ -723,7 +715,6 @@ void VPattern::LiteParseTree() return; } - delete scene; setCurrentData(); emit FullUpdateFromFile(); } @@ -1834,11 +1825,10 @@ void VPattern::CollectId(const QDomElement &node, QVector &vector) cons } //--------------------------------------------------------------------------------------------------------------------- -void VPattern::PrepareForParse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw, - VMainGraphicsScene *sceneDetail) +void VPattern::PrepareForParse(const Document::Documents &parse) { - Q_CHECK_PTR(sceneDraw); - Q_CHECK_PTR(sceneDetail); + SCASSERT(sceneDraw != nullptr); + SCASSERT(sceneDetail != nullptr); if (parse == Document::FullParse) { TestUniqueId(); diff --git a/src/app/xml/vpattern.h b/src/app/xml/vpattern.h index 6930b42b7..d662a1974 100644 --- a/src/app/xml/vpattern.h +++ b/src/app/xml/vpattern.h @@ -70,8 +70,7 @@ public: bool GetActivDrawElement(QDomElement &element) const; bool appendDraw(const QString& name); bool SetNameDraw(const QString& name); - void Parse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw, - VMainGraphicsScene *sceneDetail); + void Parse(const Document::Documents &parse); QHash* getTools(); VDataTool* getTool(const quint32 &id); QVector *getHistory(); @@ -203,8 +202,7 @@ private: void ParseIncrementsElement(const QDomNode& node); quint32 GetParametrId(const QDomElement& domElement) const; void CollectId(const QDomElement &node, QVector &vector)const; - void PrepareForParse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw, - VMainGraphicsScene *sceneDetail); + void PrepareForParse(const Document::Documents &parse); void UpdateMeasurements(); };