Copy SingleStreamAudioContent into DCPContent and SndfileContent.
[dcpomatic.git] / src / wx / content_properties_dialog.cc
index 4f92e53ce05aa925058bfbc88e62956e7869a196..bae4ff2415bc837fbe14e0559b1bebf86beb0d2f 100644 (file)
 #include "lib/content.h"
 #include "lib/video_content.h"
 #include "lib/audio_content.h"
-#include "lib/single_stream_audio_content.h"
 #include <boost/algorithm/string.hpp>
+#include <boost/foreach.hpp>
 
 using std::string;
 using std::list;
 using std::pair;
+using std::map;
 using boost::shared_ptr;
 using boost::dynamic_pointer_cast;
 
 ContentPropertiesDialog::ContentPropertiesDialog (wxWindow* parent, shared_ptr<Content> content)
-       : TableDialog (parent, _("Content Properties"), 2, false)
+       : 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)));
 
-       list<pair<string, string> > properties = content->properties ();
-       for (list<pair<string, string> >::const_iterator i = properties.begin(); i != properties.end(); ++i) {
-               add (std_to_wx (i->first), true);
-               add (new wxStaticText (this, wxID_ANY, std_to_wx (i->second)));
+       map<string, list<UserProperty> > grouped;
+       BOOST_FOREACH (UserProperty i, content->user_properties()) {
+               if (grouped.find(i.category) == grouped.end()) {
+                       grouped[i.category] = list<UserProperty> ();
+               }
+               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);
+
+               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)));
+               }
        }
 
        layout ();