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