1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-08 09:37:53 +00:00

Savegame dialog: Grey out buttons if no save is selected

This commit is contained in:
scrawl 2014-06-10 02:47:02 +02:00
parent 311acfa8ff
commit 271aac3fcc

View File

@ -112,6 +112,7 @@ namespace MWGui
mCurrentCharacter = NULL; mCurrentCharacter = NULL;
mCurrentSlot = NULL; mCurrentSlot = NULL;
mSaveList->removeAllItems(); mSaveList->removeAllItems();
onSlotSelected(mSaveList, MyGUI::ITEM_NONE);
MWBase::StateManager* mgr = MWBase::Environment::get().getStateManager(); MWBase::StateManager* mgr = MWBase::Environment::get().getStateManager();
if (mgr->characterBegin() == mgr->characterEnd()) if (mgr->characterBegin() == mgr->characterEnd())
@ -239,12 +240,10 @@ namespace MWGui
} }
else else
{ {
if (mCurrentCharacter && mCurrentSlot) assert (mCurrentCharacter && mCurrentSlot);
{
MWBase::Environment::get().getStateManager()->loadGame (mCurrentCharacter, mCurrentSlot); MWBase::Environment::get().getStateManager()->loadGame (mCurrentCharacter, mCurrentSlot);
} }
} }
}
void SaveGameDialog::onOkButtonClicked(MyGUI::Widget *sender) void SaveGameDialog::onOkButtonClicked(MyGUI::Widget *sender)
{ {
@ -292,6 +291,9 @@ namespace MWGui
void SaveGameDialog::onSlotSelected(MyGUI::ListBox *sender, size_t pos) void SaveGameDialog::onSlotSelected(MyGUI::ListBox *sender, size_t pos)
{ {
mOkButton->setEnabled(pos != MyGUI::ITEM_NONE || mSaving);
mDeleteButton->setEnabled(pos != MyGUI::ITEM_NONE);
if (pos == MyGUI::ITEM_NONE) if (pos == MyGUI::ITEM_NONE)
{ {
mCurrentSlot = NULL; mCurrentSlot = NULL;