Initial and not-working information panel in player.
authorCarl Hetherington <cth@carlh.net>
Thu, 3 Aug 2017 00:28:43 +0000 (01:28 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 14 Aug 2017 20:07:48 +0000 (21:07 +0100)
src/lib/dcp_content.h
src/tools/dcpomatic_player.cc
src/wx/film_viewer.h
src/wx/player_information.cc [new file with mode: 0644]
src/wx/player_information.h [new file with mode: 0644]
src/wx/wscript

index 18d198fe89cbe3514bdbf26ff1d30ae14012b0be..434b6104668a70ddb52905bb9a257563efbe62a6 100644 (file)
@@ -124,6 +124,11 @@ public:
                return _cpl;
        }
 
+       std::string name () const {
+               boost::mutex::scoped_lock lm (_mutex);
+               return _name;
+       }
+
 private:
        friend class reels_test5;
 
@@ -137,11 +142,6 @@ private:
                std::list<std::string>& why_not
                ) const;
 
-       std::string name () const {
-               boost::mutex::scoped_lock lm (_mutex);
-               return _name;
-       }
-
        std::string _name;
        /** true if our DCP is encrypted */
        bool _encrypted;
index 6dede00ca66a1a50f853341947c0676c89c5aac8..5dc30d86214d939e988c057ee400b02048bfa2a4 100644 (file)
 #include "lib/encode_server_finder.h"
 #include "lib/dcp_content.h"
 #include "lib/job_manager.h"
+#include "lib/job.h"
 #include "wx/wx_signal_manager.h"
 #include "wx/wx_util.h"
 #include "wx/about_dialog.h"
 #include "wx/report_problem_dialog.h"
 #include "wx/film_viewer.h"
+#include "wx/player_information.h"
 #include "wx/update_dialog.h"
 #include <wx/wx.h>
 #include <wx/stdpaths.h>
 #include <wx/splash.h>
 #include <wx/cmdline.h>
 #include <boost/bind.hpp>
+#include <iostream>
 
 using std::string;
+using std::cout;
 using std::exception;
 using boost::shared_ptr;
 using boost::optional;
@@ -82,8 +86,10 @@ public:
                wxPanel* overall_panel = new wxPanel (this, wxID_ANY);
 
                _viewer = new FilmViewer (overall_panel, false, false);
-               wxBoxSizer* main_sizer = new wxBoxSizer (wxHORIZONTAL);
+               _info = new PlayerInformation (overall_panel, _viewer);
+               wxBoxSizer* main_sizer = new wxBoxSizer (wxVERTICAL);
                main_sizer->Add (_viewer, 1, wxEXPAND | wxALL, 6);
+               main_sizer->Add (_info, 0, wxALL, 6);
                overall_panel->SetSizer (main_sizer);
 
                UpdateChecker::instance()->StateChanged.connect (boost::bind (&DOMFrame::update_checker_state_changed, this));
@@ -102,9 +108,21 @@ public:
                        dcpomatic_sleep (1);
                }
 
-               /* XXX: report errors */
+               while (signal_manager->ui_idle ()) {}
+
+               if (jm->errors ()) {
+                       wxString errors;
+                       BOOST_FOREACH (shared_ptr<Job> i, jm->get()) {
+                               if (i->finished_in_error()) {
+                                       errors += std_to_wx (i->error_summary()) + "\n";
+                               }
+                       }
+                       error_dialog (this, errors);
+                       return;
+               }
 
                _viewer->set_film (_film);
+               _info->update ();
        }
 
 private:
@@ -114,10 +132,6 @@ private:
                wxMenu* file = new wxMenu;
                file->Append (ID_file_open, _("&Open...\tCtrl-O"));
 
-#ifndef __WXOSX__
-               file->AppendSeparator ();
-#endif
-
 #ifdef __WXOSX__
                file->Append (wxID_EXIT, _("&Exit"));
 #else
@@ -229,6 +243,7 @@ private:
        }
 
        bool _update_news_requested;
+       PlayerInformation* _info;
        FilmViewer* _viewer;
        boost::shared_ptr<Film> _film;
 };
@@ -316,6 +331,8 @@ private:
                }
                _frame->Show ();
 
