Replaced Q_CHECK_PRT on Q_ASSERT.

--HG--
branch : develop
This commit is contained in:
dismine 2013-10-14 17:44:33 +03:00
parent 900261cb7f
commit 4552f887db
13 changed files with 90 additions and 94 deletions

View file

@ -197,7 +197,7 @@ void DialogArc::F2Changed(){
}
void DialogArc::CheckState(){
Q_CHECK_PTR(bOk);
Q_ASSERT(bOk != 0);
bOk->setEnabled(flagRadius && flagF1 && flagF2);
}
@ -221,7 +221,7 @@ void DialogArc::ShowLineAngles(){
ui->listWidget->clear();
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged);
const QHash<QString, qreal> *lineAnglesTable = data->DataLineAngles();
Q_CHECK_PTR(lineAnglesTable);
Q_ASSERT(lineAnglesTable != 0);
QHashIterator<QString, qreal> i(*lineAnglesTable);
while (i.hasNext()) {
i.next();

View file

@ -158,7 +158,7 @@ void DialogLineIntersect::P2Line2Changed(int index){
}
void DialogLineIntersect::CheckState(){
Q_CHECK_PTR(bOk);
Q_ASSERT(bOk != 0);
bOk->setEnabled(flagName && flagPoint);
}

View file

@ -31,7 +31,7 @@ DialogTool::DialogTool(const VContainer *data, Draw::Draws mode, QWidget *parent
lineEditFormula(0), listWidget(0), labelResultCalculation(0), labelDescription(0), labelEditNamePoint(0),
labelEditFormula(0), radioButtonSizeGrowth(0), radioButtonStandartTable(0), radioButtonIncrements(0),
radioButtonLengthLine(0), radioButtonLengthArc(0), radioButtonLengthCurve(0), idDetail(0), mode(mode){
Q_CHECK_PTR(data);
Q_ASSERT(data != 0);
timerFormula = new QTimer(this);
connect(timerFormula, &QTimer::timeout, this, &DialogTool::EvalFormula);
}
@ -136,8 +136,8 @@ void DialogTool::ChangeCurrentData(QComboBox *box, const qint64 &value) const{
}
void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget){
Q_CHECK_PTR(lineEdit);
Q_CHECK_PTR(listWidget);
Q_ASSERT(lineEdit != 0);
Q_ASSERT(listWidget != 0);
QListWidgetItem *item = listWidget->currentItem();
QString val = item->text();
lineEdit->setText(lineEdit->text().append(val));
@ -145,9 +145,9 @@ void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget){
}
void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer){
Q_CHECK_PTR(edit);
Q_CHECK_PTR(timer);
Q_CHECK_PTR(labelEditFormula);
Q_ASSERT(edit != 0);
Q_ASSERT(timer != 0);
Q_ASSERT(labelEditFormula != 0);
if(edit->text().isEmpty()){
flag = false;
CheckState();
@ -160,10 +160,10 @@ void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer){
}
void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label){
Q_CHECK_PTR(edit);
Q_CHECK_PTR(timer);
Q_CHECK_PTR(label);
Q_CHECK_PTR(labelEditFormula);
Q_ASSERT(edit != 0);
Q_ASSERT(timer != 0);
Q_ASSERT(label != 0);
Q_ASSERT(labelEditFormula != 0);
QPalette palette = labelEditFormula->palette();
if(edit->text().isEmpty()){
flag = false;
@ -189,14 +189,14 @@ void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label)
void DialogTool::setCurrentPointId(QComboBox *box, qint64 &pointId, const qint64 &value,
const qint64 &id) const{
Q_CHECK_PTR(box);
Q_ASSERT(box != 0);
FillComboBoxPoints(box, id);
pointId = value;
ChangeCurrentData(box, value);
}
qint64 DialogTool::getCurrentPointId(QComboBox *box) const{
Q_CHECK_PTR(box);
Q_ASSERT(box != 0);
qint32 index = box->currentIndex();
Q_ASSERT(index != -1);
if(index != -1){
@ -207,7 +207,7 @@ qint64 DialogTool::getCurrentPointId(QComboBox *box) const{
}
void DialogTool::CheckState(){
Q_CHECK_PTR(bOk);
Q_ASSERT(bOk != 0);
bOk->setEnabled(flagFormula && flagName);
}
@ -218,7 +218,7 @@ void DialogTool::ChoosedObject(qint64 id, Scene::Scenes type){
}
void DialogTool::NamePointChanged(){
Q_CHECK_PTR(labelEditNamePoint);
Q_ASSERT(labelEditNamePoint != 0);
QLineEdit* edit = qobject_cast<QLineEdit*>(sender());
if (edit){
QString name = edit->text();
@ -253,48 +253,48 @@ void DialogTool::FormulaChanged(){
}
void DialogTool::ArrowUp(){
Q_CHECK_PTR(spinBoxAngle);
Q_ASSERT(spinBoxAngle != 0);
spinBoxAngle->setValue(90);
}
void DialogTool::ArrowDown(){
Q_CHECK_PTR(spinBoxAngle);
Q_ASSERT(spinBoxAngle != 0);
spinBoxAngle->setValue(270);
}
void DialogTool::ArrowLeft(){
Q_CHECK_PTR(spinBoxAngle);
Q_ASSERT(spinBoxAngle != 0);
spinBoxAngle->setValue(180);
}
void DialogTool::ArrowRight(){
Q_CHECK_PTR(spinBoxAngle);
Q_ASSERT(spinBoxAngle != 0);
spinBoxAngle->setValue(0);
}
void DialogTool::ArrowLeftUp(){
Q_CHECK_PTR(spinBoxAngle);
Q_ASSERT(spinBoxAngle != 0);
spinBoxAngle->setValue(135);
}
void DialogTool::ArrowLeftDown(){
Q_CHECK_PTR(spinBoxAngle);
Q_ASSERT(spinBoxAngle != 0);
spinBoxAngle->setValue(225);
}
void DialogTool::ArrowRightUp(){
Q_CHECK_PTR(spinBoxAngle);
Q_ASSERT(spinBoxAngle != 0);
spinBoxAngle->setValue(45);
}
void DialogTool::ArrowRightDown(){
Q_CHECK_PTR(spinBoxAngle);
Q_ASSERT(spinBoxAngle != 0);
spinBoxAngle->setValue(315);
}
void DialogTool::EvalFormula(){
Q_CHECK_PTR(lineEditFormula);
Q_CHECK_PTR(labelResultCalculation);
Q_ASSERT(lineEditFormula != 0);
Q_ASSERT(labelResultCalculation != 0);
Eval(lineEditFormula, flagFormula, timerFormula, labelResultCalculation);
}
@ -327,21 +327,21 @@ void DialogTool::PutHere(){
}
void DialogTool::PutVal(QListWidgetItem *item){
Q_CHECK_PTR(lineEditFormula);
Q_ASSERT(lineEditFormula != 0);
QString val = item->text();
lineEditFormula->setText(lineEditFormula->text().append(val));
lineEditFormula->setFocus();
}
void DialogTool::ValChenged(int row){
Q_CHECK_PTR(listWidget);
Q_CHECK_PTR(labelDescription);
Q_CHECK_PTR(radioButtonSizeGrowth);
Q_CHECK_PTR(radioButtonStandartTable);
Q_CHECK_PTR(radioButtonIncrements);
Q_CHECK_PTR(radioButtonLengthLine);
Q_CHECK_PTR(radioButtonLengthArc);
Q_CHECK_PTR(radioButtonLengthCurve);
Q_ASSERT(listWidget != 0);
Q_ASSERT(labelDescription != 0);
Q_ASSERT(radioButtonSizeGrowth != 0);
Q_ASSERT(radioButtonStandartTable != 0);
Q_ASSERT(radioButtonIncrements != 0);
Q_ASSERT(radioButtonLengthLine != 0);
Q_ASSERT(radioButtonLengthArc != 0);
Q_ASSERT(radioButtonLengthCurve != 0);
if(listWidget->count() == 0){
return;
}
@ -392,12 +392,12 @@ void DialogTool::ValChenged(int row){
}
void DialogTool::UpdateList(){
Q_CHECK_PTR(radioButtonSizeGrowth);
Q_CHECK_PTR(radioButtonStandartTable);
Q_CHECK_PTR(radioButtonIncrements);
Q_CHECK_PTR(radioButtonLengthLine);
Q_CHECK_PTR(radioButtonLengthArc);
Q_CHECK_PTR(radioButtonLengthCurve);
Q_ASSERT(radioButtonSizeGrowth != 0);
Q_ASSERT(radioButtonStandartTable != 0);
Q_ASSERT(radioButtonIncrements != 0);
Q_ASSERT(radioButtonLengthLine != 0);
Q_ASSERT(radioButtonLengthArc != 0);
Q_ASSERT(radioButtonLengthCurve != 0);
if(radioButtonSizeGrowth->isChecked()){
ShowVariable(data->DataBase());
@ -429,7 +429,7 @@ bool DialogTool::CheckObject(const qint64 &id){
template <class key, class val>
void DialogTool::ShowVariable(const QHash<key, val> *var){
Q_CHECK_PTR(listWidget);
Q_ASSERT(listWidget != 0);
disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
listWidget->clear();

View file

@ -234,7 +234,7 @@ void MainWindow::AddToolToDetail(T *tool, const qint64 &id, Tool::Tools typeTool
const qint64 &idDetail){
QHash<qint64, VDataTool*>* tools = doc->getTools();
VToolDetail *det = qobject_cast<VToolDetail*>(tools->value(idDetail));
Q_CHECK_PTR(det);
Q_ASSERT(det != 0);
det->AddTool(tool, id, typeTool);
}

View file

@ -141,7 +141,7 @@ void TableWindow::StopTable(){
}
void TableWindow::saveScene(){
QString name = QFileDialog::getSaveFileName(0, "Зберегти розкладку", "", "Images (*.png);;Svg files (*.svg)");
QString name = QFileDialog::getSaveFileName(0, tr("Save layout"), "", "Images (*.png);;Svg files (*.svg)");
if(name.isNull()){
return;
}
@ -149,12 +149,11 @@ void TableWindow::saveScene(){
QBrush *brush = new QBrush();
brush->setColor( QColor( Qt::white ) );
currentScene->setBackgroundBrush( *brush );
currentScene->clearSelection(); // Selections would also render to the file
currentScene->clearSelection(); // Selections would also render to the file
shadowPaper->setBrush(QBrush(Qt::white));
shadowPaper->setPen(QPen(Qt::white, 0.1));
paper->setPen(QPen(Qt::white, 0.1));
paper->setBrush(QBrush(Qt::white));
currentScene->setSceneRect(QRectF(10,10,590,590));
currentScene->setSceneRect(currentScene->itemsBoundingRect());
QFileInfo fi(name);
@ -163,9 +162,6 @@ void TableWindow::saveScene(){
} else if(fi.suffix() == "png"){
PngFile(name);
}
// if(name.indexOf(".svg",name.size()-4)<0){
// name.append(".svg");
// }
brush->setColor( QColor( Qt::gray ) );
brush->setStyle( Qt::SolidPattern );

View file

@ -47,8 +47,8 @@ protected:
template <typename Dialog, typename Tool>
void ContextMenu(QSharedPointer<Dialog> &dialog, Tool *tool, QGraphicsSceneContextMenuEvent *event,
bool showRemove = true){
Q_CHECK_PTR(tool);
Q_CHECK_PTR(event);
Q_ASSERT(tool != 0);
Q_ASSERT(event != 0);
if(!ignoreContextMenuEvent){
QMenu menu;
QAction *actionOption = menu.addAction(tr("Options"));

View file

@ -54,9 +54,9 @@ void VToolLine::Create(QSharedPointer<DialogLine> &dialog, VMainGraphicsScene *s
void VToolLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation){
Q_CHECK_PTR(scene);
Q_CHECK_PTR(doc);
Q_CHECK_PTR(data);
Q_ASSERT(scene != 0);
Q_ASSERT(doc != 0);
Q_ASSERT(data != 0);
qint64 id = _id;
if(typeCreation == Tool::FromGui){
id = data->getNextId();
@ -70,7 +70,7 @@ void VToolLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64
VDrawTool::AddRecord(id, Tool::LineTool, doc);
if(parse == Document::FullParse){
VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeCreation);
Q_CHECK_PTR(line);
Q_ASSERT(line != 0);
scene->addItem(line);
connect(line, &VToolLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(line, &VToolLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);

View file

@ -55,8 +55,8 @@ VModelingLine *VModelingLine::Create(const qint64 &_id, const qint64 &firstPoint
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation){
VModelingLine *line = 0;
Q_CHECK_PTR(doc);
Q_CHECK_PTR(data);
Q_ASSERT(doc != 0);
Q_ASSERT(data != 0);
qint64 id = _id;
if(typeCreation == Tool::FromGui){
id = data->getNextId();

View file

@ -38,7 +38,7 @@ void VNodeArc::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idA
Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation){
if(parse == Document::FullParse){
VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeobject, typeCreation);
Q_CHECK_PTR(arc);
Q_ASSERT(arc != 0);
doc->AddTool(id, arc);
doc->IncrementReferens(idArc);
} else {

View file

@ -43,7 +43,7 @@ void VNodePoint::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 i
Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation){
if(parse == Document::FullParse){
VNodePoint *point = new VNodePoint(doc, data, id, idPoint, typeobject, typeCreation);
Q_CHECK_PTR(point);
Q_ASSERT(point != 0);
doc->AddTool(id, point);
doc->IncrementReferens(idPoint);
} else {

View file

@ -40,7 +40,7 @@ void VNodeSplinePath::Create(VDomDocument *doc, VContainer *data, qint64 id, qin
Tool::Sources typeCreation){
if(parse == Document::FullParse){
VNodeSplinePath *splPath = new VNodeSplinePath(doc, data, id, idSpline, typeobject, typeCreation);
Q_CHECK_PTR(splPath);
Q_ASSERT(splPath != 0);
doc->AddTool(id, splPath);
VSplinePath path = data->GetModelingSplinePath(id);
const QVector<VSplinePoint> *points = path.GetPoint();

View file

@ -31,40 +31,40 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
sceneDetails(scene){
VDetail detail = data->GetDetail(id);
QHash<qint64, VDataTool*>* tools = doc->getTools();
Q_CHECK_PTR(tools);
Q_ASSERT(tools != 0);
for(qint32 i = 0; i< detail.CountNode(); ++i){
switch(detail[i].getTypeTool()){
case(Tool::NodePoint):{
VNodePoint *point = qobject_cast<VNodePoint*>(tools->value(detail[i].getId()));
Q_CHECK_PTR(point);
Q_ASSERT(point != 0);
connect(point, &VNodePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
point->setParentItem(this);
break;
}
case(Tool::NodeArc):{
VNodeArc *arc = qobject_cast<VNodeArc*>(tools->value(detail[i].getId()));
Q_CHECK_PTR(arc);
Q_ASSERT(arc != 0);
connect(arc, &VNodeArc::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
arc->setParentItem(this);
break;
}
case(Tool::NodeSpline):{
VNodeSpline *spl = qobject_cast<VNodeSpline*>(tools->value(detail[i].getId()));
Q_CHECK_PTR(spl);
Q_ASSERT(spl != 0);
connect(spl, &VNodeSpline::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
spl->setParentItem(this);
break;
}
case(Tool::NodeSplinePath):{
VNodeSplinePath *splPath = qobject_cast<VNodeSplinePath*>(tools->value(detail[i].getId()));
Q_CHECK_PTR(splPath);
Q_ASSERT(splPath != 0);
connect(splPath, &VNodeSplinePath::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
splPath->setParentItem(this);
break;
}
case(Tool::AlongLineTool):{
VModelingAlongLine *tool = qobject_cast<VModelingAlongLine*>(tools->value(detail[i].getId()));
Q_CHECK_PTR(tool);
Q_ASSERT(tool != 0);
connect(tool, &VModelingAlongLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(tool, &VModelingAlongLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
tool->setParentItem(this);
@ -72,7 +72,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
}
case(Tool::ArcTool):{
VModelingArc *tool = qobject_cast<VModelingArc*>(tools->value(detail[i].getId()));
Q_CHECK_PTR(tool);
Q_ASSERT(tool != 0);
connect(tool, &VModelingArc::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(tool, &VModelingArc::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
tool->setParentItem(this);
@ -80,7 +80,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
}
case(Tool::BisectorTool):{
VModelingBisector *tool = qobject_cast<VModelingBisector*>(tools->value(detail[i].getId()));
Q_CHECK_PTR(tool);
Q_ASSERT(tool != 0);
connect(tool, &VModelingBisector::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(tool, &VModelingBisector::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
tool->setParentItem(this);
@ -88,7 +88,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
}
case(Tool::EndLineTool):{
VModelingEndLine *tool = qobject_cast<VModelingEndLine*>(tools->value(detail[i].getId()));
Q_CHECK_PTR(tool);
Q_ASSERT(tool != 0);
connect(tool, &VModelingEndLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(tool, &VModelingEndLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
tool->setParentItem(this);
@ -96,7 +96,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
}
case(Tool::LineIntersectTool):{
VModelingLineIntersect *tool = qobject_cast<VModelingLineIntersect*>(tools->value(detail[i].getId()));
Q_CHECK_PTR(tool);
Q_ASSERT(tool != 0);
connect(tool, &VModelingLineIntersect::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(tool, &VModelingLineIntersect::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
tool->setParentItem(this);
@ -104,7 +104,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
}
case(Tool::LineTool):{
VModelingLine *tool = qobject_cast<VModelingLine*>(tools->value(detail[i].getId()));
Q_CHECK_PTR(tool);
Q_ASSERT(tool != 0);
connect(tool, &VModelingLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(tool, &VModelingLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
tool->setParentItem(this);
@ -112,7 +112,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
}
case(Tool::NormalTool):{
VModelingNormal *tool = qobject_cast<VModelingNormal*>(tools->value(detail[i].getId()));
Q_CHECK_PTR(tool);
Q_ASSERT(tool != 0);
connect(tool, &VModelingNormal::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(tool, &VModelingNormal::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
tool->setParentItem(this);
@ -120,7 +120,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
}
case(Tool::PointOfContact):{
VModelingPointOfContact *tool = qobject_cast<VModelingPointOfContact*>(tools->value(detail[i].getId()));
Q_CHECK_PTR(tool);
Q_ASSERT(tool != 0);
connect(tool, &VModelingPointOfContact::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(tool, &VModelingPointOfContact::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
tool->setParentItem(this);
@ -128,7 +128,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
}
case(Tool::ShoulderPointTool):{
VModelingShoulderPoint *tool = qobject_cast<VModelingShoulderPoint*>(tools->value(detail[i].getId()));
Q_CHECK_PTR(tool);
Q_ASSERT(tool != 0);
connect(tool, &VModelingShoulderPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(tool, &VModelingShoulderPoint::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
tool->setParentItem(this);
@ -136,7 +136,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
}
case(Tool::SplinePathTool):{
VModelingSplinePath *tool = qobject_cast<VModelingSplinePath*>(tools->value(detail[i].getId()));
Q_CHECK_PTR(tool);
Q_ASSERT(tool != 0);
connect(tool, &VModelingSplinePath::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(tool, &VModelingSplinePath::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
tool->setParentItem(this);
@ -144,7 +144,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
}
case(Tool::SplineTool):{
VModelingSpline *tool = qobject_cast<VModelingSpline*>(tools->value(detail[i].getId()));
Q_CHECK_PTR(tool);
Q_ASSERT(tool != 0);
connect(tool, &VModelingSpline::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(tool, &VModelingSpline::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
tool->setParentItem(this);

View file

@ -262,8 +262,8 @@ bool VDomDocument::GetActivNodeElement(const QString& name, QDomElement &element
void VDomDocument::Parse(Document::Documents parse, VMainGraphicsScene *sceneDraw,
VMainGraphicsScene *sceneDetail){
Q_CHECK_PTR(sceneDraw);
Q_CHECK_PTR(sceneDetail);
Q_ASSERT(sceneDraw != 0);
Q_ASSERT(sceneDetail != 0);
if(parse == Document::FullParse){
TestUniqueId();
data->Clear();
@ -429,8 +429,8 @@ void VDomDocument::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphics
void VDomDocument::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail,
const QDomNode& node, const Document::Documents &parse,
Draw::Draws mode){
Q_CHECK_PTR(sceneDraw);
Q_CHECK_PTR(sceneDetail);
Q_ASSERT(sceneDraw != 0);
Q_ASSERT(sceneDetail != 0);
VMainGraphicsScene *scene = 0;
if(mode == Draw::Calculation){
scene = sceneDraw;
@ -464,7 +464,7 @@ void VDomDocument::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsSce
void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
const Document::Documents &parse){
Q_CHECK_PTR(sceneDetail);
Q_ASSERT(sceneDetail != 0);
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try{
VDetail detail;
@ -543,7 +543,7 @@ void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDo
void VDomDocument::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
const Document::Documents &parse){
Q_CHECK_PTR(sceneDetail);
Q_ASSERT(sceneDetail != 0);
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
QDomNode domNode = domElement.firstChild();
while(!domNode.isNull()){
@ -562,7 +562,7 @@ void VDomDocument::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomEleme
void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElement& domElement,
const Document::Documents &parse, const QString& type,
Draw::Draws mode){
Q_CHECK_PTR(scene);
Q_ASSERT(scene != 0);
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(!type.isEmpty(), Q_FUNC_INFO, "type of point is empty");
if(type == "single"){
@ -581,7 +581,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
}
if(parse == Document::FullParse){
VToolSinglePoint *spoint = new VToolSinglePoint(this, data, id, Tool::FromFile);
Q_CHECK_PTR(spoint);
Q_ASSERT(spoint != 0);
scene->addItem(spoint);
connect(spoint, &VToolSinglePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
tools[id] = spoint;
@ -809,7 +809,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
const Document::Documents &parse, Draw::Draws mode){
Q_CHECK_PTR(scene);
Q_ASSERT(scene != 0);
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try{
qint64 id = GetParametrId(domElement);
@ -833,7 +833,7 @@ void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement
void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
const Document::Documents &parse, const QString &type,
Draw::Draws mode){
Q_CHECK_PTR(scene);
Q_ASSERT(scene != 0);
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(!type.isEmpty(), Q_FUNC_INFO, "type of spline is empty");
if(type == "simple"){
@ -956,7 +956,7 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme
void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &domElement,
const Document::Documents &parse, const QString &type, Draw::Draws mode){
Q_CHECK_PTR(scene);
Q_ASSERT(scene != 0);
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(!type.isEmpty(), Q_FUNC_INFO, "type of spline is empty");
if(type == "simple"){
@ -1011,7 +1011,7 @@ void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement
void VDomDocument::FullUpdateTree(){
VMainGraphicsScene *scene = new VMainGraphicsScene();
Q_CHECK_PTR(scene);
Q_ASSERT(scene != 0);
try{
data->ClearObject();
Parse(Document::LiteParse, scene, scene);
@ -1088,28 +1088,28 @@ void VDomDocument::setCurrentData(){
void VDomDocument::AddTool(const qint64 &id, VDataTool *tool){
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
Q_CHECK_PTR(tool);
Q_ASSERT(tool != 0);
tools.insert(id, tool);
}
void VDomDocument::UpdateToolData(const qint64 &id, VContainer *data){
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
Q_CHECK_PTR(data);
Q_ASSERT(data != 0);
VDataTool *tool = tools.value(id);
Q_CHECK_PTR(tool);
Q_ASSERT(tool != 0);
tool->VDataTool::setData(data);
}
void VDomDocument::IncrementReferens(qint64 id) const{
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
VDataTool *tool = tools.value(id);
Q_CHECK_PTR(tool);
Q_ASSERT(tool != 0);
tool->incrementReferens();
}
void VDomDocument::DecrementReferens(qint64 id) const{
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
VDataTool *tool = tools.value(id);
Q_CHECK_PTR(tool);
Q_ASSERT(tool != 0);
tool->decrementReferens();
}