diff options
| author | 2016-01-10 13:31:20 +0100 | |
|---|---|---|
| committer | 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.gz yuzu-c2b210f713cc820acc08a032d043c22287956bed.tar.xz yuzu-c2b210f713cc820acc08a032d043c22287956bed.zip | |
Add check before closure when emulation is running
Implement confirmation in a specific function
Fix typos and coding style
Coding convention
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() { | |||
| 497 | //GControllerConfigDialog* dialog = new GControllerConfigDialog(controller_ports, this); | 497 | //GControllerConfigDialog* dialog = new GControllerConfigDialog(controller_ports, this); |
| 498 | } | 498 | } |
| 499 | 499 | ||
| 500 | bool 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 | |||
| 500 | void GMainWindow::closeEvent(QCloseEvent* event) { | 513 | void 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 | ||
| 87 | private slots: | 94 | private slots: |