summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-08-03 01:28:43 +0100
committerCarl Hetherington <cth@carlh.net>2017-08-14 21:07:48 +0100
commit709a3af8ac11cdeb688f2d77209e036a88b3c714 (patch)
treee8ec30e72f8556d19658437c9a67fa2a34c1009a /src
parent154fae5683aa15e84bd07e37f4b219c86354692d (diff)
Initial and not-working information panel in player.
Diffstat (limited to 'src')
-rw-r--r--src/lib/dcp_content.h10
-rw-r--r--src/tools/dcpomatic_player.cc30
-rw-r--r--src/wx/film_viewer.h3
-rw-r--r--src/wx/player_information.cc73
-rw-r--r--src/wx/player_information.h38
-rw-r--r--src/wx/wscript1
6 files changed, 143 insertions, 12 deletions
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<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;
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 <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));
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<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
index 000000000..e79e71622
--- /dev/null
+++ b/src/wx/player_information.cc
@@ -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
index 000000000..7d784d715
--- /dev/null
+++ b/src/wx/player_information.h
@@ -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;
+};
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