From: Carl Hetherington Date: Thu, 3 Aug 2017 00:28:43 +0000 (+0100) Subject: Initial and not-working information panel in player. X-Git-Tag: v2.11.17~17 X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=709a3af8ac11cdeb688f2d77209e036a88b3c714 Initial and not-working information panel in player. --- diff --git a/src/lib/dcp_content.h b/src/lib/dcp_content.h index 18d198fe8..434b61046 100644 --- a/src/lib/dcp_content.h +++ b/src/lib/dcp_content.h @@ -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& 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; diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index 6dede00ca..5dc30d862 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -26,19 +26,23 @@ #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 #include #include #include #include +#include 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 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; }; @@ -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)); diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h index a411be5ec..b445528b1 100644 --- a/src/wx/film_viewer.h +++ b/src/wx/film_viewer.h @@ -45,6 +45,9 @@ public: ~FilmViewer (); void set_film (boost::shared_ptr); + boost::shared_ptr 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 index 000000000..e79e71622 --- /dev/null +++ b/src/wx/player_information.cc @@ -0,0 +1,73 @@ +/* + Copyright (C) 2017 Carl Hetherington + + 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 . + +*/ + +#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 dcp = dynamic_pointer_cast(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 index 000000000..7d784d715 --- /dev/null +++ b/src/wx/player_information.h @@ -0,0 +1,38 @@ +/* + Copyright (C) 2017 Carl Hetherington + + 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 . + +*/ + +#include + +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; +}; diff --git a/src/wx/wscript b/src/wx/wscript index 66b928247..79b1490c5 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -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