all repos — mgba @ de25c0db6b48ffe98752b716da12698d61e1c7d7

mGBA Game Boy Advance Emulator

Qt: Autofocus on the right save slot
Jeffrey Pfau jeffrey@endrift.com
Tue, 04 Aug 2015 22:07:30 -0700
commit

de25c0db6b48ffe98752b716da12698d61e1c7d7

parent

d4721cb30d3087ccf68ee61e66e33d77e2ebdd14

2 files changed, 10 insertions(+), 1 deletions(-)

jump to
M src/platform/qt/GameController.hsrc/platform/qt/GameController.h

@@ -72,6 +72,8 @@ void clearOverride() { m_threadContext.hasOverride = false; }

void setOptions(const GBAOptions*); + int stateSlot() const { return m_stateSlot; } + #ifdef USE_GDB_STUB ARMDebugger* debugger(); void setDebugger(ARMDebugger*);
M src/platform/qt/LoadSaveState.cppsrc/platform/qt/LoadSaveState.cpp

@@ -23,7 +23,7 @@

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);

@@ -43,6 +43,13 @@ for (i = 0; i < NUM_SLOTS; ++i) {

loadState(i + 1); m_slots[i]->installEventFilter(this); 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);