+ wxWindow* CreateWindow (wxWindow* parent)
+ {
+ wxPanel* panel = new wxPanel (parent);
+ wxBoxSizer* s = new wxBoxSizer (wxVERTICAL);
+ panel->SetSizer (s);
+
+ wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+ table->AddGrowableCol (1, 1);
+ s->Add (table, 1, wxALL | wxEXPAND, _border);
+
+ _set_language = new wxCheckBox (panel, wxID_ANY, _("Set language"));
+ table->Add (_set_language, 1);
+ _language = new wxChoice (panel, wxID_ANY);
+ _language->Append (wxT ("English"));
+ _language->Append (wxT ("Français"));
+ _language->Append (wxT ("Italiano"));
+ _language->Append (wxT ("Español"));
+ _language->Append (wxT ("Svenska"));
+ _language->Append (wxT ("Deutsch"));
+ table->Add (_language);
+
+ wxStaticText* restart = add_label_to_sizer (table, panel, _("(restart DCP-o-matic to see language changes)"), false);
+ wxFont font = restart->GetFont();
+ font.SetStyle (wxFONTSTYLE_ITALIC);
+ font.SetPointSize (font.GetPointSize() - 1);
+ restart->SetFont (font);
+ table->AddSpacer (0);
+
+ add_label_to_sizer (table, panel, _("Threads to use for encoding on this host"), true);
+ _num_local_encoding_threads = new wxSpinCtrl (panel);
+ table->Add (_num_local_encoding_threads, 1);
+
+ add_label_to_sizer (table, panel, _("Outgoing mail server"), true);
+ _mail_server = new wxTextCtrl (panel, wxID_ANY);
+ table->Add (_mail_server, 1, wxEXPAND | wxALL);
+
+ add_label_to_sizer (table, panel, _("Mail user name"), true);
+ _mail_user = new wxTextCtrl (panel, wxID_ANY);
+ table->Add (_mail_user, 1, wxEXPAND | wxALL);
+
+ add_label_to_sizer (table, panel, _("Mail password"), true);
+ _mail_password = new wxTextCtrl (panel, wxID_ANY);
+ table->Add (_mail_password, 1, wxEXPAND | wxALL);
+
+ wxStaticText* plain = add_label_to_sizer (table, panel, _("(password will be stored on disk in plaintext)"), false);
+ plain->SetFont (font);
+ table->AddSpacer (0);
+
+ add_label_to_sizer (table, panel, _("From address for KDM emails"), true);
+ _kdm_from = new wxTextCtrl (panel, wxID_ANY);
+ table->Add (_kdm_from, 1, wxEXPAND | wxALL);
+
+ _check_for_updates = new wxCheckBox (panel, wxID_ANY, _("Check for updates on startup"));
+ table->Add (_check_for_updates, 1, wxEXPAND | wxALL);
+ table->AddSpacer (0);
+
+ _check_for_test_updates = new wxCheckBox (panel, wxID_ANY, _("Check for testing updates as well as stable ones"));
+ table->Add (_check_for_test_updates, 1, wxEXPAND | wxALL);
+ table->AddSpacer (0);
+
+ Config* config = Config::instance ();
+
+ _set_language->SetValue (config->language ());
+
+ 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 if (config->language().get_value_or ("") == "sv") {
+ _language->SetSelection (4);
+ } else if (config->language().get_value_or ("") == "de") {
+ _language->SetSelection (5);
+ } else {
+ _language->SetSelection (0);
+ }
+
+ setup_language_sensitivity ();
+
+ _set_language->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&GeneralPage::set_language_changed, this));
+ _language->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&GeneralPage::language_changed, this));
+
+ _num_local_encoding_threads->SetRange (1, 128);
+ _num_local_encoding_threads->SetValue (config->num_local_encoding_threads ());
+ _num_local_encoding_threads->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&GeneralPage::num_local_encoding_threads_changed, this));
+
+ _mail_server->SetValue (std_to_wx (config->mail_server ()));
+ _mail_server->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&GeneralPage::mail_server_changed, this));
+ _mail_user->SetValue (std_to_wx (config->mail_user ()));
+ _mail_user->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&GeneralPage::mail_user_changed, this));
+ _mail_password->SetValue (std_to_wx (config->mail_password ()));
+ _mail_password->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&GeneralPage::mail_password_changed, this));
+ _kdm_from->SetValue (std_to_wx (config->kdm_from ()));
+ _kdm_from->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&GeneralPage::kdm_from_changed, this));
+ _check_for_updates->SetValue (config->check_for_updates ());
+ _check_for_updates->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&GeneralPage::check_for_updates_changed, this));
+ _check_for_test_updates->SetValue (config->check_for_test_updates ());
+ _check_for_test_updates->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&GeneralPage::check_for_test_updates_changed, this));
+
+ return panel;
+ }