Move UserProperty into its own file.
authorCarl Hetherington <cth@carlh.net>
Tue, 12 Apr 2016 15:13:46 +0000 (16:13 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 18 May 2016 10:50:29 +0000 (11:50 +0100)
src/lib/content.cc
src/lib/content.h
src/lib/user_property.h [new file with mode: 0644]
src/wx/content_properties_dialog.cc

index 724cabb6c6ce28f4bf1d5057e08dc062ab07b525..28103e9c054759d55e1b77bbe5f872209ab66f4c 100644 (file)
@@ -278,7 +278,7 @@ Content::path_summary () const
 }
 
 /** @return a list of properties that might be interesting to the user */
-list<Content::UserProperty>
+list<UserProperty>
 Content::user_properties () const
 {
        list<UserProperty> p;
index d87ae13d7fee53739f8a5d8ecb1173d177654929..d08540a9aa8fc9e4d00885f9cd54f05d094d4f5d 100644 (file)
@@ -28,6 +28,7 @@
 #include "signaller.h"
 #include "dcpomatic_time.h"
 #include "raw_convert.h"
+#include "user_property.h"
 #include <libcxml/cxml.h>
 #include <boost/filesystem.hpp>
 #include <boost/signals2.hpp>
@@ -161,23 +162,6 @@ public:
 
        boost::shared_ptr<const Film> film () const;
 
-       class UserProperty
-       {
-       public:
-               template <class T>
-               UserProperty (std::string category_, std::string key_, T value_, std::string unit_ = "")
-                       : category (category_)
-                       , key (key_)
-                       , value (raw_convert<std::string> (value_))
-                       , unit (unit_)
-               {}
-
-               std::string category;
-               std::string key;
-               std::string value;
-               std::string unit;
-       };
-
        std::list<UserProperty> user_properties () const;
 
        boost::signals2::signal<void (boost::weak_ptr<Content>, int, bool)> Changed;
diff --git a/src/lib/user_property.h b/src/lib/user_property.h
new file mode 100644 (file)
index 0000000..c57cbef
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+    Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+class UserProperty
+{
+public:
+       template <class T>
+       UserProperty (std::string category_, std::string key_, T value_, std::string unit_ = "")
+               : category (category_)
+               , key (key_)
+               , value (raw_convert<std::string> (value_))
+               , unit (unit_)
+       {}
+
+       std::string category;
+       std::string key;
+       std::string value;
+       std::string unit;
+};
index 37f96c156aeeef50977198ea7313f00b7742c247..fb583c751312595b1755d2d060f8bde1bb28b13e 100644 (file)
@@ -42,15 +42,15 @@ ContentPropertiesDialog::ContentPropertiesDialog (wxWindow* parent, shared_ptr<C
        add (_("Filename"), true);
        add (new wxStaticText (this, wxID_ANY, std_to_wx (n)));
 
-       map<string, list<Content::UserProperty> > grouped;
-       BOOST_FOREACH (Content::UserProperty i, content->user_properties()) {
+       map<string, list<UserProperty> > grouped;
+       BOOST_FOREACH (UserProperty i, content->user_properties()) {
                if (grouped.find(i.category) == grouped.end()) {
-                       grouped[i.category] = list<Content::UserProperty> ();
+                       grouped[i.category] = list<UserProperty> ();
                }
                grouped[i.category].push_back (i);
        }
 
-       for (map<string, list<Content::UserProperty> >::const_iterator i = grouped.begin(); i != grouped.end(); ++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);
@@ -62,7 +62,7 @@ ContentPropertiesDialog::ContentPropertiesDialog (wxWindow* parent, shared_ptr<C
                add (m, false);
                add_spacer ();
 
-               BOOST_FOREACH (Content::UserProperty j, i->second) {
+               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)));
                }