diff options
author | LittleWhite <lw.demoscene@googlemail.com> | 2016-01-10 13:31:20 +0100 |
---|---|---|
committer | LittleWhite <lw.demoscene@googlemail.com> | 2016-02-04 22:15:42 +0100 |
commit | c2b210f713cc820acc08a032d043c22287956bed (patch) | |
tree | 3f9a93052fc21151a7db9282cea59a659ec0020c | |
parent | Merge pull request #1387 from lioncash/func (diff) | |
download | yuzu-c2b210f713cc820acc08a032d043c22287956bed.tar yuzu-c2b210f713cc820acc08a032d043c22287956bed.tar.gz yuzu-c2b210f713cc820acc08a032d043c22287956bed.tar.bz2 yuzu-c2b210f713cc820acc08a032d043c22287956bed.tar.lz yuzu-c2b210f713cc820acc08a032d043c22287956bed.tar.xz yuzu-c2b210f713cc820acc08a032d043c22287956bed.tar.zst yuzu-c2b210f713cc820acc08a032d043c22287956bed.zip |
Diffstat (limited to '')
-rw-r--r-- | src/citra_qt/main.cpp | 18 | ||||
-rw-r--r-- | src/citra_qt/main.h | 7 |
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() { //GControllerConfigDialog* dialog = new GControllerConfigDialog(controller_ports, this); } +bool GMainWindow::ConfirmClose() { + if (emu_thread != nullptr) { + auto answer = QMessageBox::question(this, tr("Citra"), + tr("Are you sure you want to close Citra?"), + QMessageBox::Yes | QMessageBox::No, QMessageBox::No); + + if (answer == QMessageBox::No) { + return false; + } + } + return true; +} + void GMainWindow::closeEvent(QCloseEvent* event) { + if (!ConfirmClose()) { + event->ignore(); + return; + } + // Save window layout QSettings settings(QSettings::IniFormat, QSettings::UserScope, "Citra team", "Citra"); 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: */ void UpdateRecentFiles(); + /** + * If the emulation is running, + * asks the user if he really want to close the emulator + * + * @return true if the user confirmed + */ + bool ConfirmClose(); void closeEvent(QCloseEvent* event) override; private slots: |