Refactoring.

--HG--
branch : develop
This commit is contained in:
dismine 2014-06-26 13:41:59 +03:00
parent 88b8a00a2e
commit 280b7c9584
4 changed files with 17 additions and 22 deletions

View File

@ -188,13 +188,7 @@ void VToolSinglePoint::DeleteTool(bool ask)
{
if (ask)
{
QMessageBox msgBox;
msgBox.setText(tr("Confirm the deletion."));
msgBox.setInformativeText(tr("Do you really want delete?"));
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.setIcon(QMessageBox::Question);
if (msgBox.exec() == QMessageBox::Cancel)
if (ConfirmDeletion() == QMessageBox::Cancel)
{
return;
}

View File

@ -246,13 +246,7 @@ void VAbstractTool::DeleteTool(bool ask)
{
if (ask)
{
QMessageBox msgBox;
msgBox.setText(tr("Confirm the deletion."));
msgBox.setInformativeText(tr("Do you really want delete?"));
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.setIcon(QMessageBox::Question);
if (msgBox.exec() == QMessageBox::Cancel)
if (ConfirmDeletion() == QMessageBox::Cancel)
{
return;
}
@ -296,6 +290,18 @@ Qt::PenStyle VAbstractTool::LineStyle()
}
}
//---------------------------------------------------------------------------------------------------------------------
int VAbstractTool::ConfirmDeletion()
{
QMessageBox msgBox;
msgBox.setText(tr("Confirm the deletion."));
msgBox.setInformativeText(tr("Do you really want delete?"));
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.setIcon(QMessageBox::Question);
return msgBox.exec();
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief LineCoefficients coefficient for equation of segment. Segment equestion ax+by+c=0.

View File

@ -148,6 +148,7 @@ protected:
virtual void RemoveReferens(){}
virtual void DeleteTool(bool ask = true);
Qt::PenStyle LineStyle();
static int ConfirmDeletion();
private:
Q_DISABLE_COPY(VAbstractTool)
};

View File

@ -496,17 +496,11 @@ void VToolDetail::DeleteTool(bool ask)
DeleteDetail *delDet = new DeleteDetail(doc, id);
if (ask)
{
QMessageBox msgBox;
msgBox.setText(tr("Confirm the deletion."));
msgBox.setInformativeText(tr("Do you really want delete?"));
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.setIcon(QMessageBox::Question);
if (msgBox.exec() == QMessageBox::Cancel)
if (ConfirmDeletion() == QMessageBox::Cancel)
{
return;
}
/*Ugly hack. If UnionDetails delete detail no need emit FullParsing */
/* If UnionDetails tool delete detail no need emit FullParsing.*/
connect(delDet, &DeleteDetail::NeedFullParsing, doc, &VPattern::NeedFullParsing);
}
qApp->getUndoStack()->push(delDet);