Restore some missing stuff to the content properties dialogue.
authorCarl Hetherington <cth@carlh.net>
Tue, 31 May 2016 21:20:30 +0000 (22:20 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 31 May 2016 21:20:30 +0000 (22:20 +0100)
src/lib/content.cc
src/lib/content.h
src/lib/dcp_content.cc
src/lib/image_content.cc
src/lib/image_content.h
src/wx/content_properties_dialog.cc
src/wx/content_properties_dialog.h

index 107a9564426e46e83b3f440a36a2a3016862e1b4..7afbf924f63912c5631caf1a8b138583ad3ca616 100644 (file)
@@ -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")));
+       }
+}
index ea2aaf8d40e7e43f9b413315a51d2aeb286214d7..6b647790f2d635b9a038b5038513f40fce96dd8e 100644 (file)
@@ -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;
 
index a01f0effd4c530e177789992f47599d9062f8213..d23b4e351db8b1a2abfc847185f11e12833bbf4d 100644 (file)
@@ -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);
 }
 
index e26eed3d021f4bcaf2bc415d97e17ac56f980f9c..d4e73677113dd72a64396ae1bb0c6822d1f5fb60 100644 (file)
@@ -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);
+}
index 1ebd1b08bc0ed188bde79b5a3a55c8440db336de..edcbec6ddb04122cc3211797d24edf40757510e2 100644 (file)
@@ -44,6 +44,9 @@ public:
        void set_default_colour_conversion ();
 
        bool still () const;
+
+private:
+       void add_properties (std::list<UserProperty>& p) const;
 };
 
 #endif
index 9871c1f3f30a033a4ce7fb4dad281a11d434cedf..5df9ea5cf3f70a1e1d3b7673d5b051a2154a10d7 100644 (file)
@@ -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)));
+       }
 }
index dc4c522939f27821a795aab0ce50b5f5db1bbb8d..eb6f11ddb8a0cf1496eaa7c0c54e9b61d7bb779f 100644 (file)
@@ -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.
 
 
 #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);
 };