X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fconfig_dialog.cc;h=0b13b9c8888d3abd1fd9474b6365e69f4cb28e7a;hb=a0856e3fbef17f24073b01cb96be6bbcb229ecbc;hp=a91bfd64c6f423e2bad013fce64585d9bb31e2b0;hpb=cc56fc111c742ed5ec072fa0bbe0b950150d40c1;p=dcpomatic.git diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index a91bfd64c..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,7 +28,7 @@ #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" @@ -43,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); @@ -53,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 (); @@ -93,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); @@ -106,6 +108,11 @@ ConfigDialog::make_misc_panel () table->Add (_num_local_encoding_threads, 1, wxEXPAND); table->AddSpacer (0); + add_label_to_sizer (table, _misc_panel, _("Default duration of still images")); + _default_still_length = new wxSpinCtrl (_misc_panel); + table->Add (_default_still_length, 1, wxEXPAND); + add_label_to_sizer (table, _misc_panel, _("s")); + add_label_to_sizer (table, _misc_panel, _("Default directory for new films")); #ifdef __WXMSW__ _default_directory = new DirPickerCtrl (_misc_panel); @@ -120,9 +127,9 @@ ConfigDialog::make_misc_panel () table->Add (_default_dci_metadata_button); table->AddSpacer (1); - add_label_to_sizer (table, _misc_panel, _("Default format")); - _default_format = new wxChoice (_misc_panel, wxID_ANY); - table->Add (_default_format); + 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")); @@ -155,22 +162,26 @@ ConfigDialog::make_misc_panel () _num_local_encoding_threads->SetValue (config->num_local_encoding_threads ()); _num_local_encoding_threads->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (ConfigDialog::num_local_encoding_threads_changed), 0, this); + _default_still_length->SetRange (1, 3600); + _default_still_length->SetValue (config->default_still_length ()); + _default_still_length->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (ConfigDialog::default_still_length_changed), 0, this); + _default_directory->SetPath (std_to_wx (config->default_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir())))); _default_directory->Connect (wxID_ANY, wxEVT_COMMAND_DIRPICKER_CHANGED, wxCommandEventHandler (ConfigDialog::default_directory_changed), 0, this); _default_dci_metadata_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (ConfigDialog::edit_default_dci_metadata_clicked), 0, this); - vector fmt = Format::all (); + vector ratio = Ratio::all (); int n = 0; - for (vector::iterator i = fmt.begin(); i != fmt.end(); ++i) { - _default_format->Append (std_to_wx ((*i)->name ())); - if (*i == config->default_format ()) { - _default_format->SetSelection (n); + 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_format->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (ConfigDialog::default_format_changed), 0, this); + _default_container->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (ConfigDialog::default_container_changed), 0, this); vector const ct = DCPContentType::all (); n = 0; @@ -249,21 +260,39 @@ ConfigDialog::make_ab_panel () add_label_to_sizer (table, _ab_panel, _("Reference filters")); wxSizer* s = new wxBoxSizer (wxHORIZONTAL); _reference_filters = new wxStaticText (_ab_panel, wxID_ANY, wxT ("")); - s->Add (_reference_filters, 1, wxALIGN_CENTER_VERTICAL | wxEXPAND | wxALL, 6); + s->Add (_reference_filters, 1, wxEXPAND); _reference_filters_button = new wxButton (_ab_panel, wxID_ANY, _("Edit...")); s->Add (_reference_filters_button, 0); 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 @@ -498,10 +527,16 @@ ConfigDialog::setup_language_sensitivity () } void -ConfigDialog::default_format_changed (wxCommandEvent &) +ConfigDialog::default_still_length_changed (wxCommandEvent &) { - vector fmt = Format::all (); - Config::instance()->set_default_format (fmt[_default_format->GetSelection()]); + 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 @@ -510,3 +545,19 @@ 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); +}