mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 18:35:20 +00:00
Use std::unique_ptr in QuickKeysMenu
This commit is contained in:
parent
84911a300b
commit
6d65885bd2
@ -39,9 +39,6 @@ namespace MWGui
|
||||
, mKey(std::vector<keyData>(10))
|
||||
, mSelected(nullptr)
|
||||
, mActivated(nullptr)
|
||||
, mAssignDialog(nullptr)
|
||||
, mItemSelectionDialog(nullptr)
|
||||
, mMagicSelectionDialog(nullptr)
|
||||
|
||||
{
|
||||
getWidget(mOkButton, "OKButton");
|
||||
@ -74,13 +71,6 @@ namespace MWGui
|
||||
}
|
||||
}
|
||||
|
||||
QuickKeysMenu::~QuickKeysMenu()
|
||||
{
|
||||
delete mAssignDialog;
|
||||
delete mItemSelectionDialog;
|
||||
delete mMagicSelectionDialog;
|
||||
}
|
||||
|
||||
inline void QuickKeysMenu::validate(int index)
|
||||
{
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
@ -194,7 +184,7 @@ namespace MWGui
|
||||
|
||||
// open assign dialog
|
||||
if (!mAssignDialog)
|
||||
mAssignDialog = new QuickKeysMenuAssign(this);
|
||||
mAssignDialog = std::make_unique<QuickKeysMenuAssign>(this);
|
||||
|
||||
mAssignDialog->setVisible(true);
|
||||
}
|
||||
@ -208,7 +198,7 @@ namespace MWGui
|
||||
{
|
||||
if (!mItemSelectionDialog)
|
||||
{
|
||||
mItemSelectionDialog = new ItemSelectionDialog("#{sQuickMenu6}");
|
||||
mItemSelectionDialog = std::make_unique<ItemSelectionDialog>("#{sQuickMenu6}");
|
||||
mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &QuickKeysMenu::onAssignItem);
|
||||
mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &QuickKeysMenu::onAssignItemCancel);
|
||||
}
|
||||
@ -223,7 +213,7 @@ namespace MWGui
|
||||
{
|
||||
if (!mMagicSelectionDialog)
|
||||
{
|
||||
mMagicSelectionDialog = new MagicSelectionDialog(this);
|
||||
mMagicSelectionDialog = std::make_unique<MagicSelectionDialog>(this);
|
||||
}
|
||||
mMagicSelectionDialog->setVisible(true);
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef MWGUI_QUICKKEYS_H
|
||||
#define MWGUI_QUICKKEYS_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "windowbase.hpp"
|
||||
|
||||
#include "spellmodel.hpp"
|
||||
@ -18,7 +20,6 @@ namespace MWGui
|
||||
{
|
||||
public:
|
||||
QuickKeysMenu();
|
||||
~QuickKeysMenu();
|
||||
|
||||
void onResChange(int, int) override { center(); }
|
||||
|
||||
@ -71,9 +72,9 @@ namespace MWGui
|
||||
MyGUI::EditBox* mInstructionLabel;
|
||||
MyGUI::Button* mOkButton;
|
||||
|
||||
QuickKeysMenuAssign* mAssignDialog;
|
||||
ItemSelectionDialog* mItemSelectionDialog;
|
||||
MagicSelectionDialog* mMagicSelectionDialog;
|
||||
std::unique_ptr<QuickKeysMenuAssign> mAssignDialog;
|
||||
std::unique_ptr<ItemSelectionDialog> mItemSelectionDialog;
|
||||
std::unique_ptr<MagicSelectionDialog> mMagicSelectionDialog;
|
||||
|
||||
void onQuickKeyButtonClicked(MyGUI::Widget* sender);
|
||||
void onOkButtonClicked(MyGUI::Widget* sender);
|
||||
|
Loading…
x
Reference in New Issue
Block a user