summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/citra_qt/main.cpp18
-rw-r--r--src/citra_qt/main.h7
2 files changed, 25 insertions, 0 deletions
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index 144f11117..fefa39d0d 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -497,7 +497,25 @@ void GMainWindow::OnConfigure() {
497 //GControllerConfigDialog* dialog = new GControllerConfigDialog(controller_ports, this); 497 //GControllerConfigDialog* dialog = new GControllerConfigDialog(controller_ports, this);
498} 498}
499 499
500bool GMainWindow::ConfirmClose() {
501 if (emu_thread != nullptr) {
502 auto answer = QMessageBox::question(this, tr("Citra"),
503 tr("Are you sure you want to close Citra?"),
504 QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
505
506 if (answer == QMessageBox::No) {
507 return false;
508 }
509 }
510 return true;
511}
512
500void GMainWindow::closeEvent(QCloseEvent* event) { 513void GMainWindow::closeEvent(QCloseEvent* event) {
514 if (!ConfirmClose()) {
515 event->ignore();
516 return;
517 }
518
501 // Save window layout 519 // Save window layout
502 QSettings settings(QSettings::IniFormat, QSettings::UserScope, "Citra team", "Citra"); 520 QSettings settings(QSettings::IniFormat, QSettings::UserScope, "Citra team", "Citra");
503 521
diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h
index f6d429cd9..3b1bdf15e 100644
--- a/src/citra_qt/main.h
+++ b/src/citra_qt/main.h
@@ -82,6 +82,13 @@ private:
82 */ 82 */
83 void UpdateRecentFiles(); 83 void UpdateRecentFiles();
84 84
85 /**
86 * If the emulation is running,
87 * asks the user if he really want to close the emulator
88 *
89 * @return true if the user confirmed
90 */
91 bool ConfirmClose();
85 void closeEvent(QCloseEvent* event) override; 92 void closeEvent(QCloseEvent* event) override;
86 93
87private slots: 94private slots: