UI: Change Language: use a dialog instead of forcing first-time-wizard

The method of forcing first-time-wizard wasn't very effective because
1. it's ugly, and 2. after selecting the language at the wizard it either
imports the previous settings (together with the previous language thus
overriding the new language) or resets all other settings - which is not fun.

This patch uses a small dialog instead to only change the language, and within
it reuses the language panel from the first time wizard.
This commit is contained in:
Avi Halachmi (:avih) 2014-12-30 19:31:50 +02:00
parent 1779ee42c2
commit c4bd50c04c
3 changed files with 35 additions and 13 deletions

View File

@ -133,6 +133,23 @@ namespace Dialogs
virtual wxString& GetConfSettingsTabName() const { return g_Conf->AppSettingsTabName; }
};
// --------------------------------------------------------------------------------------
// InterfaceLanguageDialog
// --------------------------------------------------------------------------------------
class InterfaceLanguageDialog : public BaseConfigurationDialog
{
public:
InterfaceLanguageDialog(wxWindow* parent = NULL);
virtual ~InterfaceLanguageDialog() throw() { }
static wxString GetNameStatic() { return L"InterfaceLanguage"; }
wxString GetDialogName() const { return GetNameStatic(); }
protected:
virtual wxString& GetConfSettingsTabName() const { return g_Conf->AppSettingsTabName; }
};
// --------------------------------------------------------------------------------------
// McdConfigDialog
// --------------------------------------------------------------------------------------

View File

@ -270,6 +270,19 @@ Dialogs::InterfaceConfigDialog::InterfaceConfigDialog(wxWindow *parent)
//wxDialogWithHelpers::AddOkCancel( NULL, false );
}
Dialogs::InterfaceLanguageDialog::InterfaceLanguageDialog(wxWindow* parent)
: BaseConfigurationDialog(parent, _("Language selector"), 400)
{
*this += 5;
// Keep this in English - same as the menu item.
*this += Heading(L"New language will affect newly opened windows.\n");
*this += Heading(L"Full change will happen after restarting PCSX2.");
*this += new Panels::LanguageSelectionPanel(this) | StdCenter();
wxDialogWithHelpers::AddOkCancel();
}
// ------------------------------------------------------------------------
Panels::AppearanceThemesPanel::AppearanceThemesPanel( wxWindow* parent )
: BaseApplicableConfigPanel( parent )

View File

@ -70,6 +70,11 @@ void MainEmuFrame::Menu_Language_Click(wxCommandEvent &event)
InterfaceConfigDialog(this).ShowModal();
}
void MainEmuFrame::Menu_ChangeLang(wxCommandEvent &event) // Always in English
{
AppOpenDialog<InterfaceLanguageDialog>(this);
}
static void WipeSettings()
{
wxGetApp().CleanupRestartable();
@ -581,19 +586,6 @@ void MainEmuFrame::Menu_ShowConsole(wxCommandEvent &event)
wxGetApp().ProgramLog_PostEvent( evt );
}
void MainEmuFrame::Menu_ChangeLang(wxCommandEvent &event) // Always in English
{
Msgbox::Alert ( L"Please restart PCSX2.\n"
L"\n"
L"First-Time-Wizard will then appear, where you can change the language.\n"
L"\n"
L"(You can keep other settings by choosing 'Import' when prompted)"
);
wxGetApp().ForceFirstTimeWizardOnNextRun();
}
void MainEmuFrame::Menu_ShowConsole_Stdio(wxCommandEvent &event)
{
g_Conf->EmuOptions.ConsoleToStdio = GetMenuBar()->IsChecked( MenuId_Console_Stdio );