X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fconfig_dialog.cc;h=0b13b9c8888d3abd1fd9474b6365e69f4cb28e7a;hb=a0856e3fbef17f24073b01cb96be6bbcb229ecbc;hp=e1fc7a20fced8ed4caf66720f2c06a8a1e3f4acf;hpb=f85101ff72bf93ab3546ea0c4ec8e3f1242f256f;p=dcpomatic.git diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index e1fc7a20f..0b13b9c88 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -18,7 +18,7 @@ */ /** @file src/config_dialog.cc - * @brief A dialogue to edit DCP-o-matic configuration. + * @brief A dialogue to edit DVD-o-matic configuration. */ #include @@ -28,9 +28,10 @@ #include #include "lib/config.h" #include "lib/server.h" -#include "lib/format.h" +#include "lib/ratio.h" #include "lib/scaler.h" #include "lib/filter.h" +#include "lib/dcp_content_type.h" #include "config_dialog.h" #include "wx_util.h" #include "filter_dialog.h" @@ -42,7 +43,7 @@ using namespace std; using boost::bind; ConfigDialog::ConfigDialog (wxWindow* parent) - : wxDialog (parent, wxID_ANY, _("DCP-o-matic Preferences"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) + : wxDialog (parent, wxID_ANY, _("DVD-o-matic Preferences"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) { wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); _notebook = new wxNotebook (this, wxID_ANY); @@ -52,6 +53,8 @@ ConfigDialog::ConfigDialog (wxWindow* parent) _notebook->AddPage (_misc_panel, _("Miscellaneous"), true); make_servers_panel (); _notebook->AddPage (_servers_panel, _("Encoding servers"), false); + make_metadata_panel (); + _notebook->AddPage (_metadata_panel, _("Metadata"), false); make_tms_panel (); _notebook->AddPage (_tms_panel, _("TMS"), false); make_ab_panel (); @@ -92,7 +95,7 @@ ConfigDialog::make_misc_panel () table->Add (_language, 1, wxEXPAND); table->AddSpacer (0); - wxStaticText* restart = add_label_to_sizer (table, _misc_panel, _("(restart DCP-o-matic to see language changes)")); + wxStaticText* restart = add_label_to_sizer (table, _misc_panel, _("(restart DVD-o-matic to see language changes)")); wxFont font = restart->GetFont(); font.SetStyle (wxFONTSTYLE_ITALIC); font.SetPointSize (font.GetPointSize() - 1); @@ -124,6 +127,16 @@ ConfigDialog::make_misc_panel () table->Add (_default_dci_metadata_button); table->AddSpacer (1); + add_label_to_sizer (table, _misc_panel, _("Default container")); + _default_container = new wxChoice (_misc_panel, wxID_ANY); + table->Add (_default_container); + table->AddSpacer (1); + + add_label_to_sizer (table, _misc_panel, _("Default content type")); + _default_dcp_content_type = new wxChoice (_misc_panel, wxID_ANY); + table->Add (_default_dcp_content_type); + table->AddSpacer (1); + Config* config = Config::instance (); _set_language->SetValue (config->language ()); @@ -158,6 +171,29 @@ ConfigDialog::make_misc_panel () _default_dci_metadata_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (ConfigDialog::edit_default_dci_metadata_clicked), 0, this); + vector ratio = Ratio::all (); + int n = 0; + for (vector::iterator i = ratio.begin(); i != ratio.end(); ++i) { + _default_container->Append (std_to_wx ((*i)->nickname ())); + if (*i == config->default_container ()) { + _default_container->SetSelection (n); + } + ++n; + } + + _default_container->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (ConfigDialog::default_container_changed), 0, this); + + vector const ct = DCPContentType::all (); + n = 0; + for (vector::const_iterator i = ct.begin(); i != ct.end(); ++i) { + _default_dcp_content_type->Append (std_to_wx ((*i)->pretty_name ())); + if (*i == config->default_dcp_content_type ()) { + _default_dcp_content_type->SetSelection (n); + } + ++n; + } + + _default_dcp_content_type->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (ConfigDialog::default_dcp_content_type_changed), 0, this); } void @@ -230,15 +266,33 @@ ConfigDialog::make_ab_panel () table->Add (s, 1, wxEXPAND); table->AddSpacer (0); } +} + +void +ConfigDialog::make_metadata_panel () +{ + _metadata_panel = new wxPanel (_notebook); + wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); + _metadata_panel->SetSizer (s); + + wxFlexGridSizer* table = new wxFlexGridSizer (2, 6, 6); + table->AddGrowableCol (1, 1); + s->Add (table, 1, wxALL | wxEXPAND, 8); + + add_label_to_sizer (table, _metadata_panel, _("Issuer")); + _issuer = new wxTextCtrl (_metadata_panel, wxID_ANY); + table->Add (_issuer, 1, wxEXPAND); + + add_label_to_sizer (table, _metadata_panel, _("Creator")); + _creator = new wxTextCtrl (_metadata_panel, wxID_ANY); + table->Add (_creator, 1, wxEXPAND); Config* config = Config::instance (); - - _reference_scaler->SetSelection (Scaler::as_index (config->reference_scaler ())); - _reference_scaler->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (ConfigDialog::reference_scaler_changed), 0, this); - pair p = Filter::ffmpeg_strings (config->reference_filters ()); - _reference_filters->SetLabel (std_to_wx (p.first) + N_(" ") + std_to_wx (p.second)); - _reference_filters_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (ConfigDialog::edit_reference_filters_clicked), 0, this); + _issuer->SetValue (std_to_wx (config->dcp_metadata().issuer)); + _issuer->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (ConfigDialog::issuer_changed), 0, this); + _creator->SetValue (std_to_wx (config->dcp_metadata().creator)); + _creator->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (ConfigDialog::creator_changed), 0, this); } void @@ -477,3 +531,33 @@ ConfigDialog::default_still_length_changed (wxCommandEvent &) { Config::instance()->set_default_still_length (_default_still_length->GetValue ()); } + +void +ConfigDialog::default_container_changed (wxCommandEvent &) +{ + vector ratio = Ratio::all (); + Config::instance()->set_default_container (ratio[_default_container->GetSelection()]); +} + +void +ConfigDialog::default_dcp_content_type_changed (wxCommandEvent &) +{ + vector ct = DCPContentType::all (); + Config::instance()->set_default_dcp_content_type (ct[_default_dcp_content_type->GetSelection()]); +} + +void +ConfigDialog::issuer_changed (wxCommandEvent &) +{ + libdcp::XMLMetadata m = Config::instance()->dcp_metadata (); + m.issuer = wx_to_std (_issuer->GetValue ()); + Config::instance()->set_dcp_metadata (m); +} + +void +ConfigDialog::creator_changed (wxCommandEvent &) +{ + libdcp::XMLMetadata m = Config::instance()->dcp_metadata (); + m.creator = wx_to_std (_creator->GetValue ()); + Config::instance()->set_dcp_metadata (m); +}