diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-05-31 22:20:30 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-05-31 22:20:30 +0100 |
| commit | 291e2fe2e7df95019feba8097b68b31ec64be794 (patch) | |
| tree | cdac55d0ed47721190529b3443664bd3f64aa862 /src | |
| parent | 7d9321ff829498c2c87d924a9b660acbfdafa6b3 (diff) | |
Restore some missing stuff to the content properties dialogue.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/content.cc | 10 | ||||
| -rw-r--r-- | src/lib/content.h | 2 | ||||
| -rw-r--r-- | src/lib/dcp_content.cc | 2 | ||||
| -rw-r--r-- | src/lib/image_content.cc | 10 | ||||
| -rw-r--r-- | src/lib/image_content.h | 3 | ||||
| -rw-r--r-- | src/wx/content_properties_dialog.cc | 46 | ||||
| -rw-r--r-- | src/wx/content_properties_dialog.h | 8 |
7 files changed, 58 insertions, 23 deletions
diff --git a/src/lib/content.cc b/src/lib/content.cc index 107a95644..7afbf924f 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -339,3 +339,13 @@ Content::active_video_frame_rate () const DCPOMATIC_ASSERT (film); return film->active_frame_rate_change(position()).source; } + +void +Content::add_properties (list<UserProperty>& p) const +{ + p.push_back (UserProperty (_("General"), _("Filename"), path(0).string ())); + + if (_video_frame_rate) { + p.push_back (UserProperty (_("General"), _("Video frame rate"), raw_convert<string> (_video_frame_rate.get(), 5), _("frames per second"))); + } +} diff --git a/src/lib/content.h b/src/lib/content.h index ea2aaf8d4..6b647790f 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -185,7 +185,7 @@ public: protected: - virtual void add_properties (std::list<UserProperty> &) const {} + virtual void add_properties (std::list<UserProperty> &) const; boost::weak_ptr<const Film> _film; diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index a01f0effd..d23b4e351 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -275,6 +275,8 @@ DCPContent::directory () const void DCPContent::add_properties (list<UserProperty>& p) const { + Content::add_properties (p); + video->add_properties (p); audio->add_properties (p); } diff --git a/src/lib/image_content.cc b/src/lib/image_content.cc index e26eed3d0..d4e736771 100644 --- a/src/lib/image_content.cc +++ b/src/lib/image_content.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net> + Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -37,6 +37,7 @@ using std::string; using std::cout; +using std::list; using boost::shared_ptr; ImageContent::ImageContent (shared_ptr<const Film> film, boost::filesystem::path p) @@ -169,3 +170,10 @@ ImageContent::set_default_colour_conversion () video->set_colour_conversion (PresetColourConversion::from_id ("rec709").conversion); } } + +void +ImageContent::add_properties (list<UserProperty>& p) const +{ + Content::add_properties (p); + video->add_properties (p); +} diff --git a/src/lib/image_content.h b/src/lib/image_content.h index 1ebd1b08b..edcbec6dd 100644 --- a/src/lib/image_content.h +++ b/src/lib/image_content.h @@ -44,6 +44,9 @@ public: void set_default_colour_conversion (); bool still () const; + +private: + void add_properties (std::list<UserProperty>& p) const; }; #endif diff --git a/src/wx/content_properties_dialog.cc b/src/wx/content_properties_dialog.cc index 9871c1f3f..5df9ea5cf 100644 --- a/src/wx/content_properties_dialog.cc +++ b/src/wx/content_properties_dialog.cc @@ -37,11 +37,6 @@ using boost::dynamic_pointer_cast; ContentPropertiesDialog::ContentPropertiesDialog (wxWindow* parent, shared_ptr<Content> content) : TableDialog (parent, _("Content Properties"), 2, 1, false) { - string n = content->path(0).string(); - boost::algorithm::replace_all (n, "&", "&&"); - add (_("Filename"), true); - add (new wxStaticText (this, wxID_ANY, std_to_wx (n))); - map<string, list<UserProperty> > grouped; BOOST_FOREACH (UserProperty i, content->user_properties()) { if (grouped.find(i.category) == grouped.end()) { @@ -50,23 +45,34 @@ ContentPropertiesDialog::ContentPropertiesDialog (wxWindow* parent, shared_ptr<C grouped[i.category].push_back (i); } - for (map<string, list<UserProperty> >::const_iterator i = grouped.begin(); i != grouped.end(); ++i) { - - wxStaticText* m = new wxStaticText (this, wxID_ANY, std_to_wx (i->first)); - wxFont font (*wxNORMAL_FONT); - font.SetWeight (wxFONTWEIGHT_BOLD); - m->SetFont (font); + maybe_add_group (grouped, wx_to_std (_("General"))); + maybe_add_group (grouped, wx_to_std (_("Video"))); + maybe_add_group (grouped, wx_to_std (_("Audio"))); + maybe_add_group (grouped, wx_to_std (_("Length"))); - add_spacer (); - add_spacer (); - add (m, false); - add_spacer (); + layout (); +} - BOOST_FOREACH (UserProperty j, i->second) { - add (std_to_wx (j.key), true); - add (new wxStaticText (this, wxID_ANY, std_to_wx (j.value + " " + j.unit))); - } +void +ContentPropertiesDialog::maybe_add_group (map<string, list<UserProperty> > const & groups, string name) +{ + map<string, list<UserProperty> >::const_iterator i = groups.find (name); + if (i == groups.end()) { + return; } - layout (); + wxStaticText* m = new wxStaticText (this, wxID_ANY, std_to_wx (i->first)); + wxFont font (*wxNORMAL_FONT); + font.SetWeight (wxFONTWEIGHT_BOLD); + m->SetFont (font); + + add_spacer (); + add_spacer (); + add (m, false); + add_spacer (); + + BOOST_FOREACH (UserProperty j, i->second) { + add (std_to_wx (j.key), true); + add (new wxStaticText (this, wxID_ANY, std_to_wx (j.value + " " + j.unit))); + } } diff --git a/src/wx/content_properties_dialog.h b/src/wx/content_properties_dialog.h index dc4c52293..eb6f11ddb 100644 --- a/src/wx/content_properties_dialog.h +++ b/src/wx/content_properties_dialog.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2015 Carl Hetherington <cth@carlh.net> + Copyright (C) 2015-2016 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -20,11 +20,17 @@ #include "table_dialog.h" #include <boost/shared_ptr.hpp> +#include <list> +#include <map> class Content; +class UserProperty; class ContentPropertiesDialog : public TableDialog { public: ContentPropertiesDialog (wxWindow* parent, boost::shared_ptr<Content> content); + +private: + void maybe_add_group (std::map<std::string, std::list<UserProperty> > const & groups, std::string name); }; |
