diff --git a/src/Editor/WorldEditor/CTemplateEditDialog.cpp b/src/Editor/WorldEditor/CTemplateEditDialog.cpp index 24a76a42..a626717f 100644 --- a/src/Editor/WorldEditor/CTemplateEditDialog.cpp +++ b/src/Editor/WorldEditor/CTemplateEditDialog.cpp @@ -10,14 +10,12 @@ CTemplateEditDialog::CTemplateEditDialog(IProperty *pProperty, QWidget *pParent) : QDialog(pParent) - , mpUI(new Ui::CTemplateEditDialog) + , mpUI(std::make_unique()) , mpValidator(new CPropertyNameValidator(this)) , mpProperty(pProperty) , mGame(pProperty->Game()) , mOriginalName(pProperty->Name()) , mOriginalDescription(pProperty->Description()) - , mOriginalAllowTypeNameOverride(false) - , mOriginalNameWasValid(true) { mpUI->setupUi(this); @@ -112,10 +110,7 @@ CTemplateEditDialog::CTemplateEditDialog(IProperty *pProperty, QWidget *pParent) connect(mpUI->ButtonBox, SIGNAL(rejected()), this, SLOT(close())); } -CTemplateEditDialog::~CTemplateEditDialog() -{ - delete mpUI; -} +CTemplateEditDialog::~CTemplateEditDialog() = default; // ************ PUBLIC SLOTS ************ void CTemplateEditDialog::ApplyChanges() diff --git a/src/Editor/WorldEditor/CTemplateEditDialog.h b/src/Editor/WorldEditor/CTemplateEditDialog.h index 944f0e06..d0462887 100644 --- a/src/Editor/WorldEditor/CTemplateEditDialog.h +++ b/src/Editor/WorldEditor/CTemplateEditDialog.h @@ -6,6 +6,8 @@ #include #include +#include + namespace Ui { class CTemplateEditDialog; } @@ -13,7 +15,7 @@ class CTemplateEditDialog; class CTemplateEditDialog : public QDialog { Q_OBJECT - Ui::CTemplateEditDialog* mpUI; + std::unique_ptr mpUI; CPropertyNameValidator* mpValidator; IProperty *mpProperty; @@ -22,15 +24,15 @@ class CTemplateEditDialog : public QDialog TString mOriginalName; TString mOriginalDescription; TString mOriginalTypeName; - bool mOriginalAllowTypeNameOverride; - bool mOriginalNameWasValid; + bool mOriginalAllowTypeNameOverride = false; + bool mOriginalNameWasValid = true; // These members help track what templates need to be updated and resaved after the user clicks OK QVector mEquivalentProperties; public: - CTemplateEditDialog(IProperty* pProperty, QWidget *pParent = 0); - ~CTemplateEditDialog(); + explicit CTemplateEditDialog(IProperty* pProperty, QWidget *pParent = nullptr); + ~CTemplateEditDialog() override; signals: void PerformedTypeConversion();