all repos — mgba @ cd8b1e56dbb295408b5a77e55ac6c9184113c251

mGBA Game Boy Advance Emulator

Pause game while savestate window is open
Jeffrey Pfau jeffrey@endrift.com
Wed, 15 Oct 2014 23:04:32 -0700
commit

cd8b1e56dbb295408b5a77e55ac6c9184113c251

parent

0579ececb343b13c5be40dc4f1ce60fb5a8812c6

3 files changed, 11 insertions(+), 0 deletions(-)

jump to
M src/platform/qt/LoadSaveState.cppsrc/platform/qt/LoadSaveState.cpp

@@ -107,3 +107,8 @@ }

GBAThreadContinue(thread); close(); } + +void LoadSaveState::closeEvent(QCloseEvent* event) { + emit closed(); + QWidget::closeEvent(event); +}
M src/platform/qt/LoadSaveState.hsrc/platform/qt/LoadSaveState.h

@@ -25,8 +25,12 @@ LoadSaveState(GameController* controller, QWidget* parent = nullptr);

void setMode(LoadSave mode); +signals: + void closed(); + protected: virtual bool eventFilter(QObject*, QEvent*) override; + virtual void closeEvent(QCloseEvent*) override; private: void loadState(int slot);
M src/platform/qt/Window.cppsrc/platform/qt/Window.cpp

@@ -148,9 +148,11 @@ }

} void Window::openStateWindow(LoadSave ls) { + m_controller->setPaused(true); LoadSaveState* window = new LoadSaveState(m_controller); window->setAttribute(Qt::WA_DeleteOnClose); connect(this, SIGNAL(shutdown()), window, SLOT(hide())); + connect(window, &LoadSaveState::closed, [this]() { m_controller->setPaused(false); }); window->setMode(ls); window->show(); }