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

View File

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

View File

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

View File

@ -141,7 +141,7 @@ void TableWindow::StopTable(){
} }
void TableWindow::saveScene(){ 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()){ if(name.isNull()){
return; return;
} }
@ -149,12 +149,11 @@ void TableWindow::saveScene(){
QBrush *brush = new QBrush(); QBrush *brush = new QBrush();
brush->setColor( QColor( Qt::white ) ); brush->setColor( QColor( Qt::white ) );
currentScene->setBackgroundBrush( *brush ); 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->setBrush(QBrush(Qt::white));
shadowPaper->setPen(QPen(Qt::white, 0.1)); shadowPaper->setPen(QPen(Qt::white, 0.1));
paper->setPen(QPen(Qt::white, 0.1)); paper->setPen(QPen(Qt::white, 0.1));
paper->setBrush(QBrush(Qt::white)); paper->setBrush(QBrush(Qt::white));
currentScene->setSceneRect(QRectF(10,10,590,590));
currentScene->setSceneRect(currentScene->itemsBoundingRect()); currentScene->setSceneRect(currentScene->itemsBoundingRect());
QFileInfo fi(name); QFileInfo fi(name);
@ -163,9 +162,6 @@ void TableWindow::saveScene(){
} else if(fi.suffix() == "png"){ } else if(fi.suffix() == "png"){
PngFile(name); PngFile(name);
} }
// if(name.indexOf(".svg",name.size()-4)<0){
// name.append(".svg");
// }
brush->setColor( QColor( Qt::gray ) ); brush->setColor( QColor( Qt::gray ) );
brush->setStyle( Qt::SolidPattern ); brush->setStyle( Qt::SolidPattern );

View File

