summaryrefslogtreecommitdiff
path: root/libs/ardour/session_metadata.cc
diff options
context:
space:
mode:
authorBen Loftis <ben@glw.com>2012-04-18 17:46:29 +0000
committerBen Loftis <ben@glw.com>2012-04-18 17:46:29 +0000
commit45ac9c8861be4b4290fdf64f2bea8e300ab13e8f (patch)
treeedfef34a7500d6e8be05cc677b333f57f4f21be3 /libs/ardour/session_metadata.cc
parentc7c9c1bd2622b86ca4494098c80463fe15afeca4 (diff)
add User metadata. user metadata is edited from the same dialog and read/writable using the same mechanism as session metadata, but it is stored in the ardour.rc file instead of with the session. Importing metadata from another session does not change user metadata. SessionMetadata is now a singleton that is available to the session object and the various config objects.
git-svn-id: svn://localhost/ardour2/branches/3.0@12014 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/session_metadata.cc')
-rw-r--r--libs/ardour/session_metadata.cc137
1 files changed, 129 insertions, 8 deletions
diff --git a/libs/ardour/session_metadata.cc b/libs/ardour/session_metadata.cc
index 51dba7ceff..8e2a4ca057 100644
--- a/libs/ardour/session_metadata.cc
+++ b/libs/ardour/session_metadata.cc
@@ -26,6 +26,8 @@ using namespace std;
using namespace Glib;
using namespace ARDOUR;
+SessionMetadata *SessionMetadata::_metadata = NULL; //singleton instance
+
SessionMetadata::SessionMetadata ()
{
/*** General ***/
@@ -53,6 +55,10 @@ SessionMetadata::SessionMetadata ()
map.insert (Property ("mixer", ""));
//map.insert (Property ("performers", "")); // Multiple values [instrument]
+ /*** Education... ***/
+ map.insert (Property ("instructor", ""));
+ map.insert (Property ("course", ""));
+
/*** Album info ***/
map.insert (Property ("album", ""));
map.insert (Property ("compilation", ""));
@@ -79,7 +85,14 @@ SessionMetadata::SessionMetadata ()
//map.insert (Property ("album_sort", ""));
//map.insert (Property ("album_artist_sort", ""));
//map.insert (Property ("artist_sort", ""));
- //map.insert (Property ("title_sort", ""));
+ //map.insert (Property ("title_sort", ""));\
+
+ /*** Globals ***/
+ user_map.insert (Property ("user_name", ""));
+ user_map.insert (Property ("user_email", ""));
+ user_map.insert (Property ("user_web", ""));
+ user_map.insert (Property ("user_organization", ""));
+ user_map.insert (Property ("user_country", ""));
}
SessionMetadata::~SessionMetadata ()
@@ -107,9 +120,12 @@ SessionMetadata::get_value (const string & name) const
{
PropertyMap::const_iterator it = map.find (name);
if (it == map.end()) {
- // Should not be reached!
- std::cerr << "Programming error in SessionMetadata::get_value" << std::endl;
- return "";
+ it = user_map.find (name);
+ if (it == user_map.end()) {
+ // Should not be reached!
+ std::cerr << "Programming error in SessionMetadata::get_value" << std::endl;
+ return "";
+ }
}
return it->second;
@@ -126,9 +142,12 @@ SessionMetadata::set_value (const string & name, const string & value)
{
PropertyMap::iterator it = map.find (name);
if (it == map.end()) {
- // Should not be reached!
- std::cerr << "Programming error in SessionMetadata::set_value" << std::endl;
- return;
+ it = user_map.find (name);
+ if (it == user_map.end()) {
+ // Should not be reached!
+ std::cerr << "Programming error in SessionMetadata::set_value" << std::endl;
+ return;
+ }
}
it->second = value;
@@ -163,7 +182,7 @@ SessionMetadata::get_state ()
}
int
-SessionMetadata::set_state (const XMLNode & state, int /*version*/)
+SessionMetadata::set_state (const XMLNode & state, int version_num)
{
const XMLNodeList & children = state.children();
string name;
@@ -186,6 +205,22 @@ SessionMetadata::set_state (const XMLNode & state, int /*version*/)
return 0;
}
+
+XMLNode &
+SessionMetadata::get_user_state ()
+{
+ XMLNode * node = new XMLNode ("Metadata");
+ XMLNode * prop;
+
+ for (PropertyMap::const_iterator it = user_map.begin(); it != user_map.end(); ++it) {
+ if ((prop = get_xml (it->first))) {
+ node->add_child_nocopy (*prop);
+ }
+ }
+
+ return *node;
+}
+
/*** Accessing ***/
string
SessionMetadata::comment () const
@@ -343,6 +378,51 @@ SessionMetadata::genre () const
return get_value("genre");
}
+string
+SessionMetadata::instructor () const
+{
+ return get_value("instructor");
+}
+
+string
+SessionMetadata::course () const
+{
+ return get_value("course");
+}
+
+
+string
+SessionMetadata::user_name () const
+{
+ return get_value("user_name");
+}
+
+string
+SessionMetadata::user_email () const
+{
+ return get_value("user_email");
+}
+
+string
+SessionMetadata::user_web () const
+{
+ return get_value("user_web");
+}
+
+string
+SessionMetadata::organization () const
+{
+ return get_value("user_organization");
+}
+
+string
+SessionMetadata::country () const
+{
+ return get_value("user_country");
+}
+
+
+
/*** Editing ***/
void
SessionMetadata::set_comment (const string & v)
@@ -499,3 +579,44 @@ SessionMetadata::set_genre (const string & v)
{
set_value ("genre", v);
}
+
+void
+SessionMetadata::set_instructor (const string & v)
+{
+ set_value ("instructor", v);
+}
+
+void
+SessionMetadata::set_course (const string & v)
+{
+ set_value ("course", v);
+}
+
+void
+SessionMetadata::set_user_name (const string & v)
+{
+ set_value ("user_name", v);
+}
+
+void
+SessionMetadata::set_user_email (const string & v)
+{
+ set_value ("user_email", v);
+}
+
+void
+SessionMetadata::set_user_web (const string & v)
+{
+ set_value ("user_web", v);
+}
+
+void
+SessionMetadata::set_organization (const string & v)
+{
+ set_value ("user_organization", v);
+}
+void
+SessionMetadata::set_country (const string & v)
+{
+ set_value ("user_country", v);
+}