Pause game while savestate window is open

This commit is contained in:
Jeffrey Pfau 2014-10-15 23:04:32 -07:00
parent 0579ececb3
commit cd8b1e56db
3 changed files with 11 additions and 0 deletions

View File

@ -107,3 +107,8 @@ void LoadSaveState::triggerState(int slot) {
GBAThreadContinue(thread);
close();
}
void LoadSaveState::closeEvent(QCloseEvent* event) {
emit closed();
QWidget::closeEvent(event);
}

View File

@ -25,8 +25,12 @@ public:
void setMode(LoadSave mode);
signals:
void closed();
protected:
virtual bool eventFilter(QObject*, QEvent*) override;
virtual void closeEvent(QCloseEvent*) override;
private:
void loadState(int slot);

View File

@ -148,9 +148,11 @@ void Window::gameStopped() {
}
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();
}