|
|
|
@ -15,6 +15,8 @@
|
|
|
|
|
|
|
|
|
|
#include "../mwstate/character.hpp"
|
|
|
|
|
|
|
|
|
|
#include "confirmationdialog.hpp"
|
|
|
|
|
|
|
|
|
|
namespace MWGui
|
|
|
|
|
{
|
|
|
|
|
SaveGameDialog::SaveGameDialog()
|
|
|
|
@ -36,17 +38,25 @@ namespace MWGui
|
|
|
|
|
mSaveList->eventListChangePosition += MyGUI::newDelegate(this, &SaveGameDialog::onSlotSelected);
|
|
|
|
|
mSaveList->eventListSelectAccept += MyGUI::newDelegate(this, &SaveGameDialog::onSlotActivated);
|
|
|
|
|
mSaveNameEdit->eventEditSelectAccept += MyGUI::newDelegate(this, &SaveGameDialog::onEditSelectAccept);
|
|
|
|
|
mSaveNameEdit->eventEditTextChange += MyGUI::newDelegate(this, &SaveGameDialog::onSaveNameChanged);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SaveGameDialog::onSlotActivated(MyGUI::ListBox *sender, size_t pos)
|
|
|
|
|
{
|
|
|
|
|
onSlotSelected(sender, pos);
|
|
|
|
|
onOkButtonClicked(mOkButton);
|
|
|
|
|
accept();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SaveGameDialog::onSaveNameChanged(MyGUI::EditBox *sender)
|
|
|
|
|
{
|
|
|
|
|
// This might have previously been a save slot from the list. If so, that is no longer the case
|
|
|
|
|
mSaveList->setIndexSelected(MyGUI::ITEM_NONE);
|
|
|
|
|
onSlotSelected(mSaveList, MyGUI::ITEM_NONE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SaveGameDialog::onEditSelectAccept(MyGUI::EditBox *sender)
|
|
|
|
|
{
|
|
|
|
|
onOkButtonClicked(mOkButton);
|
|
|
|
|
accept();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SaveGameDialog::open()
|
|
|
|
@ -113,7 +123,12 @@ namespace MWGui
|
|
|
|
|
setVisible(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SaveGameDialog::onOkButtonClicked(MyGUI::Widget *sender)
|
|
|
|
|
void SaveGameDialog::onConfirmationGiven()
|
|
|
|
|
{
|
|
|
|
|
accept(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SaveGameDialog::accept(bool reallySure)
|
|
|
|
|
{
|
|
|
|
|
MyGUI::InputManager::getInstance().setKeyFocusWidget(NULL);
|
|
|
|
|
|
|
|
|
@ -132,6 +147,16 @@ namespace MWGui
|
|
|
|
|
|
|
|
|
|
if (mSaving)
|
|
|
|
|
{
|
|
|
|
|
// If overwriting an existing slot, ask for confirmation first
|
|
|
|
|
if (slot != NULL && !reallySure)
|
|
|
|
|
{
|
|
|
|
|
ConfirmationDialog* dialog = MWBase::Environment::get().getWindowManager()->getConfirmationDialog();
|
|
|
|
|
dialog->open("#{sMessage4}");
|
|
|
|
|
dialog->eventOkClicked.clear();
|
|
|
|
|
dialog->eventOkClicked += MyGUI::newDelegate(this, &SaveGameDialog::onConfirmationGiven);
|
|
|
|
|
dialog->eventCancelClicked.clear();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (mSaveNameEdit->getCaption().empty())
|
|
|
|
|
{
|
|
|
|
|
MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage65}");
|
|
|
|
@ -154,6 +179,11 @@ namespace MWGui
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SaveGameDialog::onOkButtonClicked(MyGUI::Widget *sender)
|
|
|
|
|
{
|
|
|
|
|
accept();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SaveGameDialog::onCharacterSelected(MyGUI::ComboBox *sender, size_t pos)
|
|
|
|
|
{
|
|
|
|
|
MWBase::StateManager* mgr = MWBase::Environment::get().getStateManager();
|
|
|
|
@ -192,6 +222,9 @@ namespace MWGui
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mSaving)
|
|
|
|
|
mSaveNameEdit->setCaption(sender->getItemNameAt(pos));
|
|
|
|
|
|
|
|
|
|
const MWState::Slot* slot = NULL;
|
|
|
|
|
unsigned int i=0;
|
|
|
|
|
for (MWState::Character::SlotIterator it = mCurrentCharacter->begin(); it != mCurrentCharacter->end(); ++it, ++i)
|
|
|
|
|