Fix log display and auto-load KDMs from the configured directory.
[dcpomatic.git] / src / wx / controls.cc
index 2802008fa58f8fb2a5dc53475ddeecdb9d2fdba3..1f6a30ae955c0bd8f428ea62cc228c673398a4da 100644 (file)
@@ -33,10 +33,7 @@ using boost::optional;
 using boost::shared_ptr;
 using boost::weak_ptr;
 
-/** @param outline_content true if viewer should present an "outline content" checkbox.
- *  @param jump_to_selected true if viewer should present a "jump to selected" checkbox.
- */
-Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool outline_content, bool jump_to_selected, bool eye, bool dcp_directory)
+Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool editor_controls)
        : wxPanel (parent)
        , _viewer (viewer)
        , _slider_being_moved (false)
@@ -62,30 +59,33 @@ Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool outlin
        SetSizer (_v_sizer);
 
        wxBoxSizer* view_options = new wxBoxSizer (wxHORIZONTAL);
-       if (outline_content) {
+       if (editor_controls) {
                _outline_content = new wxCheckBox (this, wxID_ANY, _("Outline content"));
                view_options->Add (_outline_content, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_GAP);
-       }
-
-       if (eye) {
                _eye = new wxChoice (this, wxID_ANY);
                _eye->Append (_("Left"));
                _eye->Append (_("Right"));
                _eye->SetSelection (0);
                view_options->Add (_eye, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_GAP);
-       }
-
-       if (jump_to_selected) {
                _jump_to_selected = new wxCheckBox (this, wxID_ANY, _("Jump to selected content"));
                view_options->Add (_jump_to_selected, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_GAP);
        }
 
        _v_sizer->Add (view_options, 0, wxALL, DCPOMATIC_SIZER_GAP);
 
-       _dcp_directory = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxSize(600, -1), wxLC_REPORT | wxLC_NO_HEADER);
+       wxBoxSizer* e_sizer = new wxBoxSizer (wxHORIZONTAL);
+
+       _dcp_directory = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_NO_HEADER);
        _dcp_directory->AppendColumn (wxT(""), wxLIST_FORMAT_LEFT, 580);
-       _v_sizer->Add (_dcp_directory, 0, wxALL, DCPOMATIC_SIZER_GAP);
-       _dcp_directory->Show (dcp_directory);
+       e_sizer->Add (_dcp_directory, 1, wxALL | wxEXPAND, DCPOMATIC_SIZER_GAP);
+
+       _log = new wxTextCtrl (this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(-1, 400), wxTE_READONLY | wxTE_MULTILINE);
+       e_sizer->Add (_log, 1, wxALL | wxEXPAND, DCPOMATIC_SIZER_GAP);
+
+       _dcp_directory->Show (false);
+       _log->Show (false);
+
+       _v_sizer->Add (e_sizer, 0, wxEXPAND);
 
        wxBoxSizer* h_sizer = new wxBoxSizer (wxHORIZONTAL);
 
@@ -455,9 +455,10 @@ Controls::film () const
 }
 
 void
-Controls::show_dcp_directory (bool s)
+Controls::show_extended_player_controls (bool s)
 {
        _dcp_directory->Show (s);
+       _log->Show (s);
 }
 
 void
@@ -511,3 +512,16 @@ Controls::stop_clicked ()
        DCPEjected ();
 }
 #endif
+
+void
+Controls::log (wxString s)
+{
+       struct timeval time;
+       gettimeofday (&time, 0);
+       char buffer[64];
+       time_t const sec = time.tv_sec;
+       struct tm* t = localtime (&sec);
+       strftime (buffer, 64, "%c", t);
+       wxString ts = std_to_wx(string(buffer)) + N_(": ");
+       _log->SetValue(_log->GetValue() + ts + s + "\n");
+}