Merge master.
[dcpomatic.git] / src / wx / config_dialog.cc
index 4daf581ba410191b71773b3655cb2c6d1bed96d7..0b13b9c8888d3abd1fd9474b6365e69f4cb28e7a 100644 (file)
@@ -28,7 +28,7 @@
 #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"
@@ -108,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);
@@ -122,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"));
@@ -157,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<Format const *> fmt = Format::all ();
+       vector<Ratio const *> ratio = Ratio::all ();
        int n = 0;
-       for (vector<Format const *>::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<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_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<DCPContentType const *> const ct = DCPContentType::all ();
        n = 0;
@@ -226,33 +235,6 @@ ConfigDialog::make_tms_panel ()
        _tms_password->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (ConfigDialog::tms_password_changed), 0, this);
 }
 
-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 ();
-
-       _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
 ConfigDialog::make_ab_panel ()
 {
@@ -278,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<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
@@ -527,10 +527,16 @@ ConfigDialog::setup_language_sensitivity ()
 }
 
 void
-ConfigDialog::default_format_changed (wxCommandEvent &)
+ConfigDialog::default_still_length_changed (wxCommandEvent &)
+{
+       Config::instance()->set_default_still_length (_default_still_length->GetValue ());
+}
+
+void
+ConfigDialog::default_container_changed (wxCommandEvent &)
 {
-       vector<Format const *> fmt = Format::all ();
-       Config::instance()->set_default_format (fmt[_default_format->GetSelection()]);
+       vector<Ratio const *> ratio = Ratio::all ();
+       Config::instance()->set_default_container (ratio[_default_container->GetSelection()]);
 }
 
 void