mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-30 21:30:04 +00:00 
			
		
		
		
	Per-Game Settings: options to reset game settings (#6219)
This commit is contained in:
		
							parent
							
								
									cb82ffbe20
								
							
						
					
					
						commit
						812c4fa059
					
				
					 4 changed files with 34 additions and 1 deletions
				
			
		|  | @ -141,10 +141,12 @@ void ConfigureGeneral::ResetDefaults() { | ||||||
|         tr("Are you sure you want to <b>reset your settings</b> and close Citra?"), |         tr("Are you sure you want to <b>reset your settings</b> and close Citra?"), | ||||||
|         QMessageBox::Yes | QMessageBox::No, QMessageBox::No); |         QMessageBox::Yes | QMessageBox::No, QMessageBox::No); | ||||||
| 
 | 
 | ||||||
|     if (answer == QMessageBox::No) |     if (answer == QMessageBox::No) { | ||||||
|         return; |         return; | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     FileUtil::Delete(FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + "qt-config.ini"); |     FileUtil::Delete(FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + "qt-config.ini"); | ||||||
|  |     FileUtil::DeleteDirRecursively(FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + "custom"); | ||||||
|     std::exit(0); |     std::exit(0); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -3,6 +3,7 @@ | ||||||
| 
 | 
 | ||||||
| #include <utility> | #include <utility> | ||||||
| #include <vector> | #include <vector> | ||||||
|  | #include <QMessageBox> | ||||||
| #include <QPushButton> | #include <QPushButton> | ||||||
| #include <QString> | #include <QString> | ||||||
| #include <fmt/format.h> | #include <fmt/format.h> | ||||||
|  | @ -13,6 +14,7 @@ | ||||||
| #include "citra_qt/configuration/configure_per_game.h" | #include "citra_qt/configuration/configure_per_game.h" | ||||||
| #include "citra_qt/configuration/configure_system.h" | #include "citra_qt/configuration/configure_system.h" | ||||||
| #include "citra_qt/util/util.h" | #include "citra_qt/util/util.h" | ||||||
|  | #include "common/file_util.h" | ||||||
| #include "core/core.h" | #include "core/core.h" | ||||||
| #include "core/loader/loader.h" | #include "core/loader/loader.h" | ||||||
| #include "core/loader/smdh.h" | #include "core/loader/smdh.h" | ||||||
|  | @ -51,11 +53,30 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const QString | ||||||
|                 &ConfigurePerGame::HandleApplyButtonClicked); |                 &ConfigurePerGame::HandleApplyButtonClicked); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     connect(ui->button_reset_per_game, &QPushButton::clicked, this, | ||||||
|  |             &ConfigurePerGame::ResetDefaults); | ||||||
|  | 
 | ||||||
|     LoadConfiguration(); |     LoadConfiguration(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| ConfigurePerGame::~ConfigurePerGame() = default; | ConfigurePerGame::~ConfigurePerGame() = default; | ||||||
| 
 | 
 | ||||||
|  | void ConfigurePerGame::ResetDefaults() { | ||||||
|  |     const auto config_file_name = title_id == 0 ? filename : fmt::format("{:016X}", title_id); | ||||||
|  |     QMessageBox::StandardButton answer = QMessageBox::question( | ||||||
|  |         this, tr("Citra"), tr("Are you sure you want to <b>reset your settings for this game</b>?"), | ||||||
|  |         QMessageBox::Yes | QMessageBox::No, QMessageBox::No); | ||||||
|  | 
 | ||||||
|  |     if (answer == QMessageBox::No) { | ||||||
|  |         return; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     FileUtil::Delete(fmt::format("{}/custom/{}.ini", | ||||||
|  |                                  FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir), | ||||||
|  |                                  config_file_name)); | ||||||
|  |     close(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void ConfigurePerGame::ApplyConfiguration() { | void ConfigurePerGame::ApplyConfiguration() { | ||||||
|     general_tab->ApplyConfiguration(); |     general_tab->ApplyConfiguration(); | ||||||
|     system_tab->ApplyConfiguration(); |     system_tab->ApplyConfiguration(); | ||||||
|  |  | ||||||
|  | @ -43,6 +43,9 @@ public: | ||||||
|     /// Save all button configurations to settings file
 |     /// Save all button configurations to settings file
 | ||||||
|     void ApplyConfiguration(); |     void ApplyConfiguration(); | ||||||
| 
 | 
 | ||||||
|  |     /// Reset the settings for this game
 | ||||||
|  |     void ResetDefaults(); | ||||||
|  | 
 | ||||||
| private: | private: | ||||||
|     void changeEvent(QEvent* event) override; |     void changeEvent(QEvent* event) override; | ||||||
|     void RetranslateUI(); |     void RetranslateUI(); | ||||||
|  |  | ||||||
|  | @ -177,6 +177,13 @@ | ||||||
|           </property> |           </property> | ||||||
|          </spacer> |          </spacer> | ||||||
|         </item> |         </item> | ||||||
|  |         <item> | ||||||
|  |          <widget class="QPushButton" name="button_reset_per_game"> | ||||||
|  |           <property name="text"> | ||||||
|  |            <string>Reset Game Settings</string> | ||||||
|  |           </property> | ||||||
|  |          </widget> | ||||||
|  |         </item> | ||||||
|        </layout> |        </layout> | ||||||
|       </widget> |       </widget> | ||||||
|      </item> |      </item> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue