Pause UI: Increase vertical spacing between savestate slots, allow changing the "current" slot by choosing an empty one

This commit is contained in:
Henrik Rydgard 2015-02-16 22:41:01 +01:00
parent 7f51cd6003
commit 7e38ca38b3

View File

@ -159,12 +159,12 @@ public:
saveStateButton_ = buttons->Add(new Button(i->T("Save State"), new LinearLayoutParams(0.0, G_VCENTER)));
saveStateButton_->OnClick.Handle(this, &SaveSlotView::OnSaveState);
fv->OnClick.Handle(this, &SaveSlotView::OnScreenshotClick);
if (SaveState::HasSaveInSlot(slot)) {
loadStateButton_ = buttons->Add(new Button(i->T("Load State"), new LinearLayoutParams(0.0, G_VCENTER)));
loadStateButton_->OnClick.Handle(this, &SaveSlotView::OnLoadState);
fv->OnClick.Handle(this, &SaveSlotView::OnScreenshotClick);
std::string dateStr = SaveState::GetSlotDateAsString(slot_);
std::vector<std::string> dateStrs;
SplitString(dateStr, ' ', dateStrs);
@ -274,10 +274,11 @@ void GamePauseScreen::CreateViews() {
ViewGroup *leftColumn = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0, scrollMargins));
root_->Add(leftColumn);
ViewGroup *leftColumnItems = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, WRAP_CONTENT));
LinearLayout *leftColumnItems = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, WRAP_CONTENT));
leftColumn->Add(leftColumnItems);
leftColumnItems->Add(new Spacer(0.0));
leftColumnItems->SetSpacing(10.0);
for (int i = 0; i < NUM_SAVESLOTS; i++) {
SaveSlotView *slot = leftColumnItems->Add(new SaveSlotView(i, new LayoutParams(FILL_PARENT, WRAP_CONTENT)));
slot->OnStateLoaded.Handle(this, &GamePauseScreen::OnState);
@ -358,13 +359,16 @@ void GamePauseScreen::dialogFinished(const Screen *dialog, DialogResult dr) {
}
UI::EventReturn GamePauseScreen::OnScreenshotClicked(UI::EventParams &e) {
SaveSlotView *v = (SaveSlotView *)e.v;
std::string fn = v->GetScreenshotFilename();
std::string title = v->GetScreenshotTitle();
I18NCategory *p = GetI18NCategory("Pause");
Screen *screen = new ScreenshotViewScreen(fn, title, v->GetSlot(), p);
screenManager()->push(screen);
SaveSlotView *v = static_cast<SaveSlotView *>(e.v);
int slot = v->GetSlot();
g_Config.iCurrentStateSlot = v->GetSlot();
if (SaveState::HasSaveInSlot(slot)) {
std::string fn = v->GetScreenshotFilename();
std::string title = v->GetScreenshotTitle();
I18NCategory *p = GetI18NCategory("Pause");
Screen *screen = new ScreenshotViewScreen(fn, title, v->GetSlot(), p);
screenManager()->push(screen);
}
return UI::EVENT_DONE;
}