From 291e2fe2e7df95019feba8097b68b31ec64be794 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 31 May 2016 22:20:30 +0100 Subject: Restore some missing stuff to the content properties dialogue. --- src/wx/content_properties_dialog.cc | 46 +++++++++++++++++++++---------------- src/wx/content_properties_dialog.h | 8 ++++++- 2 files changed, 33 insertions(+), 21 deletions(-) (limited to 'src/wx') 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) : 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 > 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 >::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 > const & groups, string name) +{ + map >::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 + Copyright (C) 2015-2016 Carl Hetherington This file is part of DCP-o-matic. @@ -20,11 +20,17 @@ #include "table_dialog.h" #include +#include +#include class Content; +class UserProperty; class ContentPropertiesDialog : public TableDialog { public: ContentPropertiesDialog (wxWindow* parent, boost::shared_ptr content); + +private: + void maybe_add_group (std::map > const & groups, std::string name); }; -- cgit v1.2.3