diff --git a/src/Editor/WorldEditor/CLinkDialog.cpp b/src/Editor/WorldEditor/CLinkDialog.cpp index 3182b867..1e0c09c9 100644 --- a/src/Editor/WorldEditor/CLinkDialog.cpp +++ b/src/Editor/WorldEditor/CLinkDialog.cpp @@ -6,17 +6,10 @@ #include "Editor/Undo/CEditLinkCommand.h" #include -CLinkDialog::CLinkDialog(CWorldEditor *pEditor, QWidget *pParent /*= 0*/) +CLinkDialog::CLinkDialog(CWorldEditor *pEditor, QWidget *pParent) : QDialog(pParent) - , ui(new Ui::CLinkDialog) , mpEditor(pEditor) - , mpGame(nullptr) - , mpSender(nullptr) - , mpReceiver(nullptr) - , mSenderStateModel(CStateMessageModel::EType::States, this) - , mReceiverMessageModel(CStateMessageModel::EType::Messages, this) - , mIsPicking(false) - , mpEditLink(nullptr) + , ui(std::make_unique()) { ui->setupUi(this); ui->SenderStateComboBox->setModel(&mSenderStateModel); @@ -29,10 +22,7 @@ CLinkDialog::CLinkDialog(CWorldEditor *pEditor, QWidget *pParent /*= 0*/) connect(ui->ReceiverPickFromList, SIGNAL(clicked()), this, SLOT(OnPickFromListClicked())); } -CLinkDialog::~CLinkDialog() -{ - delete ui; -} +CLinkDialog::~CLinkDialog() = default; void CLinkDialog::resizeEvent(QResizeEvent *) { diff --git a/src/Editor/WorldEditor/CLinkDialog.h b/src/Editor/WorldEditor/CLinkDialog.h index 96f12019..177e0bdd 100644 --- a/src/Editor/WorldEditor/CLinkDialog.h +++ b/src/Editor/WorldEditor/CLinkDialog.h @@ -12,24 +12,25 @@ class CLinkDialog : public QDialog Q_OBJECT CWorldEditor *mpEditor; - CGameTemplate *mpGame; - CScriptObject *mpSender; - CScriptObject *mpReceiver; - CLink *mpEditLink; + CGameTemplate *mpGame = nullptr; + CScriptObject *mpSender = nullptr; + CScriptObject *mpReceiver = nullptr; + CLink *mpEditLink = nullptr; - CStateMessageModel mSenderStateModel; - CStateMessageModel mReceiverMessageModel; + CStateMessageModel mSenderStateModel{CStateMessageModel::EType::States, this}; + CStateMessageModel mReceiverMessageModel{CStateMessageModel::EType::Messages, this}; - bool mIsPicking; + bool mIsPicking = false; - Ui::CLinkDialog *ui; + std::unique_ptr ui; public: - explicit CLinkDialog(CWorldEditor *pEditor, QWidget *parent = 0); - ~CLinkDialog(); - void resizeEvent(QResizeEvent *); - void showEvent(QShowEvent *); - void closeEvent(QCloseEvent *); + explicit CLinkDialog(CWorldEditor *pEditor, QWidget *parent = nullptr); + ~CLinkDialog() override; + + void resizeEvent(QResizeEvent*) override; + void showEvent(QShowEvent*) override; + void closeEvent(QCloseEvent*) override; void NewLink(CScriptObject *pSender, CScriptObject *pReceiver); void EditLink(CLink *pLink); @@ -44,11 +45,11 @@ public: void UpdateSenderNameLabel(); void UpdateReceiverNameLabel(); - inline CScriptObject* Sender() const { return mpSender; } - inline CScriptObject* Receiver() const { return mpReceiver; } - inline bool IsPicking() const { return mIsPicking; } - inline bool IsPickingSender() const { return mIsPicking && ui->SenderPickFromViewport->isChecked(); } - inline bool IsPickingReceiver() const { return mIsPicking && ui->ReceiverPickFromViewport->isChecked(); } + CScriptObject* Sender() const { return mpSender; } + CScriptObject* Receiver() const { return mpReceiver; } + bool IsPicking() const { return mIsPicking; } + bool IsPickingSender() const { return mIsPicking && ui->SenderPickFromViewport->isChecked(); } + bool IsPickingReceiver() const { return mIsPicking && ui->ReceiverPickFromViewport->isChecked(); } public slots: void accept();