diff options
author | bunnei <bunneidev@gmail.com> | 2016-02-26 14:36:33 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2016-02-26 14:36:33 +0100 |
commit | c28a48aa023b1617dfc94897d677f4f731f66db8 (patch) | |
tree | 86fb29d472d9b94e73d25ccedde01d658e47237d /src/citra_qt | |
parent | Merge pull request #1424 from MerryMage/lut_init (diff) | |
parent | Add a configuration entry to enable/disable the check (diff) | |
download | yuzu-c28a48aa023b1617dfc94897d677f4f731f66db8.tar yuzu-c28a48aa023b1617dfc94897d677f4f731f66db8.tar.gz yuzu-c28a48aa023b1617dfc94897d677f4f731f66db8.tar.bz2 yuzu-c28a48aa023b1617dfc94897d677f4f731f66db8.tar.lz yuzu-c28a48aa023b1617dfc94897d677f4f731f66db8.tar.xz yuzu-c28a48aa023b1617dfc94897d677f4f731f66db8.tar.zst yuzu-c28a48aa023b1617dfc94897d677f4f731f66db8.zip |
Diffstat (limited to 'src/citra_qt')
-rw-r--r-- | src/citra_qt/main.cpp | 18 | ||||
-rw-r--r-- | src/citra_qt/main.h | 8 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 144f11117..da9ea6c91 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -171,6 +171,8 @@ GMainWindow::GMainWindow() : emu_thread(nullptr) } UpdateRecentFiles(); + confirm_before_closing = settings.value("confirmClose", true).toBool(); + // Setup connections connect(game_list, SIGNAL(GameChosen(QString)), this, SLOT(OnGameListLoadFile(QString))); connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile())); @@ -497,7 +499,22 @@ void GMainWindow::OnConfigure() { //GControllerConfigDialog* dialog = new GControllerConfigDialog(controller_ports, this); } +bool GMainWindow::ConfirmClose() { + if (emu_thread == nullptr || !confirm_before_closing) + return true; + + auto answer = QMessageBox::question(this, tr("Citra"), + tr("Are you sure you want to close Citra?"), + QMessageBox::Yes | QMessageBox::No, QMessageBox::No); + return answer != QMessageBox::No; +} + void GMainWindow::closeEvent(QCloseEvent* event) { + if (!ConfirmClose()) { + event->ignore(); + return; + } + // Save window layout QSettings settings(QSettings::IniFormat, QSettings::UserScope, "Citra team", "Citra"); @@ -512,6 +529,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) { settings.setValue("singleWindowMode", ui.action_Single_Window_Mode->isChecked()); settings.setValue("displayTitleBars", ui.actionDisplay_widget_title_bars->isChecked()); settings.setValue("firstStart", false); + settings.setValue("confirmClose", confirm_before_closing); game_list->SaveInterfaceLayout(settings); SaveHotkeys(settings); diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index f6d429cd9..8c195f816 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: @@ -122,6 +129,7 @@ private: GPUCommandListWidget* graphicsCommandsWidget; QAction* actions_recent_files[max_recent_files_item]; + bool confirm_before_closing; }; #endif // _CITRA_QT_MAIN_HXX_ |