diff options
author | LittleWhite <lw.demoscene@googlemail.com> | 2015-09-05 12:29:44 +0200 |
---|---|---|
committer | LittleWhite <lw.demoscene@googlemail.com> | 2015-09-07 20:34:39 +0200 |
commit | 86e29ac2814be7789370c021eb858558557a7362 (patch) | |
tree | ed0855e6e962d979d06e00ee007a26e6c8a7c233 | |
parent | Merge pull request #1117 from yuriks/fix-glad-build (diff) | |
download | yuzu-86e29ac2814be7789370c021eb858558557a7362.tar yuzu-86e29ac2814be7789370c021eb858558557a7362.tar.gz yuzu-86e29ac2814be7789370c021eb858558557a7362.tar.bz2 yuzu-86e29ac2814be7789370c021eb858558557a7362.tar.lz yuzu-86e29ac2814be7789370c021eb858558557a7362.tar.xz yuzu-86e29ac2814be7789370c021eb858558557a7362.tar.zst yuzu-86e29ac2814be7789370c021eb858558557a7362.zip |
-rw-r--r-- | src/citra_qt/bootmanager.cpp | 5 | ||||
-rw-r--r-- | src/citra_qt/bootmanager.h | 6 | ||||
-rw-r--r-- | src/citra_qt/main.cpp | 4 |
3 files changed, 15 insertions, 0 deletions
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index 9aec16506..2aab343f2 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -223,6 +223,11 @@ QByteArray GRenderWindow::saveGeometry() return geometry; } +void GRenderWindow::closeEvent(QCloseEvent* event) { + emit Closed(); + QWidget::closeEvent(event); +} + void GRenderWindow::keyPressEvent(QKeyEvent* event) { this->KeyPressed({event->key(), keyboard_id}); diff --git a/src/citra_qt/bootmanager.h b/src/citra_qt/bootmanager.h index 1a1e0e6a5..d0fe397af 100644 --- a/src/citra_qt/bootmanager.h +++ b/src/citra_qt/bootmanager.h @@ -110,6 +110,8 @@ public: void restoreGeometry(const QByteArray& geometry); // overridden QByteArray saveGeometry(); // overridden + void closeEvent(QCloseEvent* event) override; + void keyPressEvent(QKeyEvent* event) override; void keyReleaseEvent(QKeyEvent* event) override; @@ -129,6 +131,10 @@ public slots: void OnEmulationStarting(EmuThread* emu_thread); void OnEmulationStopping(); +signals: + /// Emitted when the window is closed + void Closed(); + private: void OnMinimalClientAreaChangeRequest(const std::pair<unsigned,unsigned>& minimal_size) override; diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 11813a2a8..8dadb44ef 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -251,6 +251,7 @@ void GMainWindow::BootGame(const std::string& filename) { render_window->moveContext(); emu_thread->start(); + connect(render_window, SIGNAL(Closed()), this, SLOT(OnStopGame())); // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views before the CPU continues connect(emu_thread.get(), SIGNAL(DebugModeEntered()), disasmWidget, SLOT(OnDebugModeEntered()), Qt::BlockingQueuedConnection); connect(emu_thread.get(), SIGNAL(DebugModeEntered()), registersWidget, SLOT(OnDebugModeEntered()), Qt::BlockingQueuedConnection); @@ -283,6 +284,9 @@ void GMainWindow::ShutdownGame() { emu_thread->wait(); emu_thread = nullptr; + // The emulation is stopped, so closing the window or not does not matter anymore + disconnect(render_window, SIGNAL(Closed()), this, SLOT(OnStopGame())); + // Update the GUI ui.action_Start->setEnabled(false); ui.action_Start->setText(tr("Start")); |