Initial and not-working information panel in player.
[dcpomatic.git] / src / wx / player_information.cc
1 /*
2     Copyright (C) 2017 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
6     DCP-o-matic is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     DCP-o-matic is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21 #include "player_information.h"
22 #include "wx_util.h"
23 #include "film_viewer.h"
24 #include "lib/playlist.h"
25 #include "lib/dcp_content.h"
26
27 using std::cout;
28 using boost::shared_ptr;
29 using boost::dynamic_pointer_cast;
30
31 PlayerInformation::PlayerInformation (wxWindow* parent, FilmViewer* viewer)
32         : wxPanel (parent)
33         , _viewer (viewer)
34         , _sizer (new wxBoxSizer (wxHORIZONTAL))
35 {
36         wxFont title_font (*wxNORMAL_FONT);
37         title_font.SetWeight (wxFONTWEIGHT_BOLD);
38
39         {
40                 wxSizer* s = new wxBoxSizer (wxVERTICAL);
41                 add_label_to_sizer(s, this, _("DCP"), false, 0)->SetFont(title_font);
42                 _cpl_name = add_label_to_sizer(s, this, wxT(""), false, 0);
43                 _sizer->Add (s, 1, wxEXPAND | wxALL, 6);
44         }
45
46         {
47                 wxSizer* s = new wxBoxSizer (wxVERTICAL);
48                 add_label_to_sizer(s, this, _("Performance"), false, 0)->SetFont(title_font);
49                 _decoded_fps = add_label_to_sizer(s, this, wxT(""), false, 0);
50                 _sizer->Add (s, 1, wxEXPAND | wxALL, 6);
51         }
52
53         SetSizerAndFit (_sizer);
54
55         update ();
56 }
57
58 void
59 PlayerInformation::update ()
60 {
61         wxString cpl_name;
62         if (_viewer->film()) {
63                 ContentList content = _viewer->film()->content();
64                 if (content.size() == 1) {
65                         shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent>(content.front());
66                         if (dcp) {
67                                 cpl_name = std_to_wx (dcp->name());
68                         }
69                 }
70         }
71
72         checked_set (_cpl_name, cpl_name);
73 }