Refactoring. Create method SaveDialogChange.
--HG-- branch : feature
This commit is contained in:
parent
1dfe9eda03
commit
81c1c39be9
|
@ -112,27 +112,22 @@ void VDrawTool::FullUpdateFromGuiOk(int result)
|
|||
{
|
||||
if (result == QDialog::Accepted)
|
||||
{
|
||||
QDomElement oldDomElement = doc->elementById(QString().setNum(id));
|
||||
if (oldDomElement.isElement())
|
||||
{
|
||||
QDomElement newDomElement = oldDomElement.cloneNode().toElement();
|
||||
SaveDialog(newDomElement);
|
||||
|
||||
SaveToolOptions *saveOptions = new SaveToolOptions(oldDomElement, newDomElement, doc, id);
|
||||
connect(saveOptions, &SaveToolOptions::NeedLiteParsing, doc, &VPattern::LiteParseTree);
|
||||
qApp->getUndoStack()->push(saveOptions);
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug()<<"Can't find tool with id ="<< id << Q_FUNC_INFO;
|
||||
}
|
||||
SaveDialogChange();
|
||||
}
|
||||
delete dialog;
|
||||
dialog = nullptr;
|
||||
DialogLinkDestroy();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief FullUpdateFromGuiApply refresh tool data after change in options but do not delete dialog
|
||||
*/
|
||||
void VDrawTool::FullUpdateFromGuiApply()
|
||||
{
|
||||
SaveDialogChange();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VDrawTool::SaveDialogChange()
|
||||
{
|
||||
QDomElement oldDomElement = doc->elementById(QString().setNum(id));
|
||||
if (oldDomElement.isElement())
|
||||
|
@ -153,6 +148,7 @@ void VDrawTool::FullUpdateFromGuiApply()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VDrawTool::DialogLinkDestroy()
|
||||
{
|
||||
delete this->dialog;
|
||||
this->dialog=nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -62,9 +62,6 @@ public slots:
|
|||
virtual void ChangedActivDraw(const QString &newName);
|
||||
void ChangedNameDraw(const QString &oldName, const QString &newName);
|
||||
virtual void FullUpdateFromGuiOk(int result);
|
||||
/**
|
||||
* @brief FullUpdateFromGuiApply refresh tool data after change in options but do not delete dialog
|
||||
*/
|
||||
virtual void FullUpdateFromGuiApply();
|
||||
virtual void SetFactor(qreal factor);
|
||||
protected:
|
||||
|
@ -87,6 +84,7 @@ protected:
|
|||
|
||||
/** @brief SaveDialog save options into file after change in dialog. */
|
||||
virtual void SaveDialog(QDomElement &domElement)=0;
|
||||
void SaveDialogChange();
|
||||
|
||||
template <typename Dialog, typename Tool>
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user