X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Ffull_config_dialog.cc;h=127ca412973ba10800248d7cf9ad4b60d96afc26;hb=7bc591abc86ed4742f21f45ca1d6151cb14bc100;hp=dd8da276037bf2a1d0d668d67d7483de7741ff1f;hpb=8963f0007af1a312017b9627c18b82ec2a577591;p=dcpomatic.git diff --git a/src/wx/full_config_dialog.cc b/src/wx/full_config_dialog.cc index dd8da2760..127ca4129 100644 --- a/src/wx/full_config_dialog.cc +++ b/src/wx/full_config_dialog.cc @@ -34,6 +34,7 @@ #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" @@ -153,7 +154,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 +199,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 +213,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 { @@ -251,7 +252,7 @@ public: #ifdef DCPOMATIC_OSX wxBitmap GetLargeIcon () const { - return wxBitmap ("defaults", wxBITMAP_TYPE_PNG_RESOURCE); + return wxBitmap(bitmap_path("defaults"), wxBITMAP_TYPE_PNG); } #endif @@ -313,20 +314,40 @@ private: _standard = new wxChoice (_panel, wxID_ANY); table->Add (_standard); + table->Add (_enable_metadata["facility"] = new CheckBox (_panel, _("Default facility")), 0, wxALIGN_CENTRE_VERTICAL); + table->Add (_metadata["facility"] = new wxTextCtrl (_panel, wxID_ANY, wxT("")), 0, wxEXPAND); + + table->Add (_enable_metadata["studio"] = new CheckBox (_panel, _("Default studio")), 0, wxALIGN_CENTRE_VERTICAL); + table->Add (_metadata["studio"] = new wxTextCtrl (_panel, wxID_ANY, wxT("")), 0, wxEXPAND); + + table->Add (_enable_metadata["chain"] = new CheckBox (_panel, _("Default chain")), 0, wxALIGN_CENTRE_VERTICAL); + table->Add (_metadata["chain"] = new wxTextCtrl (_panel, wxID_ANY, wxT("")), 0, wxEXPAND); + + table->Add (_enable_metadata["distributor"] = new CheckBox (_panel, _("Default distributor")), 0, wxALIGN_CENTRE_VERTICAL); + table->Add (_metadata["distributor"] = new wxTextCtrl (_panel, wxID_ANY, wxT("")), 0, wxEXPAND); + add_label_to_sizer (table, _panel, _("Default KDM directory"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL); #ifdef DCPOMATIC_USE_OWN_PICKER _kdm_directory = new DirPickerCtrl (_panel); #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())); @@ -352,6 +373,14 @@ private: _standard->Append (_("SMPTE")); _standard->Append (_("Interop")); _standard->Bind (wxEVT_CHOICE, boost::bind (&DefaultsPage::standard_changed, this)); + + for (auto const& i: _enable_metadata) { + i.second->Bind (wxEVT_CHECKBOX, boost::bind(&DefaultsPage::metadata_changed, this)); + } + + for (auto const& i: _metadata) { + i.second->Bind (wxEVT_TEXT, boost::bind(&DefaultsPage::metadata_changed, this)); + } } void config_changed () @@ -375,11 +404,34 @@ 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())); checked_set (_audio_delay, config->default_audio_delay ()); checked_set (_standard, config->default_interop() ? 1 : 0); + + auto metadata = config->default_metadata(); + + for (auto const& i: metadata) { + _enable_metadata[i.first]->SetValue(true); + checked_set (_metadata[i.first], i.second); + } + + for (auto const& i: _enable_metadata) { + if (metadata.find(i.first) == metadata.end()) { + checked_set (i.second, false); + } + } + + for (auto const& i: _metadata) { + if (metadata.find(i.first) == metadata.end()) { + checked_set (i.second, wxT("")); + } + } + + setup_sensitivity (); } void j2k_bandwidth_changed () @@ -412,6 +464,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 ()); @@ -434,6 +496,25 @@ private: Config::instance()->set_default_interop (_standard->GetSelection() == 1); } + void metadata_changed () + { + map metadata; + for (auto const& i: _enable_metadata) { + if (i.second->GetValue()) { + metadata[i.first] = wx_to_std(_metadata[i.first]->GetValue()); + } + } + Config::instance()->set_default_metadata (metadata); + setup_sensitivity (); + } + + void setup_sensitivity () + { + for (auto const& i: _enable_metadata) { + _metadata[i.first]->Enable(i.second->GetValue()); + } + } + wxSpinCtrl* _j2k_bandwidth; wxSpinCtrl* _audio_delay; wxSpinCtrl* _still_length; @@ -444,10 +525,14 @@ 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; wxChoice* _standard; + map _enable_metadata; + map _metadata; }; @@ -466,7 +551,7 @@ public: #ifdef DCPOMATIC_OSX wxBitmap GetLargeIcon () const { - return wxBitmap ("servers", wxBITMAP_TYPE_PNG_RESOURCE); + return wxBitmap(bitmap_path("servers"), wxBITMAP_TYPE_PNG); } #endif @@ -527,7 +612,7 @@ public: #ifdef DCPOMATIC_OSX wxBitmap GetLargeIcon () const { - return wxBitmap ("tms", wxBITMAP_TYPE_PNG_RESOURCE); + return wxBitmap(bitmap_path("tms"), wxBITMAP_TYPE_PNG); } #endif @@ -638,7 +723,7 @@ public: #ifdef DCPOMATIC_OSX wxBitmap GetLargeIcon () const { - return wxBitmap ("email", wxBITMAP_TYPE_PNG_RESOURCE); + return wxBitmap(bitmap_path("email"), wxBITMAP_TYPE_PNG); } #endif @@ -665,7 +750,7 @@ private: _protocol->Append (_("Plain")); _protocol->Append (_("STARTTLS")); _protocol->Append (_("SSL")); - s->Add (_protocol); + s->Add (_protocol, 1, wxALIGN_CENTER_VERTICAL); table->Add (s, 1, wxEXPAND | wxALL); } @@ -775,16 +860,16 @@ public: #ifdef DCPOMATIC_OSX wxBitmap GetLargeIcon () const { - return wxBitmap ("kdm_email", wxBITMAP_TYPE_PNG_RESOURCE); + return wxBitmap(bitmap_path("kdm_email"), wxBITMAP_TYPE_PNG); } #endif 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); @@ -897,7 +982,7 @@ public: #ifdef DCPOMATIC_OSX wxBitmap GetLargeIcon () const { - return wxBitmap ("notifications", wxBITMAP_TYPE_PNG_RESOURCE); + return wxBitmap(bitmap_path("notifications"), wxBITMAP_TYPE_PNG); } #endif @@ -906,7 +991,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); @@ -963,10 +1048,10 @@ private: _email->Bind (wxEVT_TEXT, boost::bind (&NotificationsPage::notification_email_changed, this)); _reset_email->Bind (wxEVT_BUTTON, boost::bind (&NotificationsPage::reset_email, this)); - update_sensitivity (); + setup_sensitivity (); } - void update_sensitivity () + void setup_sensitivity () { bool const s = _enable_email->GetValue(); _subject->Enable(s); @@ -990,7 +1075,7 @@ private: checked_set (_bcc, config->notification_bcc ()); checked_set (_email, Config::instance()->notification_email ()); - update_sensitivity (); + setup_sensitivity (); } void notification_subject_changed () @@ -1033,7 +1118,7 @@ private: void type_changed (wxCheckBox* b, Config::Notification n) { Config::instance()->set_notification(n, b->GetValue()); - update_sensitivity (); + setup_sensitivity (); } wxCheckBox* _enable_message_box; @@ -1070,7 +1155,7 @@ public: #ifdef DCPOMATIC_OSX wxBitmap GetLargeIcon () const { - return wxBitmap ("cover_sheet", wxBITMAP_TYPE_PNG_RESOURCE); + return wxBitmap(bitmap_path("cover_sheet"), wxBITMAP_TYPE_PNG); } #endif @@ -1129,7 +1214,7 @@ public: #ifdef DCPOMATIC_OSX wxBitmap GetLargeIcon () const { - return wxBitmap ("identifiers", wxBITMAP_TYPE_PNG_RESOURCE); + return wxBitmap(bitmap_path("identifiers"), wxBITMAP_TYPE_PNG); } #endif @@ -1247,7 +1332,7 @@ public: #ifdef DCPOMATIC_OSX wxBitmap GetLargeIcon () const { - return wxBitmap ("advanced", wxBITMAP_TYPE_PNG_RESOURCE); + return wxBitmap(bitmap_path("advanced"), wxBITMAP_TYPE_PNG); } #endif @@ -1274,7 +1359,7 @@ private: wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); _maximum_j2k_bandwidth = new wxSpinCtrl (_panel); s->Add (_maximum_j2k_bandwidth, 1); - add_label_to_sizer (s, _panel, _("Mbit/s"), false); + add_label_to_sizer (s, _panel, _("Mbit/s"), false, 0, wxLEFT | wxALIGN_CENTRE_VERTICAL); table->Add (s, 1); } @@ -1318,7 +1403,14 @@ private: } { - add_top_aligned_label_to_sizer (table, _panel, _("DCP metadata filename format")); + auto format = create_label (_panel, _("DCP metadata filename format"), true); +#ifdef DCPOMATIC_OSX + auto align = new wxBoxSizer (wxHORIZONTAL); + align->Add (format, 0, wxTOP, 2); + table->Add (align, 0, wxALIGN_RIGHT | wxRIGHT, DCPOMATIC_SIZER_GAP - 2); +#else + table->Add (format, 0, wxTOP | wxRIGHT | wxALIGN_TOP, DCPOMATIC_SIZER_GAP); +#endif dcp::NameFormat::Map titles; titles['t'] = wx_to_std (_("type (cpl/pkl)")); dcp::NameFormat::Map examples; @@ -1330,7 +1422,14 @@ private: } { - add_top_aligned_label_to_sizer (table, _panel, _("DCP asset filename format")); + auto format = create_label (_panel, _("DCP asset filename format"), true); +#ifdef DCPOMATIC_OSX + auto align = new wxBoxSizer (wxHORIZONTAL); + align->Add (format, 0, wxTOP, 2); + table->Add (align, 0, wxALIGN_RIGHT | wxRIGHT, DCPOMATIC_SIZER_GAP - 2); +#else + table->Add (format, 0, wxTOP | wxRIGHT | wxALIGN_TOP, DCPOMATIC_SIZER_GAP); +#endif dcp::NameFormat::Map titles; titles['t'] = wx_to_std (_("type (j2c/pcm/sub)")); titles['r'] = wx_to_std (_("reel number")); @@ -1349,7 +1448,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")); @@ -1383,7 +1482,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)); @@ -1567,7 +1668,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);