Pause game while savestate window is open
Jeffrey Pfau jeffrey@endrift.com
Wed, 15 Oct 2014 23:04:32 -0700
3 files changed,
11 insertions(+),
0 deletions(-)
M
src/platform/qt/LoadSaveState.cpp
→
src/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.h
→
src/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.cpp
→
src/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(); }