implement factory reset option #368

Add a "Factory Reset" item to the Options menu, which calls
`DeleteAll()` on the config object, which actually deletes the config
file. After this the application is relaunched asynchronously without
parameters and the current instance is closed.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2019-02-20 19:44:42 -08:00
parent 12fa61af82
commit d7cf15e076
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
2 changed files with 19 additions and 0 deletions

View File

@ -13,6 +13,7 @@
#include <wx/sstream.h>
#include <wx/url.h>
#include <wx/wfstream.h>
#include <wx/msgdlg.h>
#ifndef NO_FFMPEG
extern "C" {
@ -2381,6 +2382,21 @@ EVT_HANDLER(Customize, "Customize UI...")
update_opts();
}
EVT_HANDLER(FactoryReset, "Factory Reset...")
{
wxMessageDialog dlg(NULL, wxString(wxT(
"YOUR CONFIGURATION WILL BE DELETED!\n\n")) + wxString(wxT(
"Are you sure?")),
wxT("FACTORY RESET"), wxYES_NO | wxNO_DEFAULT | wxCENTRE);
if (dlg.ShowModal() == wxID_YES) {
wxGetApp().cfg->DeleteAll();
wxExecute(wxStandardPaths::Get().GetExecutablePath(), wxEXEC_ASYNC);
Close(true);
}
}
EVT_HANDLER(BugReport, "Report bugs...")
{
wxLaunchDefaultBrowser(wxT("https://github.com/visualboyadvance-m/visualboyadvance-m/issues"));

View File

@ -466,6 +466,9 @@
<object class="wxMenuItem" name="Customize">
<label>_Key Shortcuts ...</label>
</object>
<object class="wxMenuItem" name="FactoryReset">
<label>_Factory Reset...</label>
</object>
</object>
<object class="wxMenu">
<label>_Tools</label>