+               signal_manager = new wxSignalManager (this);
+
                if (!_dcp_to_load.empty() && boost::filesystem::is_directory (_dcp_to_load)) {
                        try {
                                _frame->load_dcp (_dcp_to_load);
@@ -324,7 +341,6 @@ private:
                        }
                }
 
-               signal_manager = new wxSignalManager (this);
                Bind (wxEVT_IDLE, boost::bind (&App::idle, this));
 
                Bind (wxEVT_TIMER, boost::bind (&App::check, this));
index a411be5ec5f14a86d040df633262075f7d4cfe58..b445528b1a93cc9fec16ccf7627ca18c462231cd 100644 (file)
@@ -45,6 +45,9 @@ public:
        ~FilmViewer ();
 
        void set_film (boost::shared_ptr<Film>);
+       boost::shared_ptr<Film> film () const {
+               return _film;
+       }
 
        /** @return our `playhead' position; this may not lie exactly on a frame boundary */
        DCPTime position () const {
diff --git a/src/wx/player_information.cc b/src/wx/player_information.cc
new file mode 100644 (file)
index 0000000..e79e716
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+    Copyright (C) 2017 Carl Hetherington <cth@carlh.net>
+
+    This file is part of DCP-o-matic.
+
+    DCP-o-matic is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    DCP-o-matic is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "player_information.h"
+#include "wx_util.h"
+#include "film_viewer.h"
+#include "lib/playlist.h"
+#include "lib/dcp_content.h"
+
+using std::cout;
+using boost::shared_ptr;
+using boost::dynamic_pointer_cast;
+
+PlayerInformation::PlayerInformation (wxWindow* parent, FilmViewer* viewer)
+       : wxPanel (parent)
+       , _viewer (viewer)
+       , _sizer (new wxBoxSizer (wxHORIZONTAL))
+{
+       wxFont title_font (*wxNORMAL_FONT);
+       title_font.SetWeight (wxFONTWEIGHT_BOLD);
+
+       {
+               wxSizer* s = new wxBoxSizer (wxVERTICAL);
+               add_label_to_sizer(s, this, _("DCP"), false, 0)->SetFont(title_font);
+               _cpl_name = add_label_to_sizer(s, this, wxT(""), false, 0);
+               _sizer->Add (s, 1, wxEXPAND | wxALL, 6);
+       }
+
+       {
+               wxSizer* s = new wxBoxSizer (wxVERTICAL);
+               add_label_to_sizer(s, this, _("Performance"), false, 0)->SetFont(title_font);
+               _decoded_fps = add_label_to_sizer(s, this, wxT(""), false, 0);
+               _sizer->Add (s, 1, wxEXPAND | wxALL, 6);
+       }
+
+       SetSizerAndFit (_sizer);
+
+       update ();
+}
+
+void
+PlayerInformation::update ()
+{
+       wxString cpl_name;
+       if (_viewer->film()) {
+               ContentList content = _viewer->film()->content();
+               if (content.size() == 1) {
+                       shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent>(content.front());
+                       if (dcp) {
+                               cpl_name = std_to_wx (dcp->name());
+                       }
+               }
+       }
+
+       checked_set (_cpl_name, cpl_name);
+}
diff --git a/src/wx/player_information.h b/src/wx/player_information.h
new file mode 100644 (file)
index 0000000..7d784d7
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+    Copyright (C) 2017 Carl Hetherington <cth@carlh.net>
+
+    This file is part of DCP-o-matic.
+
+    DCP-o-matic is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    DCP-o-matic is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include <wx/wx.h>
+
+class FilmViewer;
+
+class PlayerInformation : public wxPanel
+{
+public:
+       PlayerInformation (wxWindow* parent, FilmViewer* viewer);
+
+       void update ();
+
+private:
+
+       FilmViewer* _viewer;
+       wxSizer* _sizer;
+       wxStaticText* _cpl_name;
+       wxStaticText* _decoded_fps;
+};
index 66b928247c3eadb5cda91e0c89550a0486f5b74f..79b1490c57c6c644230ada689dd3f498078633d8 100644 (file)
@@ -75,6 +75,7 @@ sources = """
           name_format_editor.cc
           new_dkdm_folder_dialog.cc
           normal_job_view.cc
+          player_information.cc
           playhead_to_timecode_dialog.cc
           playhead_to_frame_dialog.cc
           question_dialog.cc