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) CTemplateEditDialog::CTemplateEditDialog(IProperty *pProperty, QWidget *pParent)
: QDialog(pParent) : QDialog(pParent)
, mpUI(new Ui::CTemplateEditDialog) , mpUI(std::make_unique<Ui::CTemplateEditDialog>())
, mpValidator(new CPropertyNameValidator(this)) , mpValidator(new CPropertyNameValidator(this))
, mpProperty(pProperty) , mpProperty(pProperty)
, mGame(pProperty->Game()) , mGame(pProperty->Game())
, mOriginalName(pProperty->Name()) , mOriginalName(pProperty->Name())
, mOriginalDescription(pProperty->Description()) , mOriginalDescription(pProperty->Description())
, mOriginalAllowTypeNameOverride(false)
, mOriginalNameWasValid(true)
{ {
mpUI->setupUi(this); mpUI->setupUi(this);
@ -112,10 +110,7 @@ CTemplateEditDialog::CTemplateEditDialog(IProperty *pProperty, QWidget *pParent)
connect(mpUI->ButtonBox, SIGNAL(rejected()), this, SLOT(close())); connect(mpUI->ButtonBox, SIGNAL(rejected()), this, SLOT(close()));
} }
CTemplateEditDialog::~CTemplateEditDialog() CTemplateEditDialog::~CTemplateEditDialog() = default;
{
delete mpUI;
}
// ************ PUBLIC SLOTS ************ // ************ PUBLIC SLOTS ************
void CTemplateEditDialog::ApplyChanges() void CTemplateEditDialog::ApplyChanges()

View File

@ -6,6 +6,8 @@
#include <Core/Resource/Script/CGameTemplate.h> #include <Core/Resource/Script/CGameTemplate.h>
#include <QDialog> #include <QDialog>
#include <memory>
namespace Ui { namespace Ui {
class CTemplateEditDialog; class CTemplateEditDialog;
} }
@ -13,7 +15,7 @@ class CTemplateEditDialog;
class CTemplateEditDialog : public QDialog class CTemplateEditDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
Ui::CTemplateEditDialog* mpUI; std::unique_ptr<Ui::CTemplateEditDialog> mpUI;
CPropertyNameValidator* mpValidator; CPropertyNameValidator* mpValidator;
IProperty *mpProperty; IProperty *mpProperty;
@ -22,15 +24,15 @@ class CTemplateEditDialog : public QDialog
TString mOriginalName; TString mOriginalName;
TString mOriginalDescription; TString mOriginalDescription;
TString mOriginalTypeName; TString mOriginalTypeName;
bool mOriginalAllowTypeNameOverride; bool mOriginalAllowTypeNameOverride = false;
bool mOriginalNameWasValid; bool mOriginalNameWasValid = true;
// These members help track what templates need to be updated and resaved after the user clicks OK // These members help track what templates need to be updated and resaved after the user clicks OK
QVector<IProperty*> mEquivalentProperties; QVector<IProperty*> mEquivalentProperties;
public: public:
CTemplateEditDialog(IProperty* pProperty, QWidget *pParent = 0); explicit CTemplateEditDialog(IProperty* pProperty, QWidget *pParent = nullptr);
~CTemplateEditDialog(); ~CTemplateEditDialog() override;
signals: signals:
void PerformedTypeConversion(); void PerformedTypeConversion();