summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-03-24 23:24:27 +0000
committerCarl Hetherington <cth@carlh.net>2013-03-24 23:24:27 +0000
commit17097564ffb940478b2d5519302bc3bb9162a965 (patch)
treee131baedf6e4de74ad0b52bb5b0529b7672d2d19 /src
parent5925d300db2a237d59645dc26933c14e9bc94b65 (diff)
User interface for language selection.
Diffstat (limited to 'src')
-rw-r--r--src/tools/dvdomatic.cc4
-rw-r--r--src/wx/config_dialog.cc47
-rw-r--r--src/wx/config_dialog.h4
3 files changed, 53 insertions, 2 deletions
diff --git a/src/tools/dvdomatic.cc b/src/tools/dvdomatic.cc
index 991b4daf8..66f366a24 100644
--- a/src/tools/dvdomatic.cc
+++ b/src/tools/dvdomatic.cc
@@ -471,7 +471,9 @@ setup_i18n ()
}
}
- dvdomatic_setup_i18n (wx_to_std (locale->GetCanonicalName ()));
+ if (locale) {
+ dvdomatic_setup_i18n (wx_to_std (locale->GetCanonicalName ()));
+ }
}
class App : public wxApp
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc
index b28c350ea..ea1a7319e 100644
--- a/src/wx/config_dialog.cc
+++ b/src/wx/config_dialog.cc
@@ -46,6 +46,23 @@ ConfigDialog::ConfigDialog (wxWindow* parent)
wxFlexGridSizer* table = new wxFlexGridSizer (3, 6, 6);
table->AddGrowableCol (1, 1);
+ add_label_to_sizer (table, this, _("User interface language"));
+ _language = new wxChoice (this, wxID_ANY);
+ _language->Append (wxT ("English"));
+ _language->Append (wxT ("Français"));
+ _language->Append (wxT ("Italiano"));
+ _language->Append (wxT ("Español"));
+ table->Add (_language, 1, wxEXPAND);
+ table->AddSpacer (0);
+
+ table->AddSpacer (0);
+ wxStaticText* restart = add_label_to_sizer (table, this, _("(restart DVD-o-matic to see language changes)"));
+ wxFont font = restart->GetFont();
+ font.SetStyle (wxFONTSTYLE_ITALIC);
+ font.SetPointSize (font.GetPointSize() - 1);
+ restart->SetFont (font);
+ table->AddSpacer (0);
+
add_label_to_sizer (table, this, _("TMS IP address"));
_tms_ip = new wxTextCtrl (this, wxID_ANY);
table->Add (_tms_ip, 1, wxEXPAND);
@@ -132,6 +149,17 @@ ConfigDialog::ConfigDialog (wxWindow* parent)
Config* config = Config::instance ();
+ if (config->language().get_value_or ("") == "fr") {
+ _language->SetSelection (1);
+ } else if (config->language().get_value_or ("") == "it") {
+ _language->SetSelection (2);
+ } else if (config->language().get_value_or ("") == "es") {
+ _language->SetSelection (3);
+ } else {
+ _language->SetSelection (0);
+ }
+
+ _language->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (ConfigDialog::language_changed), 0, this);
_tms_ip->SetValue (std_to_wx (config->tms_ip ()));
_tms_ip->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (ConfigDialog::tms_ip_changed), 0, this);
_tms_path->SetValue (std_to_wx (config->tms_path ()));
@@ -185,6 +213,25 @@ ConfigDialog::ConfigDialog (wxWindow* parent)
}
void
+ConfigDialog::language_changed (wxCommandEvent &)
+{
+ switch (_language->GetSelection ()) {
+ case 0:
+ Config::instance()->set_language ("");
+ break;
+ case 1:
+ Config::instance()->set_language ("fr");
+ break;
+ case 2:
+ Config::instance()->set_language ("it");
+ break;
+ case 3:
+ Config::instance()->set_language ("es");
+ break;
+ }
+}
+
+void
ConfigDialog::tms_ip_changed (wxCommandEvent &)
{
Config::instance()->set_tms_ip (wx_to_std (_tms_ip->GetValue ()));
diff --git a/src/wx/config_dialog.h b/src/wx/config_dialog.h
index 948bf0571..8a3c81ec9 100644
--- a/src/wx/config_dialog.h
+++ b/src/wx/config_dialog.h
@@ -39,6 +39,7 @@ public:
ConfigDialog (wxWindow *);
private:
+ void language_changed (wxCommandEvent &);
void tms_ip_changed (wxCommandEvent &);
void tms_path_changed (wxCommandEvent &);
void tms_user_changed (wxCommandEvent &);
@@ -55,7 +56,8 @@ private:
void server_selection_changed (wxListEvent &);
void add_server_to_control (ServerDescription *);
-
+
+ wxChoice* _language;
wxTextCtrl* _tms_ip;
wxTextCtrl* _tms_path;
wxTextCtrl* _tms_user;