*/
/** @file src/config_dialog.cc
- * @brief A dialogue to edit DCP-o-matic configuration.
+ * @brief A dialogue to edit DVD-o-matic configuration.
*/
#include <iostream>
#include <wx/notebook.h>
#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"
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);
_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 ();
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);
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 ());
_default_dci_metadata_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (ConfigDialog::edit_default_dci_metadata_clicked), 0, this);
+ vector<Ratio const *> ratio = Ratio::all ();
+ int n = 0;
+ for (vector<Ratio const *>::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<DCPContentType const *> const ct = DCPContentType::all ();
+ n = 0;
+ for (vector<DCPContentType const *>::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
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<string, string> 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
{
Config::instance()->set_default_still_length (_default_still_length->GetValue ());
}
+
+void
+ConfigDialog::default_container_changed (wxCommandEvent &)
+{
+ vector<Ratio const *> ratio = Ratio::all ();
+ Config::instance()->set_default_container (ratio[_default_container->GetSelection()]);
+}
+
+void
+ConfigDialog::default_dcp_content_type_changed (wxCommandEvent &)
+{
+ vector<DCPContentType const *> 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);
+}