mirror of https://github.com/mgba-emu/mgba.git
Qt: Autofocus on the right save slot
This commit is contained in:
parent
d4721cb30d
commit
de25c0db6b
|
@ -72,6 +72,8 @@ public:
|
|||
|
||||
void setOptions(const GBAOptions*);
|
||||
|
||||
int stateSlot() const { return m_stateSlot; }
|
||||
|
||||
#ifdef USE_GDB_STUB
|
||||
ARMDebugger* debugger();
|
||||
void setDebugger(ARMDebugger*);
|
||||
|
|
|
@ -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"));
|
||||
|
|
Loading…
Reference in New Issue