X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Ffull_config_dialog.cc;h=1c14ad35ca88553cb6c83fbbb9a89bfbf8c1d1ba;hb=8c39f950ec8f8b3cf4d258279ab499d7e71dafc8;hp=1d0c1e01acf200c00c346ce713f86b93c21fb2e3;hpb=924f4edb20d14bc697956254951fb87513cf2e19;p=dcpomatic.git diff --git a/src/wx/full_config_dialog.cc b/src/wx/full_config_dialog.cc index 1d0c1e01a..1c14ad35c 100644 --- a/src/wx/full_config_dialog.cc +++ b/src/wx/full_config_dialog.cc @@ -34,16 +34,19 @@ #include "file_picker_ctrl.h" #include "filter_dialog.h" #include "full_config_dialog.h" +#include "kdm_choice.h" #include "make_chain_dialog.h" #include "nag_dialog.h" #include "name_format_editor.h" #include "password_entry.h" +#include "send_test_email_dialog.h" #include "server_dialog.h" #include "static_text.h" #include "wx_util.h" #include "lib/config.h" #include "lib/cross.h" #include "lib/dcp_content_type.h" +#include "lib/emailer.h" #include "lib/exceptions.h" #include "lib/filter.h" #include "lib/log.h" @@ -153,7 +156,7 @@ private: checked_set (_analyse_ebur128, config->analyse_ebur128 ()); #endif checked_set (_automatic_audio_analysis, config->automatic_audio_analysis ()); - checked_set (_config_file, config->config_file()); + checked_set (_config_file, config->config_read_file()); checked_set (_cinemas_file, config->cinemas_file()); GeneralPage::config_changed (); @@ -198,7 +201,7 @@ private: { auto config = Config::instance(); boost::filesystem::path new_file = wx_to_std(_config_file->GetPath()); - if (new_file == config->config_file()) { + if (new_file == config->config_read_file()) { return; } bool copy_and_link = true; @@ -212,7 +215,7 @@ private: if (copy_and_link) { config->write (); - if (new_file != config->config_file()) { + if (new_file != config->config_read_file()) { config->copy_and_link (new_file); } } else { @@ -331,14 +334,22 @@ private: #else _kdm_directory = new wxDirPickerCtrl (_panel, wxDD_DIR_MUST_EXIST); #endif - table->Add (_kdm_directory, 1, wxEXPAND); + add_label_to_sizer (table, _panel, _("Default KDM type"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL); + _kdm_type = new KDMChoice (_panel); + table->Add (_kdm_type, 1, wxEXPAND); + + table->Add (_use_isdcf_name_by_default = new CheckBox(_panel, _("Use ISDCF name by default")), 0, wxALIGN_CENTRE_VERTICAL); + _still_length->SetRange (1, 3600); _still_length->Bind (wxEVT_SPINCTRL, boost::bind (&DefaultsPage::still_length_changed, this)); _directory->Bind (wxEVT_DIRPICKER_CHANGED, boost::bind (&DefaultsPage::directory_changed, this)); _kdm_directory->Bind (wxEVT_DIRPICKER_CHANGED, boost::bind (&DefaultsPage::kdm_directory_changed, this)); + _kdm_type->Bind (wxEVT_CHOICE, boost::bind(&DefaultsPage::kdm_type_changed, this)); + + _use_isdcf_name_by_default->Bind (wxEVT_CHECKBOX, boost::bind(&DefaultsPage::use_isdcf_name_by_default_changed, this)); for (auto i: Ratio::containers()) { _container->Append (std_to_wx(i->container_nickname())); @@ -395,6 +406,8 @@ private: checked_set (_still_length, config->default_still_length ()); _directory->SetPath (std_to_wx (config->default_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir())).string ())); _kdm_directory->SetPath (std_to_wx (config->default_kdm_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir())).string ())); + _kdm_type->set (config->default_kdm_type()); + checked_set (_use_isdcf_name_by_default, config->use_isdcf_name_by_default()); checked_set (_j2k_bandwidth, config->default_j2k_bandwidth() / 1000000); _j2k_bandwidth->SetRange (50, config->maximum_j2k_bandwidth() / 1000000); checked_set (_dcp_audio_channels, locale_convert (config->default_dcp_audio_channels())); @@ -453,6 +466,16 @@ private: Config::instance()->set_default_kdm_directory (wx_to_std (_kdm_directory->GetPath ())); } + void kdm_type_changed () + { + Config::instance()->set_default_kdm_type(_kdm_type->get()); + } + + void use_isdcf_name_by_default_changed () + { + Config::instance()->set_use_isdcf_name_by_default (_use_isdcf_name_by_default->GetValue()); + } + void still_length_changed () { Config::instance()->set_default_still_length (_still_length->GetValue ()); @@ -504,6 +527,8 @@ private: wxDirPickerCtrl* _directory; wxDirPickerCtrl* _kdm_directory; #endif + KDMChoice* _kdm_type; + wxCheckBox* _use_isdcf_name_by_default; wxChoice* _container; wxChoice* _dcp_content_type; wxChoice* _dcp_audio_channels; @@ -739,11 +764,16 @@ private: _password = new PasswordEntry (_panel); table->Add (_password->get_panel(), 1, wxEXPAND | wxALL); + table->AddSpacer (0); + _send_test_email = new Button (_panel, _("Send test email...")); + table->Add (_send_test_email); + _server->Bind (wxEVT_TEXT, boost::bind(&EmailPage::server_changed, this)); _port->Bind (wxEVT_SPINCTRL, boost::bind(&EmailPage::port_changed, this)); _protocol->Bind (wxEVT_CHOICE, boost::bind(&EmailPage::protocol_changed, this)); _user->Bind (wxEVT_TEXT, boost::bind(&EmailPage::user_changed, this)); _password->Changed.connect (boost::bind(&EmailPage::password_changed, this)); + _send_test_email->Bind (wxEVT_BUTTON, boost::bind(&EmailPage::send_test_email_clicked, this)); } void config_changed () @@ -808,11 +838,41 @@ private: Config::instance()->set_mail_password(_password->get()); } + void send_test_email_clicked () + { + auto dialog = new SendTestEmailDialog(_panel); + auto result = dialog->ShowModal(); + dialog->Destroy(); + if (result == wxID_OK) { + Emailer emailer( + wx_to_std(dialog->from()), + { wx_to_std(dialog->to()) }, + wx_to_std(_("DCP-o-matic test email")), + wx_to_std(_("This is a test email from DCP-o-matic.")) + ); + auto config = Config::instance(); + try { + emailer.send (config->mail_server(), config->mail_port(), config->mail_protocol(), config->mail_user(), config->mail_password()); + } catch (NetworkError& e) { + error_dialog (_panel, std_to_wx(e.summary()), std_to_wx(e.detail().get_value_or(""))); + return; + } catch (std::exception& e) { + error_dialog (_panel, _("Test email sending failed."), std_to_wx(e.what())); + return; + } catch (...) { + error_dialog (_panel, _("Test email sending failed.")); + return; + } + message_dialog (_panel, _("Test email sent.")); + } + } + wxTextCtrl* _server; wxSpinCtrl* _port; wxChoice* _protocol; wxTextCtrl* _user; PasswordEntry* _password; + Button* _send_test_email; }; @@ -844,9 +904,9 @@ public: private: void setup () { - wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); + auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); table->AddGrowableCol (1, 1); - _panel->GetSizer()->Add (table, 1, wxEXPAND | wxALL, _border); + _panel->GetSizer()->Add (table, 0, wxEXPAND | wxALL, _border); add_label_to_sizer (table, _panel, _("Subject"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL); _subject = new wxTextCtrl (_panel, wxID_ANY); @@ -968,7 +1028,7 @@ private: { auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); table->AddGrowableCol (1, 1); - _panel->GetSizer()->Add (table, 1, wxEXPAND | wxALL, _border); + _panel->GetSizer()->Add (table, 0, wxEXPAND | wxALL, _border); _enable_message_box = new CheckBox (_panel, _("Message box")); table->Add (_enable_message_box, 1, wxEXPAND | wxALL); @@ -1425,7 +1485,7 @@ private: { add_top_aligned_label_to_sizer (table, _panel, _("Log")); - auto t = new wxBoxSizer (wxVERTICAL); + auto t = new wxFlexGridSizer (2); _log_general = new CheckBox (_panel, _("General")); t->Add (_log_general, 1, wxEXPAND | wxALL); _log_warning = new CheckBox (_panel, _("Warnings")); @@ -1459,7 +1519,9 @@ private: _maximum_j2k_bandwidth->SetRange (1, 1000); _maximum_j2k_bandwidth->Bind (wxEVT_SPINCTRL, boost::bind (&AdvancedPage::maximum_j2k_bandwidth_changed, this)); _video_display_mode->Append (_("Simple (safer)")); +#if wxCHECK_VERSION(3, 1, 0) _video_display_mode->Append (_("OpenGL (faster)")); +#endif _video_display_mode->Bind (wxEVT_CHOICE, boost::bind(&AdvancedPage::video_display_mode_changed, this)); _allow_any_dcp_frame_rate->Bind (wxEVT_CHECKBOX, boost::bind (&AdvancedPage::allow_any_dcp_frame_rate_changed, this)); _allow_any_container->Bind (wxEVT_CHECKBOX, boost::bind (&AdvancedPage::allow_any_container_changed, this)); @@ -1643,7 +1705,7 @@ create_full_config_dialog () the containing window doesn't shrink too much when we select those panels. This is obviously an unpleasant hack. */ - wxSize ps = wxSize (700, -1); + wxSize ps = wxSize (750, -1); int const border = 16; #else wxSize ps = wxSize (-1, -1);