@ -47,8 +47,8 @@ protected:
template <typename Dialog, typename Tool> template <typename Dialog, typename Tool>
void ContextMenu(QSharedPointer<Dialog> &dialog, Tool *tool, QGraphicsSceneContextMenuEvent *event, void ContextMenu(QSharedPointer<Dialog> &dialog, Tool *tool, QGraphicsSceneContextMenuEvent *event,
bool showRemove = true){ bool showRemove = true){
Q_CHECK_PTR(tool); Q_ASSERT(tool != 0);
Q_CHECK_PTR(event); Q_ASSERT(event != 0);
if(!ignoreContextMenuEvent){ if(!ignoreContextMenuEvent){
QMenu menu; QMenu menu;
QAction *actionOption = menu.addAction(tr("Options")); 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, void VToolLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint,
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
const Document::Documents &parse, Tool::Sources typeCreation){ const Document::Documents &parse, Tool::Sources typeCreation){
Q_CHECK_PTR(scene); Q_ASSERT(scene != 0);
Q_CHECK_PTR(doc); Q_ASSERT(doc != 0);
Q_CHECK_PTR(data); Q_ASSERT(data != 0);
qint64 id = _id; qint64 id = _id;
if(typeCreation == Tool::FromGui){ if(typeCreation == Tool::FromGui){
id = data->getNextId(); id = data->getNextId();
@ -70,7 +70,7 @@ void VToolLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64
VDrawTool::AddRecord(id, Tool::LineTool, doc); VDrawTool::AddRecord(id, Tool::LineTool, doc);
if(parse == Document::FullParse){ if(parse == Document::FullParse){
VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeCreation); VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeCreation);
Q_CHECK_PTR(line); Q_ASSERT(line != 0);
scene->addItem(line); scene->addItem(line);
connect(line, &VToolLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(line, &VToolLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(line, &VToolLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); 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, VDomDocument *doc, VContainer *data, const Document::Documents &parse,
Tool::Sources typeCreation){ Tool::Sources typeCreation){
VModelingLine *line = 0; VModelingLine *line = 0;
Q_CHECK_PTR(doc); Q_ASSERT(doc != 0);
Q_CHECK_PTR(data); Q_ASSERT(data != 0);
qint64 id = _id; qint64 id = _id;
if(typeCreation == Tool::FromGui){ if(typeCreation == Tool::FromGui){
id = data->getNextId(); 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){ Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation){
if(parse == Document::FullParse){ if(parse == Document::FullParse){
VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeobject, typeCreation); VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeobject, typeCreation);
Q_CHECK_PTR(arc); Q_ASSERT(arc != 0);
doc->AddTool(id, arc); doc->AddTool(id, arc);
doc->IncrementReferens(idArc); doc->IncrementReferens(idArc);
} else { } 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){ Draw::Draws typeobject, const Document::Documents &parse, Tool::Sources typeCreation){
if(parse == Document::FullParse){ if(parse == Document::FullParse){
VNodePoint *point = new VNodePoint(doc, data, id, idPoint, typeobject, typeCreation); VNodePoint *point = new VNodePoint(doc, data, id, idPoint, typeobject, typeCreation);
Q_CHECK_PTR(point); Q_ASSERT(point != 0);
doc->AddTool(id, point); doc->AddTool(id, point);
doc->IncrementReferens(idPoint); doc->IncrementReferens(idPoint);
} else { } else {

View File

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

View File

@ -31,40 +31,40 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
sceneDetails(scene){ sceneDetails(scene){
VDetail detail = data->GetDetail(id); VDetail detail = data->GetDetail(id);
QHash<qint64, VDataTool*>* tools = doc->getTools(); QHash<qint64, VDataTool*>* tools = doc->getTools();
Q_CHECK_PTR(tools); Q_ASSERT(tools != 0);
for(qint32 i = 0; i< detail.CountNode(); ++i){ for(qint32 i = 0; i< detail.CountNode(); ++i){
switch(detail[i].getTypeTool()){ switch(detail[i].getTypeTool()){
case(Tool::NodePoint):{ case(Tool::NodePoint):{
VNodePoint *point = qobject_cast<VNodePoint*>(tools->value(detail[i].getId())); 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); connect(point, &VNodePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
point->setParentItem(this); point->setParentItem(this);
break; break;
} }
case(Tool::NodeArc):{ case(Tool::NodeArc):{
VNodeArc *arc = qobject_cast<VNodeArc*>(tools->value(detail[i].getId())); 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); connect(arc, &VNodeArc::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
arc->setParentItem(this); arc->setParentItem(this);
break; break;
} }
case(Tool::NodeSpline):{ case(Tool::NodeSpline):{
VNodeSpline *spl = qobject_cast<VNodeSpline*>(tools->value(detail[i].getId())); 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); connect(spl, &VNodeSpline::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
spl->setParentItem(this); spl->setParentItem(this);
break; break;
} }
case(Tool::NodeSplinePath):{ case(Tool::NodeSplinePath):{
VNodeSplinePath *splPath = qobject_cast<VNodeSplinePath*>(tools->value(detail[i].getId())); 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); connect(splPath, &VNodeSplinePath::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
splPath->setParentItem(this); splPath->setParentItem(this);
break; break;
} }
case(Tool::AlongLineTool):{ case(Tool::AlongLineTool):{
VModelingAlongLine *tool = qobject_cast<VModelingAlongLine*>(tools->value(detail[i].getId())); 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::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(tool, &VModelingAlongLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); connect(tool, &VModelingAlongLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
tool->setParentItem(this); tool->setParentItem(this);
@ -72,7 +72,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
} }
case(Tool::ArcTool):{ case(Tool::ArcTool):{
VModelingArc *tool = qobject_cast<VModelingArc*>(tools->value(detail[i].getId())); 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::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(tool, &VModelingArc::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); connect(tool, &VModelingArc::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
tool->setParentItem(this); tool->setParentItem(this);
@ -80,7 +80,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
} }
case(Tool::BisectorTool):{ case(Tool::BisectorTool):{
VModelingBisector *tool = qobject_cast<VModelingBisector*>(tools->value(detail[i].getId())); 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::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(tool, &VModelingBisector::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); connect(tool, &VModelingBisector::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
tool->setParentItem(this); tool->setParentItem(this);
@ -88,7 +88,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
} }
case(Tool::EndLineTool):{ case(Tool::EndLineTool):{
VModelingEndLine *tool = qobject_cast<VModelingEndLine*>(tools->value(detail[i].getId())); 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::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(tool, &VModelingEndLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); connect(tool, &VModelingEndLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
tool->setParentItem(this); tool->setParentItem(this);
@ -96,7 +96,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
} }
case(Tool::LineIntersectTool):{ case(Tool::LineIntersectTool):{
VModelingLineIntersect *tool = qobject_cast<VModelingLineIntersect*>(tools->value(detail[i].getId())); 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::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(tool, &VModelingLineIntersect::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); connect(tool, &VModelingLineIntersect::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
tool->setParentItem(this); tool->setParentItem(this);
@ -104,7 +104,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
} }
case(Tool::LineTool):{ case(Tool::LineTool):{
VModelingLine *tool = qobject_cast<VModelingLine*>(tools->value(detail[i].getId())); 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::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(tool, &VModelingLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); connect(tool, &VModelingLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
tool->setParentItem(this); tool->setParentItem(this);
@ -112,7 +112,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
} }
case(Tool::NormalTool):{ case(Tool::NormalTool):{
VModelingNormal *tool = qobject_cast<VModelingNormal*>(tools->value(detail[i].getId())); 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::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(tool, &VModelingNormal::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); connect(tool, &VModelingNormal::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
tool->setParentItem(this); tool->setParentItem(this);
@ -120,7 +120,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
} }
case(Tool::PointOfContact):{ case(Tool::PointOfContact):{
VModelingPointOfContact *tool = qobject_cast<VModelingPointOfContact*>(tools->value(detail[i].getId())); 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::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(tool, &VModelingPointOfContact::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); connect(tool, &VModelingPointOfContact::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
tool->setParentItem(this); tool->setParentItem(this);
@ -128,7 +128,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
} }
case(Tool::ShoulderPointTool):{ case(Tool::ShoulderPointTool):{
VModelingShoulderPoint *tool = qobject_cast<VModelingShoulderPoint*>(tools->value(detail[i].getId())); 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::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(tool, &VModelingShoulderPoint::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); connect(tool, &VModelingShoulderPoint::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
tool->setParentItem(this); tool->setParentItem(this);
@ -136,7 +136,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
} }
case(Tool::SplinePathTool):{ case(Tool::SplinePathTool):{
VModelingSplinePath *tool = qobject_cast<VModelingSplinePath*>(tools->value(detail[i].getId())); 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::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(tool, &VModelingSplinePath::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); connect(tool, &VModelingSplinePath::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
tool->setParentItem(this); tool->setParentItem(this);
@ -144,7 +144,7 @@ VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id,
} }
case(Tool::SplineTool):{ case(Tool::SplineTool):{
VModelingSpline *tool = qobject_cast<VModelingSpline*>(tools->value(detail[i].getId())); 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::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(tool, &VModelingSpline::RemoveTool, scene, &VMainGraphicsScene::RemoveTool); connect(tool, &VModelingSpline::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
tool->setParentItem(this); 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, void VDomDocument::Parse(Document::Documents parse, VMainGraphicsScene *sceneDraw,
VMainGraphicsScene *sceneDetail){ VMainGraphicsScene *sceneDetail){
Q_CHECK_PTR(sceneDraw); Q_ASSERT(sceneDraw != 0);
Q_CHECK_PTR(sceneDetail); Q_ASSERT(sceneDetail != 0);
if(parse == Document::FullParse){ if(parse == Document::FullParse){
TestUniqueId(); TestUniqueId();
data->Clear(); data->Clear();
@ -429,8 +429,8 @@ void VDomDocument::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphics
void VDomDocument::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, void VDomDocument::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail,
const QDomNode& node, const Document::Documents &parse, const QDomNode& node, const Document::Documents &parse,
Draw::Draws mode){ Draw::Draws mode){
Q_CHECK_PTR(sceneDraw); Q_ASSERT(sceneDraw != 0);
Q_CHECK_PTR(sceneDetail); Q_ASSERT(sceneDetail != 0);
VMainGraphicsScene *scene = 0; VMainGraphicsScene *scene = 0;
if(mode == Draw::Calculation){ if(mode == Draw::Calculation){
scene = sceneDraw; scene = sceneDraw;
@ -464,7 +464,7 @@ void VDomDocument::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsSce
void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
const Document::Documents &parse){ const Document::Documents &parse){
Q_CHECK_PTR(sceneDetail); Q_ASSERT(sceneDetail != 0);
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try{ try{
VDetail detail; VDetail detail;
@ -543,7 +543,7 @@ void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDo
void VDomDocument::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, void VDomDocument::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement,
const Document::Documents &parse){ const Document::Documents &parse){
Q_CHECK_PTR(sceneDetail); Q_ASSERT(sceneDetail != 0);
Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
QDomNode domNode = domElement.firstChild(); QDomNode domNode = domElement.firstChild();
while(!domNode.isNull()){ while(!domNode.isNull()){
@ -562,7 +562,7 @@ void VDomDocument::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomEleme
void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElement& domElement, void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElement& domElement,
const Document::Documents &parse, const QString& type, const Document::Documents &parse, const QString& type,
Draw::Draws mode){ 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(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(!type.isEmpty(), Q_FUNC_INFO, "type of point is empty"); Q_ASSERT_X(!type.isEmpty(), Q_FUNC_INFO, "type of point is empty");
if(type == "single"){ if(type == "single"){
@ -581,7 +581,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
} }
if(parse == Document::FullParse){ if(parse == Document::FullParse){
VToolSinglePoint *spoint = new VToolSinglePoint(this, data, id, Tool::FromFile); VToolSinglePoint *spoint = new VToolSinglePoint(this, data, id, Tool::FromFile);
Q_CHECK_PTR(spoint); Q_ASSERT(spoint != 0);
scene->addItem(spoint); scene->addItem(spoint);
connect(spoint, &VToolSinglePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(spoint, &VToolSinglePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
tools[id] = spoint; tools[id] = spoint;
@ -809,7 +809,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement, void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
const Document::Documents &parse, Draw::Draws mode){ 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"); Q_ASSERT_X(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try{ try{
qint64 id = GetParametrId(domElement); qint64 id = GetParametrId(domElement);
@ -833,7 +833,7 @@ void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement
void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &domElement, void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
const Document::Documents &parse, const QString &type, const Document::Documents &parse, const QString &type,
Draw::Draws mode){ 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(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(!type.isEmpty(), Q_FUNC_INFO, "type of spline is empty"); Q_ASSERT_X(!type.isEmpty(), Q_FUNC_INFO, "type of spline is empty");
if(type == "simple"){ if(type == "simple"){
@ -956,7 +956,7 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme
void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &domElement, void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &domElement,
const Document::Documents &parse, const QString &type, Draw::Draws mode){ 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(!domElement.isNull(), Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(!type.isEmpty(), Q_FUNC_INFO, "type of spline is empty"); Q_ASSERT_X(!type.isEmpty(), Q_FUNC_INFO, "type of spline is empty");
if(type == "simple"){ if(type == "simple"){
@ -1011,7 +1011,7 @@ void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement
void VDomDocument::FullUpdateTree(){ void VDomDocument::FullUpdateTree(){
VMainGraphicsScene *scene = new VMainGraphicsScene(); VMainGraphicsScene *scene = new VMainGraphicsScene();
Q_CHECK_PTR(scene); Q_ASSERT(scene != 0);
try{ try{
data->ClearObject(); data->ClearObject();
Parse(Document::LiteParse, scene, scene); Parse(Document::LiteParse, scene, scene);
@ -1088,28 +1088,28 @@ void VDomDocument::setCurrentData(){
void VDomDocument::AddTool(const qint64 &id, VDataTool *tool){ void VDomDocument::AddTool(const qint64 &id, VDataTool *tool){
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
Q_CHECK_PTR(tool); Q_ASSERT(tool != 0);
tools.insert(id, tool); tools.insert(id, tool);
} }
void VDomDocument::UpdateToolData(const qint64 &id, VContainer *data){ void VDomDocument::UpdateToolData(const qint64 &id, VContainer *data){
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
Q_CHECK_PTR(data); Q_ASSERT(data != 0);
VDataTool *tool = tools.value(id); VDataTool *tool = tools.value(id);
Q_CHECK_PTR(tool); Q_ASSERT(tool != 0);
tool->VDataTool::setData(data); tool->VDataTool::setData(data);
} }
void VDomDocument::IncrementReferens(qint64 id) const{ void VDomDocument::IncrementReferens(qint64 id) const{
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
VDataTool *tool = tools.value(id); VDataTool *tool = tools.value(id);
Q_CHECK_PTR(tool); Q_ASSERT(tool != 0);
tool->incrementReferens(); tool->incrementReferens();
} }
void VDomDocument::DecrementReferens(qint64 id) const{ void VDomDocument::DecrementReferens(qint64 id) const{
Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0");
VDataTool *tool = tools.value(id); VDataTool *tool = tools.value(id);
Q_CHECK_PTR(tool); Q_ASSERT(tool != 0);
tool->decrementReferens(); tool->decrementReferens();
} }