| 2523 | } |
| 2524 | |
| 2525 | void MainWindow::closeEvent(QCloseEvent* event) |
| 2526 | { |
| 2527 | // If there's no VM, we can just exit as normal. |
| 2528 | if (!s_vm_valid || !m_display_created) |
| 2529 | { |
| 2530 | m_is_closing = true; |
| 2531 | saveStateToConfig(); |
| 2532 | if (m_display_created) |
| 2533 | g_emu_thread->stopFullscreenUI(); |
| 2534 | destroySubWindows(); |
| 2535 | QMainWindow::closeEvent(event); |
| 2536 | return; |
| 2537 | } |
| 2538 | |
| 2539 | // But if there is, we have to cancel the action, regardless of whether we ended exiting |
| 2540 | // or not. The window still needs to be visible while GS is shutting down. |
| 2541 | event->ignore(); |
| 2542 | |
| 2543 | // Exit cancelled? |
| 2544 | if (!requestShutdown(true, true, EmuConfig.SaveStateOnShutdown)) |
| 2545 | return; |
| 2546 | |
| 2547 | // Application will be exited in VM stopped handler. |
| 2548 | m_is_closing = true; |
| 2549 | } |
| 2550 | |
| 2551 | void MainWindow::changeEvent(QEvent* event) |
| 2552 | { |
nothing calls this directly
no test coverage detected