mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	Add check before closure when emulation is running
Implement confirmation in a specific function Fix typos and coding style Coding convention
This commit is contained in:
		
							parent
							
								
									7497675a83
								
							
						
					
					
						commit
						c2b210f713
					
				
					 2 changed files with 25 additions and 0 deletions
				
			
		|  | @ -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"); | ||||
| 
 | ||||
|  |  | |||
|  | @ -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: | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue