mirror of
https://github.com/OpenMW/openmw.git
synced 2025-12-13 09:13:06 +00:00
Use std::unique_ptr in EnchantingDialog
This commit is contained in:
parent
58d08d402a
commit
b21c77a026
2 changed files with 6 additions and 12 deletions
|
|
@ -34,7 +34,6 @@ namespace MWGui
|
||||||
EnchantingDialog::EnchantingDialog()
|
EnchantingDialog::EnchantingDialog()
|
||||||
: WindowBase("openmw_enchanting_dialog.layout")
|
: WindowBase("openmw_enchanting_dialog.layout")
|
||||||
, EffectEditorBase(EffectEditorBase::Enchanting)
|
, EffectEditorBase(EffectEditorBase::Enchanting)
|
||||||
, mItemSelectionDialog(nullptr)
|
|
||||||
{
|
{
|
||||||
getWidget(mName, "NameEdit");
|
getWidget(mName, "NameEdit");
|
||||||
getWidget(mCancelButton, "CancelButton");
|
getWidget(mCancelButton, "CancelButton");
|
||||||
|
|
@ -62,11 +61,6 @@ namespace MWGui
|
||||||
mName->eventEditSelectAccept += MyGUI::newDelegate(this, &EnchantingDialog::onAccept);
|
mName->eventEditSelectAccept += MyGUI::newDelegate(this, &EnchantingDialog::onAccept);
|
||||||
}
|
}
|
||||||
|
|
||||||
EnchantingDialog::~EnchantingDialog()
|
|
||||||
{
|
|
||||||
delete mItemSelectionDialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EnchantingDialog::onOpen()
|
void EnchantingDialog::onOpen()
|
||||||
{
|
{
|
||||||
center();
|
center();
|
||||||
|
|
@ -195,8 +189,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
if (mEnchanting.getOldItem().isEmpty())
|
if (mEnchanting.getOldItem().isEmpty())
|
||||||
{
|
{
|
||||||
delete mItemSelectionDialog;
|
mItemSelectionDialog = std::make_unique<ItemSelectionDialog>("#{sEnchantItems}");
|
||||||
mItemSelectionDialog = new ItemSelectionDialog("#{sEnchantItems}");
|
|
||||||
mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &EnchantingDialog::onItemSelected);
|
mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &EnchantingDialog::onItemSelected);
|
||||||
mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &EnchantingDialog::onItemCancel);
|
mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &EnchantingDialog::onItemCancel);
|
||||||
mItemSelectionDialog->setVisible(true);
|
mItemSelectionDialog->setVisible(true);
|
||||||
|
|
@ -250,8 +243,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
if (mEnchanting.getGem().isEmpty())
|
if (mEnchanting.getGem().isEmpty())
|
||||||
{
|
{
|
||||||
delete mItemSelectionDialog;
|
mItemSelectionDialog = std::make_unique<ItemSelectionDialog>("#{sSoulGemsWithSouls}");
|
||||||
mItemSelectionDialog = new ItemSelectionDialog("#{sSoulGemsWithSouls}");
|
|
||||||
mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &EnchantingDialog::onSoulSelected);
|
mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &EnchantingDialog::onSoulSelected);
|
||||||
mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &EnchantingDialog::onSoulCancel);
|
mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &EnchantingDialog::onSoulCancel);
|
||||||
mItemSelectionDialog->setVisible(true);
|
mItemSelectionDialog->setVisible(true);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef MWGUI_ENCHANTINGDIALOG_H
|
#ifndef MWGUI_ENCHANTINGDIALOG_H
|
||||||
#define MWGUI_ENCHANTINGDIALOG_H
|
#define MWGUI_ENCHANTINGDIALOG_H
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "spellcreationdialog.hpp"
|
#include "spellcreationdialog.hpp"
|
||||||
|
|
||||||
#include "../mwmechanics/enchanting.hpp"
|
#include "../mwmechanics/enchanting.hpp"
|
||||||
|
|
@ -15,7 +17,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EnchantingDialog();
|
EnchantingDialog();
|
||||||
virtual ~EnchantingDialog();
|
virtual ~EnchantingDialog() = default;
|
||||||
|
|
||||||
void onOpen() override;
|
void onOpen() override;
|
||||||
|
|
||||||
|
|
@ -48,7 +50,7 @@ namespace MWGui
|
||||||
void onTypeButtonClicked(MyGUI::Widget* sender);
|
void onTypeButtonClicked(MyGUI::Widget* sender);
|
||||||
void onAccept(MyGUI::EditBox* sender);
|
void onAccept(MyGUI::EditBox* sender);
|
||||||
|
|
||||||
ItemSelectionDialog* mItemSelectionDialog;
|
std::unique_ptr<ItemSelectionDialog> mItemSelectionDialog;
|
||||||
|
|
||||||
MyGUI::Widget* mChanceLayout;
|
MyGUI::Widget* mChanceLayout;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue