Qt: Autofocus on the right save slot

This commit is contained in:
Jeffrey Pfau 2015-08-04 22:07:30 -07:00
parent d4721cb30d
commit de25c0db6b
2 changed files with 10 additions and 1 deletions

View File

@ -72,6 +72,8 @@ public:
void setOptions(const GBAOptions*);
int stateSlot() const { return m_stateSlot; }
#ifdef USE_GDB_STUB
ARMDebugger* debugger();
void setDebugger(ARMDebugger*);

View File

@ -23,7 +23,7 @@ using namespace QGBA;
LoadSaveState::LoadSaveState(GameController* controller, QWidget* parent)
: QWidget(parent)
, m_controller(controller)
, m_currentFocus(0)
, m_currentFocus(controller->stateSlot() - 1)
, m_mode(LoadSave::LOAD)
{
m_ui.setupUi(this);
@ -45,6 +45,13 @@ LoadSaveState::LoadSaveState(GameController* controller, QWidget* parent)
connect(m_slots[i], &QAbstractButton::clicked, this, [this, i]() { triggerState(i + 1); });
}
if (m_currentFocus >= 9) {
m_currentFocus = 0;
}
if (m_currentFocus < 0) {
m_currentFocus = 0;
}
QAction* escape = new QAction(this);
escape->connect(escape, SIGNAL(triggered()), this, SLOT(close()));
escape->setShortcut(QKeySequence("Esc"));