CTemplateEditDialog: Make use of in-class initializers where applicable

This commit is contained in:
Lioncash 2020-06-28 06:04:27 -04:00
parent ad1b285e2b
commit f2d7f896d2
2 changed files with 9 additions and 12 deletions

View File

@ -10,14 +10,12 @@
CTemplateEditDialog::CTemplateEditDialog(IProperty *pProperty, QWidget *pParent)
: QDialog(pParent)
, mpUI(new Ui::CTemplateEditDialog)
, mpUI(std::make_unique<Ui::CTemplateEditDialog>())
, 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()

View File

@ -6,6 +6,8 @@
#include <Core/Resource/Script/CGameTemplate.h>
#include <QDialog>
#include <memory>
namespace Ui {
class CTemplateEditDialog;
}
@ -13,7 +15,7 @@ class CTemplateEditDialog;
class CTemplateEditDialog : public QDialog
{
Q_OBJECT
Ui::CTemplateEditDialog* mpUI;
std::unique_ptr<Ui::CTemplateEditDialog> 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<IProperty*> mEquivalentProperties;
public:
CTemplateEditDialog(IProperty* pProperty, QWidget *pParent = 0);
~CTemplateEditDialog();
explicit CTemplateEditDialog(IProperty* pProperty, QWidget *pParent = nullptr);
~CTemplateEditDialog() override;
signals:
void PerformedTypeConversion();