Load the right states in the right slots

This commit is contained in:
Jeffrey Pfau 2014-10-15 23:40:52 -07:00
parent 961121808d
commit 05cb9d47ab
1 changed files with 6 additions and 6 deletions

View File

@ -34,9 +34,9 @@ LoadSaveState::LoadSaveState(GameController* controller, QWidget* parent)
int i;
for (i = 0; i < NUM_SLOTS; ++i) {
loadState(i);
loadState(i + 1);
m_slots[i]->installEventFilter(this);
connect(m_slots[i], &QAbstractButton::clicked, this, [this, i]() { triggerState(i); });
connect(m_slots[i], &QAbstractButton::clicked, this, [this, i]() { triggerState(i + 1); });
}
}
@ -91,12 +91,12 @@ void LoadSaveState::loadState(int slot) {
if (!stateImage.isNull()) {
QPixmap statePixmap;
statePixmap.convertFromImage(stateImage);
m_slots[slot]->setIcon(statePixmap);
m_slots[slot]->setText(QString());
m_slots[slot - 1]->setIcon(statePixmap);
m_slots[slot - 1]->setText(QString());
} else {
m_slots[slot]->setText(tr("Slot %1").arg(slot + 1));
m_slots[slot - 1]->setText(tr("Slot %1").arg(slot));
}
m_slots[slot]->setShortcut(QString::number(slot + 1));
m_slots[slot - 1]->setShortcut(QString::number(slot));
}
void LoadSaveState::triggerState(int slot) {